wasm-ast-types 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main/wasm.js +3 -2
- package/module/wasm.js +3 -3
- package/package.json +2 -2
package/main/wasm.js
CHANGED
@@ -244,6 +244,7 @@ exports.createExecuteInterface = createExecuteInterface;
|
|
244
244
|
var createTypedObjectParams = function createTypedObjectParams(jsonschema) {
|
245
245
|
var _jsonschema$propertie3;
|
246
246
|
|
247
|
+
var camelize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
247
248
|
var keys = Object.keys((_jsonschema$propertie3 = jsonschema.properties) !== null && _jsonschema$propertie3 !== void 0 ? _jsonschema$propertie3 : {});
|
248
249
|
if (!keys.length) return;
|
249
250
|
var typedParams = keys.map(function (prop) {
|
@@ -251,10 +252,10 @@ var createTypedObjectParams = function createTypedObjectParams(jsonschema) {
|
|
251
252
|
type = _getPropertyType2.type,
|
252
253
|
optional = _getPropertyType2.optional;
|
253
254
|
|
254
|
-
return t.tsPropertySignature(t.identifier(prop), t.tsTypeAnnotation(type));
|
255
|
+
return t.tsPropertySignature(camelize ? t.identifier((0, _case.camel)(prop)) : t.identifier(prop), t.tsTypeAnnotation(type));
|
255
256
|
});
|
256
257
|
var params = keys.map(function (prop) {
|
257
|
-
return t.objectProperty(t.identifier(prop), t.identifier(prop), false, true);
|
258
|
+
return t.objectProperty(camelize ? t.identifier((0, _case.camel)(prop)) : t.identifier(prop), camelize ? t.identifier((0, _case.camel)(prop)) : t.identifier(prop), false, true);
|
258
259
|
});
|
259
260
|
var obj = t.objectPattern((0, _toConsumableArray2["default"])(params));
|
260
261
|
obj.typeAnnotation = t.tsTypeAnnotation(t.tsTypeLiteral((0, _toConsumableArray2["default"])(typedParams)));
|
package/module/wasm.js
CHANGED
@@ -187,7 +187,7 @@ export const createExecuteInterface = (className, extendsClassName, execMsg) =>
|
|
187
187
|
t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())), // contract address
|
188
188
|
t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods])));
|
189
189
|
};
|
190
|
-
export const createTypedObjectParams = jsonschema => {
|
190
|
+
export const createTypedObjectParams = (jsonschema, camelize = true) => {
|
191
191
|
const keys = Object.keys(jsonschema.properties ?? {});
|
192
192
|
if (!keys.length) return;
|
193
193
|
const typedParams = keys.map(prop => {
|
@@ -195,10 +195,10 @@ export const createTypedObjectParams = jsonschema => {
|
|
195
195
|
type,
|
196
196
|
optional
|
197
197
|
} = getPropertyType(jsonschema, prop);
|
198
|
-
return t.tsPropertySignature(t.identifier(prop), t.tsTypeAnnotation(type));
|
198
|
+
return t.tsPropertySignature(camelize ? t.identifier(camel(prop)) : t.identifier(prop), t.tsTypeAnnotation(type));
|
199
199
|
});
|
200
200
|
const params = keys.map(prop => {
|
201
|
-
return t.objectProperty(t.identifier(prop), t.identifier(prop), false, true);
|
201
|
+
return t.objectProperty(camelize ? t.identifier(camel(prop)) : t.identifier(prop), camelize ? t.identifier(camel(prop)) : t.identifier(prop), false, true);
|
202
202
|
});
|
203
203
|
const obj = t.objectPattern([...params]);
|
204
204
|
obj.typeAnnotation = t.tsTypeAnnotation(t.tsTypeLiteral([...typedParams]));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wasm-ast-types",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.10",
|
4
4
|
"description": "CosmWasm TypeScript AST generation",
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
6
|
"homepage": "https://github.com/pyramation/cosmwasm-typescript-gen/tree/master/packages/wasm-ast-types#readme",
|
@@ -85,5 +85,5 @@
|
|
85
85
|
"ast-stringify": "0.1.0",
|
86
86
|
"case": "1.6.3"
|
87
87
|
},
|
88
|
-
"gitHead": "
|
88
|
+
"gitHead": "c68977bec42dfc57a0272965fba25660ebc04498"
|
89
89
|
}
|