@polkadot/types-codec 8.3.3-6 → 8.3.3-9
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 +7 -7
- package/native/Text.d.ts +2 -2
- package/package.json +1 -1
- package/packageInfo.js +1 -1
- package/types/interfaces.d.ts +2 -0
- package/utils/sanitize.js +7 -7
package/cjs/packageInfo.js
CHANGED
package/cjs/utils/sanitize.js
CHANGED
|
@@ -73,8 +73,8 @@ function cleanupCompact() {
|
|
|
73
73
|
if (value[index] === '<') {
|
|
74
74
|
const end = findClosing(value, index + 1) - 14;
|
|
75
75
|
|
|
76
|
-
if (value.
|
|
77
|
-
value = `Compact<${value.
|
|
76
|
+
if (value.substring(end, end + 14) === ' as HasCompact') {
|
|
77
|
+
value = `Compact<${value.substring(index + 1, end)}>`;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -106,7 +106,7 @@ function replaceTagWith(value, matcher, replacer) {
|
|
|
106
106
|
|
|
107
107
|
const start = index + matcher.length;
|
|
108
108
|
const end = findClosing(value, start);
|
|
109
|
-
value = `${value.
|
|
109
|
+
value = `${value.substring(0, index)}${replacer(value.substring(start, end))}${value.substring(end + 1)}`;
|
|
110
110
|
}
|
|
111
111
|
} // remove the Bounded* or Weak* wrappers
|
|
112
112
|
|
|
@@ -134,7 +134,7 @@ function removeColons() {
|
|
|
134
134
|
index = value.indexOf('::');
|
|
135
135
|
|
|
136
136
|
if (index === 0) {
|
|
137
|
-
value = value.
|
|
137
|
+
value = value.substring(2);
|
|
138
138
|
} else if (index !== -1) {
|
|
139
139
|
if (allowNamespaces) {
|
|
140
140
|
return value;
|
|
@@ -146,7 +146,7 @@ function removeColons() {
|
|
|
146
146
|
start--;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
value = `${value.
|
|
149
|
+
value = `${value.substring(0, start + 1)}${value.substring(index + 2)}`;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -161,13 +161,13 @@ function removeGenerics() {
|
|
|
161
161
|
// check against the allowed wrappers, be it Vec<..>, Option<...> ...
|
|
162
162
|
const box = ALLOWED_BOXES.find(box => {
|
|
163
163
|
const start = index - box.length;
|
|
164
|
-
return start >= 0 && value.
|
|
164
|
+
return start >= 0 && value.substring(start, start + box.length) === box && ( // make sure it is stand-alone, i.e. don't catch ElectionResult<...> as Result<...>
|
|
165
165
|
start === 0 || BOX_PRECEDING.includes(value[start - 1]));
|
|
166
166
|
}); // we have not found anything, unwrap generic innards
|
|
167
167
|
|
|
168
168
|
if (!box) {
|
|
169
169
|
const end = findClosing(value, index + 1);
|
|
170
|
-
value = `${value.
|
|
170
|
+
value = `${value.substring(0, index)}${value.substring(end + 1)}`;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
package/native/Text.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyU8a,
|
|
2
|
+
import type { AnyU8a, Inspect, IText, IU8a, Registry } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @name Text
|
|
5
5
|
* @description
|
|
@@ -8,7 +8,7 @@ import type { AnyU8a, Codec, Inspect, IU8a, Registry } from '../types';
|
|
|
8
8
|
* object, inheriting all methods exposed from `String`.
|
|
9
9
|
* @noInheritDoc
|
|
10
10
|
*/
|
|
11
|
-
export declare class Text extends String implements
|
|
11
|
+
export declare class Text extends String implements IText {
|
|
12
12
|
#private;
|
|
13
13
|
readonly registry: Registry;
|
|
14
14
|
createdAtHash?: IU8a;
|
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.3.3-
|
|
8
|
+
version: '8.3.3-9'
|
|
9
9
|
};
|
package/types/interfaces.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface IStruct<K = string, V extends Codec = Codec> extends Map<K, V>,
|
|
|
47
47
|
getAtIndex(index: number): Codec;
|
|
48
48
|
toArray(): Codec[];
|
|
49
49
|
}
|
|
50
|
+
export interface IText extends String, Codec {
|
|
51
|
+
}
|
|
50
52
|
export declare type ITuple<T extends AnyTuple = Codec[]> = T & Codec;
|
|
51
53
|
export interface IU8a extends Uint8Array, Codec {
|
|
52
54
|
readonly isAscii: boolean;
|
package/utils/sanitize.js
CHANGED
|
@@ -54,8 +54,8 @@ export function cleanupCompact() {
|
|
|
54
54
|
if (value[index] === '<') {
|
|
55
55
|
const end = findClosing(value, index + 1) - 14;
|
|
56
56
|
|
|
57
|
-
if (value.
|
|
58
|
-
value = `Compact<${value.
|
|
57
|
+
if (value.substring(end, end + 14) === ' as HasCompact') {
|
|
58
|
+
value = `Compact<${value.substring(index + 1, end)}>`;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -86,7 +86,7 @@ function replaceTagWith(value, matcher, replacer) {
|
|
|
86
86
|
|
|
87
87
|
const start = index + matcher.length;
|
|
88
88
|
const end = findClosing(value, start);
|
|
89
|
-
value = `${value.
|
|
89
|
+
value = `${value.substring(0, index)}${replacer(value.substring(start, end))}${value.substring(end + 1)}`;
|
|
90
90
|
}
|
|
91
91
|
} // remove the Bounded* or Weak* wrappers
|
|
92
92
|
|
|
@@ -112,7 +112,7 @@ export function removeColons() {
|
|
|
112
112
|
index = value.indexOf('::');
|
|
113
113
|
|
|
114
114
|
if (index === 0) {
|
|
115
|
-
value = value.
|
|
115
|
+
value = value.substring(2);
|
|
116
116
|
} else if (index !== -1) {
|
|
117
117
|
if (allowNamespaces) {
|
|
118
118
|
return value;
|
|
@@ -124,7 +124,7 @@ export function removeColons() {
|
|
|
124
124
|
start--;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
value = `${value.
|
|
127
|
+
value = `${value.substring(0, start + 1)}${value.substring(index + 2)}`;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -138,13 +138,13 @@ export function removeGenerics() {
|
|
|
138
138
|
// check against the allowed wrappers, be it Vec<..>, Option<...> ...
|
|
139
139
|
const box = ALLOWED_BOXES.find(box => {
|
|
140
140
|
const start = index - box.length;
|
|
141
|
-
return start >= 0 && value.
|
|
141
|
+
return start >= 0 && value.substring(start, start + box.length) === box && ( // make sure it is stand-alone, i.e. don't catch ElectionResult<...> as Result<...>
|
|
142
142
|
start === 0 || BOX_PRECEDING.includes(value[start - 1]));
|
|
143
143
|
}); // we have not found anything, unwrap generic innards
|
|
144
144
|
|
|
145
145
|
if (!box) {
|
|
146
146
|
const end = findClosing(value, index + 1);
|
|
147
|
-
value = `${value.
|
|
147
|
+
value = `${value.substring(0, index)}${value.substring(end + 1)}`;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|