@celljs/grpc 0.0.0-stage → 4.3.0

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 (186) hide show
  1. package/README.md +123 -2
  2. package/cell.yml +12 -0
  3. package/esm/node/call/async-queue.d.ts +31 -0
  4. package/esm/node/call/async-queue.js +80 -0
  5. package/esm/node/call/async-queue.js.map +1 -0
  6. package/esm/node/call/grpc-status.d.ts +33 -0
  7. package/esm/node/call/grpc-status.js +48 -0
  8. package/esm/node/call/grpc-status.js.map +1 -0
  9. package/esm/node/call/message-framer.d.ts +24 -0
  10. package/esm/node/call/message-framer.js +105 -0
  11. package/esm/node/call/message-framer.js.map +1 -0
  12. package/esm/node/call/metadata.d.ts +15 -0
  13. package/esm/node/call/metadata.js +81 -0
  14. package/esm/node/call/metadata.js.map +1 -0
  15. package/esm/node/client/grpc-channel.d.ts +64 -0
  16. package/esm/node/client/grpc-channel.js +285 -0
  17. package/esm/node/client/grpc-channel.js.map +1 -0
  18. package/esm/node/codec/proto-reader.d.ts +26 -0
  19. package/esm/node/codec/proto-reader.js +153 -0
  20. package/esm/node/codec/proto-reader.js.map +1 -0
  21. package/esm/node/codec/proto-writer.d.ts +29 -0
  22. package/esm/node/codec/proto-writer.js +150 -0
  23. package/esm/node/codec/proto-writer.js.map +1 -0
  24. package/esm/node/index.d.ts +15 -0
  25. package/esm/node/index.js +16 -0
  26. package/esm/node/index.js.map +1 -0
  27. package/esm/node/module.d.ts +3 -0
  28. package/esm/node/module.js +4 -0
  29. package/esm/node/module.js.map +1 -0
  30. package/esm/node/proto/proto-ast.d.ts +46 -0
  31. package/esm/node/proto/proto-ast.js +2 -0
  32. package/esm/node/proto/proto-ast.js.map +1 -0
  33. package/esm/node/proto/proto-parser.d.ts +45 -0
  34. package/esm/node/proto/proto-parser.js +451 -0
  35. package/esm/node/proto/proto-parser.js.map +1 -0
  36. package/esm/node/proto/proto-types.d.ts +76 -0
  37. package/esm/node/proto/proto-types.js +444 -0
  38. package/esm/node/proto/proto-types.js.map +1 -0
  39. package/esm/node/proto/proto.d.ts +57 -0
  40. package/esm/node/proto/proto.js +174 -0
  41. package/esm/node/proto/proto.js.map +1 -0
  42. package/esm/node/proto/well-known.d.ts +5 -0
  43. package/esm/node/proto/well-known.js +41 -0
  44. package/esm/node/proto/well-known.js.map +1 -0
  45. package/esm/node/server/grpc-server-lifecycle.d.ts +21 -0
  46. package/esm/node/server/grpc-server-lifecycle.js +65 -0
  47. package/esm/node/server/grpc-server-lifecycle.js.map +1 -0
  48. package/esm/node/server/grpc-server.d.ts +60 -0
  49. package/esm/node/server/grpc-server.js +312 -0
  50. package/esm/node/server/grpc-server.js.map +1 -0
  51. package/esm/node/server/grpc-service.d.ts +24 -0
  52. package/esm/node/server/grpc-service.js +38 -0
  53. package/esm/node/server/grpc-service.js.map +1 -0
  54. package/esm/node/test/proto-loader.d.ts +2 -0
  55. package/esm/node/test/proto-loader.js +13 -0
  56. package/esm/node/test/proto-loader.js.map +1 -0
  57. package/esm/node/test/test-protos.d.ts +28 -0
  58. package/esm/node/test/test-protos.js +145 -0
  59. package/esm/node/test/test-protos.js.map +1 -0
  60. package/esm/package.json +3 -0
  61. package/lib/node/call/async-queue.d.ts +32 -0
  62. package/lib/node/call/async-queue.d.ts.map +1 -0
  63. package/lib/node/call/async-queue.js +84 -0
  64. package/lib/node/call/async-queue.js.map +1 -0
  65. package/lib/node/call/grpc-status.d.ts +34 -0
  66. package/lib/node/call/grpc-status.d.ts.map +1 -0
  67. package/lib/node/call/grpc-status.js +52 -0
  68. package/lib/node/call/grpc-status.js.map +1 -0
  69. package/lib/node/call/message-framer.d.ts +25 -0
  70. package/lib/node/call/message-framer.d.ts.map +1 -0
  71. package/lib/node/call/message-framer.js +109 -0
  72. package/lib/node/call/message-framer.js.map +1 -0
  73. package/lib/node/call/metadata.d.ts +16 -0
  74. package/lib/node/call/metadata.d.ts.map +1 -0
  75. package/lib/node/call/metadata.js +84 -0
  76. package/lib/node/call/metadata.js.map +1 -0
  77. package/lib/node/client/grpc-channel.d.ts +65 -0
  78. package/lib/node/client/grpc-channel.d.ts.map +1 -0
  79. package/lib/node/client/grpc-channel.js +289 -0
  80. package/lib/node/client/grpc-channel.js.map +1 -0
  81. package/lib/node/codec/proto-reader.d.ts +27 -0
  82. package/lib/node/codec/proto-reader.d.ts.map +1 -0
  83. package/lib/node/codec/proto-reader.js +157 -0
  84. package/lib/node/codec/proto-reader.js.map +1 -0
  85. package/lib/node/codec/proto-writer.d.ts +30 -0
  86. package/lib/node/codec/proto-writer.d.ts.map +1 -0
  87. package/lib/node/codec/proto-writer.js +154 -0
  88. package/lib/node/codec/proto-writer.js.map +1 -0
  89. package/lib/node/grpc.spec.d.ts +2 -0
  90. package/lib/node/grpc.spec.d.ts.map +1 -0
  91. package/lib/node/grpc.spec.js +148 -0
  92. package/lib/node/grpc.spec.js.map +1 -0
  93. package/lib/node/index.d.ts +16 -0
  94. package/lib/node/index.d.ts.map +1 -0
  95. package/lib/node/index.js +32 -0
  96. package/lib/node/index.js.map +1 -0
  97. package/lib/node/interop.spec.d.ts +2 -0
  98. package/lib/node/interop.spec.d.ts.map +1 -0
  99. package/lib/node/interop.spec.js +194 -0
  100. package/lib/node/interop.spec.js.map +1 -0
  101. package/lib/node/module.d.ts +4 -0
  102. package/lib/node/module.d.ts.map +1 -0
  103. package/lib/node/module.js +6 -0
  104. package/lib/node/module.js.map +1 -0
  105. package/lib/node/proto/proto-ast.d.ts +47 -0
  106. package/lib/node/proto/proto-ast.d.ts.map +1 -0
  107. package/lib/node/proto/proto-ast.js +3 -0
  108. package/lib/node/proto/proto-ast.js.map +1 -0
  109. package/lib/node/proto/proto-parser.d.ts +46 -0
  110. package/lib/node/proto/proto-parser.d.ts.map +1 -0
  111. package/lib/node/proto/proto-parser.js +455 -0
  112. package/lib/node/proto/proto-parser.js.map +1 -0
  113. package/lib/node/proto/proto-parser.spec.d.ts +2 -0
  114. package/lib/node/proto/proto-parser.spec.d.ts.map +1 -0
  115. package/lib/node/proto/proto-parser.spec.js +95 -0
  116. package/lib/node/proto/proto-parser.spec.js.map +1 -0
  117. package/lib/node/proto/proto-types.d.ts +77 -0
  118. package/lib/node/proto/proto-types.d.ts.map +1 -0
  119. package/lib/node/proto/proto-types.js +449 -0
  120. package/lib/node/proto/proto-types.js.map +1 -0
  121. package/lib/node/proto/proto-types.spec.d.ts +2 -0
  122. package/lib/node/proto/proto-types.spec.d.ts.map +1 -0
  123. package/lib/node/proto/proto-types.spec.js +120 -0
  124. package/lib/node/proto/proto-types.spec.js.map +1 -0
  125. package/lib/node/proto/proto.d.ts +58 -0
  126. package/lib/node/proto/proto.d.ts.map +1 -0
  127. package/lib/node/proto/proto.js +178 -0
  128. package/lib/node/proto/proto.js.map +1 -0
  129. package/lib/node/proto/well-known.d.ts +6 -0
  130. package/lib/node/proto/well-known.d.ts.map +1 -0
  131. package/lib/node/proto/well-known.js +44 -0
  132. package/lib/node/proto/well-known.js.map +1 -0
  133. package/lib/node/server/grpc-server-lifecycle.d.ts +22 -0
  134. package/lib/node/server/grpc-server-lifecycle.d.ts.map +1 -0
  135. package/lib/node/server/grpc-server-lifecycle.js +68 -0
  136. package/lib/node/server/grpc-server-lifecycle.js.map +1 -0
  137. package/lib/node/server/grpc-server-lifecycle.spec.d.ts +2 -0
  138. package/lib/node/server/grpc-server-lifecycle.spec.d.ts.map +1 -0
  139. package/lib/node/server/grpc-server-lifecycle.spec.js +100 -0
  140. package/lib/node/server/grpc-server-lifecycle.spec.js.map +1 -0
  141. package/lib/node/server/grpc-server.d.ts +61 -0
  142. package/lib/node/server/grpc-server.d.ts.map +1 -0
  143. package/lib/node/server/grpc-server.js +316 -0
  144. package/lib/node/server/grpc-server.js.map +1 -0
  145. package/lib/node/server/grpc-service.d.ts +25 -0
  146. package/lib/node/server/grpc-service.d.ts.map +1 -0
  147. package/lib/node/server/grpc-service.js +42 -0
  148. package/lib/node/server/grpc-service.js.map +1 -0
  149. package/lib/node/test/proto-loader.d.ts +3 -0
  150. package/lib/node/test/proto-loader.d.ts.map +1 -0
  151. package/lib/node/test/proto-loader.js +16 -0
  152. package/lib/node/test/proto-loader.js.map +1 -0
  153. package/lib/node/test/test-protos.d.ts +29 -0
  154. package/lib/node/test/test-protos.d.ts.map +1 -0
  155. package/lib/node/test/test-protos.js +150 -0
  156. package/lib/node/test/test-protos.js.map +1 -0
  157. package/lib/package.spec.d.ts +2 -0
  158. package/lib/package.spec.d.ts.map +1 -0
  159. package/lib/package.spec.js +7 -0
  160. package/lib/package.spec.js.map +1 -0
  161. package/package.json +69 -4
  162. package/src/node/call/async-queue.ts +79 -0
  163. package/src/node/call/grpc-status.ts +49 -0
  164. package/src/node/call/message-framer.ts +109 -0
  165. package/src/node/call/metadata.ts +85 -0
  166. package/src/node/client/grpc-channel.ts +327 -0
  167. package/src/node/codec/proto-reader.ts +172 -0
  168. package/src/node/codec/proto-writer.ts +170 -0
  169. package/src/node/grpc.spec.ts +160 -0
  170. package/src/node/index.ts +15 -0
  171. package/src/node/interop.spec.ts +174 -0
  172. package/src/node/module.ts +4 -0
  173. package/src/node/proto/proto-ast.ts +48 -0
  174. package/src/node/proto/proto-parser.spec.ts +104 -0
  175. package/src/node/proto/proto-parser.ts +477 -0
  176. package/src/node/proto/proto-types.spec.ts +128 -0
  177. package/src/node/proto/proto-types.ts +497 -0
  178. package/src/node/proto/proto.ts +218 -0
  179. package/src/node/proto/well-known.ts +40 -0
  180. package/src/node/server/grpc-server-lifecycle.spec.ts +88 -0
  181. package/src/node/server/grpc-server-lifecycle.ts +56 -0
  182. package/src/node/server/grpc-server.ts +368 -0
  183. package/src/node/server/grpc-service.ts +40 -0
  184. package/src/node/test/proto-loader.ts +13 -0
  185. package/src/node/test/test-protos.ts +159 -0
  186. package/src/package.spec.ts +5 -0
@@ -0,0 +1,150 @@
1
+ const encoder = new TextEncoder();
2
+ /** Writes the protobuf binary format into a growing buffer. */
3
+ export class ProtoWriter {
4
+ constructor(initialSize = 64) {
5
+ this.pos = 0;
6
+ this.buf = new Uint8Array(initialSize);
7
+ this.view = new DataView(this.buf.buffer);
8
+ }
9
+ tag(fieldNumber, wireType) {
10
+ this.uint32(((fieldNumber << 3) | wireType) >>> 0);
11
+ }
12
+ uint32(value) {
13
+ this.ensure(5);
14
+ const buf = this.buf;
15
+ let v = value >>> 0;
16
+ while (v > 127) {
17
+ buf[this.pos++] = (v & 127) | 128;
18
+ v >>>= 7;
19
+ }
20
+ buf[this.pos++] = v;
21
+ }
22
+ int32(value) {
23
+ if (value >= 0) {
24
+ this.uint32(value);
25
+ }
26
+ else {
27
+ // Negative int32 values are sign-extended to 64 bits: always 10 bytes.
28
+ this.ensure(10);
29
+ const buf = this.buf;
30
+ let v = value >>> 0;
31
+ for (let i = 0; i < 4; i++) {
32
+ buf[this.pos++] = (v & 127) | 128;
33
+ v >>>= 7;
34
+ }
35
+ buf[this.pos++] = (v & 15) | 0xf0;
36
+ for (let i = 0; i < 4; i++) {
37
+ buf[this.pos++] = 0xff;
38
+ }
39
+ buf[this.pos++] = 1;
40
+ }
41
+ }
42
+ sint32(value) {
43
+ this.uint32((value << 1) ^ (value >> 31));
44
+ }
45
+ bool(value) {
46
+ this.ensure(1);
47
+ this.buf[this.pos++] = value ? 1 : 0;
48
+ }
49
+ /** An unsigned 64-bit varint; `value` must be in [0, 2^64). */
50
+ varint64(value) {
51
+ if (value < 0x80000000) {
52
+ this.uint32(Number(value));
53
+ return;
54
+ }
55
+ this.ensure(10);
56
+ let v = value;
57
+ while (v > 127) {
58
+ this.buf[this.pos++] = Number(v & BigInt(127)) | 128;
59
+ v >>= BigInt(7);
60
+ }
61
+ this.buf[this.pos++] = Number(v);
62
+ }
63
+ fixed32(value) {
64
+ this.ensure(4);
65
+ this.view.setUint32(this.pos, value >>> 0, true);
66
+ this.pos += 4;
67
+ }
68
+ sfixed32(value) {
69
+ this.ensure(4);
70
+ this.view.setInt32(this.pos, value | 0, true);
71
+ this.pos += 4;
72
+ }
73
+ float(value) {
74
+ this.ensure(4);
75
+ this.view.setFloat32(this.pos, value, true);
76
+ this.pos += 4;
77
+ }
78
+ double(value) {
79
+ this.ensure(8);
80
+ this.view.setFloat64(this.pos, value, true);
81
+ this.pos += 8;
82
+ }
83
+ fixed64(value) {
84
+ this.ensure(8);
85
+ this.view.setBigUint64(this.pos, value, true);
86
+ this.pos += 8;
87
+ }
88
+ sfixed64(value) {
89
+ this.ensure(8);
90
+ this.view.setBigInt64(this.pos, value, true);
91
+ this.pos += 8;
92
+ }
93
+ bytes(value) {
94
+ this.uint32(value.length);
95
+ this.ensure(value.length);
96
+ this.buf.set(value, this.pos);
97
+ this.pos += value.length;
98
+ }
99
+ string(value) {
100
+ var _a;
101
+ const start = this.fork();
102
+ this.ensure(value.length * 3);
103
+ this.pos += (_a = encoder.encodeInto(value, this.buf.subarray(this.pos)).written) !== null && _a !== void 0 ? _a : 0;
104
+ this.ldelim(start);
105
+ }
106
+ /** Starts a length-delimited value; finish it with {@link ldelim}. */
107
+ fork() {
108
+ this.ensure(1);
109
+ return this.pos++;
110
+ }
111
+ /** Writes the length of the value started at `start` by {@link fork}, moving the value when the length needs more than one byte. */
112
+ ldelim(start) {
113
+ const length = this.pos - start - 1;
114
+ if (length < 128) {
115
+ this.buf[start] = length;
116
+ return;
117
+ }
118
+ let size = 1;
119
+ for (let v = length >>> 7; v > 0; v >>>= 7) {
120
+ size++;
121
+ }
122
+ this.ensure(size - 1);
123
+ const buf = this.buf;
124
+ buf.copyWithin(start + size, start + 1, this.pos);
125
+ this.pos += size - 1;
126
+ let p = start;
127
+ let v = length;
128
+ while (v > 127) {
129
+ buf[p++] = (v & 127) | 128;
130
+ v >>>= 7;
131
+ }
132
+ buf[p] = v;
133
+ }
134
+ skip(count) {
135
+ this.ensure(count);
136
+ this.pos += count;
137
+ }
138
+ finish() {
139
+ return this.buf.subarray(0, this.pos);
140
+ }
141
+ ensure(count) {
142
+ if (this.pos + count > this.buf.length) {
143
+ const buf = new Uint8Array(Math.max(this.buf.length * 2, this.pos + count));
144
+ buf.set(this.buf.subarray(0, this.pos));
145
+ this.buf = buf;
146
+ this.view = new DataView(buf.buffer);
147
+ }
148
+ }
149
+ }
150
+ //# sourceMappingURL=proto-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proto-writer.js","sourceRoot":"","sources":["../../../src/node/codec/proto-writer.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,+DAA+D;AAC/D,MAAM,OAAO,WAAW;IAKpB,YAAY,WAAW,GAAG,EAAE;QAF5B,QAAG,GAAG,CAAC,CAAC;QAGJ,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,GAAG,CAAC,WAAmB,EAAE,QAAgB;QACrC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,KAAa;QAChB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC;QACpB,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YAClC,CAAC,MAAM,CAAC,CAAC;QACb,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,KAAa;QACf,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACb,IAAI,CAAC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AI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC;IACtB,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAES,MAAM,CAAC,KAAa;QAC1B,IAAI,IAAI,CAAC,GAAG,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;YAC5E,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACxC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,15 @@
1
+ export * from './call/async-queue.js';
2
+ export * from './call/grpc-status.js';
3
+ export * from './call/message-framer.js';
4
+ export * from './call/metadata.js';
5
+ export * from './client/grpc-channel.js';
6
+ export * from './codec/proto-reader.js';
7
+ export * from './codec/proto-writer.js';
8
+ export * from './proto/proto.js';
9
+ export * from './proto/proto-ast.js';
10
+ export * from './proto/proto-parser.js';
11
+ export * from './proto/proto-types.js';
12
+ export * from './proto/well-known.js';
13
+ export * from './server/grpc-server.js';
14
+ export * from './server/grpc-server-lifecycle.js';
15
+ export * from './server/grpc-service.js';
@@ -0,0 +1,16 @@
1
+ export * from './call/async-queue.js';
2
+ export * from './call/grpc-status.js';
3
+ export * from './call/message-framer.js';
4
+ export * from './call/metadata.js';
5
+ export * from './client/grpc-channel.js';
6
+ export * from './codec/proto-reader.js';
7
+ export * from './codec/proto-writer.js';
8
+ export * from './proto/proto.js';
9
+ export * from './proto/proto-ast.js';
10
+ export * from './proto/proto-parser.js';
11
+ export * from './proto/proto-types.js';
12
+ export * from './proto/well-known.js';
13
+ export * from './server/grpc-server.js';
14
+ export * from './server/grpc-server-lifecycle.js';
15
+ export * from './server/grpc-service.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import './index.js';
2
+ declare const _default: import("@celljs/core").ContainerModule;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { autoBind } from '@celljs/core';
2
+ import './index.js';
3
+ export default autoBind();
4
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,CAAC;AAEjB,eAAe,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,46 @@
1
+ /** What {@link ProtoParser} reads from one .proto file, before type references are resolved. */
2
+ export interface ProtoFileAst {
3
+ syntax: 'proto2' | 'proto3';
4
+ package: string;
5
+ imports: string[];
6
+ messages: MessageAst[];
7
+ enums: EnumAst[];
8
+ services: ServiceAst[];
9
+ }
10
+ export interface MessageAst {
11
+ name: string;
12
+ fields: FieldAst[];
13
+ oneofs: string[];
14
+ messages: MessageAst[];
15
+ enums: EnumAst[];
16
+ }
17
+ export interface FieldAst {
18
+ name: string;
19
+ number: number;
20
+ /** A scalar type name (`int32`, `string`...) or a message / enum reference as written. */
21
+ type: string;
22
+ rule?: 'repeated' | 'optional' | 'required';
23
+ /** Key type of a `map<K, V>` field; `type` is then the value type. */
24
+ keyType?: string;
25
+ oneof?: string;
26
+ /** `[packed = ...]`, when given. */
27
+ packed?: boolean;
28
+ }
29
+ export interface EnumAst {
30
+ name: string;
31
+ values: {
32
+ name: string;
33
+ number: number;
34
+ }[];
35
+ }
36
+ export interface ServiceAst {
37
+ name: string;
38
+ methods: MethodAst[];
39
+ }
40
+ export interface MethodAst {
41
+ name: string;
42
+ requestType: string;
43
+ requestStream: boolean;
44
+ responseType: string;
45
+ responseStream: boolean;
46
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=proto-ast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proto-ast.js","sourceRoot":"","sources":["../../../src/node/proto/proto-ast.ts"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import type { EnumAst, FieldAst, MessageAst, MethodAst, ProtoFileAst, ServiceAst } from './proto-ast.js';
2
+ interface Token {
3
+ kind: 'ident' | 'number' | 'string' | 'symbol';
4
+ value: string;
5
+ line: number;
6
+ column: number;
7
+ }
8
+ /**
9
+ * Parses the text of a .proto file (proto2 or proto3) into a {@link ProtoFileAst}: messages (nested,
10
+ * `oneof`, `map<K, V>`), enums and services. Options, `reserved`, `extensions` and `extend` blocks are
11
+ * read and skipped; groups and editions are rejected.
12
+ */
13
+ export declare class ProtoParser {
14
+ protected readonly source: string;
15
+ protected readonly fileName: string;
16
+ protected readonly tokens: Token[];
17
+ protected pos: number;
18
+ constructor(source: string, fileName?: string);
19
+ static parse(source: string, fileName?: string): ProtoFileAst;
20
+ parseFile(): ProtoFileAst;
21
+ protected parseMessage(): MessageAst;
22
+ protected parseField(): FieldAst;
23
+ protected parseEnum(): EnumAst;
24
+ protected parseService(): ServiceAst;
25
+ protected parseMethod(): MethodAst;
26
+ protected methodType(): [boolean, string];
27
+ protected optionName(): string;
28
+ protected optionValue(): string;
29
+ /** Skips the rest of an `option`, `reserved` or `extensions` statement, aggregate values included. */
30
+ protected skipStatement(): void;
31
+ /** Skips a `{ ... }` block, nested blocks included. */
32
+ protected skipBlock(): void;
33
+ protected skipUntil(symbol: string): void;
34
+ protected ident(): string;
35
+ protected string(): string;
36
+ protected integer(): number;
37
+ protected accept(value: string): boolean;
38
+ protected expect(symbol: string): void;
39
+ protected peek(offset?: number): Token;
40
+ protected next(): Token;
41
+ protected endToken(): Token;
42
+ protected fail(message: string, token: Token): never;
43
+ protected tokenize(): Token[];
44
+ }
45
+ export {};