Drop Metadata V0-V8 (#2634)

* Drop MetadatV0

* Apply suggestions from code review

* Restore asV1

* Remove V0 comment

* Handle DoNotConstruct in enum

* No imports from DoNotConstruct

* Merge & re-generate

* Attempt empty construction

* Drop Metadata from 0-4

* CHANGELOG

* assert(5)

* BE vs LE

* Metadataall to no-construction

* Empty U8a create

* Remove old comment

* Santize handling

* Update CHANGELOG.md

* Drop support for Metadata < 9

* Remove old pre-9 definitions

* Update CHANGELOG.md

* CHANGELOG

* Remove v8-era tests

* v8 tests
This commit is contained in:
Jaco Greeff
2020-09-25 16:32:48 +02:00
committed by GitHub
parent dff7243aad
commit 5ce3524ccd
56 changed files with 179 additions and 35167 deletions
+7 -2
View File
@@ -51,10 +51,12 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
const keys = (sub as TypeDef[]).map(({ info, name = '', type }): string => {
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
const isComplexType = [TypeDefInfo.Tuple, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null'
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports);
const isGetter = createGetter(definitions, `is${getter}`, 'boolean', imports);
const isGetter = info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `is${getter}`, 'boolean', imports);
switch (info) {
case TypeDefInfo.Compact:
@@ -65,6 +67,9 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
case TypeDefInfo.VecFixed:
return `${isGetter}${asGetter}`;
case TypeDefInfo.DoNotConstruct:
return '';
default:
throw new Error(`Enum: ${enumName || 'undefined'}: Unhandled type ${TypeDefInfo[info]}`);
}