@cosmwasm/ts-codegen 0.9.4 → 0.11.0

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.
Files changed (32) hide show
  1. package/main/commands/generate.js +44 -7
  2. package/main/generators/client.js +2 -2
  3. package/main/generators/types.js +1 -1
  4. package/module/commands/generate.js +35 -1
  5. package/module/generators/client.js +2 -2
  6. package/module/generators/types.js +1 -1
  7. package/package.json +3 -3
  8. package/types/{builder → src/builder}/builder.d.ts +0 -0
  9. package/types/{builder → src/builder}/index.d.ts +0 -0
  10. package/types/{bundler → src/bundler}/bundler.d.ts +0 -0
  11. package/types/{bundler → src/bundler}/index.d.ts +0 -0
  12. package/types/{cli.d.ts → src/cli.d.ts} +0 -0
  13. package/types/{cmds.d.ts → src/cmds.d.ts} +0 -0
  14. package/types/{commands → src/commands}/create-boilerplate.d.ts +0 -0
  15. package/types/{commands → src/commands}/generate.d.ts +0 -0
  16. package/types/{commands → src/commands}/install.d.ts +0 -0
  17. package/types/{file.d.ts → src/file.d.ts} +0 -0
  18. package/types/{generators → src/generators}/client.d.ts +2 -1
  19. package/types/{generators → src/generators}/message-composer.d.ts +1 -0
  20. package/types/{generators → src/generators}/react-query.d.ts +1 -0
  21. package/types/{generators → src/generators}/recoil.d.ts +1 -0
  22. package/types/{generators → src/generators}/types.d.ts +1 -0
  23. /package/types/{index.d.ts → src/index.d.ts} +0 -0
  24. /package/types/{ts-codegen.d.ts → src/ts-codegen.d.ts} +0 -0
  25. /package/types/{types.d.ts → src/types.d.ts} +0 -0
  26. /package/types/{utils → src/utils}/clean.d.ts +0 -0
  27. /package/types/{utils → src/utils}/cleanse.d.ts +0 -0
  28. /package/types/{utils → src/utils}/header.d.ts +0 -0
  29. /package/types/{utils → src/utils}/index.d.ts +0 -0
  30. /package/types/{utils → src/utils}/parse.d.ts +0 -0
  31. /package/types/{utils → src/utils}/prompt.d.ts +0 -0
  32. /package/types/{utils → src/utils}/schemas.d.ts +0 -0
@@ -17,7 +17,7 @@ var _index = _interopRequireDefault(require("../index"));
17
17
 
18
18
  var _default = /*#__PURE__*/function () {
19
19
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(argv) {
20
- var questions, _yield$prompt, schema, out, name, plugin, questions2, _yield$prompt2, optionalClient, version, questions3, _yield$prompt3, mutations, options;
20
+ var questions, _yield$prompt, schema, out, name, plugin, bundle, questions2, _yield$prompt2, optionalClient, version, questions3, _yield$prompt3, mutations, questions4, _yield$prompt4, bundleFile, bundleScope, options;
21
21
 
22
22
  return _regenerator["default"].wrap(function _callee$(_context) {
23
23
  while (1) {
@@ -45,6 +45,11 @@ var _default = /*#__PURE__*/function () {
45
45
  name: 'plugin',
46
46
  message: 'which plugins?',
47
47
  choices: ['client', 'recoil', 'react-query', 'message-composer']
48
+ }, {
49
+ type: 'confirm',
50
+ name: 'bundle',
51
+ message: 'enable bundle?',
52
+ "default": true
48
53
  }];
49
54
 
50
55
  if (argv.typesOnly) {
@@ -60,6 +65,7 @@ var _default = /*#__PURE__*/function () {
60
65
  out = _yield$prompt.out;
61
66
  name = _yield$prompt.name;
62
67
  plugin = _yield$prompt.plugin;
68
+ bundle = _yield$prompt.bundle;
63
69
  if (!Array.isArray(plugin)) plugin = [plugin]; ///////// REACT QUERY
64
70
 
65
71
  questions2 = [];
@@ -80,10 +86,10 @@ var _default = /*#__PURE__*/function () {
80
86
  }
81
87
 
82
88
  ;
83
- _context.next = 15;
89
+ _context.next = 16;
84
90
  return (0, _prompt.prompt)(questions2, argv);
85
91
 
86
- case 15:
92
+ case 16:
87
93
  _yield$prompt2 = _context.sent;
88
94
  optionalClient = _yield$prompt2.optionalClient;
89
95
  version = _yield$prompt2.version;
@@ -100,13 +106,39 @@ var _default = /*#__PURE__*/function () {
100
106
  }
101
107
 
102
108
  ;
103
- _context.next = 23;
109
+ _context.next = 24;
104
110
  return (0, _prompt.prompt)(questions3, argv);
105
111
 
106
- case 23:
112
+ case 24:
107
113
  _yield$prompt3 = _context.sent;
108
114
  mutations = _yield$prompt3.mutations;
109
115
  ///////// END REACT QUERY
116
+ ///////// BUNDLE
117
+ questions4 = [];
118
+
119
+ if (bundle) {
120
+ [].push.apply(questions4, [{
121
+ type: 'string',
122
+ name: 'bundleFile',
123
+ message: 'bundleFile?',
124
+ "default": 'bundle.ts'
125
+ }, {
126
+ type: 'string',
127
+ name: 'bundleScope',
128
+ message: 'bundleScope?',
129
+ "default": 'contracts'
130
+ }]);
131
+ }
132
+
133
+ ;
134
+ _context.next = 31;
135
+ return (0, _prompt.prompt)(questions4, argv);
136
+
137
+ case 31:
138
+ _yield$prompt4 = _context.sent;
139
+ bundleFile = _yield$prompt4.bundleFile;
140
+ bundleScope = _yield$prompt4.bundleScope;
141
+ ///////// END BUNDLE
110
142
  options = {
111
143
  types: {
112
144
  enabled: true
@@ -125,9 +157,14 @@ var _default = /*#__PURE__*/function () {
125
157
  },
126
158
  messageComposer: {
127
159
  enabled: plugin.includes('message-composer')
160
+ },
161
+ bundle: {
162
+ enabled: bundle,
163
+ scope: bundleScope,
164
+ bundleFile: bundleFile
128
165
  }
129
166
  };
130
- _context.next = 28;
167
+ _context.next = 37;
131
168
  return (0, _index["default"])({
132
169
  contracts: [{
133
170
  name: name,
@@ -137,7 +174,7 @@ var _default = /*#__PURE__*/function () {
137
174
  options: options
138
175
  });
139
176
 
140
- case 28:
177
+ case 37:
141
178
  case "end":
142
179
  return _context.stop();
143
180
  }
@@ -45,9 +45,9 @@ var _default = /*#__PURE__*/function () {
45
45
  switch (_context.prev = _context.next) {
46
46
  case 0:
47
47
  context = new w.RenderContext((0, _utils.getDefinitionSchema)(schemas), {
48
- tsClient: tsClientOptions !== null && tsClientOptions !== void 0 ? tsClientOptions : {}
48
+ client: tsClientOptions !== null && tsClientOptions !== void 0 ? tsClientOptions : {}
49
49
  });
50
- options = context.options.tsClient;
50
+ options = context.options.client;
51
51
  localname = (0, _case.pascal)(name) + '.client.ts';
52
52
  TypesFile = (0, _case.pascal)(name) + '.types';
53
53
  QueryMsg = (0, _utils.findQueryMsg)(schemas);
@@ -47,7 +47,7 @@ var _default = /*#__PURE__*/function () {
47
47
  switch (_context.prev = _context.next) {
48
48
  case 0:
49
49
  context = new _wasmAstTypes.RenderContext((0, _utils.getDefinitionSchema)(schemas), {
50
- tsClient: tsTypesOptions !== null && tsTypesOptions !== void 0 ? tsTypesOptions : {}
50
+ types: tsTypesOptions !== null && tsTypesOptions !== void 0 ? tsTypesOptions : {}
51
51
  });
52
52
  options = context.options.types;
53
53
  localname = (0, _case.pascal)(name) + '.types.ts';
@@ -23,6 +23,11 @@ export default (async argv => {
23
23
  name: 'plugin',
24
24
  message: 'which plugins?',
25
25
  choices: ['client', 'recoil', 'react-query', 'message-composer']
26
+ }, {
27
+ type: 'confirm',
28
+ name: 'bundle',
29
+ message: 'enable bundle?',
30
+ default: true
26
31
  }];
27
32
 
28
33
  if (argv.typesOnly) {
@@ -33,7 +38,8 @@ export default (async argv => {
33
38
  schema,
34
39
  out,
35
40
  name,
36
- plugin
41
+ plugin,
42
+ bundle
37
43
  } = await prompt(questions, argv);
38
44
  if (!Array.isArray(plugin)) plugin = [plugin]; ///////// REACT QUERY
39
45
 
@@ -75,6 +81,29 @@ export default (async argv => {
75
81
  const {
76
82
  mutations
77
83
  } = await prompt(questions3, argv); ///////// END REACT QUERY
84
+ ///////// BUNDLE
85
+
86
+ const questions4 = [];
87
+
88
+ if (bundle) {
89
+ [].push.apply(questions4, [{
90
+ type: 'string',
91
+ name: 'bundleFile',
92
+ message: 'bundleFile?',
93
+ default: 'bundle.ts'
94
+ }, {
95
+ type: 'string',
96
+ name: 'bundleScope',
97
+ message: 'bundleScope?',
98
+ default: 'contracts'
99
+ }]);
100
+ }
101
+
102
+ ;
103
+ const {
104
+ bundleFile,
105
+ bundleScope
106
+ } = await prompt(questions4, argv); ///////// END BUNDLE
78
107
 
79
108
  const options = {
80
109
  types: {
@@ -94,6 +123,11 @@ export default (async argv => {
94
123
  },
95
124
  messageComposer: {
96
125
  enabled: plugin.includes('message-composer')
126
+ },
127
+ bundle: {
128
+ enabled: bundle,
129
+ scope: bundleScope,
130
+ bundleFile
97
131
  }
98
132
  };
99
133
  await codegen({
@@ -11,9 +11,9 @@ import { findAndParseTypes, findExecuteMsg, findQueryMsg, getDefinitionSchema }
11
11
  import { RenderContext } from "wasm-ast-types";
12
12
  export default (async (name, schemas, outPath, tsClientOptions) => {
13
13
  const context = new RenderContext(getDefinitionSchema(schemas), {
14
- tsClient: tsClientOptions ?? {}
14
+ client: tsClientOptions ?? {}
15
15
  });
16
- const options = context.options.tsClient;
16
+ const options = context.options.client;
17
17
  const localname = pascal(name) + '.client.ts';
18
18
  const TypesFile = pascal(name) + '.types';
19
19
  const QueryMsg = findQueryMsg(schemas);
@@ -10,7 +10,7 @@ import { findAndParseTypes, findExecuteMsg, getDefinitionSchema } from '../utils
10
10
  import { RenderContext } from "wasm-ast-types";
11
11
  export default (async (name, schemas, outPath, tsTypesOptions) => {
12
12
  const context = new RenderContext(getDefinitionSchema(schemas), {
13
- tsClient: tsTypesOptions ?? {}
13
+ types: tsTypesOptions ?? {}
14
14
  });
15
15
  const options = context.options.types;
16
16
  const localname = pascal(name) + '.types.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmwasm/ts-codegen",
3
- "version": "0.9.4",
3
+ "version": "0.11.0",
4
4
  "description": "@cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/cosmwasm/ts-codegen",
@@ -93,7 +93,7 @@
93
93
  "parse-package-name": "1.0.0",
94
94
  "rimraf": "3.0.2",
95
95
  "shelljs": "0.8.5",
96
- "wasm-ast-types": "^0.7.2"
96
+ "wasm-ast-types": "^0.8.1"
97
97
  },
98
- "gitHead": "e6774745d0a40fc2dbfe74c5c1ef0488120d99bf"
98
+ "gitHead": "bf90bb5c40775566622f1d9cf6173900313aed8c"
99
99
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
+ import { TSClientOptions } from "wasm-ast-types";
1
2
  import { BuilderFile } from "../builder";
2
- declare const _default: (name: string, schemas: any[], outPath: string, tsClientOptions?: TsClientOptions) => Promise<BuilderFile[]>;
3
+ declare const _default: (name: string, schemas: any[], outPath: string, tsClientOptions?: TSClientOptions) => Promise<BuilderFile[]>;
3
4
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { MessageComposerOptions } from "wasm-ast-types";
1
2
  import { BuilderFile } from "../builder";
2
3
  declare const _default: (name: string, schemas: any[], outPath: string, messageComposerOptions?: MessageComposerOptions) => Promise<BuilderFile[]>;
3
4
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { ReactQueryOptions } from "wasm-ast-types";
1
2
  import { BuilderFile } from "../builder";
2
3
  declare const _default: (contractName: string, schemas: any[], outPath: string, reactQueryOptions?: ReactQueryOptions) => Promise<BuilderFile[]>;
3
4
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { RecoilOptions } from "wasm-ast-types";
1
2
  import { BuilderFile } from "../builder";
2
3
  declare const _default: (name: string, schemas: any[], outPath: string, recoilOptions?: RecoilOptions) => Promise<BuilderFile[]>;
3
4
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { TSTypesOptions } from "wasm-ast-types";
1
2
  import { BuilderFile } from "../builder";
2
3
  declare const _default: (name: string, schemas: any[], outPath: string, tsTypesOptions?: TSTypesOptions) => Promise<BuilderFile[]>;
3
4
  export default _default;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes