diff --git a/packages/cli/src/lib/project/manifests/plugin/languages.ts b/packages/cli/src/lib/project/manifests/plugin/languages.ts index c89c084ee0..0ec5ac4c80 100644 --- a/packages/cli/src/lib/project/manifests/plugin/languages.ts +++ b/packages/cli/src/lib/project/manifests/plugin/languages.ts @@ -4,6 +4,7 @@ import { BindLanguage } from "@polywrap/schema-bind"; export const pluginManifestLanguages = { "plugin/typescript": "plugin/typescript", + "plugin/rust": "plugin/rust", }; export type PluginManifestLanguages = typeof pluginManifestLanguages; @@ -22,6 +23,8 @@ export function pluginManifestLanguageToBindLanguage( switch (manifestLanguage) { case "plugin/typescript": return "plugin-ts"; + case "plugin/rust": + return "plugin-rs"; default: throw Error( intlMsg.lib_language_unsupportedManifestLanguage({ diff --git a/packages/schema/bind/src/bindings/index.ts b/packages/schema/bind/src/bindings/index.ts index 61e4cfa78e..69b641af5d 100644 --- a/packages/schema/bind/src/bindings/index.ts +++ b/packages/schema/bind/src/bindings/index.ts @@ -18,6 +18,8 @@ export function getGenerateBindingFn( return Rust.Wasm.generateBinding; case "plugin-ts": return TypeScript.Plugin.generateBinding; + case "plugin-rs": + return Rust.Plugin.generateBinding; case "app-ts": return TypeScript.App.generateBinding; default: diff --git a/packages/schema/bind/src/bindings/rust/index.ts b/packages/schema/bind/src/bindings/rust/index.ts index a01310ad9e..7bdebbf2d4 100644 --- a/packages/schema/bind/src/bindings/rust/index.ts +++ b/packages/schema/bind/src/bindings/rust/index.ts @@ -1,3 +1,4 @@ export * as Wasm from "./wasm"; +export * as Plugin from "./plugin"; export * as Functions from "./functions"; export * as Types from "./types"; diff --git a/packages/schema/bind/src/bindings/rust/plugin/index.ts b/packages/schema/bind/src/bindings/rust/plugin/index.ts new file mode 100644 index 0000000000..e8ab399913 --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/index.ts @@ -0,0 +1,80 @@ +import * as Transforms from "./transforms"; +import { Functions } from "../"; +import { GenerateBindingFn, renderTemplates } from "../.."; +import { BindOptions, BindOutput } from "../../.."; + +import { + transformAbi, + extendType, + addFirstLast, + toPrefixedGraphQLType, + hasImports, + methodParentPointers, + latestWrapManifestVersion, +} from "@polywrap/schema-parse"; +import path from "path"; +import { WrapAbi } from "@polywrap/wrap-manifest-types-js/src"; + +const templatePath = (subpath: string) => + path.join(__dirname, "./templates", subpath); + +const sort = (obj: Record) => + Object.keys(obj) + .sort() + .reduce((map: Record, key: string) => { + if (typeof obj[key] === "object") { + map[key] = sort(obj[key] as Record); + + if (Array.isArray(obj[key])) { + map[key] = Object.values(map[key] as Record); + } + } else { + map[key] = obj[key]; + } + return map; + }, {}); + +export const generateBinding: GenerateBindingFn = ( + options: BindOptions +): BindOutput => { + const result: BindOutput = { + output: { + entries: [], + }, + outputDirAbs: options.outputDirAbs, + }; + const output = result.output; + const abi = applyTransforms(options.abi); + + const manifest = { + name: options.projectName, + type: "plugin", + version: latestWrapManifestVersion, + abi: JSON.stringify( + sort((options.abi as unknown) as Record), + null, + 2 + ), + }; + + output.entries = renderTemplates(templatePath(""), { ...abi, manifest }, {}); + + return result; +}; + +function applyTransforms(abi: WrapAbi): WrapAbi { + const transforms = [ + extendType(Functions), + addFirstLast, + toPrefixedGraphQLType, + hasImports, + methodParentPointers(), + Transforms.propertyDeps(), + Transforms.byRef(), + ]; + + for (const transform of transforms) { + abi = transformAbi(abi, transform); + } + return abi; +} diff --git a/packages/schema/bind/src/bindings/rust/plugin/templates/mod-rs.mustache b/packages/schema/bind/src/bindings/rust/plugin/templates/mod-rs.mustache new file mode 100644 index 0000000000..88b7de7bdf --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/templates/mod-rs.mustache @@ -0,0 +1,7 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +pub mod types; +#[path = "wrap.info.rs"] +pub mod wrap_info; +pub mod module; \ No newline at end of file diff --git a/packages/schema/bind/src/bindings/rust/plugin/templates/module-rs.mustache b/packages/schema/bind/src/bindings/rust/plugin/templates/module-rs.mustache new file mode 100644 index 0000000000..fc418e4cb8 --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/templates/module-rs.mustache @@ -0,0 +1,49 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +use std::sync::Arc; +use polywrap_core::invoke::Invoker; +use polywrap_plugin::error::PluginError; +use polywrap_plugin::module::PluginModule; +use serde::{Serialize, Deserialize}; +use super::types::*; +use async_trait::async_trait; +pub use polywrap_plugin::impl_plugin_traits; + +#[macro_export] +macro_rules! impl_traits { + ($plugin_type:ty) => { + $crate::wrap::module::impl_plugin_traits!( + $plugin_type, + $crate::wrap::wrap_info::get_manifest(), + {{#moduleType}} + {{#methods}} + ({{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}, $crate::wrap::module::Args{{#toUpper}}{{name}}{{/toUpper}}), + {{/methods}} + {{/moduleType}} + ); + }; +} + +{{#moduleType}} +{{#methods}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Args{{#toUpper}}{{name}}{{/toUpper}} { + {{#arguments}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}pub {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}, + {{/arguments}} +} + +{{/methods}} +{{/moduleType}} +#[async_trait] +pub trait Module: PluginModule { + {{#moduleType}} + {{#methods}} + async fn {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(&mut self, args: &Args{{#toUpper}}{{name}}{{/toUpper}}, invoker: Arc) -> Result<{{#return}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/return}}, PluginError>; + {{^last}} + + {{/last}} + {{/methods}} + {{/moduleType}} +} diff --git a/packages/schema/bind/src/bindings/rust/plugin/templates/types-rs.mustache b/packages/schema/bind/src/bindings/rust/plugin/templates/types-rs.mustache new file mode 100644 index 0000000000..9f4a08f780 --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/templates/types-rs.mustache @@ -0,0 +1,185 @@ +#![allow(unused_imports)] +#![allow(non_camel_case_types)] + +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +use serde::{Serialize, Deserialize}; +use num_bigint::BigInt; +use bigdecimal::BigDecimal as BigNumber; +use serde_json as JSON; +use std::collections::BTreeMap as Map; +{{#importedModuleTypes}} +use std::sync::Arc; +use polywrap_msgpack::{decode, serialize}; +use polywrap_core::{invoke::{Invoker, InvokeArgs}, uri::Uri}; +use polywrap_plugin::error::PluginError; +{{/importedModuleTypes}} + +/// Env START /// + +{{#envType}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#properties}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}pub {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}, + {{/properties}} +} +{{/envType}} +/// Env END /// + +/// Objects START /// + +{{#objectTypes}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#properties}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}pub {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}, + {{/properties}} +} +{{/objectTypes}} +/// Objects END /// + +/// Enums START /// + +{{#enumTypes}} +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#constants}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}{{#detectKeyword}}{{.}}{{/detectKeyword}}, + {{/constants}} + _MAX_ +} +{{/enumTypes}} +/// Enums END /// + +/// Imported objects START /// + +{{#importedObjectTypes}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#properties}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}pub {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}, + {{/properties}} +} +{{/importedObjectTypes}} +/// Imported objects END /// + +/// Imported envs START /// + +{{#importedEnvType}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#properties}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}pub {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}, + {{/properties}} +} +{{/importedEnvType}} +/// Imported envs END /// + +/// Imported enums START /// + +{{#importedEnumTypes}} +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#constants}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}{{#detectKeyword}}{{.}}{{/detectKeyword}}, + {{/constants}} + _MAX_ +} +{{/importedEnumTypes}} +/// Imported enums END /// + +/// Imported Modules START /// + +{{#importedModuleTypes}} +{{#methods}} +/// URI: "{{parent.uri}}" /// +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#toUpper}}{{parent.type}}{{/toUpper}}Args{{#toUpper}}{{name}}{{/toUpper}} { + {{#arguments}} + {{#serdeKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/serdeKeyword}}pub {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}: {{#toWasm}}{{toGraphQLType}}{{/toWasm}}, + {{/arguments}} +} + +{{/methods}} +{{^isInterface}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} {} + +impl {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + pub const URI: &'static str = "{{uri}}"; + + pub fn new() -> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} {} + } + + {{#methods}} + pub async fn {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(args: &{{#toUpper}}{{parent.type}}{{/toUpper}}Args{{#toUpper}}{{name}}{{/toUpper}}, invoker: Arc) -> Result<{{#return}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/return}}, PluginError> { + let uri = {{#parent}}{{#toUpper}}{{type}}{{/toUpper}}{{/parent}}::URI; + let serialized_args = InvokeArgs::UIntArray(serialize(args.clone()).unwrap()); + let opt_args = Some(&serialized_args); + let uri = Uri::try_from(uri).unwrap(); + let result = invoker.invoke( + &uri, + "{{name}}", + opt_args, + None, + None + ) + .await + .map_err(|e| PluginError::SubinvocationError { + uri: uri.to_string(), + method: "{{name}}".to_string(), + args: serde_json::to_string(&args).unwrap(), + exception: e.to_string(), + })?; + + Ok({{#return}}{{^required}}Some({{/required}}{{/return}}decode(result.as_slice())?{{#return}}{{^required}}){{/required}}{{/return}}) + } + {{^last}} + + {{/last}} + {{/methods}} +} +{{/isInterface}} +{{#isInterface}} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a> { + {{#isInterface}}uri: &'a str{{/isInterface}} +} + +impl<'a> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a> { + pub const INTERFACE_URI: &'static str = "{{uri}}"; + + pub fn new(uri: &'a str) -> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a> { + {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { uri: uri } + } + + {{#methods}} + pub async fn {{#toLower}}{{name}}{{/toLower}}(&self, args: &{{#toUpper}}{{parent.type}}{{/toUpper}}Args{{#toUpper}}{{name}}{{/toUpper}}) -> Result<{{#return}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/return}}, PluginError> { + let uri = self.uri; + let serialized_args = InvokeArgs::UIntArray(serialize(args.clone()).unwrap()); + let result = invoker.invoke( + uri, + "{{name}}", + serialized_args, + None, + None + .await + .map_err(|e| PluginError::SubinvocationError { + uri: uri.to_string(), + method: "{{name}}".to_string(), + args: serde_json::to_string(&args).unwrap(), + exception: e.to_string(), + })?; + + Ok({{#return}}{{^required}}Some({{/required}}{{/return}}decode(result.as_slice())?{{#return}}{{^required}}){{/required}}{{/return}}) + } + {{^last}} + + {{/last}} + {{/methods}} +} +{{/isInterface}} +{{/importedModuleTypes}} +/// Imported Modules END /// diff --git a/packages/schema/bind/src/bindings/rust/plugin/templates/wrap.info-rs.mustache b/packages/schema/bind/src/bindings/rust/plugin/templates/wrap.info-rs.mustache new file mode 100644 index 0000000000..384d029035 --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/templates/wrap.info-rs.mustache @@ -0,0 +1,15 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +use polywrap_manifest::versions::{WrapManifest, WrapManifestAbi}; +use serde_json::{json, from_value}; + +{{#manifest}} +pub fn get_manifest() -> WrapManifest { + WrapManifest { + name: "{{name}}".to_string(), + type_: "{{type}}".to_string(), + version: "{{version}}".to_string(), + abi: from_value::(json!({{abi}})).unwrap() + } +} +{{/manifest}} diff --git a/packages/schema/bind/src/bindings/rust/plugin/transforms/byRef.ts b/packages/schema/bind/src/bindings/rust/plugin/transforms/byRef.ts new file mode 100644 index 0000000000..b5f87a673c --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/transforms/byRef.ts @@ -0,0 +1,24 @@ +import { AbiTransforms } from "@polywrap/schema-parse"; +import { AnyDefinition } from "@polywrap/wrap-manifest-types-js"; + +export function byRef(): AbiTransforms { + return { + enter: { + // eslint-disable-next-line @typescript-eslint/naming-convention + AnyDefinition: (def: AnyDefinition) => { + const byRefScalars = ["String", "BigInt", "BigNumber", "Map", "Bytes"]; + + if (def.scalar) { + if (byRefScalars.indexOf(def.scalar.type) > -1 || !def.required) { + return { + ...def, + byRef: true, + }; + } + } + + return def; + }, + }, + }; +} diff --git a/packages/schema/bind/src/bindings/rust/plugin/transforms/index.ts b/packages/schema/bind/src/bindings/rust/plugin/transforms/index.ts new file mode 100644 index 0000000000..56b11478c3 --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/transforms/index.ts @@ -0,0 +1,2 @@ +export * from "./byRef"; +export * from "./propertyDeps"; diff --git a/packages/schema/bind/src/bindings/rust/plugin/transforms/propertyDeps.ts b/packages/schema/bind/src/bindings/rust/plugin/transforms/propertyDeps.ts new file mode 100644 index 0000000000..793ef1f641 --- /dev/null +++ b/packages/schema/bind/src/bindings/rust/plugin/transforms/propertyDeps.ts @@ -0,0 +1,171 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-useless-escape */ +import { isBaseType, isBuiltInType } from "../../types"; + +import { + ImportedModuleDefinition, + ObjectDefinition, + AnyDefinition, + ModuleDefinition, + EnvDefinition, +} from "@polywrap/wrap-manifest-types-js"; +import { AbiTransforms } from "@polywrap/schema-parse"; + +interface PropertyDep { + crate: string; + type: string; + isEnum: boolean; +} + +interface PropertyDepsState { + envDefinition?: EnvDefinition; + objectDefinition?: ObjectDefinition; + moduleDefinition?: ModuleDefinition; + importedModuleDefinition?: ImportedModuleDefinition; + propertyDeps?: PropertyDep[]; +} + +export function propertyDeps(): AbiTransforms { + const state: PropertyDepsState = {}; + + return { + enter: { + EnvDefinition: (def: EnvDefinition) => { + state.envDefinition = def; + state.propertyDeps = []; + return def; + }, + ObjectDefinition: (def: ObjectDefinition) => { + state.objectDefinition = def; + state.propertyDeps = []; + return def; + }, + ModuleDefinition: (def: ModuleDefinition) => { + state.moduleDefinition = def; + state.propertyDeps = []; + return def; + }, + ImportedModuleDefinition: (def: ImportedModuleDefinition) => { + state.importedModuleDefinition = def; + state.propertyDeps = []; + return def; + }, + AnyDefinition: (def: AnyDefinition) => { + const appendPropertyDep = ( + rootType: string, + array: PropertyDep[] + ): PropertyDep[] => { + let typeName = def.type; + + if (typeName.indexOf("[") === 0) { + typeName = typeName.replace(/\[|\]|\!|\?/g, ""); + } + + const appendUnique = (item: PropertyDep) => { + if ( + array.findIndex( + (i) => i.crate === item.crate && i.type === item.type + ) === -1 + ) { + array.push(item); + } + }; + + const isKnownType = (name: string) => + isBaseType(name) || isBuiltInType(name) || name === rootType; + + // if type is map and the value is custom, + // we need to add it into property dependency + if (typeName.startsWith("Map<")) { + const valueName = def.map?.object?.type ?? def.map?.enum?.type; + if (valueName && !isKnownType(valueName)) { + appendUnique({ + crate: "crate", + type: valueName, + isEnum: valueName === def.map?.enum?.type, + }); + + return array; + } + + return array; + } + + if (isKnownType(typeName)) { + return array; + } + + appendUnique({ + crate: "crate", + type: typeName, + isEnum: !!def.enum || !!def.array?.enum, + }); + + return array; + }; + + if (state.envDefinition && state.propertyDeps) { + state.propertyDeps = appendPropertyDep( + state.envDefinition.type, + state.propertyDeps + ); + } else if (state.objectDefinition && state.propertyDeps) { + state.propertyDeps = appendPropertyDep( + state.objectDefinition.type, + state.propertyDeps + ); + } else if (state.moduleDefinition && state.propertyDeps) { + state.propertyDeps = appendPropertyDep( + state.moduleDefinition.type, + state.propertyDeps + ); + } else if (state.importedModuleDefinition && state.propertyDeps) { + state.propertyDeps = appendPropertyDep( + state.importedModuleDefinition.type, + state.propertyDeps + ); + } + + return def; + }, + }, + leave: { + EnvDefinition: (def: EnvDefinition) => { + const propertyDeps = state.propertyDeps; + state.propertyDeps = undefined; + state.envDefinition = undefined; + return { + ...def, + propertyDeps, + }; + }, + ObjectDefinition: (def: ObjectDefinition) => { + const propertyDeps = state.propertyDeps; + state.propertyDeps = undefined; + state.objectDefinition = undefined; + return { + ...def, + propertyDeps, + }; + }, + ModuleDefinition: (def: ModuleDefinition) => { + const propertyDeps = state.propertyDeps; + state.propertyDeps = undefined; + state.moduleDefinition = undefined; + return { + ...def, + propertyDeps, + }; + }, + ImportedModuleDefinition: (def: ImportedModuleDefinition) => { + const propertyDeps = state.propertyDeps; + state.propertyDeps = undefined; + state.importedModuleDefinition = undefined; + return { + ...def, + propertyDeps, + }; + }, + }, + }; +} diff --git a/packages/schema/bind/src/types.ts b/packages/schema/bind/src/types.ts index 3ae6aa13dc..64a2894739 100644 --- a/packages/schema/bind/src/types.ts +++ b/packages/schema/bind/src/types.ts @@ -1,7 +1,12 @@ import { OutputDirectory } from "@polywrap/os-js"; import { WrapAbi } from "@polywrap/schema-parse"; -export type BindLanguage = "wasm-as" | "wasm-rs" | "plugin-ts" | "app-ts"; +export type BindLanguage = + | "wasm-as" + | "wasm-rs" + | "plugin-ts" + | "plugin-rs" + | "app-ts"; export interface BindOutput { output: OutputDirectory; diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-rs/mod.rs b/packages/test-cases/cases/bind/sanity/output/plugin-rs/mod.rs new file mode 100644 index 0000000000..88b7de7bdf --- /dev/null +++ b/packages/test-cases/cases/bind/sanity/output/plugin-rs/mod.rs @@ -0,0 +1,7 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +pub mod types; +#[path = "wrap.info.rs"] +pub mod wrap_info; +pub mod module; \ No newline at end of file diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-rs/module.rs b/packages/test-cases/cases/bind/sanity/output/plugin-rs/module.rs new file mode 100644 index 0000000000..dca382da71 --- /dev/null +++ b/packages/test-cases/cases/bind/sanity/output/plugin-rs/module.rs @@ -0,0 +1,73 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +use std::sync::Arc; +use polywrap_core::invoke::Invoker; +use polywrap_plugin::error::PluginError; +use polywrap_plugin::module::PluginModule; +use serde::{Serialize, Deserialize}; +use super::types::*; +use async_trait::async_trait; +pub use polywrap_plugin::impl_plugin_traits; + +#[macro_export] +macro_rules! impl_traits { + ($plugin_type:ty) => { + $crate::wrap::module::impl_plugin_traits!( + $plugin_type, + $crate::wrap::wrap_info::get_manifest(), + (module_method, $crate::wrap::module::ArgsModuleMethod), + (object_method, $crate::wrap::module::ArgsObjectMethod), + (optional_env_method, $crate::wrap::module::ArgsOptionalEnvMethod), + (_if, $crate::wrap::module::ArgsIf), + ); + }; +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ArgsModuleMethod { + pub str: String, + pub opt_str: Option, + pub en: CustomEnum, + pub opt_enum: Option, + pub enum_array: Vec, + pub opt_enum_array: Option>>, + pub map: Map, + pub map_of_arr: Map>, + pub map_of_map: Map>, + pub map_of_obj: Map, + pub map_of_arr_of_obj: Map>, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ArgsObjectMethod { + pub object: AnotherType, + pub opt_object: Option, + pub object_array: Vec, + pub opt_object_array: Option>>, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ArgsOptionalEnvMethod { + pub object: AnotherType, + pub opt_object: Option, + pub object_array: Vec, + pub opt_object_array: Option>>, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ArgsIf { + #[serde(rename = "if")] + pub _if: Else, +} + +#[async_trait] +pub trait Module: PluginModule { + async fn module_method(&mut self, args: &ArgsModuleMethod, invoker: Arc) -> Result; + + async fn object_method(&mut self, args: &ArgsObjectMethod, invoker: Arc) -> Result, PluginError>; + + async fn optional_env_method(&mut self, args: &ArgsOptionalEnvMethod, invoker: Arc) -> Result, PluginError>; + + async fn _if(&mut self, args: &ArgsIf, invoker: Arc) -> Result; +} diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-rs/types.rs b/packages/test-cases/cases/bind/sanity/output/plugin-rs/types.rs new file mode 100644 index 0000000000..fddb5bd880 --- /dev/null +++ b/packages/test-cases/cases/bind/sanity/output/plugin-rs/types.rs @@ -0,0 +1,250 @@ +#![allow(unused_imports)] +#![allow(non_camel_case_types)] + +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +use serde::{Serialize, Deserialize}; +use num_bigint::BigInt; +use bigdecimal::BigDecimal as BigNumber; +use serde_json as JSON; +use std::collections::BTreeMap as Map; +use std::sync::Arc; +use polywrap_msgpack::{decode, serialize}; +use polywrap_core::{invoke::{Invoker, InvokeArgs}, uri::Uri}; +use polywrap_plugin::error::PluginError; + +/// Env START /// + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Env { + pub prop: String, + pub opt_prop: Option, + pub opt_map: Option>>, +} +/// Env END /// + +/// Objects START /// + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CustomType { + pub str: String, + pub opt_str: Option, + pub u: u32, + pub opt_u: Option, + pub u8: u8, + pub u16: u16, + pub u32: u32, + pub i: i32, + pub i8: i8, + pub i16: i16, + pub i32: i32, + pub bigint: BigInt, + pub opt_bigint: Option, + pub bignumber: BigNumber, + pub opt_bignumber: Option, + pub json: JSON::Value, + pub opt_json: Option, + pub bytes: Vec, + pub opt_bytes: Option>, + pub boolean: bool, + pub opt_boolean: Option, + pub u_array: Vec, + pub u_opt_array: Option>, + pub opt_u_opt_array: Option>>, + pub opt_str_opt_array: Option>>, + pub u_array_array: Vec>, + pub u_opt_array_opt_array: Vec>>>, + pub u_array_opt_array_array: Vec>>>, + pub crazy_array: Option>>>>>>, + pub object: AnotherType, + pub opt_object: Option, + pub object_array: Vec, + pub opt_object_array: Option>>, + pub en: CustomEnum, + pub opt_enum: Option, + pub enum_array: Vec, + pub opt_enum_array: Option>>, + pub map: Map, + pub map_of_arr: Map>, + pub map_of_obj: Map, + pub map_of_arr_of_obj: Map>, + pub map_custom_value: Map>, +} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct AnotherType { + pub prop: Option, + pub circular: Option, + #[serde(rename = "const")] + pub _const: Option, +} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CustomMapValue { + pub foo: String, +} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Else { + #[serde(rename = "else")] + pub _else: String, +} +/// Objects END /// + +/// Enums START /// + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum CustomEnum { + STRING, + BYTES, + _MAX_ +} +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum While { + _for, + _in, + _MAX_ +} +/// Enums END /// + +/// Imported objects START /// + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TestImportObject { + pub object: TestImportAnotherObject, + pub opt_object: Option, + pub object_array: Vec, + pub opt_object_array: Option>>, + pub en: TestImportEnum, + pub opt_enum: Option, + pub enum_array: Vec, + pub opt_enum_array: Option>>, +} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TestImportAnotherObject { + pub prop: String, +} +/// Imported objects END /// + +/// Imported envs START /// + +/// Imported envs END /// + +/// Imported enums START /// + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum TestImportEnum { + STRING, + BYTES, + _MAX_ +} +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub enum TestImportEnumReturn { + STRING, + BYTES, + _MAX_ +} +/// Imported enums END /// + +/// Imported Modules START /// + +/// URI: "testimport.uri.eth" /// +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TestImportModuleArgsImportedMethod { + pub str: String, + pub opt_str: Option, + pub u: u32, + pub opt_u: Option, + pub u_array_array: Vec>>>, + pub object: TestImportObject, + pub opt_object: Option, + pub object_array: Vec, + pub opt_object_array: Option>>, + pub en: TestImportEnum, + pub opt_enum: Option, + pub enum_array: Vec, + pub opt_enum_array: Option>>, +} + +/// URI: "testimport.uri.eth" /// +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TestImportModuleArgsAnotherMethod { + pub arg: Vec, +} + +/// URI: "testimport.uri.eth" /// +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TestImportModuleArgsReturnsArrayOfEnums { + pub arg: String, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TestImportModule<'a> { + uri: &'a str +} + +impl<'a> TestImportModule<'a> { + pub const INTERFACE_URI: &'static str = "testimport.uri.eth"; + + pub fn new(uri: &'a str) -> TestImportModule<'a> { + TestImportModule { uri: uri } + } + + pub async fn imported_method(&self, args: &TestImportModuleArgsImportedMethod) -> Result, PluginError> { + let uri = self.uri; + let serialized_args = InvokeArgs::UIntArray(serialize(args.clone()).unwrap()); + let result = invoker.invoke( + uri, + "importedMethod", + serialized_args, + None, + None + .await + .map_err(|e| PluginError::SubinvocationError { + uri: uri.to_string(), + method: "importedMethod".to_string(), + args: serde_json::to_string(&args).unwrap(), + exception: e.to_string(), + })?; + + Ok(Some(decode(result.as_slice())?)) + } + + pub async fn another_method(&self, args: &TestImportModuleArgsAnotherMethod) -> Result { + let uri = self.uri; + let serialized_args = InvokeArgs::UIntArray(serialize(args.clone()).unwrap()); + let result = invoker.invoke( + uri, + "anotherMethod", + serialized_args, + None, + None + .await + .map_err(|e| PluginError::SubinvocationError { + uri: uri.to_string(), + method: "anotherMethod".to_string(), + args: serde_json::to_string(&args).unwrap(), + exception: e.to_string(), + })?; + + Ok(decode(result.as_slice())?) + } + + pub async fn returns_array_of_enums(&self, args: &TestImportModuleArgsReturnsArrayOfEnums) -> Result>, PluginError> { + let uri = self.uri; + let serialized_args = InvokeArgs::UIntArray(serialize(args.clone()).unwrap()); + let result = invoker.invoke( + uri, + "returnsArrayOfEnums", + serialized_args, + None, + None + .await + .map_err(|e| PluginError::SubinvocationError { + uri: uri.to_string(), + method: "returnsArrayOfEnums".to_string(), + args: serde_json::to_string(&args).unwrap(), + exception: e.to_string(), + })?; + + Ok(decode(result.as_slice())?) + } +} +/// Imported Modules END /// diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-rs/wrap.info.rs b/packages/test-cases/cases/bind/sanity/output/plugin-rs/wrap.info.rs new file mode 100644 index 0000000000..e0c68ed5c9 --- /dev/null +++ b/packages/test-cases/cases/bind/sanity/output/plugin-rs/wrap.info.rs @@ -0,0 +1,2316 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +use polywrap_manifest::versions::{WrapManifest, WrapManifestAbi}; +use serde_json::{json, from_value}; + +pub fn get_manifest() -> WrapManifest { + WrapManifest { + name: "Test".to_string(), + type_: "plugin".to_string(), + version: "0.1".to_string(), + abi: from_value::(json!({ + "enumTypes": [ + { + "constants": [ + "STRING", + "BYTES" + ], + "kind": 8, + "type": "CustomEnum" + }, + { + "constants": [ + "for", + "in" + ], + "kind": 8, + "type": "while" + } + ], + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "prop", + "required": true, + "scalar": { + "kind": 4, + "name": "prop", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optProp", + "scalar": { + "kind": 4, + "name": "optProp", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "optMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "optMap", + "scalar": { + "kind": 4, + "name": "optMap", + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "optMap", + "type": "Int" + } + }, + "name": "optMap", + "type": "Map" + } + ], + "type": "Env" + }, + "importedEnumTypes": [ + { + "constants": [ + "STRING", + "BYTES" + ], + "kind": 520, + "namespace": "TestImport", + "nativeType": "Enum", + "type": "TestImport_Enum", + "uri": "testimport.uri.eth" + }, + { + "constants": [ + "STRING", + "BYTES" + ], + "kind": 520, + "namespace": "TestImport", + "nativeType": "Enum", + "type": "TestImport_Enum_Return", + "uri": "testimport.uri.eth" + } + ], + "importedEnvTypes": [ + { + "kind": 524288, + "namespace": "TestImport", + "nativeType": "Env", + "properties": [ + { + "kind": 34, + "name": "enviroProp", + "required": true, + "scalar": { + "kind": 4, + "name": "enviroProp", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "TestImport_Env", + "uri": "testimport.uri.eth" + } + ], + "importedModuleTypes": [ + { + "isInterface": true, + "kind": 256, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "kind": 34, + "name": "optU", + "scalar": { + "kind": 4, + "name": "optU", + "type": "UInt" + }, + "type": "UInt" + }, + { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "scalar": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "type": "[UInt]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "scalar": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + "kind": 34, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "TestImport_Object" + }, + "required": true, + "type": "TestImport_Object" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "TestImport_Object" + }, + "type": "TestImport_Object" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_Object" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_Object" + }, + "required": true, + "type": "[TestImport_Object]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[TestImport_Object]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_Object" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_Object" + }, + "type": "[TestImport_Object]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[TestImport_Object]" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "optEnum", + "type": "TestImport_Enum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + } + ], + "env": { + "required": true + }, + "kind": 64, + "name": "importedMethod", + "required": true, + "return": { + "kind": 34, + "name": "importedMethod", + "object": { + "kind": 8192, + "name": "importedMethod", + "type": "TestImport_Object" + }, + "type": "TestImport_Object" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "arg", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "arg", + "required": true, + "scalar": { + "kind": 4, + "name": "arg", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "arg", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "anotherMethod", + "required": true, + "return": { + "kind": 34, + "name": "anotherMethod", + "required": true, + "scalar": { + "kind": 4, + "name": "anotherMethod", + "required": true, + "type": "Int32" + }, + "type": "Int32" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "arg", + "required": true, + "scalar": { + "kind": 4, + "name": "arg", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "returnsArrayOfEnums", + "required": true, + "return": { + "array": { + "enum": { + "kind": 16384, + "name": "returnsArrayOfEnums", + "type": "TestImport_Enum_Return" + }, + "item": { + "kind": 16384, + "name": "returnsArrayOfEnums", + "type": "TestImport_Enum_Return" + }, + "kind": 18, + "name": "returnsArrayOfEnums", + "required": true, + "type": "[TestImport_Enum_Return]" + }, + "kind": 34, + "name": "returnsArrayOfEnums", + "required": true, + "type": "[TestImport_Enum_Return]" + }, + "type": "Method" + } + ], + "namespace": "TestImport", + "nativeType": "Module", + "type": "TestImport_Module", + "uri": "testimport.uri.eth" + } + ], + "importedObjectTypes": [ + { + "kind": 1025, + "namespace": "TestImport", + "nativeType": "Object", + "properties": [ + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "TestImport_AnotherObject" + }, + "required": true, + "type": "TestImport_AnotherObject" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "TestImport_AnotherObject" + }, + "type": "TestImport_AnotherObject" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_AnotherObject" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_AnotherObject" + }, + "required": true, + "type": "[TestImport_AnotherObject]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[TestImport_AnotherObject]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_AnotherObject" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_AnotherObject" + }, + "type": "[TestImport_AnotherObject]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[TestImport_AnotherObject]" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "optEnum", + "type": "TestImport_Enum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + } + ], + "type": "TestImport_Object", + "uri": "testimport.uri.eth" + }, + { + "kind": 1025, + "namespace": "TestImport", + "nativeType": "AnotherObject", + "properties": [ + { + "kind": 34, + "name": "prop", + "required": true, + "scalar": { + "kind": 4, + "name": "prop", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "TestImport_AnotherObject", + "uri": "testimport.uri.eth" + } + ], + "interfaceTypes": [ + { + "capabilities": { + "getImplementations": { + "enabled": true + } + }, + "kind": 32768, + "namespace": "TestImport", + "nativeType": "Interface", + "type": "TestImport", + "uri": "testimport.uri.eth" + } + ], + "moduleType": { + "imports": [ + { + "type": "TestImport_Module" + }, + { + "type": "TestImport_Object" + }, + { + "type": "TestImport_AnotherObject" + }, + { + "type": "TestImport_Enum" + }, + { + "type": "TestImport_Enum_Return" + } + ], + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "CustomEnum" + }, + "kind": 34, + "name": "optEnum", + "type": "CustomEnum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "required": true, + "scalar": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + }, + "name": "map", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + }, + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + "name": "mapOfArr", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "map": { + "key": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfMap", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "Int" + } + }, + "name": "mapOfMap", + "required": true, + "type": "Map>", + "value": { + "key": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfMap", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "mapOfMap", + "required": true, + "type": "Int" + } + } + }, + "name": "mapOfMap", + "required": true, + "type": "Map>" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfObj", + "object": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + "name": "mapOfObj", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + }, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map" + } + ], + "kind": 64, + "name": "moduleMethod", + "required": true, + "return": { + "kind": 34, + "name": "moduleMethod", + "required": true, + "scalar": { + "kind": 4, + "name": "moduleMethod", + "required": true, + "type": "Int" + }, + "type": "Int" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "AnotherType" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[AnotherType]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[AnotherType]" + } + ], + "env": { + "required": true + }, + "kind": 64, + "name": "objectMethod", + "required": true, + "return": { + "kind": 34, + "name": "objectMethod", + "object": { + "kind": 8192, + "name": "objectMethod", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "AnotherType" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[AnotherType]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[AnotherType]" + } + ], + "env": { + "required": false + }, + "kind": 64, + "name": "optionalEnvMethod", + "required": true, + "return": { + "kind": 34, + "name": "optionalEnvMethod", + "object": { + "kind": 8192, + "name": "optionalEnvMethod", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "if", + "object": { + "kind": 8192, + "name": "if", + "required": true, + "type": "else" + }, + "required": true, + "type": "else" + } + ], + "kind": 64, + "name": "if", + "required": true, + "return": { + "kind": 34, + "name": "if", + "object": { + "kind": 8192, + "name": "if", + "required": true, + "type": "else" + }, + "required": true, + "type": "else" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "kind": 34, + "name": "optU", + "scalar": { + "kind": 4, + "name": "optU", + "type": "UInt" + }, + "type": "UInt" + }, + { + "kind": 34, + "name": "u8", + "required": true, + "scalar": { + "kind": 4, + "name": "u8", + "required": true, + "type": "UInt8" + }, + "type": "UInt8" + }, + { + "kind": 34, + "name": "u16", + "required": true, + "scalar": { + "kind": 4, + "name": "u16", + "required": true, + "type": "UInt16" + }, + "type": "UInt16" + }, + { + "kind": 34, + "name": "u32", + "required": true, + "scalar": { + "kind": 4, + "name": "u32", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "i", + "required": true, + "scalar": { + "kind": 4, + "name": "i", + "required": true, + "type": "Int" + }, + "type": "Int" + }, + { + "kind": 34, + "name": "i8", + "required": true, + "scalar": { + "kind": 4, + "name": "i8", + "required": true, + "type": "Int8" + }, + "type": "Int8" + }, + { + "kind": 34, + "name": "i16", + "required": true, + "scalar": { + "kind": 4, + "name": "i16", + "required": true, + "type": "Int16" + }, + "type": "Int16" + }, + { + "kind": 34, + "name": "i32", + "required": true, + "scalar": { + "kind": 4, + "name": "i32", + "required": true, + "type": "Int32" + }, + "type": "Int32" + }, + { + "kind": 34, + "name": "bigint", + "required": true, + "scalar": { + "kind": 4, + "name": "bigint", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "optBigint", + "scalar": { + "kind": 4, + "name": "optBigint", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "bignumber", + "required": true, + "scalar": { + "kind": 4, + "name": "bignumber", + "required": true, + "type": "BigNumber" + }, + "type": "BigNumber" + }, + { + "kind": 34, + "name": "optBignumber", + "scalar": { + "kind": 4, + "name": "optBignumber", + "type": "BigNumber" + }, + "type": "BigNumber" + }, + { + "kind": 34, + "name": "json", + "required": true, + "scalar": { + "kind": 4, + "name": "json", + "required": true, + "type": "JSON" + }, + "type": "JSON" + }, + { + "kind": 34, + "name": "optJson", + "scalar": { + "kind": 4, + "name": "optJson", + "type": "JSON" + }, + "type": "JSON" + }, + { + "kind": 34, + "name": "bytes", + "required": true, + "scalar": { + "kind": 4, + "name": "bytes", + "required": true, + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "optBytes", + "scalar": { + "kind": 4, + "name": "optBytes", + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "boolean", + "required": true, + "scalar": { + "kind": 4, + "name": "boolean", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "optBoolean", + "scalar": { + "kind": 4, + "name": "optBoolean", + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "array": { + "item": { + "kind": 4, + "name": "uArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 34, + "name": "uArray", + "required": true, + "type": "[UInt]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "uOptArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uOptArray", + "scalar": { + "kind": 4, + "name": "uOptArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 34, + "name": "uOptArray", + "type": "[UInt]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "optUOptArray", + "type": "UInt" + }, + "kind": 18, + "name": "optUOptArray", + "scalar": { + "kind": 4, + "name": "optUOptArray", + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 34, + "name": "optUOptArray", + "type": "[UInt]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "optStrOptArray", + "type": "String" + }, + "kind": 18, + "name": "optStrOptArray", + "scalar": { + "kind": 4, + "name": "optStrOptArray", + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "optStrOptArray", + "type": "[String]" + }, + { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + "kind": 34, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "kind": 18, + "name": "uOptArrayOptArray", + "scalar": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "kind": 18, + "name": "uOptArrayOptArray", + "scalar": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "uOptArrayOptArray", + "required": true, + "type": "[[UInt32]]" + }, + "kind": 34, + "name": "uOptArrayOptArray", + "required": true, + "type": "[[UInt32]]" + }, + { + "array": { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "type": "[[UInt32]]" + }, + "item": { + "array": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "type": "[[UInt32]]" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "type": "[[[UInt32]]]" + }, + "kind": 34, + "name": "uArrayOptArrayArray", + "required": true, + "type": "[[[UInt32]]]" + }, + { + "array": { + "array": { + "array": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "item": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "kind": 18, + "name": "crazyArray", + "type": "[[[UInt32]]]" + }, + "item": { + "array": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "item": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "kind": 18, + "name": "crazyArray", + "type": "[[[UInt32]]]" + }, + "kind": 18, + "name": "crazyArray", + "type": "[[[[UInt32]]]]" + }, + "kind": 34, + "name": "crazyArray", + "type": "[[[[UInt32]]]]" + }, + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "AnotherType" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[AnotherType]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[AnotherType]" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "CustomEnum" + }, + "kind": 34, + "name": "optEnum", + "type": "CustomEnum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "required": true, + "scalar": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + }, + "name": "map", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + }, + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + "name": "mapOfArr", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfObj", + "object": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + "name": "mapOfObj", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + }, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapCustomValue", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapCustomValue", + "object": { + "kind": 8192, + "name": "mapCustomValue", + "type": "CustomMapValue" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapCustomValue", + "type": "CustomMapValue" + } + }, + "name": "mapCustomValue", + "required": true, + "type": "Map" + } + ], + "type": "CustomType" + }, + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "prop", + "scalar": { + "kind": 4, + "name": "prop", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "circular", + "object": { + "kind": 8192, + "name": "circular", + "type": "CustomType" + }, + "type": "CustomType" + }, + { + "kind": 34, + "name": "const", + "scalar": { + "kind": 4, + "name": "const", + "type": "String" + }, + "type": "String" + } + ], + "type": "AnotherType" + }, + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "foo", + "required": true, + "scalar": { + "kind": 4, + "name": "foo", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "CustomMapValue" + }, + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "else", + "required": true, + "scalar": { + "kind": 4, + "name": "else", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "else" + } + ], + "version": "0.1" +})).unwrap() + } +}