@pezkuwi/typegen 16.5.18 → 16.5.31

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.
Files changed (308) hide show
  1. package/{build-tsc-cjs → cjs}/generate/lookup.js +39 -10
  2. package/{build/cjs → cjs}/packageInfo.js +1 -1
  3. package/{build-tsc-cjs → cjs}/util/derived.js +15 -0
  4. package/{build-tsc-cjs → cjs}/util/formatting.js +5 -0
  5. package/generate/lookup.js +39 -10
  6. package/package.json +27 -27
  7. package/{build-tsc-esm/packageInfo.js → packageInfo.js} +1 -1
  8. package/{build/util → util}/derived.js +16 -1
  9. package/{build-tsc-esm/util → util}/formatting.js +5 -0
  10. package/build/LICENSE +0 -201
  11. package/build/README.md +0 -3
  12. package/build/augment.js +0 -2
  13. package/build/bundle.js +0 -2
  14. package/build/cjs/augment.d.ts +0 -2
  15. package/build/cjs/augment.js +0 -4
  16. package/build/cjs/bundle.d.ts +0 -2
  17. package/build/cjs/bundle.js +0 -7
  18. package/build/cjs/extractChain.js +0 -44
  19. package/build/cjs/fromChain.js +0 -95
  20. package/build/cjs/fromDefs.js +0 -82
  21. package/build/cjs/generate/consts.d.ts +0 -5
  22. package/build/cjs/generate/consts.js +0 -91
  23. package/build/cjs/generate/errors.d.ts +0 -4
  24. package/build/cjs/generate/errors.js +0 -59
  25. package/build/cjs/generate/events.d.ts +0 -5
  26. package/build/cjs/generate/events.js +0 -139
  27. package/build/cjs/generate/index.js +0 -23
  28. package/build/cjs/generate/interfaceRegistry.d.ts +0 -4
  29. package/build/cjs/generate/interfaceRegistry.js +0 -64
  30. package/build/cjs/generate/lookup.d.ts +0 -4
  31. package/build/cjs/generate/lookup.js +0 -240
  32. package/build/cjs/generate/query.d.ts +0 -5
  33. package/build/cjs/generate/query.js +0 -140
  34. package/build/cjs/generate/rpc.d.ts +0 -6
  35. package/build/cjs/generate/rpc.js +0 -115
  36. package/build/cjs/generate/runtime.d.ts +0 -7
  37. package/build/cjs/generate/runtime.js +0 -233
  38. package/build/cjs/generate/tsDef.d.ts +0 -16
  39. package/build/cjs/generate/tsDef.js +0 -254
  40. package/build/cjs/generate/tx.d.ts +0 -5
  41. package/build/cjs/generate/tx.js +0 -121
  42. package/build/cjs/generate/types.d.ts +0 -12
  43. package/build/cjs/generate/types.js +0 -16
  44. package/build/cjs/index.js +0 -5
  45. package/build/cjs/interfacesTs.js +0 -28
  46. package/build/cjs/metadataMd.js +0 -652
  47. package/build/cjs/util/assert.js +0 -15
  48. package/build/cjs/util/derived.js +0 -128
  49. package/build/cjs/util/docs.js +0 -10
  50. package/build/cjs/util/file.js +0 -33
  51. package/build/cjs/util/formatting.js +0 -237
  52. package/build/cjs/util/imports.js +0 -126
  53. package/build/cjs/util/index.js +0 -39
  54. package/build/cjs/util/initMeta.js +0 -22
  55. package/build/cjs/util/register.js +0 -10
  56. package/build/cjs/util/wsMeta.js +0 -60
  57. package/build/extractChain.d.ts +0 -1
  58. package/build/extractChain.js +0 -40
  59. package/build/fromChain.d.ts +0 -1
  60. package/build/fromChain.js +0 -91
  61. package/build/fromDefs.d.ts +0 -1
  62. package/build/fromDefs.js +0 -78
  63. package/build/generate/consts.d.ts +0 -5
  64. package/build/generate/consts.js +0 -87
  65. package/build/generate/errors.d.ts +0 -4
  66. package/build/generate/errors.js +0 -55
  67. package/build/generate/events.d.ts +0 -5
  68. package/build/generate/events.js +0 -135
  69. package/build/generate/index.d.ts +0 -10
  70. package/build/generate/index.js +0 -10
  71. package/build/generate/interfaceRegistry.d.ts +0 -4
  72. package/build/generate/interfaceRegistry.js +0 -59
  73. package/build/generate/lookup.d.ts +0 -4
  74. package/build/generate/lookup.js +0 -235
  75. package/build/generate/query.d.ts +0 -5
  76. package/build/generate/query.js +0 -136
  77. package/build/generate/rpc.d.ts +0 -6
  78. package/build/generate/rpc.js +0 -110
  79. package/build/generate/runtime.d.ts +0 -7
  80. package/build/generate/runtime.js +0 -228
  81. package/build/generate/tsDef.d.ts +0 -16
  82. package/build/generate/tsDef.js +0 -246
  83. package/build/generate/tx.d.ts +0 -5
  84. package/build/generate/tx.js +0 -117
  85. package/build/generate/types.d.ts +0 -12
  86. package/build/generate/types.js +0 -13
  87. package/build/index.d.ts +0 -2
  88. package/build/index.js +0 -2
  89. package/build/interfacesTs.d.ts +0 -1
  90. package/build/interfacesTs.js +0 -24
  91. package/build/metadataMd.d.ts +0 -1
  92. package/build/metadataMd.js +0 -648
  93. package/build/package.json +0 -548
  94. package/build/packageDetect.d.ts +0 -1
  95. package/build/packageDetect.js +0 -6
  96. package/build/packageInfo.d.ts +0 -6
  97. package/build/packageInfo.js +0 -1
  98. package/build/scripts/pezkuwi-types-chain-info.mjs +0 -7
  99. package/build/scripts/pezkuwi-types-from-chain.mjs +0 -7
  100. package/build/scripts/pezkuwi-types-from-defs.mjs +0 -7
  101. package/build/scripts/pezkuwi-types-internal-interfaces.mjs +0 -7
  102. package/build/scripts/pezkuwi-types-internal-metadata.mjs +0 -7
  103. package/build/templates/calls.hbs +0 -30
  104. package/build/templates/consts.hbs +0 -28
  105. package/build/templates/docs.hbs +0 -7
  106. package/build/templates/errors.hbs +0 -28
  107. package/build/templates/events.hbs +0 -28
  108. package/build/templates/header.hbs +0 -2
  109. package/build/templates/interfaceRegistry.hbs +0 -15
  110. package/build/templates/lookup/defs-named.hbs +0 -12
  111. package/build/templates/lookup/defs.hbs +0 -15
  112. package/build/templates/lookup/index.hbs +0 -3
  113. package/build/templates/lookup/types.hbs +0 -14
  114. package/build/templates/query.hbs +0 -29
  115. package/build/templates/rpc.hbs +0 -22
  116. package/build/templates/tsDef/index.hbs +0 -3
  117. package/build/templates/tsDef/moduleTypes.hbs +0 -10
  118. package/build/templates/tsDef/types.hbs +0 -7
  119. package/build/templates/tx.hbs +0 -30
  120. package/build/util/assert.d.ts +0 -2
  121. package/build/util/assert.js +0 -10
  122. package/build/util/derived.d.ts +0 -4
  123. package/build/util/docs.d.ts +0 -1
  124. package/build/util/docs.js +0 -6
  125. package/build/util/file.d.ts +0 -2
  126. package/build/util/file.js +0 -28
  127. package/build/util/formatting.d.ts +0 -11
  128. package/build/util/formatting.js +0 -230
  129. package/build/util/imports.d.ts +0 -23
  130. package/build/util/imports.js +0 -121
  131. package/build/util/index.d.ts +0 -16
  132. package/build/util/index.js +0 -34
  133. package/build/util/initMeta.d.ts +0 -12
  134. package/build/util/initMeta.js +0 -19
  135. package/build/util/register.d.ts +0 -4
  136. package/build/util/register.js +0 -7
  137. package/build/util/wsMeta.d.ts +0 -4
  138. package/build/util/wsMeta.js +0 -55
  139. package/build-tsc-cjs/packageDetect.js +0 -8
  140. package/build-tsc-cjs/packageInfo.js +0 -4
  141. package/build-tsc-esm/generate/consts.js +0 -87
  142. package/build-tsc-esm/generate/errors.js +0 -55
  143. package/build-tsc-esm/generate/events.js +0 -135
  144. package/build-tsc-esm/generate/interfaceRegistry.js +0 -59
  145. package/build-tsc-esm/generate/lookup.js +0 -235
  146. package/build-tsc-esm/generate/query.js +0 -136
  147. package/build-tsc-esm/generate/rpc.js +0 -110
  148. package/build-tsc-esm/generate/runtime.js +0 -228
  149. package/build-tsc-esm/generate/tsDef.js +0 -246
  150. package/build-tsc-esm/generate/tx.js +0 -117
  151. package/build-tsc-esm/generate/types.js +0 -13
  152. package/build-tsc-esm/util/derived.js +0 -125
  153. package/src/augment.ts +0 -5
  154. package/src/bundle.ts +0 -5
  155. package/src/extractChain.ts +0 -54
  156. package/src/fromChain.ts +0 -123
  157. package/src/fromDefs.ts +0 -106
  158. package/src/generate/consts.ts +0 -112
  159. package/src/generate/errors.ts +0 -75
  160. package/src/generate/events.ts +0 -165
  161. package/src/generate/index.ts +0 -13
  162. package/src/generate/interfaceRegistry.ts +0 -85
  163. package/src/generate/lookup.ts +0 -322
  164. package/src/generate/query.ts +0 -169
  165. package/src/generate/rpc.ts +0 -158
  166. package/src/generate/runtime.ts +0 -293
  167. package/src/generate/tsDef.ts +0 -321
  168. package/src/generate/tx.ts +0 -152
  169. package/src/generate/types.ts +0 -26
  170. package/src/index.ts +0 -6
  171. package/src/interfacesTs.ts +0 -35
  172. package/src/metadataMd.ts +0 -844
  173. package/src/packageDetect.ts +0 -14
  174. package/src/packageInfo.ts +0 -6
  175. package/src/templates/calls.hbs +0 -30
  176. package/src/templates/consts.hbs +0 -28
  177. package/src/templates/docs.hbs +0 -7
  178. package/src/templates/errors.hbs +0 -28
  179. package/src/templates/events.hbs +0 -28
  180. package/src/templates/header.hbs +0 -2
  181. package/src/templates/interfaceRegistry.hbs +0 -15
  182. package/src/templates/lookup/defs-named.hbs +0 -12
  183. package/src/templates/lookup/defs.hbs +0 -15
  184. package/src/templates/lookup/index.hbs +0 -3
  185. package/src/templates/lookup/types.hbs +0 -14
  186. package/src/templates/query.hbs +0 -29
  187. package/src/templates/rpc.hbs +0 -22
  188. package/src/templates/tsDef/index.hbs +0 -3
  189. package/src/templates/tsDef/moduleTypes.hbs +0 -10
  190. package/src/templates/tsDef/types.hbs +0 -7
  191. package/src/templates/tx.hbs +0 -30
  192. package/src/util/assert.ts +0 -18
  193. package/src/util/derived.spec.ts +0 -58
  194. package/src/util/derived.ts +0 -133
  195. package/src/util/docs.ts +0 -13
  196. package/src/util/file.ts +0 -42
  197. package/src/util/formatting.spec.ts +0 -30
  198. package/src/util/formatting.ts +0 -322
  199. package/src/util/imports.ts +0 -164
  200. package/src/util/index.ts +0 -42
  201. package/src/util/initMeta.ts +0 -37
  202. package/src/util/register.ts +0 -12
  203. package/src/util/wsMeta.ts +0 -70
  204. package/tsconfig.build.json +0 -28
  205. package/tsconfig.build.tsbuildinfo +0 -1
  206. package/tsconfig.scripts.json +0 -19
  207. package/tsconfig.spec.json +0 -17
  208. package/tsconfig.spec.tsbuildinfo +0 -1
  209. /package/{build-tsc/augment.d.ts → augment.d.ts} +0 -0
  210. /package/{build-tsc-esm/augment.js → augment.js} +0 -0
  211. /package/{build-tsc/bundle.d.ts → bundle.d.ts} +0 -0
  212. /package/{build-tsc-esm/bundle.js → bundle.js} +0 -0
  213. /package/{build → cjs}/augment.d.ts +0 -0
  214. /package/{build-tsc-cjs → cjs}/augment.js +0 -0
  215. /package/{build → cjs}/bundle.d.ts +0 -0
  216. /package/{build-tsc-cjs → cjs}/bundle.js +0 -0
  217. /package/{build-tsc → cjs}/extractChain.d.ts +0 -0
  218. /package/{build-tsc-cjs → cjs}/extractChain.js +0 -0
  219. /package/{build-tsc → cjs}/fromChain.d.ts +0 -0
  220. /package/{build-tsc-cjs → cjs}/fromChain.js +0 -0
  221. /package/{build-tsc → cjs}/fromDefs.d.ts +0 -0
  222. /package/{build-tsc-cjs → cjs}/fromDefs.js +0 -0
  223. /package/{build-tsc → cjs}/generate/consts.d.ts +0 -0
  224. /package/{build-tsc-cjs → cjs}/generate/consts.js +0 -0
  225. /package/{build-tsc → cjs}/generate/errors.d.ts +0 -0
  226. /package/{build-tsc-cjs → cjs}/generate/errors.js +0 -0
  227. /package/{build-tsc → cjs}/generate/events.d.ts +0 -0
  228. /package/{build-tsc-cjs → cjs}/generate/events.js +0 -0
  229. /package/{build-tsc → cjs}/generate/index.d.ts +0 -0
  230. /package/{build-tsc-cjs → cjs}/generate/index.js +0 -0
  231. /package/{build-tsc → cjs}/generate/interfaceRegistry.d.ts +0 -0
  232. /package/{build-tsc-cjs → cjs}/generate/interfaceRegistry.js +0 -0
  233. /package/{build-tsc → cjs}/generate/lookup.d.ts +0 -0
  234. /package/{build-tsc → cjs}/generate/query.d.ts +0 -0
  235. /package/{build-tsc-cjs → cjs}/generate/query.js +0 -0
  236. /package/{build-tsc → cjs}/generate/rpc.d.ts +0 -0
  237. /package/{build-tsc-cjs → cjs}/generate/rpc.js +0 -0
  238. /package/{build-tsc → cjs}/generate/runtime.d.ts +0 -0
  239. /package/{build-tsc-cjs → cjs}/generate/runtime.js +0 -0
  240. /package/{build-tsc → cjs}/generate/tsDef.d.ts +0 -0
  241. /package/{build-tsc-cjs → cjs}/generate/tsDef.js +0 -0
  242. /package/{build-tsc → cjs}/generate/tx.d.ts +0 -0
  243. /package/{build-tsc-cjs → cjs}/generate/tx.js +0 -0
  244. /package/{build-tsc → cjs}/generate/types.d.ts +0 -0
  245. /package/{build-tsc-cjs → cjs}/generate/types.js +0 -0
  246. /package/{build-tsc → cjs}/index.d.ts +0 -0
  247. /package/{build-tsc-cjs → cjs}/index.js +0 -0
  248. /package/{build-tsc → cjs}/interfacesTs.d.ts +0 -0
  249. /package/{build-tsc-cjs → cjs}/interfacesTs.js +0 -0
  250. /package/{build-tsc → cjs}/metadataMd.d.ts +0 -0
  251. /package/{build-tsc-cjs → cjs}/metadataMd.js +0 -0
  252. /package/{build/cjs → cjs}/package.json +0 -0
  253. /package/{build-tsc → cjs}/packageDetect.d.ts +0 -0
  254. /package/{build/cjs → cjs}/packageDetect.js +0 -0
  255. /package/{build-tsc → cjs}/packageInfo.d.ts +0 -0
  256. /package/{build-tsc → cjs}/util/assert.d.ts +0 -0
  257. /package/{build-tsc-cjs → cjs}/util/assert.js +0 -0
  258. /package/{build-tsc → cjs}/util/derived.d.ts +0 -0
  259. /package/{build-tsc → cjs}/util/docs.d.ts +0 -0
  260. /package/{build-tsc-cjs → cjs}/util/docs.js +0 -0
  261. /package/{build-tsc → cjs}/util/file.d.ts +0 -0
  262. /package/{build-tsc-cjs → cjs}/util/file.js +0 -0
  263. /package/{build-tsc → cjs}/util/formatting.d.ts +0 -0
  264. /package/{build-tsc → cjs}/util/imports.d.ts +0 -0
  265. /package/{build-tsc-cjs → cjs}/util/imports.js +0 -0
  266. /package/{build-tsc → cjs}/util/index.d.ts +0 -0
  267. /package/{build-tsc-cjs → cjs}/util/index.js +0 -0
  268. /package/{build-tsc → cjs}/util/initMeta.d.ts +0 -0
  269. /package/{build-tsc-cjs → cjs}/util/initMeta.js +0 -0
  270. /package/{build-tsc → cjs}/util/register.d.ts +0 -0
  271. /package/{build-tsc-cjs → cjs}/util/register.js +0 -0
  272. /package/{build-tsc → cjs}/util/wsMeta.d.ts +0 -0
  273. /package/{build-tsc-cjs → cjs}/util/wsMeta.js +0 -0
  274. /package/{build/cjs/extractChain.d.ts → extractChain.d.ts} +0 -0
  275. /package/{build-tsc-esm/extractChain.js → extractChain.js} +0 -0
  276. /package/{build/cjs/fromChain.d.ts → fromChain.d.ts} +0 -0
  277. /package/{build-tsc-esm/fromChain.js → fromChain.js} +0 -0
  278. /package/{build/cjs/fromDefs.d.ts → fromDefs.d.ts} +0 -0
  279. /package/{build-tsc-esm/fromDefs.js → fromDefs.js} +0 -0
  280. /package/{build/cjs/generate → generate}/index.d.ts +0 -0
  281. /package/{build-tsc-esm/generate → generate}/index.js +0 -0
  282. /package/{build/cjs/index.d.ts → index.d.ts} +0 -0
  283. /package/{build-tsc-esm/index.js → index.js} +0 -0
  284. /package/{build/cjs/interfacesTs.d.ts → interfacesTs.d.ts} +0 -0
  285. /package/{build-tsc-esm/interfacesTs.js → interfacesTs.js} +0 -0
  286. /package/{build/cjs/metadataMd.d.ts → metadataMd.d.ts} +0 -0
  287. /package/{build-tsc-esm/metadataMd.js → metadataMd.js} +0 -0
  288. /package/{build/cjs/packageDetect.d.ts → packageDetect.d.ts} +0 -0
  289. /package/{build-tsc-esm/packageDetect.js → packageDetect.js} +0 -0
  290. /package/{build/cjs/packageInfo.d.ts → packageInfo.d.ts} +0 -0
  291. /package/{build/cjs/util → util}/assert.d.ts +0 -0
  292. /package/{build-tsc-esm/util → util}/assert.js +0 -0
  293. /package/{build/cjs/util → util}/derived.d.ts +0 -0
  294. /package/{build/cjs/util → util}/docs.d.ts +0 -0
  295. /package/{build-tsc-esm/util → util}/docs.js +0 -0
  296. /package/{build/cjs/util → util}/file.d.ts +0 -0
  297. /package/{build-tsc-esm/util → util}/file.js +0 -0
  298. /package/{build/cjs/util → util}/formatting.d.ts +0 -0
  299. /package/{build/cjs/util → util}/imports.d.ts +0 -0
  300. /package/{build-tsc-esm/util → util}/imports.js +0 -0
  301. /package/{build/cjs/util → util}/index.d.ts +0 -0
  302. /package/{build-tsc-esm/util → util}/index.js +0 -0
  303. /package/{build/cjs/util → util}/initMeta.d.ts +0 -0
  304. /package/{build-tsc-esm/util → util}/initMeta.js +0 -0
  305. /package/{build/cjs/util → util}/register.d.ts +0 -0
  306. /package/{build-tsc-esm/util → util}/register.js +0 -0
  307. /package/{build/cjs/util → util}/wsMeta.d.ts +0 -0
  308. /package/{build-tsc-esm/util → util}/wsMeta.js +0 -0
@@ -1,28 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/api-base/types/errors';
6
-
7
- {{{ importsAll }}}
8
-
9
- export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>;
10
-
11
- declare module '@pezkuwi/api-base/types/errors' {
12
- interface AugmentedErrors<ApiType extends ApiTypes> {
13
- {{#each modules}}
14
- {{{name}}}: {
15
- {{#each items}}
16
- {{> docs}}
17
- {{{name}}}: AugmentedError<ApiType>;
18
- {{/each}}
19
- {{#unless @root.isStrict}}
20
- /**
21
- * Generic error
22
- **/
23
- [key: string]: AugmentedError<ApiType>;
24
- {{/unless}}
25
- };
26
- {{/each}}
27
- } // AugmentedErrors
28
- } // declare module
@@ -1,28 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/api-base/types/events';
6
-
7
- {{{ importsAll }}}
8
-
9
- export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
10
-
11
- declare module '@pezkuwi/api-base/types/events' {
12
- interface AugmentedEvents<ApiType extends ApiTypes> {
13
- {{#each modules}}
14
- {{{name}}}: {
15
- {{#each items}}
16
- {{> docs}}
17
- {{{name}}}: AugmentedEvent<ApiType, {{{type}}}>;
18
- {{/each}}
19
- {{#unless @root.isStrict}}
20
- /**
21
- * Generic event
22
- **/
23
- [key: string]: AugmentedEvent<ApiType>;
24
- {{/unless}}
25
- };
26
- {{/each}}
27
- } // AugmentedEvents
28
- } // declare module
@@ -1,2 +0,0 @@
1
- // Auto-generated via `yarn polkadot-types-from-{{headerType}}`, do not edit
2
- /* eslint-disable */
@@ -1,15 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/types/types/registry';
6
-
7
- {{{ importsAll }}}
8
-
9
- declare module '@pezkuwi/types/types/registry' {
10
- interface InterfaceTypes {
11
- {{#each items}}
12
- {{{this}}}: {{{this}}};
13
- {{/each}}
14
- } // InterfaceTypes
15
- } // declare module
@@ -1,12 +0,0 @@
1
- {{> header }}
2
-
3
- /* eslint-disable sort-keys */
4
-
5
- export default {
6
- {{#each defs}}
7
- {{> docs}}
8
- {{#each defs}}
9
- {{{this}}}
10
- {{/each}}
11
- {{/each}}
12
- };
@@ -1,15 +0,0 @@
1
- {{> header }}
2
-
3
- /* eslint-disable sort-keys */
4
-
5
- export default {
6
- rpc: {},
7
- types: {
8
- {{#each defs}}
9
- {{> docs}}
10
- {{#each defs}}
11
- {{{this}}}
12
- {{/each}}
13
- {{/each}}
14
- }
15
- };
@@ -1,3 +0,0 @@
1
- {{> header }}
2
-
3
- export * from './types.js';
@@ -1,14 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/types/lookup';
6
-
7
- {{{ importsAll }}}
8
-
9
- declare module '@pezkuwi/types/lookup' {
10
- {{#each items}}
11
- {{{this}}}
12
-
13
- {{/each}}
14
- } // declare module
@@ -1,29 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/api-base/types/storage';
6
-
7
- {{{ importsAll }}}
8
-
9
- export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
10
- export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>;
11
-
12
- declare module '@pezkuwi/api-base/types/storage' {
13
- interface AugmentedQueries<ApiType extends ApiTypes> {
14
- {{#each modules}}
15
- {{{name}}}: {
16
- {{#each items}}
17
- {{> docs}}
18
- {{{name}}}: {{{entryType}}}<ApiType, ({{{params}}}) => Observable<{{{returnType}}}>, [{{{args}}}]>{{#unless @root.isStrict}} & QueryableStorageEntry<ApiType, [{{{args}}}]>{{/unless}};
19
- {{/each}}
20
- {{#unless @root.isStrict}}
21
- /**
22
- * Generic query
23
- **/
24
- [key: string]: QueryableStorageEntry<ApiType>;
25
- {{/unless}}
26
- };
27
- {{/each}}
28
- } // AugmentedQueries
29
- } // declare module
@@ -1,22 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/rpc-core/types/jsonrpc';
6
-
7
- {{{ importsAll }}}
8
-
9
- export type __AugmentedRpc = AugmentedRpc<() => unknown>;
10
-
11
- declare module '@pezkuwi/rpc-core/types/jsonrpc' {
12
- interface RpcInterface {
13
- {{#each modules}}
14
- {{{name}}}: {
15
- {{#each items}}
16
- {{> docs}}
17
- {{{name}}}: AugmentedRpc<{{#if generic}}<{{{generic}}}>{{/if}}({{{args}}}) => Observable<{{{type}}}>>;
18
- {{/each}}
19
- };
20
- {{/each}}
21
- } // RpcInterface
22
- } // declare module
@@ -1,3 +0,0 @@
1
- {{> header }}
2
-
3
- export * from './types.js';
@@ -1,10 +0,0 @@
1
- {{> header }}
2
-
3
- {{{ importsAll }}}
4
-
5
- {{#each items}}
6
- {{{this}}}
7
-
8
- {{/each}}
9
-
10
- export type PHANTOM_{{#upper}}{{{name}}}{{/upper}} = '{{{name}}}';
@@ -1,7 +0,0 @@
1
- {{> header }}
2
-
3
- {{#each items}}
4
- export * from './{{{this}}}/types.js';
5
- {{/each}}
6
-
7
- export type PHANTOM_GENERATED = 'generated';
@@ -1,30 +0,0 @@
1
- {{> header }}
2
-
3
- // import type lookup before we augment - in some environments
4
- // this is required to allow for ambient/previous definitions
5
- import '@pezkuwi/api-base/types/submittable';
6
-
7
- {{{ importsAll }}}
8
-
9
- export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>;
10
- export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrinsic<ApiType>;
11
- export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>;
12
-
13
- declare module '@pezkuwi/api-base/types/submittable' {
14
- interface AugmentedSubmittables<ApiType extends ApiTypes> {
15
- {{#each modules}}
16
- {{{name}}}: {
17
- {{#each items}}
18
- {{> docs}}
19
- {{{name}}}: AugmentedSubmittable<({{{params}}}) => SubmittableExtrinsic<ApiType>, [{{{args}}}]>;
20
- {{/each}}
21
- {{#unless @root.isStrict}}
22
- /**
23
- * Generic tx
24
- **/
25
- [key: string]: SubmittableExtrinsicFunction<ApiType>;
26
- {{/unless}}
27
- };
28
- {{/each}}
29
- } // AugmentedSubmittables
30
- } // declare module
@@ -1,2 +0,0 @@
1
- export declare function assertDir(path: string): string;
2
- export declare function assertFile(path: string): string;
@@ -1,10 +0,0 @@
1
- import fs from 'node:fs';
2
- import { assert } from '@pezkuwi/util';
3
- export function assertDir(path) {
4
- assert(fs.existsSync(path) && fs.lstatSync(path).isDirectory(), `${path} is not a directory`);
5
- return path;
6
- }
7
- export function assertFile(path) {
8
- assert(fs.existsSync(path) && fs.lstatSync(path).isFile(), `${path} is not a file`);
9
- return path;
10
- }
@@ -1,4 +0,0 @@
1
- import type { Registry } from '@pezkuwi/types/types';
2
- import type { ModuleTypes, TypeImports } from './imports.js';
3
- /** @internal */
4
- export declare function getSimilarTypes(registry: Registry, definitions: Record<string, ModuleTypes>, _type: string, imports: TypeImports): string[];
@@ -1 +0,0 @@
1
- export declare const __TYPEGEN_DUMMY_DOCS = "DUMMY_DOCS";
@@ -1,6 +0,0 @@
1
- import Handlebars from 'handlebars';
2
- import { readTemplate } from './file.js';
3
- Handlebars.registerPartial({
4
- docs: Handlebars.compile(readTemplate('docs'))
5
- });
6
- export const __TYPEGEN_DUMMY_DOCS = 'DUMMY_DOCS';
@@ -1,2 +0,0 @@
1
- export declare function writeFile(dest: string, generator: () => string, noLog?: boolean): void;
2
- export declare function readTemplate(template: string): string;
@@ -1,28 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import process from 'node:process';
4
- import { packageInfo } from '../packageInfo.js';
5
- export function writeFile(dest, generator, noLog) {
6
- !noLog && console.log(`${dest}\n\tGenerating`);
7
- let generated = generator();
8
- while (generated.includes('\n\n\n')) {
9
- generated = generated.replace(/\n\n\n/g, '\n\n');
10
- }
11
- !noLog && console.log('\tWriting');
12
- fs.writeFileSync(dest, generated, { flag: 'w' });
13
- !noLog && console.log('');
14
- }
15
- export function readTemplate(template) {
16
- // Inside the api repo itself, it will be 'auto'
17
- const rootDir = packageInfo.path === 'auto'
18
- ? path.join(process.cwd(), 'packages/typegen/src')
19
- : packageInfo.path;
20
- // NOTE With cjs in a subdir, search one lower as well
21
- const file = ['./templates', '../templates']
22
- .map((p) => path.join(rootDir, p, `${template}.hbs`))
23
- .find((p) => fs.existsSync(p));
24
- if (!file) {
25
- throw new Error(`Unable to locate ${template}.hbs from ${rootDir}`);
26
- }
27
- return fs.readFileSync(file).toString();
28
- }
@@ -1,11 +0,0 @@
1
- import type { AnyString, Registry } from '@pezkuwi/types/types';
2
- import type { TypeDef } from '@pezkuwi/types-create/types';
3
- import type { ModuleTypes, TypeImports } from './imports.js';
4
- export declare const HEADER: (type: "chain" | "defs") => string;
5
- /** @internal */
6
- export declare function exportInterface(lookupIndex: number | undefined, name: string | undefined, base: string, body?: string, withShortcut?: boolean): string;
7
- /**
8
- * Correctly format a given type
9
- */
10
- /** @internal */
11
- export declare function formatType(registry: Registry, definitions: Record<string, ModuleTypes>, type: AnyString | TypeDef, imports: TypeImports, withShortcut?: boolean): string;
@@ -1,230 +0,0 @@
1
- import Handlebars from 'handlebars';
2
- import * as typesCodec from '@pezkuwi/types-codec';
3
- import { getTypeDef, paramsNotation, TypeDefInfo } from '@pezkuwi/types-create';
4
- import { isString, stringify } from '@pezkuwi/util';
5
- import { readTemplate } from './file.js';
6
- import { setImports } from './imports.js';
7
- function rebrandTypeName(typeName) {
8
- return typeName
9
- // Main projects
10
- .replace(/Polkadot/g, 'Pezkuwi')
11
- .replace(/Substrate/g, 'Bizinikiwi')
12
- .replace(/Cumulus/g, 'Pezcumulus')
13
- // Networks
14
- .replace(/Kusama/g, 'Dicle')
15
- .replace(/Westend/g, 'Zagros')
16
- .replace(/Rococo/g, 'Pezkuwichain')
17
- // Chain types
18
- .replace(/Parachain/g, 'Teyrchain')
19
- // Module prefixes (in PascalCase type names)
20
- .replace(/Frame(?=[A-Z])/g, 'Pezframe')
21
- .replace(/Pallet(?=[A-Z])/g, 'Pezpallet')
22
- // Primitives prefixes (sp_ becomes Sp in type names)
23
- .replace(/^Sp(?=[A-Z])/g, 'Pezsp')
24
- .replace(/([^a-zA-Z])Sp(?=[A-Z])/g, '$1Pezsp')
25
- // Client prefixes (sc_ becomes Sc in type names)
26
- .replace(/^Sc(?=[A-Z])/g, 'Pezsc')
27
- .replace(/([^a-zA-Z])Sc(?=[A-Z])/g, '$1Pezsc');
28
- }
29
- const NO_CODEC = ['Tuple', 'VecFixed'];
30
- const ON_CODEC = Object.keys(typesCodec);
31
- const ON_CODEC_TYPES = ['Codec', 'AnyJson', 'AnyFunction', 'AnyNumber', 'AnyString', 'AnyTuple', 'AnyU8a', 'ICompact', 'IEnum', 'IMap', 'INumber', 'IOption', 'IResult', 'ISet', 'IStruct', 'ITuple', 'IU8a', 'IVec', 'IMethod'];
32
- export const HEADER = (type) => `// Auto-generated via \`yarn pezkuwi-types-from-${type}\`, do not edit\n/* eslint-disable */\n\n`;
33
- function extractImports({ imports, types }) {
34
- const toplevel = [
35
- ...Object.keys(imports.codecTypes),
36
- ...Object.keys(imports.extrinsicTypes),
37
- ...Object.keys(imports.genericTypes),
38
- ...Object.keys(imports.metadataTypes),
39
- ...Object.keys(imports.primitiveTypes)
40
- ];
41
- return [
42
- {
43
- file: '@pezkuwi/types',
44
- types: toplevel.filter((n) => !NO_CODEC.includes(n) && !ON_CODEC.includes(n))
45
- },
46
- {
47
- file: '@pezkuwi/types/lookup',
48
- types: Object.keys(imports.lookupTypes)
49
- },
50
- {
51
- file: '@pezkuwi/types/types',
52
- types: Object.keys(imports.typesTypes).filter((n) => !ON_CODEC_TYPES.includes(n))
53
- },
54
- {
55
- file: '@pezkuwi/types-codec',
56
- types: toplevel.filter((n) => !NO_CODEC.includes(n) && ON_CODEC.includes(n))
57
- },
58
- {
59
- file: '@pezkuwi/types-codec/types',
60
- types: Object.keys(imports.typesTypes).filter((n) => ON_CODEC_TYPES.includes(n))
61
- },
62
- ...types
63
- ]
64
- .filter(({ types }) => types.length)
65
- .sort(({ file }, b) => file.localeCompare(b.file))
66
- .map(({ file, types }) => `import type { ${types.sort().join(', ')} } from '${file}';`);
67
- }
68
- Handlebars.registerPartial({
69
- header: Handlebars.compile(readTemplate('header'))
70
- });
71
- Handlebars.registerHelper({
72
- importsAll() {
73
- return extractImports(this)
74
- .join('\n');
75
- },
76
- importsPackage() {
77
- return extractImports(this)
78
- .filter((l) => !l.includes("from '."))
79
- .join('\n ');
80
- },
81
- importsRelative() {
82
- return extractImports(this)
83
- .filter((l) => l.includes("from '."))
84
- .join('\n');
85
- },
86
- trim(options) {
87
- return options.fn(this).trim();
88
- },
89
- upper(options) {
90
- return options.fn(this).toUpperCase();
91
- }
92
- });
93
- /** @internal */
94
- export function exportInterface(lookupIndex = -1, name = '', base, body = '', withShortcut = false) {
95
- // * @description extends [[${base}]]
96
- const doc = withShortcut
97
- ? ''
98
- : `/** @name ${name}${lookupIndex !== -1 ? ` (${lookupIndex})` : ''} */\n`;
99
- return `${doc}${withShortcut ? '' : `export interface ${name} extends ${base} `}{${body.length ? '\n' : ''}${body}${withShortcut ? ' ' : ''}}`;
100
- }
101
- function singleParamNotation(registry, wrapper, typeDef, definitions, imports, withShortcut) {
102
- const sub = typeDef.sub;
103
- const lookupName = rebrandTypeName(sub.lookupName || '');
104
- setImports(definitions, imports, [wrapper, lookupName]);
105
- return paramsNotation(wrapper, lookupName || formatType(registry, definitions, sub.type, imports, withShortcut));
106
- }
107
- function dualParamsNotation(registry, wrapper, typeDef, definitions, imports, withShortcut) {
108
- const [a, b] = typeDef.sub;
109
- const aLookupName = rebrandTypeName(a.lookupName || '');
110
- const bLookupName = rebrandTypeName(b.lookupName || '');
111
- setImports(definitions, imports, [wrapper, aLookupName, bLookupName]);
112
- return paramsNotation(wrapper, [
113
- aLookupName || formatType(registry, definitions, a.type, imports, withShortcut),
114
- bLookupName || formatType(registry, definitions, b.type, imports, withShortcut)
115
- ]);
116
- }
117
- const formatters = {
118
- [TypeDefInfo.Compact]: (registry, typeDef, definitions, imports, withShortcut) => {
119
- return singleParamNotation(registry, 'Compact', typeDef, definitions, imports, withShortcut);
120
- },
121
- [TypeDefInfo.DoNotConstruct]: (_registry, _typeDef, definitions, imports, _withShortcut) => {
122
- setImports(definitions, imports, ['DoNotConstruct']);
123
- return 'DoNotConstruct';
124
- },
125
- [TypeDefInfo.Enum]: (_registry, typeDef, _definitions, _imports, _withShortcut) => {
126
- if (typeDef.lookupName) {
127
- return rebrandTypeName(typeDef.lookupName);
128
- }
129
- throw new Error(`TypeDefInfo.Enum: Parameter formatting not implemented on ${stringify(typeDef)}`);
130
- },
131
- [TypeDefInfo.Int]: (_registry, typeDef, _definitions, _imports, _withShortcut) => {
132
- throw new Error(`TypeDefInfo.Int: Parameter formatting not implemented on ${stringify(typeDef)}`);
133
- },
134
- [TypeDefInfo.UInt]: (_registry, typeDef, _definitions, _imports, _withShortcut) => {
135
- throw new Error(`TypeDefInfo.UInt: Parameter formatting not implemented on ${stringify(typeDef)}`);
136
- },
137
- [TypeDefInfo.Null]: (_registry, _typeDef, definitions, imports, _withShortcut) => {
138
- setImports(definitions, imports, ['Null']);
139
- return 'Null';
140
- },
141
- [TypeDefInfo.Option]: (registry, typeDef, definitions, imports, withShortcut) => {
142
- return singleParamNotation(registry, 'Option', typeDef, definitions, imports, withShortcut);
143
- },
144
- [TypeDefInfo.Plain]: (_registry, typeDef, definitions, imports, _withShortcut) => {
145
- setImports(definitions, imports, [rebrandTypeName(typeDef.type)]);
146
- return rebrandTypeName(typeDef.type);
147
- },
148
- [TypeDefInfo.Range]: (registry, typeDef, definitions, imports, withShortcut) => {
149
- return singleParamNotation(registry, 'Range', typeDef, definitions, imports, withShortcut);
150
- },
151
- [TypeDefInfo.RangeInclusive]: (registry, typeDef, definitions, imports, withShortcut) => {
152
- return singleParamNotation(registry, 'RangeInclusive', typeDef, definitions, imports, withShortcut);
153
- },
154
- [TypeDefInfo.Set]: (_registry, typeDef, _definitions, _imports, _withShortcut) => {
155
- throw new Error(`TypeDefInfo.Set: Parameter formatting not implemented on ${stringify(typeDef)}`);
156
- },
157
- [TypeDefInfo.Si]: (registry, typeDef, definitions, imports, withShortcut) => {
158
- return formatType(registry, definitions, registry.lookup.getTypeDef(typeDef.type), imports, withShortcut);
159
- },
160
- [TypeDefInfo.Struct]: (registry, typeDef, definitions, imports, withShortcut) => {
161
- if (typeDef.lookupName) {
162
- return rebrandTypeName(typeDef.lookupName);
163
- }
164
- const sub = typeDef.sub;
165
- setImports(definitions, imports, ['Struct', ...sub.map(({ lookupName }) => rebrandTypeName(lookupName || ''))]);
166
- return `{${withShortcut ? ' ' : '\n'}${sub.map(({ lookupName, name, type }, index) => [
167
- name || `unknown${index}`,
168
- rebrandTypeName(lookupName || '') || formatType(registry, definitions, type, imports, withShortcut)
169
- ]).map(([k, t]) => `${withShortcut ? '' : ' readonly '}${k}: ${t};`).join(withShortcut ? ' ' : '\n')}${withShortcut ? ' ' : '\n '}} & Struct`;
170
- },
171
- [TypeDefInfo.Tuple]: (registry, typeDef, definitions, imports, withShortcut) => {
172
- const sub = typeDef.sub;
173
- setImports(definitions, imports, ['ITuple', ...sub.map(({ lookupName }) => rebrandTypeName(lookupName || ''))]);
174
- // `(a,b)` gets transformed into `ITuple<[a, b]>`
175
- return paramsNotation('ITuple', `[${sub.map(({ lookupName, type }) => rebrandTypeName(lookupName || '') || formatType(registry, definitions, type, imports, withShortcut)).join(', ')}]`);
176
- },
177
- [TypeDefInfo.Vec]: (registry, typeDef, definitions, imports, withShortcut) => {
178
- return singleParamNotation(registry, 'Vec', typeDef, definitions, imports, withShortcut);
179
- },
180
- [TypeDefInfo.VecFixed]: (registry, typeDef, definitions, imports, withShortcut) => {
181
- const sub = typeDef.sub;
182
- if (sub.type === 'u8') {
183
- setImports(definitions, imports, ['U8aFixed']);
184
- return 'U8aFixed';
185
- }
186
- return singleParamNotation(registry, 'Vec', typeDef, definitions, imports, withShortcut);
187
- },
188
- [TypeDefInfo.BTreeMap]: (registry, typeDef, definitions, imports, withShortcut) => {
189
- return dualParamsNotation(registry, 'BTreeMap', typeDef, definitions, imports, withShortcut);
190
- },
191
- [TypeDefInfo.BTreeSet]: (registry, typeDef, definitions, imports, withShortcut) => {
192
- return singleParamNotation(registry, 'BTreeSet', typeDef, definitions, imports, withShortcut);
193
- },
194
- [TypeDefInfo.HashMap]: (registry, typeDef, definitions, imports, withShortcut) => {
195
- return dualParamsNotation(registry, 'HashMap', typeDef, definitions, imports, withShortcut);
196
- },
197
- [TypeDefInfo.Linkage]: (registry, typeDef, definitions, imports, withShortcut) => {
198
- return singleParamNotation(registry, 'Linkage', typeDef, definitions, imports, withShortcut);
199
- },
200
- [TypeDefInfo.Result]: (registry, typeDef, definitions, imports, withShortcut) => {
201
- return dualParamsNotation(registry, 'Result', typeDef, definitions, imports, withShortcut);
202
- },
203
- [TypeDefInfo.WrapperKeepOpaque]: (registry, typeDef, definitions, imports, withShortcut) => {
204
- return singleParamNotation(registry, 'WrapperKeepOpaque', typeDef, definitions, imports, withShortcut);
205
- },
206
- [TypeDefInfo.WrapperOpaque]: (registry, typeDef, definitions, imports, withShortcut) => {
207
- return singleParamNotation(registry, 'WrapperOpaque', typeDef, definitions, imports, withShortcut);
208
- }
209
- };
210
- /**
211
- * Correctly format a given type
212
- */
213
- /** @internal */
214
- export function formatType(registry, definitions, type, imports, withShortcut = false) {
215
- let typeDef;
216
- if (isString(type)) {
217
- const _type = type.toString();
218
- // If type is "unorthodox" (i.e. `{ something: any }` for an Enum input or `[a | b | c, d | e | f]` for a Tuple's similar types),
219
- // we return it as-is
220
- if (withShortcut && /(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
221
- return rebrandTypeName(_type);
222
- }
223
- typeDef = getTypeDef(type);
224
- }
225
- else {
226
- typeDef = type;
227
- }
228
- setImports(definitions, imports, [rebrandTypeName(typeDef.lookupName || typeDef.type)]);
229
- return rebrandTypeName(formatters[typeDef.info](registry, typeDef, definitions, imports, withShortcut));
230
- }
@@ -1,23 +0,0 @@
1
- export interface ModuleTypes {
2
- types: Record<string, unknown>;
3
- }
4
- type TypeExist = Record<string, boolean>;
5
- type TypeExistMap = Record<string, TypeExist>;
6
- export interface TypeImports {
7
- codecTypes: TypeExist;
8
- extrinsicTypes: TypeExist;
9
- genericTypes: TypeExist;
10
- ignoredTypes: string[];
11
- localTypes: TypeExistMap;
12
- lookupTypes: TypeExistMap;
13
- primitiveTypes: TypeExist;
14
- metadataTypes: TypeExist;
15
- typesTypes: TypeExist;
16
- definitions: Record<string, ModuleTypes>;
17
- typeToModule: Record<string, string>;
18
- }
19
- /** @internal */
20
- export declare function setImports(allDefs: Record<string, ModuleTypes>, imports: TypeImports, types: (string | null | undefined)[]): void;
21
- /** @internal */
22
- export declare function createImports(importDefinitions: Record<string, Record<string, ModuleTypes>>, { types }?: ModuleTypes): TypeImports;
23
- export {};