New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wasm-ast-types

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wasm-ast-types - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

22

main/utils/types.js

@@ -194,3 +194,2 @@ "use strict";

var allOf = JSON.stringify(jsonschema.properties[prop].allOf, null, 2);
var isOptional = !((_jsonschema$required = jsonschema.required) !== null && _jsonschema$required !== void 0 && _jsonschema$required.includes(prop));

@@ -210,2 +209,23 @@ var unionTypes = jsonschema.properties[prop].allOf.map(function (el) {

}
} else if (Array.isArray(jsonschema.properties[prop].oneOf)) {
var _jsonschema$required2;
var oneOf = JSON.stringify(jsonschema.properties[prop].oneOf, null, 2);
var _isOptional = !((_jsonschema$required2 = jsonschema.required) !== null && _jsonschema$required2 !== void 0 && _jsonschema$required2.includes(prop));
var _unionTypes = jsonschema.properties[prop].oneOf.map(function (el) {
if (el.title) return el.title;
return el.type;
});
var _uniqUnionTypes = (0, _toConsumableArray2["default"])(new Set(_unionTypes));
if (_uniqUnionTypes.length === 1) {
return (0, _babel.propertySignature)(camelize ? (0, _case.camel)(prop) : prop, t.tsTypeAnnotation(t.tsTypeReference(t.identifier(forEmptyNameFix(_uniqUnionTypes[0])))), _isOptional);
} else {
return (0, _babel.propertySignature)(camelize ? (0, _case.camel)(prop) : prop, t.tsTypeAnnotation(t.tsUnionType(_uniqUnionTypes.map(function (typ) {
return t.tsTypeReference(t.identifier(forEmptyNameFix(typ)));
}))), _isOptional);
}
}

@@ -212,0 +232,0 @@

@@ -7,6 +7,12 @@ "use strict";

var _cosmos_msg_for__empty = _interopRequireDefault(require("./../../../__fixtures__/vectis/cosmos_msg_for__empty.json"));
var _cosmos_msg_for__empty = _interopRequireDefault(require("./../../../__fixtures__/vectis/govec/cosmos_msg_for__empty.json"));
var _execute_msg_for__empty = _interopRequireDefault(require("./../../../__fixtures__/vectis/execute_msg_for__empty.json"));
var _execute_msg_for__empty = _interopRequireDefault(require("./../../../__fixtures__/vectis/govec/execute_msg_for__empty.json"));
var _can_execute_relay_response = _interopRequireDefault(require("./../../../__fixtures__/vectis/govec/can_execute_relay_response.json"));
var _info_response = _interopRequireDefault(require("./../../../__fixtures__/vectis/govec/info_response.json"));
var _relay_transaction = _interopRequireDefault(require("./../../../__fixtures__/vectis/govec/relay_transaction.json"));
var _wasm = require("./wasm");

@@ -28,2 +34,11 @@

});
it('can_execute_relay_response', function () {
expectCode((0, _wasm.createTypeInterface)(_can_execute_relay_response["default"]));
});
it('info_response', function () {
expectCode((0, _wasm.createTypeInterface)(_info_response["default"]));
});
it('relay_transaction', function () {
expectCode((0, _wasm.createTypeInterface)(_relay_transaction["default"]));
});
it('query classes', function () {

@@ -30,0 +45,0 @@ expectCode((0, _wasm.createQueryClass)('SG721QueryClient', 'SG721ReadOnlyInstance', _cosmos_msg_for__empty["default"]));

@@ -153,3 +153,2 @@ import * as t from '@babel/types';

if (Array.isArray(jsonschema.properties[prop].allOf)) {
const allOf = JSON.stringify(jsonschema.properties[prop].allOf, null, 2);
const isOptional = !jsonschema.required?.includes(prop);

@@ -167,2 +166,16 @@ const unionTypes = jsonschema.properties[prop].allOf.map(el => {

}
} else if (Array.isArray(jsonschema.properties[prop].oneOf)) {
const oneOf = JSON.stringify(jsonschema.properties[prop].oneOf, null, 2);
const isOptional = !jsonschema.required?.includes(prop);
const unionTypes = jsonschema.properties[prop].oneOf.map(el => {
if (el.title) return el.title;
return el.type;
});
const uniqUnionTypes = [...new Set(unionTypes)];
if (uniqUnionTypes.length === 1) {
return propertySignature(camelize ? camel(prop) : prop, t.tsTypeAnnotation(t.tsTypeReference(t.identifier(forEmptyNameFix(uniqUnionTypes[0])))), isOptional);
} else {
return propertySignature(camelize ? camel(prop) : prop, t.tsTypeAnnotation(t.tsUnionType(uniqUnionTypes.map(typ => t.tsTypeReference(t.identifier(forEmptyNameFix(typ)))))), isOptional);
}
}

@@ -169,0 +182,0 @@

import generate from '@babel/generator';
import cosmos_msg_for__empty from './../../../__fixtures__/vectis/cosmos_msg_for__empty.json';
import execute_msg_for__empty from './../../../__fixtures__/vectis/execute_msg_for__empty.json';
import cosmos_msg_for__empty from './../../../__fixtures__/vectis/govec/cosmos_msg_for__empty.json';
import execute_msg_for__empty from './../../../__fixtures__/vectis/govec/execute_msg_for__empty.json';
import can_execute_relay_response from './../../../__fixtures__/vectis/govec/can_execute_relay_response.json';
import info_response from './../../../__fixtures__/vectis/govec/info_response.json';
import relay_transaction from './../../../__fixtures__/vectis/govec/relay_transaction.json';
import { createQueryClass, createExecuteClass, createExecuteInterface, createTypeInterface } from './wasm';

@@ -20,2 +23,11 @@

});
it('can_execute_relay_response', () => {
expectCode(createTypeInterface(can_execute_relay_response));
});
it('info_response', () => {
expectCode(createTypeInterface(info_response));
});
it('relay_transaction', () => {
expectCode(createTypeInterface(relay_transaction));
});
it('query classes', () => {

@@ -22,0 +34,0 @@ expectCode(createQueryClass('SG721QueryClient', 'SG721ReadOnlyInstance', cosmos_msg_for__empty));

4

package.json
{
"name": "wasm-ast-types",
"version": "0.3.0",
"version": "0.3.1",
"description": "CosmWasm TypeScript AST generation",

@@ -88,3 +88,3 @@ "author": "Dan Lynch <pyramation@gmail.com>",

},
"gitHead": "0e1c21c1c495002883f9511bb1dd693c468af0a6"
"gitHead": "aade6ffc08df51adc9922d4cd813fe8ef5bebfa1"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc