@lodestar/api 1.35.0-dev.549f58dd39 → 1.35.0-dev.5c65fa3b36

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 (170) hide show
  1. package/lib/beacon/client/index.js.map +1 -1
  2. package/lib/beacon/index.d.ts +1 -1
  3. package/lib/beacon/index.js.map +1 -1
  4. package/lib/beacon/routes/beacon/index.d.ts +3 -3
  5. package/lib/beacon/routes/beacon/index.js.map +1 -1
  6. package/lib/beacon/routes/beacon/rewards.js.map +1 -1
  7. package/lib/beacon/routes/events.js.map +1 -1
  8. package/lib/beacon/routes/index.js.map +1 -1
  9. package/lib/beacon/server/index.d.ts +1 -1
  10. package/lib/beacon/server/index.js.map +1 -1
  11. package/lib/builder/index.js.map +1 -1
  12. package/lib/builder/routes.js.map +1 -1
  13. package/lib/builder/server/index.d.ts +1 -1
  14. package/lib/index.d.ts +6 -6
  15. package/lib/index.js +3 -3
  16. package/lib/index.js.map +1 -1
  17. package/lib/keymanager/index.d.ts +2 -2
  18. package/lib/keymanager/index.js +2 -1
  19. package/lib/keymanager/index.js.map +1 -1
  20. package/lib/keymanager/server/index.d.ts +1 -1
  21. package/lib/utils/client/httpClient.d.ts +2 -1
  22. package/lib/utils/client/httpClient.js +2 -1
  23. package/lib/utils/client/httpClient.js.map +1 -1
  24. package/lib/utils/client/index.d.ts +1 -1
  25. package/lib/utils/client/index.js +1 -1
  26. package/lib/utils/client/index.js.map +1 -1
  27. package/lib/utils/server/route.js.map +1 -1
  28. package/package.json +11 -17
  29. package/lib/beacon/client/beacon.d.ts.map +0 -1
  30. package/lib/beacon/client/config.d.ts.map +0 -1
  31. package/lib/beacon/client/debug.d.ts.map +0 -1
  32. package/lib/beacon/client/events.d.ts.map +0 -1
  33. package/lib/beacon/client/index.d.ts.map +0 -1
  34. package/lib/beacon/client/lightclient.d.ts.map +0 -1
  35. package/lib/beacon/client/lodestar.d.ts.map +0 -1
  36. package/lib/beacon/client/node.d.ts.map +0 -1
  37. package/lib/beacon/client/proof.d.ts.map +0 -1
  38. package/lib/beacon/client/validator.d.ts.map +0 -1
  39. package/lib/beacon/index.d.ts.map +0 -1
  40. package/lib/beacon/routes/beacon/block.d.ts.map +0 -1
  41. package/lib/beacon/routes/beacon/index.d.ts.map +0 -1
  42. package/lib/beacon/routes/beacon/pool.d.ts.map +0 -1
  43. package/lib/beacon/routes/beacon/rewards.d.ts.map +0 -1
  44. package/lib/beacon/routes/beacon/state.d.ts.map +0 -1
  45. package/lib/beacon/routes/config.d.ts.map +0 -1
  46. package/lib/beacon/routes/debug.d.ts.map +0 -1
  47. package/lib/beacon/routes/events.d.ts.map +0 -1
  48. package/lib/beacon/routes/index.d.ts.map +0 -1
  49. package/lib/beacon/routes/lightclient.d.ts.map +0 -1
  50. package/lib/beacon/routes/lodestar.d.ts.map +0 -1
  51. package/lib/beacon/routes/node.d.ts.map +0 -1
  52. package/lib/beacon/routes/proof.d.ts.map +0 -1
  53. package/lib/beacon/routes/validator.d.ts.map +0 -1
  54. package/lib/beacon/server/beacon.d.ts.map +0 -1
  55. package/lib/beacon/server/config.d.ts.map +0 -1
  56. package/lib/beacon/server/debug.d.ts.map +0 -1
  57. package/lib/beacon/server/events.d.ts.map +0 -1
  58. package/lib/beacon/server/index.d.ts.map +0 -1
  59. package/lib/beacon/server/lightclient.d.ts.map +0 -1
  60. package/lib/beacon/server/lodestar.d.ts.map +0 -1
  61. package/lib/beacon/server/node.d.ts.map +0 -1
  62. package/lib/beacon/server/proof.d.ts.map +0 -1
  63. package/lib/beacon/server/validator.d.ts.map +0 -1
  64. package/lib/builder/client.d.ts.map +0 -1
  65. package/lib/builder/index.d.ts.map +0 -1
  66. package/lib/builder/routes.d.ts.map +0 -1
  67. package/lib/builder/server/index.d.ts.map +0 -1
  68. package/lib/index.d.ts.map +0 -1
  69. package/lib/keymanager/client.d.ts.map +0 -1
  70. package/lib/keymanager/index.d.ts.map +0 -1
  71. package/lib/keymanager/routes.d.ts.map +0 -1
  72. package/lib/keymanager/server/index.d.ts.map +0 -1
  73. package/lib/server/index.d.ts.map +0 -1
  74. package/lib/utils/client/error.d.ts.map +0 -1
  75. package/lib/utils/client/eventSource.d.ts.map +0 -1
  76. package/lib/utils/client/format.d.ts.map +0 -1
  77. package/lib/utils/client/httpClient.d.ts.map +0 -1
  78. package/lib/utils/client/index.d.ts.map +0 -1
  79. package/lib/utils/client/method.d.ts.map +0 -1
  80. package/lib/utils/client/metrics.d.ts.map +0 -1
  81. package/lib/utils/client/request.d.ts.map +0 -1
  82. package/lib/utils/client/response.d.ts.map +0 -1
  83. package/lib/utils/codecs.d.ts.map +0 -1
  84. package/lib/utils/fork.d.ts.map +0 -1
  85. package/lib/utils/headers.d.ts.map +0 -1
  86. package/lib/utils/httpStatusCode.d.ts.map +0 -1
  87. package/lib/utils/index.d.ts.map +0 -1
  88. package/lib/utils/metadata.d.ts.map +0 -1
  89. package/lib/utils/schema.d.ts.map +0 -1
  90. package/lib/utils/serdes.d.ts.map +0 -1
  91. package/lib/utils/server/error.d.ts.map +0 -1
  92. package/lib/utils/server/handler.d.ts.map +0 -1
  93. package/lib/utils/server/index.d.ts.map +0 -1
  94. package/lib/utils/server/method.d.ts.map +0 -1
  95. package/lib/utils/server/parser.d.ts.map +0 -1
  96. package/lib/utils/server/route.d.ts.map +0 -1
  97. package/lib/utils/types.d.ts.map +0 -1
  98. package/lib/utils/urlFormat.d.ts.map +0 -1
  99. package/lib/utils/wireFormat.d.ts.map +0 -1
  100. package/src/beacon/client/beacon.ts +0 -12
  101. package/src/beacon/client/config.ts +0 -12
  102. package/src/beacon/client/debug.ts +0 -12
  103. package/src/beacon/client/events.ts +0 -69
  104. package/src/beacon/client/index.ts +0 -46
  105. package/src/beacon/client/lightclient.ts +0 -12
  106. package/src/beacon/client/lodestar.ts +0 -12
  107. package/src/beacon/client/node.ts +0 -12
  108. package/src/beacon/client/proof.ts +0 -12
  109. package/src/beacon/client/validator.ts +0 -12
  110. package/src/beacon/index.ts +0 -24
  111. package/src/beacon/routes/beacon/block.ts +0 -602
  112. package/src/beacon/routes/beacon/index.ts +0 -66
  113. package/src/beacon/routes/beacon/pool.ts +0 -503
  114. package/src/beacon/routes/beacon/rewards.ts +0 -216
  115. package/src/beacon/routes/beacon/state.ts +0 -588
  116. package/src/beacon/routes/config.ts +0 -114
  117. package/src/beacon/routes/debug.ts +0 -231
  118. package/src/beacon/routes/events.ts +0 -337
  119. package/src/beacon/routes/index.ts +0 -33
  120. package/src/beacon/routes/lightclient.ts +0 -241
  121. package/src/beacon/routes/lodestar.ts +0 -456
  122. package/src/beacon/routes/node.ts +0 -286
  123. package/src/beacon/routes/proof.ts +0 -79
  124. package/src/beacon/routes/validator.ts +0 -1014
  125. package/src/beacon/server/beacon.ts +0 -7
  126. package/src/beacon/server/config.ts +0 -7
  127. package/src/beacon/server/debug.ts +0 -7
  128. package/src/beacon/server/events.ts +0 -73
  129. package/src/beacon/server/index.ts +0 -55
  130. package/src/beacon/server/lightclient.ts +0 -7
  131. package/src/beacon/server/lodestar.ts +0 -7
  132. package/src/beacon/server/node.ts +0 -7
  133. package/src/beacon/server/proof.ts +0 -7
  134. package/src/beacon/server/validator.ts +0 -7
  135. package/src/builder/client.ts +0 -9
  136. package/src/builder/index.ts +0 -26
  137. package/src/builder/routes.ts +0 -227
  138. package/src/builder/server/index.ts +0 -19
  139. package/src/index.ts +0 -19
  140. package/src/keymanager/client.ts +0 -9
  141. package/src/keymanager/index.ts +0 -39
  142. package/src/keymanager/routes.ts +0 -699
  143. package/src/keymanager/server/index.ts +0 -19
  144. package/src/server/index.ts +0 -2
  145. package/src/utils/client/error.ts +0 -10
  146. package/src/utils/client/eventSource.ts +0 -7
  147. package/src/utils/client/format.ts +0 -22
  148. package/src/utils/client/httpClient.ts +0 -444
  149. package/src/utils/client/index.ts +0 -6
  150. package/src/utils/client/method.ts +0 -50
  151. package/src/utils/client/metrics.ts +0 -9
  152. package/src/utils/client/request.ts +0 -113
  153. package/src/utils/client/response.ts +0 -205
  154. package/src/utils/codecs.ts +0 -143
  155. package/src/utils/fork.ts +0 -44
  156. package/src/utils/headers.ts +0 -173
  157. package/src/utils/httpStatusCode.ts +0 -392
  158. package/src/utils/index.ts +0 -3
  159. package/src/utils/metadata.ts +0 -170
  160. package/src/utils/schema.ts +0 -141
  161. package/src/utils/serdes.ts +0 -120
  162. package/src/utils/server/error.ts +0 -9
  163. package/src/utils/server/handler.ts +0 -149
  164. package/src/utils/server/index.ts +0 -5
  165. package/src/utils/server/method.ts +0 -38
  166. package/src/utils/server/parser.ts +0 -15
  167. package/src/utils/server/route.ts +0 -45
  168. package/src/utils/types.ts +0 -161
  169. package/src/utils/urlFormat.ts +0 -112
  170. package/src/utils/wireFormat.ts +0 -24
@@ -1,112 +0,0 @@
1
- export enum TokenType {
2
- String = "String",
3
- Variable = "Variable",
4
- }
5
- export type Token = {type: TokenType.String; str: string} | {type: TokenType.Variable; var: string};
6
-
7
- type Args = Record<string, string | number>;
8
-
9
- export function urlToTokens(path: string): Token[] {
10
- const tokens: Token[] = [];
11
-
12
- let ptr = 0;
13
- let inVariable = false;
14
-
15
- for (let i = 0, len = path.length; i < len; i++) {
16
- switch (path[i]) {
17
- case "{": {
18
- if (inVariable) {
19
- throw Error(`Invalid path variable not closed: ${path}`);
20
- }
21
- if (i > ptr) {
22
- tokens.push({type: TokenType.String, str: path.slice(ptr, i)});
23
- }
24
- ptr = i + 1;
25
- inVariable = true;
26
- break;
27
- }
28
-
29
- case "}": {
30
- if (!inVariable) {
31
- throw Error(`Invalid path variable not open: ${path}`);
32
- }
33
- if (ptr === i) {
34
- throw Error(`Empty variable: ${path}`);
35
- }
36
- tokens.push({type: TokenType.Variable, var: path.slice(ptr, i)});
37
- inVariable = false;
38
- ptr = i + 1;
39
- break;
40
- }
41
- }
42
- }
43
-
44
- if (inVariable) {
45
- throw Error(`Invalid path variable not closed: ${path}`);
46
- }
47
-
48
- if (ptr < path.length) {
49
- tokens.push({type: TokenType.String, str: path.slice(ptr)});
50
- }
51
-
52
- return tokens;
53
- }
54
-
55
- /**
56
- * Compile a route URL formatter with syntax `/path/{var1}/{var2}`.
57
- * Returns a function that expects an object `{var1: 1, var2: 2}`, and returns`/path/1/2`.
58
- *
59
- * It's cheap enough to be negligible. For the sample input below it costs:
60
- * - compile: 1010 ns / op
61
- * - execute: 105 ns / op
62
- * - execute with template literal: 12 ns / op
63
- * @param path `/eth/v1/validator/:name/attester/:epoch`
64
- */
65
- export function compileRouteUrlFormatter(path: string): (arg: Args) => string {
66
- const tokens = urlToTokens(path);
67
-
68
- // Return a faster function if there's not ':' token
69
- if (tokens.length === 1 && tokens[0].type === TokenType.String) {
70
- return () => path;
71
- }
72
-
73
- const fns = tokens.map((token) => {
74
- switch (token.type) {
75
- case TokenType.String:
76
- return () => token.str;
77
-
78
- case TokenType.Variable: {
79
- const argKey = token.var;
80
- return (args: Args) => args[argKey];
81
- }
82
- }
83
- });
84
-
85
- return function urlFormatter(args: Args) {
86
- // Don't use .map() or .join(), it's x3 slower
87
- let s = "";
88
- for (const fn of fns) s += fn(args);
89
- return s;
90
- };
91
- }
92
-
93
- /**
94
- * Converts notation used in OpenAPI spec '/states/{state_id}',
95
- * into colon notation used by fastify '/states/:state_id'
96
- */
97
- export function toColonNotationPath(path: string): string {
98
- const tokens = urlToTokens(path);
99
-
100
- return tokens
101
- .map((token) => {
102
- switch (token.type) {
103
- case TokenType.String:
104
- return token.str;
105
-
106
- case TokenType.Variable: {
107
- return `:${token.var}`;
108
- }
109
- }
110
- })
111
- .join("");
112
- }
@@ -1,24 +0,0 @@
1
- import {MediaType} from "./headers.js";
2
-
3
- export enum WireFormat {
4
- json = "json",
5
- ssz = "ssz",
6
- }
7
-
8
- export function getWireFormat(mediaType: MediaType): WireFormat {
9
- switch (mediaType) {
10
- case MediaType.json:
11
- return WireFormat.json;
12
- case MediaType.ssz:
13
- return WireFormat.ssz;
14
- }
15
- }
16
-
17
- export function fromWireFormat(wireFormat: WireFormat): MediaType {
18
- switch (wireFormat) {
19
- case WireFormat.json:
20
- return MediaType.json;
21
- case WireFormat.ssz:
22
- return MediaType.ssz;
23
- }
24
- }