@lodestar/api 1.35.0-dev.fcf8d024ea → 1.35.0-dev.feed916580

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 (143) hide show
  1. package/package.json +11 -17
  2. package/lib/beacon/client/beacon.d.ts.map +0 -1
  3. package/lib/beacon/client/config.d.ts.map +0 -1
  4. package/lib/beacon/client/debug.d.ts.map +0 -1
  5. package/lib/beacon/client/events.d.ts.map +0 -1
  6. package/lib/beacon/client/index.d.ts.map +0 -1
  7. package/lib/beacon/client/lightclient.d.ts.map +0 -1
  8. package/lib/beacon/client/lodestar.d.ts.map +0 -1
  9. package/lib/beacon/client/node.d.ts.map +0 -1
  10. package/lib/beacon/client/proof.d.ts.map +0 -1
  11. package/lib/beacon/client/validator.d.ts.map +0 -1
  12. package/lib/beacon/index.d.ts.map +0 -1
  13. package/lib/beacon/routes/beacon/block.d.ts.map +0 -1
  14. package/lib/beacon/routes/beacon/index.d.ts.map +0 -1
  15. package/lib/beacon/routes/beacon/pool.d.ts.map +0 -1
  16. package/lib/beacon/routes/beacon/rewards.d.ts.map +0 -1
  17. package/lib/beacon/routes/beacon/state.d.ts.map +0 -1
  18. package/lib/beacon/routes/config.d.ts.map +0 -1
  19. package/lib/beacon/routes/debug.d.ts.map +0 -1
  20. package/lib/beacon/routes/events.d.ts.map +0 -1
  21. package/lib/beacon/routes/index.d.ts.map +0 -1
  22. package/lib/beacon/routes/lightclient.d.ts.map +0 -1
  23. package/lib/beacon/routes/lodestar.d.ts.map +0 -1
  24. package/lib/beacon/routes/node.d.ts.map +0 -1
  25. package/lib/beacon/routes/proof.d.ts.map +0 -1
  26. package/lib/beacon/routes/validator.d.ts.map +0 -1
  27. package/lib/beacon/server/beacon.d.ts.map +0 -1
  28. package/lib/beacon/server/config.d.ts.map +0 -1
  29. package/lib/beacon/server/debug.d.ts.map +0 -1
  30. package/lib/beacon/server/events.d.ts.map +0 -1
  31. package/lib/beacon/server/index.d.ts.map +0 -1
  32. package/lib/beacon/server/lightclient.d.ts.map +0 -1
  33. package/lib/beacon/server/lodestar.d.ts.map +0 -1
  34. package/lib/beacon/server/node.d.ts.map +0 -1
  35. package/lib/beacon/server/proof.d.ts.map +0 -1
  36. package/lib/beacon/server/validator.d.ts.map +0 -1
  37. package/lib/builder/client.d.ts.map +0 -1
  38. package/lib/builder/index.d.ts.map +0 -1
  39. package/lib/builder/routes.d.ts.map +0 -1
  40. package/lib/builder/server/index.d.ts.map +0 -1
  41. package/lib/index.d.ts.map +0 -1
  42. package/lib/keymanager/client.d.ts.map +0 -1
  43. package/lib/keymanager/index.d.ts.map +0 -1
  44. package/lib/keymanager/routes.d.ts.map +0 -1
  45. package/lib/keymanager/server/index.d.ts.map +0 -1
  46. package/lib/server/index.d.ts.map +0 -1
  47. package/lib/utils/client/error.d.ts.map +0 -1
  48. package/lib/utils/client/eventSource.d.ts.map +0 -1
  49. package/lib/utils/client/format.d.ts.map +0 -1
  50. package/lib/utils/client/httpClient.d.ts.map +0 -1
  51. package/lib/utils/client/index.d.ts.map +0 -1
  52. package/lib/utils/client/method.d.ts.map +0 -1
  53. package/lib/utils/client/metrics.d.ts.map +0 -1
  54. package/lib/utils/client/request.d.ts.map +0 -1
  55. package/lib/utils/client/response.d.ts.map +0 -1
  56. package/lib/utils/codecs.d.ts.map +0 -1
  57. package/lib/utils/fork.d.ts.map +0 -1
  58. package/lib/utils/headers.d.ts.map +0 -1
  59. package/lib/utils/httpStatusCode.d.ts.map +0 -1
  60. package/lib/utils/index.d.ts.map +0 -1
  61. package/lib/utils/metadata.d.ts.map +0 -1
  62. package/lib/utils/schema.d.ts.map +0 -1
  63. package/lib/utils/serdes.d.ts.map +0 -1
  64. package/lib/utils/server/error.d.ts.map +0 -1
  65. package/lib/utils/server/handler.d.ts.map +0 -1
  66. package/lib/utils/server/index.d.ts.map +0 -1
  67. package/lib/utils/server/method.d.ts.map +0 -1
  68. package/lib/utils/server/parser.d.ts.map +0 -1
  69. package/lib/utils/server/route.d.ts.map +0 -1
  70. package/lib/utils/types.d.ts.map +0 -1
  71. package/lib/utils/urlFormat.d.ts.map +0 -1
  72. package/lib/utils/wireFormat.d.ts.map +0 -1
  73. package/src/beacon/client/beacon.ts +0 -12
  74. package/src/beacon/client/config.ts +0 -12
  75. package/src/beacon/client/debug.ts +0 -12
  76. package/src/beacon/client/events.ts +0 -69
  77. package/src/beacon/client/index.ts +0 -46
  78. package/src/beacon/client/lightclient.ts +0 -12
  79. package/src/beacon/client/lodestar.ts +0 -12
  80. package/src/beacon/client/node.ts +0 -12
  81. package/src/beacon/client/proof.ts +0 -12
  82. package/src/beacon/client/validator.ts +0 -12
  83. package/src/beacon/index.ts +0 -24
  84. package/src/beacon/routes/beacon/block.ts +0 -602
  85. package/src/beacon/routes/beacon/index.ts +0 -66
  86. package/src/beacon/routes/beacon/pool.ts +0 -503
  87. package/src/beacon/routes/beacon/rewards.ts +0 -216
  88. package/src/beacon/routes/beacon/state.ts +0 -588
  89. package/src/beacon/routes/config.ts +0 -114
  90. package/src/beacon/routes/debug.ts +0 -231
  91. package/src/beacon/routes/events.ts +0 -337
  92. package/src/beacon/routes/index.ts +0 -33
  93. package/src/beacon/routes/lightclient.ts +0 -241
  94. package/src/beacon/routes/lodestar.ts +0 -456
  95. package/src/beacon/routes/node.ts +0 -286
  96. package/src/beacon/routes/proof.ts +0 -79
  97. package/src/beacon/routes/validator.ts +0 -1014
  98. package/src/beacon/server/beacon.ts +0 -7
  99. package/src/beacon/server/config.ts +0 -7
  100. package/src/beacon/server/debug.ts +0 -7
  101. package/src/beacon/server/events.ts +0 -73
  102. package/src/beacon/server/index.ts +0 -55
  103. package/src/beacon/server/lightclient.ts +0 -7
  104. package/src/beacon/server/lodestar.ts +0 -7
  105. package/src/beacon/server/node.ts +0 -7
  106. package/src/beacon/server/proof.ts +0 -7
  107. package/src/beacon/server/validator.ts +0 -7
  108. package/src/builder/client.ts +0 -9
  109. package/src/builder/index.ts +0 -26
  110. package/src/builder/routes.ts +0 -227
  111. package/src/builder/server/index.ts +0 -19
  112. package/src/index.ts +0 -19
  113. package/src/keymanager/client.ts +0 -9
  114. package/src/keymanager/index.ts +0 -39
  115. package/src/keymanager/routes.ts +0 -699
  116. package/src/keymanager/server/index.ts +0 -19
  117. package/src/server/index.ts +0 -2
  118. package/src/utils/client/error.ts +0 -10
  119. package/src/utils/client/eventSource.ts +0 -7
  120. package/src/utils/client/format.ts +0 -22
  121. package/src/utils/client/httpClient.ts +0 -444
  122. package/src/utils/client/index.ts +0 -6
  123. package/src/utils/client/method.ts +0 -50
  124. package/src/utils/client/metrics.ts +0 -9
  125. package/src/utils/client/request.ts +0 -113
  126. package/src/utils/client/response.ts +0 -205
  127. package/src/utils/codecs.ts +0 -143
  128. package/src/utils/fork.ts +0 -44
  129. package/src/utils/headers.ts +0 -173
  130. package/src/utils/httpStatusCode.ts +0 -392
  131. package/src/utils/index.ts +0 -3
  132. package/src/utils/metadata.ts +0 -170
  133. package/src/utils/schema.ts +0 -141
  134. package/src/utils/serdes.ts +0 -120
  135. package/src/utils/server/error.ts +0 -9
  136. package/src/utils/server/handler.ts +0 -149
  137. package/src/utils/server/index.ts +0 -5
  138. package/src/utils/server/method.ts +0 -38
  139. package/src/utils/server/parser.ts +0 -15
  140. package/src/utils/server/route.ts +0 -45
  141. package/src/utils/types.ts +0 -161
  142. package/src/utils/urlFormat.ts +0 -112
  143. 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
- }