@cosmwasm/ts-codegen 0.21.1 → 0.22.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.
package/README.md CHANGED
@@ -150,7 +150,7 @@ The `client` plugin will generate TS client classes for your contracts. This opt
150
150
  | --------------------------------------- | --------------------------------------------------- |
151
151
  | `client.enabled` | generate TS client classes for your contracts |
152
152
  | `client.execExtendsQuery` | execute should extend query message clients |
153
- | `client.noImplicit.noImplicitOverride` | should match your tsconfig noImplicitOverride option |
153
+ | `client.noImplicitOverride` | should match your tsconfig noImplicitOverride option |
154
154
 
155
155
  #### Client via CLI
156
156
 
@@ -24,6 +24,14 @@ var cleanFor = function cleanFor(str) {
24
24
  return str;
25
25
  };
26
26
 
27
+ var cleanNullable = function cleanNullable(str) {
28
+ if (/^Nullable_/.test(str)) {
29
+ str = str.replace(/^Nullable_/, 'Nullable');
30
+ }
31
+
32
+ return str;
33
+ };
34
+
27
35
  var cleanse = function cleanse(obj) {
28
36
  var copy; // Handle the 3 simple types, and null or undefined
29
37
 
@@ -62,12 +70,14 @@ var cleanse = function cleanse(obj) {
62
70
  if (obj.hasOwnProperty(attr)) {
63
71
  if (/_for_/.test(attr)) {
64
72
  copy[cleanFor(attr)] = cleanse(obj[attr]);
73
+ } else if (/^Nullable_/.test(attr)) {
74
+ copy[cleanNullable(attr)] = cleanse(obj[attr]);
65
75
  } else {
66
76
  switch (attr) {
67
77
  case 'title':
68
78
  case '$ref':
69
79
  if (typeof obj[attr] === 'string') {
70
- copy[attr] = cleanse(cleanFor(obj[attr]));
80
+ copy[attr] = cleanse(cleanNullable(cleanFor(obj[attr])));
71
81
  } else {
72
82
  copy[attr] = cleanse(obj[attr]);
73
83
  }
@@ -13,6 +13,14 @@ const cleanFor = str => {
13
13
  return str;
14
14
  };
15
15
 
16
+ const cleanNullable = str => {
17
+ if (/^Nullable_/.test(str)) {
18
+ str = str.replace(/^Nullable_/, 'Nullable');
19
+ }
20
+
21
+ return str;
22
+ };
23
+
16
24
  export const cleanse = obj => {
17
25
  var copy; // Handle the 3 simple types, and null or undefined
18
26
 
@@ -51,12 +59,14 @@ export const cleanse = obj => {
51
59
  if (obj.hasOwnProperty(attr)) {
52
60
  if (/_for_/.test(attr)) {
53
61
  copy[cleanFor(attr)] = cleanse(obj[attr]);
62
+ } else if (/^Nullable_/.test(attr)) {
63
+ copy[cleanNullable(attr)] = cleanse(obj[attr]);
54
64
  } else {
55
65
  switch (attr) {
56
66
  case 'title':
57
67
  case '$ref':
58
68
  if (typeof obj[attr] === 'string') {
59
- copy[attr] = cleanse(cleanFor(obj[attr]));
69
+ copy[attr] = cleanse(cleanNullable(cleanFor(obj[attr])));
60
70
  } else {
61
71
  copy[attr] = cleanse(obj[attr]);
62
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmwasm/ts-codegen",
3
- "version": "0.21.1",
3
+ "version": "0.22.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",
@@ -98,5 +98,5 @@
98
98
  "shelljs": "0.8.5",
99
99
  "wasm-ast-types": "^0.15.0"
100
100
  },
101
- "gitHead": "390e1a9c503c79e2a2f5276e479a7791bd63f7a7"
101
+ "gitHead": "9135105f4362a390946d93659a750d80a39e6df0"
102
102
  }
@@ -13,6 +13,14 @@ const cleanFor = (str) => {
13
13
  return str;
14
14
  };
15
15
 
16
+ const cleanNullable = (str) => {
17
+ if (/^Nullable_/.test(str)) {
18
+ str = str.replace(/^Nullable_/, 'Nullable');
19
+ }
20
+
21
+ return str;
22
+ };
23
+
16
24
  export const cleanse = (obj) => {
17
25
  var copy;
18
26
  // Handle the 3 simple types, and null or undefined
@@ -51,12 +59,16 @@ export const cleanse = (obj) => {
51
59
 
52
60
  if (/_for_/.test(attr)) {
53
61
  copy[cleanFor(attr)] = cleanse(obj[attr]);
62
+ } else if (/^Nullable_/.test(attr)) {
63
+ copy[cleanNullable(attr)] = cleanse(obj[attr]);
54
64
  } else {
55
65
  switch (attr) {
56
66
  case 'title':
57
67
  case '$ref':
58
68
  if (typeof obj[attr] === 'string') {
59
- copy[attr] = cleanse(cleanFor(obj[attr]));
69
+ copy[attr] = cleanse(
70
+ cleanNullable(cleanFor(obj[attr]))
71
+ );
60
72
  } else {
61
73
  copy[attr] = cleanse(obj[attr]);
62
74
  }