@polkadot/types-codec 8.8.2-1 → 8.8.2-2
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/cjs/packageInfo.js +1 -1
- package/cjs/utils/sanitize.js +35 -18
- package/package.json +1 -1
- package/packageInfo.js +1 -1
- package/utils/sanitize.js +35 -18
package/cjs/packageInfo.js
CHANGED
package/cjs/utils/sanitize.js
CHANGED
|
@@ -76,12 +76,14 @@ function alias(src, dest) {
|
|
|
76
76
|
|
|
77
77
|
function cleanupCompact() {
|
|
78
78
|
return value => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
if (value.includes(' as HasCompact')) {
|
|
80
|
+
for (let index = 0; index < value.length; index++) {
|
|
81
|
+
if (value[index] === '<') {
|
|
82
|
+
const end = findClosing(value, index + 1) - 14;
|
|
83
|
+
|
|
84
|
+
if (value.substring(end, end + 14) === ' as HasCompact') {
|
|
85
|
+
value = `Compact<${value.substring(index + 1, end)}>`;
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
}
|
|
@@ -119,15 +121,22 @@ function replaceTagWith(value, matcher, replacer) {
|
|
|
119
121
|
|
|
120
122
|
|
|
121
123
|
function removeExtensions(type, isSized) {
|
|
122
|
-
return value =>
|
|
123
|
-
|
|
124
|
+
return value => {
|
|
125
|
+
for (let i = 0; i < BOUNDED.length; i++) {
|
|
126
|
+
const tag = BOUNDED[i];
|
|
127
|
+
value = replaceTagWith(value, `${type}${tag}<`, v => {
|
|
128
|
+
const parts = v.split(',').map(s => s.trim()).filter(s => s);
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
if (isSized) {
|
|
131
|
+
parts.pop();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return `${tag}<${parts.join(',')}>`;
|
|
135
|
+
});
|
|
127
136
|
}
|
|
128
137
|
|
|
129
|
-
return
|
|
130
|
-
}
|
|
138
|
+
return value;
|
|
139
|
+
};
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
function removeColons() {
|
|
@@ -181,13 +190,17 @@ function removeGenerics() {
|
|
|
181
190
|
|
|
182
191
|
return value;
|
|
183
192
|
};
|
|
193
|
+
}
|
|
194
|
+
/** @internal */
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
function pairOfReplacer(v) {
|
|
198
|
+
return `(${v},${v})`;
|
|
184
199
|
} // remove the PairOf wrappers
|
|
185
200
|
|
|
186
201
|
|
|
187
202
|
function removePairOf() {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return value => replaceTagWith(value, 'PairOf<', replacer);
|
|
203
|
+
return value => replaceTagWith(value, 'PairOf<', pairOfReplacer);
|
|
191
204
|
} // remove the type traits
|
|
192
205
|
|
|
193
206
|
|
|
@@ -213,13 +226,17 @@ function removeTraits() {
|
|
|
213
226
|
.replace(from5, 'Lookup') // replace `<...>::Type`
|
|
214
227
|
.replace(from6, '');
|
|
215
228
|
};
|
|
229
|
+
}
|
|
230
|
+
/** @internal */
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
function wrapReplacer(v) {
|
|
234
|
+
return v;
|
|
216
235
|
} // remove wrapping values, i.e. Box<Proposal> -> Proposal
|
|
217
236
|
|
|
218
237
|
|
|
219
238
|
function removeWrap(check) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return value => replaceTagWith(value, check, replacer);
|
|
239
|
+
return value => replaceTagWith(value, check, wrapReplacer);
|
|
223
240
|
}
|
|
224
241
|
|
|
225
242
|
const sanitizeMap = new Map(); // eslint-disable-next-line @typescript-eslint/ban-types
|
package/package.json
CHANGED
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/types-codec',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '8.8.2-
|
|
8
|
+
version: '8.8.2-2'
|
|
9
9
|
};
|
package/utils/sanitize.js
CHANGED
|
@@ -55,12 +55,14 @@ export function alias(src, dest, withChecks = true) {
|
|
|
55
55
|
}
|
|
56
56
|
export function cleanupCompact() {
|
|
57
57
|
return value => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
if (value.includes(' as HasCompact')) {
|
|
59
|
+
for (let index = 0; index < value.length; index++) {
|
|
60
|
+
if (value[index] === '<') {
|
|
61
|
+
const end = findClosing(value, index + 1) - 14;
|
|
62
|
+
|
|
63
|
+
if (value.substring(end, end + 14) === ' as HasCompact') {
|
|
64
|
+
value = `Compact<${value.substring(index + 1, end)}>`;
|
|
65
|
+
}
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -97,15 +99,22 @@ function replaceTagWith(value, matcher, replacer) {
|
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
export function removeExtensions(type, isSized) {
|
|
100
|
-
return value =>
|
|
101
|
-
|
|
102
|
+
return value => {
|
|
103
|
+
for (let i = 0; i < BOUNDED.length; i++) {
|
|
104
|
+
const tag = BOUNDED[i];
|
|
105
|
+
value = replaceTagWith(value, `${type}${tag}<`, v => {
|
|
106
|
+
const parts = v.split(',').map(s => s.trim()).filter(s => s);
|
|
102
107
|
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
if (isSized) {
|
|
109
|
+
parts.pop();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return `${tag}<${parts.join(',')}>`;
|
|
113
|
+
});
|
|
105
114
|
}
|
|
106
115
|
|
|
107
|
-
return
|
|
108
|
-
}
|
|
116
|
+
return value;
|
|
117
|
+
};
|
|
109
118
|
}
|
|
110
119
|
export function removeColons() {
|
|
111
120
|
return (value, {
|
|
@@ -156,12 +165,16 @@ export function removeGenerics() {
|
|
|
156
165
|
|
|
157
166
|
return value;
|
|
158
167
|
};
|
|
168
|
+
}
|
|
169
|
+
/** @internal */
|
|
170
|
+
|
|
171
|
+
function pairOfReplacer(v) {
|
|
172
|
+
return `(${v},${v})`;
|
|
159
173
|
} // remove the PairOf wrappers
|
|
160
174
|
|
|
161
|
-
export function removePairOf() {
|
|
162
|
-
const replacer = inner => `(${inner},${inner})`;
|
|
163
175
|
|
|
164
|
-
|
|
176
|
+
export function removePairOf() {
|
|
177
|
+
return value => replaceTagWith(value, 'PairOf<', pairOfReplacer);
|
|
165
178
|
} // remove the type traits
|
|
166
179
|
|
|
167
180
|
export function removeTraits() {
|
|
@@ -186,12 +199,16 @@ export function removeTraits() {
|
|
|
186
199
|
.replace(from5, 'Lookup') // replace `<...>::Type`
|
|
187
200
|
.replace(from6, '');
|
|
188
201
|
};
|
|
202
|
+
}
|
|
203
|
+
/** @internal */
|
|
204
|
+
|
|
205
|
+
function wrapReplacer(v) {
|
|
206
|
+
return v;
|
|
189
207
|
} // remove wrapping values, i.e. Box<Proposal> -> Proposal
|
|
190
208
|
|
|
191
|
-
export function removeWrap(check) {
|
|
192
|
-
const replacer = inner => inner;
|
|
193
209
|
|
|
194
|
-
|
|
210
|
+
export function removeWrap(check) {
|
|
211
|
+
return value => replaceTagWith(value, check, wrapReplacer);
|
|
195
212
|
}
|
|
196
213
|
const sanitizeMap = new Map(); // eslint-disable-next-line @typescript-eslint/ban-types
|
|
197
214
|
|