@pezkuwi/types-create 16.5.8 → 16.5.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/cjs/packageInfo.js +1 -1
- package/package.json +6 -5
- package/packageInfo.js +1 -1
- package/build/LICENSE +0 -201
- package/build/README.md +0 -3
- package/build/bundle.d.ts +0 -3
- package/build/bundle.js +0 -3
- package/build/cjs/bundle.d.ts +0 -3
- package/build/cjs/bundle.js +0 -9
- package/build/cjs/create/class.d.ts +0 -5
- package/build/cjs/create/class.js +0 -165
- package/build/cjs/create/index.d.ts +0 -2
- package/build/cjs/create/index.js +0 -5
- package/build/cjs/create/type.d.ts +0 -3
- package/build/cjs/create/type.js +0 -66
- package/build/cjs/exports.d.ts +0 -2
- package/build/cjs/exports.js +0 -5
- package/build/cjs/index.d.ts +0 -2
- package/build/cjs/index.js +0 -5
- package/build/cjs/package.json +0 -3
- package/build/cjs/packageDetect.d.ts +0 -1
- package/build/cjs/packageDetect.js +0 -6
- package/build/cjs/packageInfo.d.ts +0 -6
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/types/augmentRegistry.d.ts +0 -11
- package/build/cjs/types/augmentRegistry.js +0 -3
- package/build/cjs/types/index.d.ts +0 -4
- package/build/cjs/types/index.js +0 -6
- package/build/cjs/types/lookup.d.ts +0 -14
- package/build/cjs/types/lookup.js +0 -2
- package/build/cjs/types/types.d.ts +0 -43
- package/build/cjs/types/types.js +0 -29
- package/build/cjs/util/encodeTypes.d.ts +0 -11
- package/build/cjs/util/encodeTypes.js +0 -128
- package/build/cjs/util/getTypeDef.d.ts +0 -8
- package/build/cjs/util/getTypeDef.js +0 -195
- package/build/cjs/util/index.d.ts +0 -4
- package/build/cjs/util/index.js +0 -7
- package/build/cjs/util/typeSplit.d.ts +0 -1
- package/build/cjs/util/typeSplit.js +0 -60
- package/build/cjs/util/xcm.d.ts +0 -2
- package/build/cjs/util/xcm.js +0 -9
- package/build/create/class.d.ts +0 -5
- package/build/create/class.js +0 -160
- package/build/create/index.d.ts +0 -2
- package/build/create/index.js +0 -2
- package/build/create/type.d.ts +0 -3
- package/build/create/type.js +0 -63
- package/build/exports.d.ts +0 -2
- package/build/exports.js +0 -2
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -2
- package/build/package.json +0 -290
- package/build/packageDetect.d.ts +0 -1
- package/build/packageDetect.js +0 -4
- package/build/packageInfo.d.ts +0 -6
- package/build/packageInfo.js +0 -1
- package/build/types/augmentRegistry.d.ts +0 -11
- package/build/types/augmentRegistry.js +0 -1
- package/build/types/index.d.ts +0 -4
- package/build/types/index.js +0 -3
- package/build/types/lookup.d.ts +0 -14
- package/build/types/lookup.js +0 -1
- package/build/types/types.d.ts +0 -43
- package/build/types/types.js +0 -26
- package/build/util/encodeTypes.d.ts +0 -11
- package/build/util/encodeTypes.js +0 -123
- package/build/util/getTypeDef.d.ts +0 -8
- package/build/util/getTypeDef.js +0 -192
- package/build/util/index.d.ts +0 -4
- package/build/util/index.js +0 -4
- package/build/util/typeSplit.d.ts +0 -1
- package/build/util/typeSplit.js +0 -57
- package/build/util/xcm.d.ts +0 -2
- package/build/util/xcm.js +0 -5
- package/build-deno/README.md +0 -3
- package/build-deno/bundle.ts +0 -5
- package/build-deno/create/class.ts +0 -252
- package/build-deno/create/index.ts +0 -3
- package/build-deno/create/type.ts +0 -85
- package/build-deno/exports.ts +0 -3
- package/build-deno/index.ts +0 -4
- package/build-deno/mod.ts +0 -2
- package/build-deno/packageDetect.ts +0 -8
- package/build-deno/packageInfo.ts +0 -3
- package/build-deno/types/augmentRegistry.ts +0 -15
- package/build-deno/types/index.ts +0 -7
- package/build-deno/types/lookup.ts +0 -16
- package/build-deno/types/types.ts +0 -45
- package/build-deno/util/encodeTypes.ts +0 -201
- package/build-deno/util/getTypeDef.ts +0 -267
- package/build-deno/util/index.ts +0 -5
- package/build-deno/util/typeSplit.ts +0 -53
- package/build-deno/util/xcm.ts +0 -10
- package/build-tsc/bundle.d.ts +0 -3
- package/build-tsc/create/class.d.ts +0 -5
- package/build-tsc/create/index.d.ts +0 -2
- package/build-tsc/create/type.d.ts +0 -3
- package/build-tsc/exports.d.ts +0 -2
- package/build-tsc/index.d.ts +0 -2
- package/build-tsc/packageDetect.d.ts +0 -1
- package/build-tsc/packageInfo.d.ts +0 -6
- package/build-tsc/types/augmentRegistry.d.ts +0 -11
- package/build-tsc/types/index.d.ts +0 -4
- package/build-tsc/types/lookup.d.ts +0 -14
- package/build-tsc/types/types.d.ts +0 -43
- package/build-tsc/util/encodeTypes.d.ts +0 -11
- package/build-tsc/util/getTypeDef.d.ts +0 -8
- package/build-tsc/util/index.d.ts +0 -4
- package/build-tsc/util/typeSplit.d.ts +0 -1
- package/build-tsc/util/xcm.d.ts +0 -2
- package/build-tsc-cjs/bundle.js +0 -9
- package/build-tsc-cjs/create/class.js +0 -165
- package/build-tsc-cjs/create/index.js +0 -5
- package/build-tsc-cjs/create/type.js +0 -66
- package/build-tsc-cjs/exports.js +0 -5
- package/build-tsc-cjs/index.js +0 -5
- package/build-tsc-cjs/packageDetect.js +0 -6
- package/build-tsc-cjs/packageInfo.js +0 -4
- package/build-tsc-cjs/types/augmentRegistry.js +0 -3
- package/build-tsc-cjs/types/index.js +0 -6
- package/build-tsc-cjs/types/lookup.js +0 -2
- package/build-tsc-cjs/types/types.js +0 -29
- package/build-tsc-cjs/util/encodeTypes.js +0 -128
- package/build-tsc-cjs/util/getTypeDef.js +0 -195
- package/build-tsc-cjs/util/index.js +0 -7
- package/build-tsc-cjs/util/typeSplit.js +0 -60
- package/build-tsc-cjs/util/xcm.js +0 -9
- package/build-tsc-esm/bundle.js +0 -3
- package/build-tsc-esm/create/class.js +0 -160
- package/build-tsc-esm/create/index.js +0 -2
- package/build-tsc-esm/create/type.js +0 -63
- package/build-tsc-esm/exports.js +0 -2
- package/build-tsc-esm/index.js +0 -2
- package/build-tsc-esm/packageDetect.js +0 -4
- package/build-tsc-esm/packageInfo.js +0 -1
- package/build-tsc-esm/types/augmentRegistry.js +0 -1
- package/build-tsc-esm/types/index.js +0 -3
- package/build-tsc-esm/types/lookup.js +0 -1
- package/build-tsc-esm/types/types.js +0 -26
- package/build-tsc-esm/util/encodeTypes.js +0 -123
- package/build-tsc-esm/util/getTypeDef.js +0 -192
- package/build-tsc-esm/util/index.js +0 -4
- package/build-tsc-esm/util/typeSplit.js +0 -57
- package/build-tsc-esm/util/xcm.js +0 -5
- package/src/bundle.ts +0 -9
- package/src/create/class.ts +0 -257
- package/src/create/index.ts +0 -5
- package/src/create/type.ts +0 -94
- package/src/exports.ts +0 -6
- package/src/index.ts +0 -6
- package/src/mod.ts +0 -4
- package/src/packageDetect.ts +0 -12
- package/src/packageInfo.ts +0 -6
- package/src/types/augmentRegistry.ts +0 -19
- package/src/types/index.ts +0 -11
- package/src/types/lookup.ts +0 -21
- package/src/types/types.ts +0 -47
- package/src/util/encodeTypes.spec.ts +0 -217
- package/src/util/encodeTypes.ts +0 -205
- package/src/util/getTypeDef.spec.ts +0 -704
- package/src/util/getTypeDef.ts +0 -279
- package/src/util/index.ts +0 -7
- package/src/util/typeSplit.spec.ts +0 -50
- package/src/util/typeSplit.ts +0 -56
- package/src/util/xcm.ts +0 -12
- package/tsconfig.build.json +0 -15
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.spec.json +0 -17
- package/tsconfig.spec.tsbuildinfo +0 -1
package/build/create/class.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@pezkuwi/types-codec';
|
|
2
|
-
import { isNumber, stringify } from '@pezkuwi/util';
|
|
3
|
-
import { TypeDefInfo } from '../types/index.js';
|
|
4
|
-
import { getTypeDef } from '../util/getTypeDef.js';
|
|
5
|
-
function getTypeDefType({ lookupName, type }) {
|
|
6
|
-
return lookupName || type;
|
|
7
|
-
}
|
|
8
|
-
function getSubDefArray(value) {
|
|
9
|
-
if (!Array.isArray(value.sub)) {
|
|
10
|
-
throw new Error(`Expected subtype as TypeDef[] in ${stringify(value)}`);
|
|
11
|
-
}
|
|
12
|
-
return value.sub;
|
|
13
|
-
}
|
|
14
|
-
function getSubDef(value) {
|
|
15
|
-
if (!value.sub || Array.isArray(value.sub)) {
|
|
16
|
-
throw new Error(`Expected subtype as TypeDef in ${stringify(value)}`);
|
|
17
|
-
}
|
|
18
|
-
return value.sub;
|
|
19
|
-
}
|
|
20
|
-
function getSubType(value) {
|
|
21
|
-
return getTypeDefType(getSubDef(value));
|
|
22
|
-
}
|
|
23
|
-
function getTypeClassMap(value) {
|
|
24
|
-
const subs = getSubDefArray(value);
|
|
25
|
-
const map = {};
|
|
26
|
-
for (let i = 0, count = subs.length; i < count; i++) {
|
|
27
|
-
const sub = subs[i];
|
|
28
|
-
if (!sub.name) {
|
|
29
|
-
throw new Error(`No name found in definition ${stringify(sub)}`);
|
|
30
|
-
}
|
|
31
|
-
map[sub.name] = getTypeDefType(sub);
|
|
32
|
-
}
|
|
33
|
-
return map;
|
|
34
|
-
}
|
|
35
|
-
function getTypeClassArray(value) {
|
|
36
|
-
return getSubDefArray(value).map(getTypeDefType);
|
|
37
|
-
}
|
|
38
|
-
function createInt(Clazz, { displayName, length }) {
|
|
39
|
-
if (!isNumber(length)) {
|
|
40
|
-
throw new Error(`Expected bitLength information for ${displayName || Clazz.constructor.name}<bitLength>`);
|
|
41
|
-
}
|
|
42
|
-
return Clazz.with(length, displayName);
|
|
43
|
-
}
|
|
44
|
-
function createHashMap(Clazz, value) {
|
|
45
|
-
const [keyType, valueType] = getTypeClassArray(value);
|
|
46
|
-
return Clazz.with(keyType, valueType);
|
|
47
|
-
}
|
|
48
|
-
function createWithSub(Clazz, value) {
|
|
49
|
-
return Clazz.with(getSubType(value));
|
|
50
|
-
}
|
|
51
|
-
const infoMapping = {
|
|
52
|
-
[TypeDefInfo.BTreeMap]: (_registry, value) => createHashMap(BTreeMap, value),
|
|
53
|
-
[TypeDefInfo.BTreeSet]: (_registry, value) => createWithSub(BTreeSet, value),
|
|
54
|
-
[TypeDefInfo.Compact]: (_registry, value) => createWithSub(Compact, value),
|
|
55
|
-
[TypeDefInfo.DoNotConstruct]: (_registry, value) => DoNotConstruct.with(value.displayName || value.type),
|
|
56
|
-
[TypeDefInfo.Enum]: (_registry, value) => {
|
|
57
|
-
const subs = getSubDefArray(value);
|
|
58
|
-
return Enum.with(subs.every(({ type }) => type === 'Null')
|
|
59
|
-
? subs.reduce((out, { index, name }, count) => {
|
|
60
|
-
if (!name) {
|
|
61
|
-
throw new Error('No name found in sub definition');
|
|
62
|
-
}
|
|
63
|
-
out[name] = index || count;
|
|
64
|
-
return out;
|
|
65
|
-
}, {})
|
|
66
|
-
: getTypeClassMap(value));
|
|
67
|
-
},
|
|
68
|
-
[TypeDefInfo.HashMap]: (_registry, value) => createHashMap(HashMap, value),
|
|
69
|
-
[TypeDefInfo.Int]: (_registry, value) => createInt(Int, value),
|
|
70
|
-
// We have circular deps between Linkage & Struct
|
|
71
|
-
[TypeDefInfo.Linkage]: (_registry, value) => {
|
|
72
|
-
const type = `Option<${getSubType(value)}>`;
|
|
73
|
-
// eslint-disable-next-line sort-keys
|
|
74
|
-
const Clazz = Struct.with({ previous: type, next: type });
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
76
|
-
Clazz.prototype.toRawType = function () {
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
|
|
78
|
-
return `Linkage<${this.next.toRawType(true)}>`;
|
|
79
|
-
};
|
|
80
|
-
return Clazz;
|
|
81
|
-
},
|
|
82
|
-
[TypeDefInfo.Null]: (_registry, _value) => Null,
|
|
83
|
-
[TypeDefInfo.Option]: (_registry, value) => {
|
|
84
|
-
if (!value.sub || Array.isArray(value.sub)) {
|
|
85
|
-
throw new Error('Expected type information for Option');
|
|
86
|
-
}
|
|
87
|
-
// NOTE This is opt-in (unhandled), not by default
|
|
88
|
-
// if (value.sub.type === 'bool') {
|
|
89
|
-
// return OptionBool;
|
|
90
|
-
// }
|
|
91
|
-
return createWithSub(Option, value);
|
|
92
|
-
},
|
|
93
|
-
[TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type),
|
|
94
|
-
[TypeDefInfo.Range]: (_registry, value) => createWithSub(Range, value),
|
|
95
|
-
[TypeDefInfo.RangeInclusive]: (_registry, value) => createWithSub(RangeInclusive, value),
|
|
96
|
-
[TypeDefInfo.Result]: (_registry, value) => {
|
|
97
|
-
const [Ok, Err] = getTypeClassArray(value);
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
99
|
-
return Result.with({ Err, Ok });
|
|
100
|
-
},
|
|
101
|
-
[TypeDefInfo.Set]: (_registry, value) => CodecSet.with(getSubDefArray(value).reduce((result, { index, name }) => {
|
|
102
|
-
if (!name || !isNumber(index)) {
|
|
103
|
-
throw new Error('No name found in sub definition');
|
|
104
|
-
}
|
|
105
|
-
result[name] = index;
|
|
106
|
-
return result;
|
|
107
|
-
}, {}), value.length),
|
|
108
|
-
[TypeDefInfo.Si]: (registry, value) => getTypeClass(registry, registry.lookup.getTypeDef(value.type)),
|
|
109
|
-
[TypeDefInfo.Struct]: (_registry, value) => Struct.with(getTypeClassMap(value), value.alias),
|
|
110
|
-
[TypeDefInfo.Tuple]: (_registry, value) => Tuple.with(getTypeClassArray(value)),
|
|
111
|
-
[TypeDefInfo.UInt]: (_registry, value) => createInt(UInt, value),
|
|
112
|
-
[TypeDefInfo.Vec]: (_registry, { sub }) => {
|
|
113
|
-
if (!sub || Array.isArray(sub)) {
|
|
114
|
-
throw new Error('Expected type information for vector');
|
|
115
|
-
}
|
|
116
|
-
return (sub.type === 'u8'
|
|
117
|
-
? Bytes
|
|
118
|
-
: Vec.with(getTypeDefType(sub)));
|
|
119
|
-
},
|
|
120
|
-
[TypeDefInfo.VecFixed]: (_registry, { displayName, length, sub }) => {
|
|
121
|
-
if (!isNumber(length) || !sub || Array.isArray(sub)) {
|
|
122
|
-
throw new Error('Expected length & type information for fixed vector');
|
|
123
|
-
}
|
|
124
|
-
return (sub.type === 'u8'
|
|
125
|
-
? U8aFixed.with((length * 8), displayName)
|
|
126
|
-
: VecFixed.with(getTypeDefType(sub), length));
|
|
127
|
-
},
|
|
128
|
-
[TypeDefInfo.WrapperKeepOpaque]: (_registry, value) => createWithSub(WrapperKeepOpaque, value),
|
|
129
|
-
[TypeDefInfo.WrapperOpaque]: (_registry, value) => createWithSub(WrapperOpaque, value)
|
|
130
|
-
};
|
|
131
|
-
export function constructTypeClass(registry, typeDef) {
|
|
132
|
-
try {
|
|
133
|
-
const Type = infoMapping[typeDef.info](registry, typeDef);
|
|
134
|
-
if (!Type) {
|
|
135
|
-
throw new Error('No class created');
|
|
136
|
-
}
|
|
137
|
-
// don't clobber any existing
|
|
138
|
-
if (!Type.__fallbackType && typeDef.fallbackType) {
|
|
139
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
140
|
-
// @ts-ignore ...this is the only place we we actually assign this...
|
|
141
|
-
Type.__fallbackType = typeDef.fallbackType;
|
|
142
|
-
}
|
|
143
|
-
return Type;
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
throw new Error(`Unable to construct class from ${stringify(typeDef)}: ${error.message}`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
export function getTypeClass(registry, typeDef) {
|
|
150
|
-
return registry.getUnsafe(typeDef.type, false, typeDef);
|
|
151
|
-
}
|
|
152
|
-
export function createClassUnsafe(registry, type) {
|
|
153
|
-
return (
|
|
154
|
-
// just retrieve via name, no creation via typeDef
|
|
155
|
-
registry.getUnsafe(type) ||
|
|
156
|
-
// we don't have an existing type, create the class via typeDef
|
|
157
|
-
getTypeClass(registry, registry.isLookupType(type)
|
|
158
|
-
? registry.lookup.getTypeDef(type)
|
|
159
|
-
: getTypeDef(type)));
|
|
160
|
-
}
|
package/build/create/index.d.ts
DELETED
package/build/create/index.js
DELETED
package/build/create/type.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Codec, Registry } from '@pezkuwi/types-codec/types';
|
|
2
|
-
import type { CreateOptions } from '../types/index.js';
|
|
3
|
-
export declare function createTypeUnsafe<T extends Codec = Codec, K extends string = string>(registry: Registry, type: K, params?: unknown[], options?: CreateOptions): T;
|
package/build/create/type.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Option } from '@pezkuwi/types-codec';
|
|
2
|
-
import { isHex, isU8a, u8aEq, u8aToHex, u8aToU8a } from '@pezkuwi/util';
|
|
3
|
-
import { createClassUnsafe } from './class.js';
|
|
4
|
-
function checkInstance(created, matcher) {
|
|
5
|
-
const u8a = created.toU8a();
|
|
6
|
-
const rawType = created.toRawType();
|
|
7
|
-
const isOk = (
|
|
8
|
-
// full match, all ok
|
|
9
|
-
u8aEq(u8a, matcher) ||
|
|
10
|
-
(
|
|
11
|
-
// on a length-prefixed type, just check the actual length
|
|
12
|
-
['Bytes', 'Text', 'Type'].includes(rawType) &&
|
|
13
|
-
matcher.length === created.length) ||
|
|
14
|
-
(
|
|
15
|
-
// when the created is empty and matcher is also empty, let it slide...
|
|
16
|
-
created.isEmpty &&
|
|
17
|
-
matcher.every((v) => !v)));
|
|
18
|
-
if (!isOk) {
|
|
19
|
-
throw new Error(`${rawType}:: Decoded input doesn't match input, received ${u8aToHex(matcher, 512)} (${matcher.length} bytes), created ${u8aToHex(u8a, 512)} (${u8a.length} bytes)`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function checkPedantic(created, [value]) {
|
|
23
|
-
if (isU8a(value)) {
|
|
24
|
-
checkInstance(created, value);
|
|
25
|
-
}
|
|
26
|
-
else if (isHex(value)) {
|
|
27
|
-
checkInstance(created, u8aToU8a(value));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function initType(registry, Type, params = [], { blockHash, isFallback, isOptional, isPedantic } = {}) {
|
|
31
|
-
const created = new (isOptional
|
|
32
|
-
? Option.with(Type)
|
|
33
|
-
: Type)(registry, ...params);
|
|
34
|
-
isPedantic && checkPedantic(created, params);
|
|
35
|
-
if (blockHash) {
|
|
36
|
-
created.createdAtHash = createTypeUnsafe(registry, 'BlockHash', [blockHash]);
|
|
37
|
-
}
|
|
38
|
-
if (isFallback) {
|
|
39
|
-
created.isStorageFallback = true;
|
|
40
|
-
}
|
|
41
|
-
return created;
|
|
42
|
-
}
|
|
43
|
-
export function createTypeUnsafe(registry, type, params = [], options = {}) {
|
|
44
|
-
let Clazz = null;
|
|
45
|
-
let firstError = null;
|
|
46
|
-
try {
|
|
47
|
-
Clazz = createClassUnsafe(registry, type);
|
|
48
|
-
return initType(registry, Clazz, params, options);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
firstError = new Error(`createType(${type}):: ${error.message}`);
|
|
52
|
-
}
|
|
53
|
-
if (Clazz?.__fallbackType) {
|
|
54
|
-
try {
|
|
55
|
-
Clazz = createClassUnsafe(registry, Clazz.__fallbackType);
|
|
56
|
-
return initType(registry, Clazz, params, options);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
// swallow, we will throw the first error again
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
throw firstError;
|
|
63
|
-
}
|
package/build/exports.d.ts
DELETED
package/build/exports.js
DELETED
package/build/index.d.ts
DELETED
package/build/index.js
DELETED
package/build/package.json
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "Jaco Greeff <jacogr@gmail.com>",
|
|
3
|
-
"bugs": "https://github.com/pezkuwichain/pezkuwi-api/issues",
|
|
4
|
-
"description": "Type creator helpers",
|
|
5
|
-
"engines": {
|
|
6
|
-
"node": ">=18"
|
|
7
|
-
},
|
|
8
|
-
"homepage": "https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/types-create#readme",
|
|
9
|
-
"license": "Apache-2.0",
|
|
10
|
-
"name": "@pezkuwi/types-create",
|
|
11
|
-
"repository": {
|
|
12
|
-
"directory": "packages/types-create",
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/pezkuwichain/pezkuwi-api.git"
|
|
15
|
-
},
|
|
16
|
-
"sideEffects": [
|
|
17
|
-
"./packageDetect.js",
|
|
18
|
-
"./cjs/packageDetect.js"
|
|
19
|
-
],
|
|
20
|
-
"type": "module",
|
|
21
|
-
"version": "16.5.8",
|
|
22
|
-
"main": "./cjs/index.js",
|
|
23
|
-
"module": "./index.js",
|
|
24
|
-
"types": "./index.d.ts",
|
|
25
|
-
"exports": {
|
|
26
|
-
"./cjs/package.json": "./cjs/package.json",
|
|
27
|
-
"./cjs/*": "./cjs/*.js",
|
|
28
|
-
".": {
|
|
29
|
-
"module": {
|
|
30
|
-
"types": "./index.d.ts",
|
|
31
|
-
"default": "./index.js"
|
|
32
|
-
},
|
|
33
|
-
"require": {
|
|
34
|
-
"types": "./cjs/index.d.ts",
|
|
35
|
-
"default": "./cjs/index.js"
|
|
36
|
-
},
|
|
37
|
-
"default": {
|
|
38
|
-
"types": "./index.d.ts",
|
|
39
|
-
"default": "./index.js"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"./bundle": {
|
|
43
|
-
"module": {
|
|
44
|
-
"types": "./bundle.d.ts",
|
|
45
|
-
"default": "./bundle.js"
|
|
46
|
-
},
|
|
47
|
-
"require": {
|
|
48
|
-
"types": "./cjs/bundle.d.ts",
|
|
49
|
-
"default": "./cjs/bundle.js"
|
|
50
|
-
},
|
|
51
|
-
"default": {
|
|
52
|
-
"types": "./bundle.d.ts",
|
|
53
|
-
"default": "./bundle.js"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"./create": {
|
|
57
|
-
"module": {
|
|
58
|
-
"types": "./create/index.d.ts",
|
|
59
|
-
"default": "./create/index.js"
|
|
60
|
-
},
|
|
61
|
-
"require": {
|
|
62
|
-
"types": "./cjs/create/index.d.ts",
|
|
63
|
-
"default": "./cjs/create/index.js"
|
|
64
|
-
},
|
|
65
|
-
"default": {
|
|
66
|
-
"types": "./create/index.d.ts",
|
|
67
|
-
"default": "./create/index.js"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
"./create/class": {
|
|
71
|
-
"module": {
|
|
72
|
-
"types": "./create/class.d.ts",
|
|
73
|
-
"default": "./create/class.js"
|
|
74
|
-
},
|
|
75
|
-
"require": {
|
|
76
|
-
"types": "./cjs/create/class.d.ts",
|
|
77
|
-
"default": "./cjs/create/class.js"
|
|
78
|
-
},
|
|
79
|
-
"default": {
|
|
80
|
-
"types": "./create/class.d.ts",
|
|
81
|
-
"default": "./create/class.js"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"./create/type": {
|
|
85
|
-
"module": {
|
|
86
|
-
"types": "./create/type.d.ts",
|
|
87
|
-
"default": "./create/type.js"
|
|
88
|
-
},
|
|
89
|
-
"require": {
|
|
90
|
-
"types": "./cjs/create/type.d.ts",
|
|
91
|
-
"default": "./cjs/create/type.js"
|
|
92
|
-
},
|
|
93
|
-
"default": {
|
|
94
|
-
"types": "./create/type.d.ts",
|
|
95
|
-
"default": "./create/type.js"
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"./exports": {
|
|
99
|
-
"module": {
|
|
100
|
-
"types": "./exports.d.ts",
|
|
101
|
-
"default": "./exports.js"
|
|
102
|
-
},
|
|
103
|
-
"require": {
|
|
104
|
-
"types": "./cjs/exports.d.ts",
|
|
105
|
-
"default": "./cjs/exports.js"
|
|
106
|
-
},
|
|
107
|
-
"default": {
|
|
108
|
-
"types": "./exports.d.ts",
|
|
109
|
-
"default": "./exports.js"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
"./package.json": {
|
|
113
|
-
"require": "./cjs/package.json",
|
|
114
|
-
"default": "./package.json"
|
|
115
|
-
},
|
|
116
|
-
"./packageDetect": {
|
|
117
|
-
"module": {
|
|
118
|
-
"types": "./packageDetect.d.ts",
|
|
119
|
-
"default": "./packageDetect.js"
|
|
120
|
-
},
|
|
121
|
-
"require": {
|
|
122
|
-
"types": "./cjs/packageDetect.d.ts",
|
|
123
|
-
"default": "./cjs/packageDetect.js"
|
|
124
|
-
},
|
|
125
|
-
"default": {
|
|
126
|
-
"types": "./packageDetect.d.ts",
|
|
127
|
-
"default": "./packageDetect.js"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
"./packageInfo.js": {
|
|
131
|
-
"module": {
|
|
132
|
-
"types": "./packageInfo.d.ts",
|
|
133
|
-
"default": "./packageInfo.js"
|
|
134
|
-
},
|
|
135
|
-
"require": {
|
|
136
|
-
"types": "./cjs/packageInfo.d.ts",
|
|
137
|
-
"default": "./cjs/packageInfo.js"
|
|
138
|
-
},
|
|
139
|
-
"default": {
|
|
140
|
-
"types": "./packageInfo.d.ts",
|
|
141
|
-
"default": "./packageInfo.js"
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
"./packageInfo": {
|
|
145
|
-
"module": {
|
|
146
|
-
"types": "./packageInfo.d.ts",
|
|
147
|
-
"default": "./packageInfo.js"
|
|
148
|
-
},
|
|
149
|
-
"require": {
|
|
150
|
-
"types": "./cjs/packageInfo.d.ts",
|
|
151
|
-
"default": "./cjs/packageInfo.js"
|
|
152
|
-
},
|
|
153
|
-
"default": {
|
|
154
|
-
"types": "./packageInfo.d.ts",
|
|
155
|
-
"default": "./packageInfo.js"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
"./types": {
|
|
159
|
-
"module": {
|
|
160
|
-
"types": "./types/index.d.ts",
|
|
161
|
-
"default": "./types/index.js"
|
|
162
|
-
},
|
|
163
|
-
"require": {
|
|
164
|
-
"types": "./cjs/types/index.d.ts",
|
|
165
|
-
"default": "./cjs/types/index.js"
|
|
166
|
-
},
|
|
167
|
-
"default": {
|
|
168
|
-
"types": "./types/index.d.ts",
|
|
169
|
-
"default": "./types/index.js"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
"./types/augmentRegistry": {
|
|
173
|
-
"module": {
|
|
174
|
-
"types": "./types/augmentRegistry.d.ts",
|
|
175
|
-
"default": "./types/augmentRegistry.js"
|
|
176
|
-
},
|
|
177
|
-
"require": {
|
|
178
|
-
"types": "./cjs/types/augmentRegistry.d.ts",
|
|
179
|
-
"default": "./cjs/types/augmentRegistry.js"
|
|
180
|
-
},
|
|
181
|
-
"default": {
|
|
182
|
-
"types": "./types/augmentRegistry.d.ts",
|
|
183
|
-
"default": "./types/augmentRegistry.js"
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"./types/lookup": {
|
|
187
|
-
"module": {
|
|
188
|
-
"types": "./types/lookup.d.ts",
|
|
189
|
-
"default": "./types/lookup.js"
|
|
190
|
-
},
|
|
191
|
-
"require": {
|
|
192
|
-
"types": "./cjs/types/lookup.d.ts",
|
|
193
|
-
"default": "./cjs/types/lookup.js"
|
|
194
|
-
},
|
|
195
|
-
"default": {
|
|
196
|
-
"types": "./types/lookup.d.ts",
|
|
197
|
-
"default": "./types/lookup.js"
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"./types/types": {
|
|
201
|
-
"module": {
|
|
202
|
-
"types": "./types/types.d.ts",
|
|
203
|
-
"default": "./types/types.js"
|
|
204
|
-
},
|
|
205
|
-
"require": {
|
|
206
|
-
"types": "./cjs/types/types.d.ts",
|
|
207
|
-
"default": "./cjs/types/types.js"
|
|
208
|
-
},
|
|
209
|
-
"default": {
|
|
210
|
-
"types": "./types/types.d.ts",
|
|
211
|
-
"default": "./types/types.js"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
"./util": {
|
|
215
|
-
"module": {
|
|
216
|
-
"types": "./util/index.d.ts",
|
|
217
|
-
"default": "./util/index.js"
|
|
218
|
-
},
|
|
219
|
-
"require": {
|
|
220
|
-
"types": "./cjs/util/index.d.ts",
|
|
221
|
-
"default": "./cjs/util/index.js"
|
|
222
|
-
},
|
|
223
|
-
"default": {
|
|
224
|
-
"types": "./util/index.d.ts",
|
|
225
|
-
"default": "./util/index.js"
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
"./util/encodeTypes": {
|
|
229
|
-
"module": {
|
|
230
|
-
"types": "./util/encodeTypes.d.ts",
|
|
231
|
-
"default": "./util/encodeTypes.js"
|
|
232
|
-
},
|
|
233
|
-
"require": {
|
|
234
|
-
"types": "./cjs/util/encodeTypes.d.ts",
|
|
235
|
-
"default": "./cjs/util/encodeTypes.js"
|
|
236
|
-
},
|
|
237
|
-
"default": {
|
|
238
|
-
"types": "./util/encodeTypes.d.ts",
|
|
239
|
-
"default": "./util/encodeTypes.js"
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
"./util/getTypeDef": {
|
|
243
|
-
"module": {
|
|
244
|
-
"types": "./util/getTypeDef.d.ts",
|
|
245
|
-
"default": "./util/getTypeDef.js"
|
|
246
|
-
},
|
|
247
|
-
"require": {
|
|
248
|
-
"types": "./cjs/util/getTypeDef.d.ts",
|
|
249
|
-
"default": "./cjs/util/getTypeDef.js"
|
|
250
|
-
},
|
|
251
|
-
"default": {
|
|
252
|
-
"types": "./util/getTypeDef.d.ts",
|
|
253
|
-
"default": "./util/getTypeDef.js"
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
"./util/typeSplit": {
|
|
257
|
-
"module": {
|
|
258
|
-
"types": "./util/typeSplit.d.ts",
|
|
259
|
-
"default": "./util/typeSplit.js"
|
|
260
|
-
},
|
|
261
|
-
"require": {
|
|
262
|
-
"types": "./cjs/util/typeSplit.d.ts",
|
|
263
|
-
"default": "./cjs/util/typeSplit.js"
|
|
264
|
-
},
|
|
265
|
-
"default": {
|
|
266
|
-
"types": "./util/typeSplit.d.ts",
|
|
267
|
-
"default": "./util/typeSplit.js"
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
"./util/xcm": {
|
|
271
|
-
"module": {
|
|
272
|
-
"types": "./util/xcm.d.ts",
|
|
273
|
-
"default": "./util/xcm.js"
|
|
274
|
-
},
|
|
275
|
-
"require": {
|
|
276
|
-
"types": "./cjs/util/xcm.d.ts",
|
|
277
|
-
"default": "./cjs/util/xcm.js"
|
|
278
|
-
},
|
|
279
|
-
"default": {
|
|
280
|
-
"types": "./util/xcm.d.ts",
|
|
281
|
-
"default": "./util/xcm.js"
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
"dependencies": {
|
|
286
|
-
"@pezkuwi/types-codec": "workspace:*",
|
|
287
|
-
"@pezkuwi/util": "^14.0.1",
|
|
288
|
-
"tslib": "^2.8.1"
|
|
289
|
-
}
|
|
290
|
-
}
|
package/build/packageDetect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/packageDetect.js
DELETED
package/build/packageInfo.d.ts
DELETED
package/build/packageInfo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const packageInfo = { name: '@pezkuwi/types-create', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '16.5.8' };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import '@pezkuwi/types-codec/types/registry';
|
|
2
|
-
import type { Codec, CodecClass, ICompact, INumber, LookupString } from '@pezkuwi/types-codec/types';
|
|
3
|
-
import type { ILookup, TypeDef } from '@pezkuwi/types-create/types';
|
|
4
|
-
declare module '@pezkuwi/types-codec/types/registry' {
|
|
5
|
-
interface Registry {
|
|
6
|
-
readonly lookup: ILookup;
|
|
7
|
-
createLookupType(lookupId: ICompact<INumber> | number): LookupString;
|
|
8
|
-
getUnsafe<T extends Codec = Codec, K extends string = string>(name: K, withUnknown?: boolean, knownTypeDef?: TypeDef): CodecClass<T> | undefined;
|
|
9
|
-
setLookup(lookup: ILookup): void;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@pezkuwi/types-codec/types/registry';
|
package/build/types/index.d.ts
DELETED
package/build/types/index.js
DELETED
package/build/types/lookup.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Option, Text } from '@pezkuwi/types-codec';
|
|
2
|
-
import type { ICompact, INumber, LookupString } from '@pezkuwi/types-codec/types';
|
|
3
|
-
import type { TypeDef } from './types.js';
|
|
4
|
-
interface SiTypeBase {
|
|
5
|
-
def: {
|
|
6
|
-
asTuple: ICompact<INumber>[];
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export interface ILookup {
|
|
10
|
-
getSiType(lookupId: ICompact<INumber> | LookupString | number): SiTypeBase;
|
|
11
|
-
getTypeDef(lookupId: ICompact<INumber> | LookupString | number): TypeDef;
|
|
12
|
-
sanitizeField(name: Option<Text>): [string | null, string | null];
|
|
13
|
-
}
|
|
14
|
-
export {};
|
package/build/types/lookup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/types/types.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare enum TypeDefInfo {
|
|
2
|
-
BTreeMap = 0,
|
|
3
|
-
BTreeSet = 1,
|
|
4
|
-
Compact = 2,
|
|
5
|
-
DoNotConstruct = 3,
|
|
6
|
-
Enum = 4,
|
|
7
|
-
HashMap = 5,
|
|
8
|
-
Int = 6,
|
|
9
|
-
Linkage = 7,
|
|
10
|
-
Null = 8,
|
|
11
|
-
Option = 9,
|
|
12
|
-
Plain = 10,
|
|
13
|
-
Range = 11,
|
|
14
|
-
RangeInclusive = 12,
|
|
15
|
-
Result = 13,
|
|
16
|
-
Set = 14,
|
|
17
|
-
Si = 15,
|
|
18
|
-
Struct = 16,
|
|
19
|
-
Tuple = 17,
|
|
20
|
-
UInt = 18,
|
|
21
|
-
Vec = 19,
|
|
22
|
-
VecFixed = 20,
|
|
23
|
-
WrapperKeepOpaque = 21,
|
|
24
|
-
WrapperOpaque = 22
|
|
25
|
-
}
|
|
26
|
-
export interface TypeDef {
|
|
27
|
-
alias?: Map<string, string> | undefined;
|
|
28
|
-
displayName?: string | undefined;
|
|
29
|
-
docs?: string[] | undefined;
|
|
30
|
-
fallbackType?: string | undefined;
|
|
31
|
-
info: TypeDefInfo;
|
|
32
|
-
index?: number;
|
|
33
|
-
isFromSi?: boolean;
|
|
34
|
-
length?: number;
|
|
35
|
-
lookupIndex?: number;
|
|
36
|
-
lookupName?: string | undefined;
|
|
37
|
-
lookupNameRoot?: string | undefined;
|
|
38
|
-
name?: string | undefined;
|
|
39
|
-
namespace?: string | undefined;
|
|
40
|
-
sub?: TypeDef | TypeDef[];
|
|
41
|
-
type: string;
|
|
42
|
-
typeName?: string | undefined;
|
|
43
|
-
}
|