@apibara/protocol 2.0.0-beta.2 → 2.0.0-beta.21

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.
@@ -1,279 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v1.176.0
4
- // protoc unknown
5
- // source: common.proto
6
-
7
- /* eslint-disable */
8
- import Long from "long";
9
- import _m0 from "protobufjs/minimal";
10
-
11
- export const protobufPackage = "dna.v2.common";
12
-
13
- /** A cursor over the stream content. */
14
- export interface Cursor {
15
- /** Key used for ordering messages in the stream. */
16
- readonly orderKey: bigint;
17
- /** Key used to discriminate branches in the stream. */
18
- readonly uniqueKey: Uint8Array;
19
- }
20
-
21
- /** Request for the `Status` method. */
22
- export interface StatusRequest {
23
- }
24
-
25
- /** Response for the `Status` method. */
26
- export interface StatusResponse {
27
- /** The current head of the chain. */
28
- readonly currentHead?:
29
- | Cursor
30
- | undefined;
31
- /** The last cursor that was ingested by the node. */
32
- readonly lastIngested?: Cursor | undefined;
33
- }
34
-
35
- function createBaseCursor(): Cursor {
36
- return { orderKey: BigInt("0"), uniqueKey: new Uint8Array(0) };
37
- }
38
-
39
- export const Cursor = {
40
- encode(message: Cursor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
41
- if (message.orderKey !== BigInt("0")) {
42
- if (BigInt.asUintN(64, message.orderKey) !== message.orderKey) {
43
- throw new globalThis.Error("value provided for field message.orderKey of type uint64 too large");
44
- }
45
- writer.uint32(8).uint64(message.orderKey.toString());
46
- }
47
- if (message.uniqueKey.length !== 0) {
48
- writer.uint32(18).bytes(message.uniqueKey);
49
- }
50
- return writer;
51
- },
52
-
53
- decode(input: _m0.Reader | Uint8Array, length?: number): Cursor {
54
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
55
- let end = length === undefined ? reader.len : reader.pos + length;
56
- const message = createBaseCursor() as any;
57
- while (reader.pos < end) {
58
- const tag = reader.uint32();
59
- switch (tag >>> 3) {
60
- case 1:
61
- if (tag !== 8) {
62
- break;
63
- }
64
-
65
- message.orderKey = longToBigint(reader.uint64() as Long);
66
- continue;
67
- case 2:
68
- if (tag !== 18) {
69
- break;
70
- }
71
-
72
- message.uniqueKey = reader.bytes();
73
- continue;
74
- }
75
- if ((tag & 7) === 4 || tag === 0) {
76
- break;
77
- }
78
- reader.skipType(tag & 7);
79
- }
80
- return message;
81
- },
82
-
83
- fromJSON(object: any): Cursor {
84
- return {
85
- orderKey: isSet(object.orderKey) ? BigInt(object.orderKey) : BigInt("0"),
86
- uniqueKey: isSet(object.uniqueKey) ? bytesFromBase64(object.uniqueKey) : new Uint8Array(0),
87
- };
88
- },
89
-
90
- toJSON(message: Cursor): unknown {
91
- const obj: any = {};
92
- if (message.orderKey !== BigInt("0")) {
93
- obj.orderKey = message.orderKey.toString();
94
- }
95
- if (message.uniqueKey.length !== 0) {
96
- obj.uniqueKey = base64FromBytes(message.uniqueKey);
97
- }
98
- return obj;
99
- },
100
-
101
- create(base?: DeepPartial<Cursor>): Cursor {
102
- return Cursor.fromPartial(base ?? {});
103
- },
104
- fromPartial(object: DeepPartial<Cursor>): Cursor {
105
- const message = createBaseCursor() as any;
106
- message.orderKey = object.orderKey ?? BigInt("0");
107
- message.uniqueKey = object.uniqueKey ?? new Uint8Array(0);
108
- return message;
109
- },
110
- };
111
-
112
- function createBaseStatusRequest(): StatusRequest {
113
- return {};
114
- }
115
-
116
- export const StatusRequest = {
117
- encode(_: StatusRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
118
- return writer;
119
- },
120
-
121
- decode(input: _m0.Reader | Uint8Array, length?: number): StatusRequest {
122
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
123
- let end = length === undefined ? reader.len : reader.pos + length;
124
- const message = createBaseStatusRequest() as any;
125
- while (reader.pos < end) {
126
- const tag = reader.uint32();
127
- switch (tag >>> 3) {
128
- }
129
- if ((tag & 7) === 4 || tag === 0) {
130
- break;
131
- }
132
- reader.skipType(tag & 7);
133
- }
134
- return message;
135
- },
136
-
137
- fromJSON(_: any): StatusRequest {
138
- return {};
139
- },
140
-
141
- toJSON(_: StatusRequest): unknown {
142
- const obj: any = {};
143
- return obj;
144
- },
145
-
146
- create(base?: DeepPartial<StatusRequest>): StatusRequest {
147
- return StatusRequest.fromPartial(base ?? {});
148
- },
149
- fromPartial(_: DeepPartial<StatusRequest>): StatusRequest {
150
- const message = createBaseStatusRequest() as any;
151
- return message;
152
- },
153
- };
154
-
155
- function createBaseStatusResponse(): StatusResponse {
156
- return { currentHead: undefined, lastIngested: undefined };
157
- }
158
-
159
- export const StatusResponse = {
160
- encode(message: StatusResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
161
- if (message.currentHead !== undefined) {
162
- Cursor.encode(message.currentHead, writer.uint32(10).fork()).ldelim();
163
- }
164
- if (message.lastIngested !== undefined) {
165
- Cursor.encode(message.lastIngested, writer.uint32(18).fork()).ldelim();
166
- }
167
- return writer;
168
- },
169
-
170
- decode(input: _m0.Reader | Uint8Array, length?: number): StatusResponse {
171
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
172
- let end = length === undefined ? reader.len : reader.pos + length;
173
- const message = createBaseStatusResponse() as any;
174
- while (reader.pos < end) {
175
- const tag = reader.uint32();
176
- switch (tag >>> 3) {
177
- case 1:
178
- if (tag !== 10) {
179
- break;
180
- }
181
-
182
- message.currentHead = Cursor.decode(reader, reader.uint32());
183
- continue;
184
- case 2:
185
- if (tag !== 18) {
186
- break;
187
- }
188
-
189
- message.lastIngested = Cursor.decode(reader, reader.uint32());
190
- continue;
191
- }
192
- if ((tag & 7) === 4 || tag === 0) {
193
- break;
194
- }
195
- reader.skipType(tag & 7);
196
- }
197
- return message;
198
- },
199
-
200
- fromJSON(object: any): StatusResponse {
201
- return {
202
- currentHead: isSet(object.currentHead) ? Cursor.fromJSON(object.currentHead) : undefined,
203
- lastIngested: isSet(object.lastIngested) ? Cursor.fromJSON(object.lastIngested) : undefined,
204
- };
205
- },
206
-
207
- toJSON(message: StatusResponse): unknown {
208
- const obj: any = {};
209
- if (message.currentHead !== undefined) {
210
- obj.currentHead = Cursor.toJSON(message.currentHead);
211
- }
212
- if (message.lastIngested !== undefined) {
213
- obj.lastIngested = Cursor.toJSON(message.lastIngested);
214
- }
215
- return obj;
216
- },
217
-
218
- create(base?: DeepPartial<StatusResponse>): StatusResponse {
219
- return StatusResponse.fromPartial(base ?? {});
220
- },
221
- fromPartial(object: DeepPartial<StatusResponse>): StatusResponse {
222
- const message = createBaseStatusResponse() as any;
223
- message.currentHead = (object.currentHead !== undefined && object.currentHead !== null)
224
- ? Cursor.fromPartial(object.currentHead)
225
- : undefined;
226
- message.lastIngested = (object.lastIngested !== undefined && object.lastIngested !== null)
227
- ? Cursor.fromPartial(object.lastIngested)
228
- : undefined;
229
- return message;
230
- },
231
- };
232
-
233
- function bytesFromBase64(b64: string): Uint8Array {
234
- if ((globalThis as any).Buffer) {
235
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
236
- } else {
237
- const bin = globalThis.atob(b64);
238
- const arr = new Uint8Array(bin.length);
239
- for (let i = 0; i < bin.length; ++i) {
240
- arr[i] = bin.charCodeAt(i);
241
- }
242
- return arr;
243
- }
244
- }
245
-
246
- function base64FromBytes(arr: Uint8Array): string {
247
- if ((globalThis as any).Buffer) {
248
- return globalThis.Buffer.from(arr).toString("base64");
249
- } else {
250
- const bin: string[] = [];
251
- arr.forEach((byte) => {
252
- bin.push(globalThis.String.fromCharCode(byte));
253
- });
254
- return globalThis.btoa(bin.join(""));
255
- }
256
- }
257
-
258
- type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
259
-
260
- export type DeepPartial<T> = T extends Builtin ? T
261
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
262
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
263
- : T extends { readonly $case: string }
264
- ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { readonly $case: T["$case"] }
265
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
266
- : Partial<T>;
267
-
268
- function longToBigint(long: Long) {
269
- return BigInt(long.toString());
270
- }
271
-
272
- if (_m0.util.Long !== Long) {
273
- _m0.util.Long = Long as any;
274
- _m0.configure();
275
- }
276
-
277
- function isSet(value: any): boolean {
278
- return value !== null && value !== undefined;
279
- }
package/tsconfig.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "declarationDir": "dist",
6
- "noEmit": false,
7
- "rootDir": "src",
8
- "exactOptionalPropertyTypes": true,
9
- "types": ["node"]
10
- },
11
- "include": ["src/"]
12
- }