@apibara/protocol 2.0.0-beta.39 → 2.0.0-beta.40
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.
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/shared/{protocol.8f86bf80.d.ts → protocol.4b1cfe2c.d.cts} +12 -1
- package/dist/shared/{protocol.8f86bf80.d.cts → protocol.4b1cfe2c.d.mts} +12 -1
- package/dist/shared/{protocol.8f86bf80.d.mts → protocol.4b1cfe2c.d.ts} +12 -1
- package/dist/shared/{protocol.07359592.mjs → protocol.991ff9ad.mjs} +13 -1
- package/dist/shared/{protocol.601cde5b.cjs → protocol.e39e40d6.cjs} +13 -0
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.mjs +1 -1
- package/package.json +1 -1
- package/src/common.ts +24 -0
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const config = require('./shared/protocol.
|
|
3
|
+
const config = require('./shared/protocol.e39e40d6.cjs');
|
|
4
4
|
const schema = require('@effect/schema');
|
|
5
5
|
const niceGrpc = require('nice-grpc');
|
|
6
6
|
require('protobufjs/minimal.js');
|
|
@@ -205,6 +205,7 @@ exports.cursorFromProto = config.cursorFromProto;
|
|
|
205
205
|
exports.cursorToBytes = config.cursorToBytes;
|
|
206
206
|
exports.cursorToProto = config.cursorToProto;
|
|
207
207
|
exports.isCursor = config.isCursor;
|
|
208
|
+
exports.normalizeCursor = config.normalizeCursor;
|
|
208
209
|
exports.ClientError = niceGrpc.ClientError;
|
|
209
210
|
exports.Status = niceGrpc.Status;
|
|
210
211
|
exports.GrpcClient = GrpcClient;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, b as BytesFromUint8Array,
|
|
1
|
+
import { s as stream } from './shared/protocol.4b1cfe2c.cjs';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, J as Client, E as ClientCallOptions, K as CreateClientOptions, c as Cursor, g as CursorFromBytes, C as CursorProto, y as Data, q as DataFinality, r as DataProduction, D as DnaStreamClient, a as DnaStreamDefinition, t as Duration, F as Finalize, M as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, w as StdErr, v as StdOut, A as StreamConfig, N as StreamDataIterable, G as StreamDataOptions, u as StreamDataRequest, z as StreamDataResponse, x as SystemMessage, T as TimeoutError, _ as _Cursor, L as createClient, d as createCursor, i as cursorFromBytes, f as cursorFromProto, h as cursorToBytes, e as cursorToProto, j as isCursor, n as normalizeCursor, l as statusRequestFromProto, k as statusRequestToProto, p as statusResponseFromProto, o as statusResponseToProto } from './shared/protocol.4b1cfe2c.cjs';
|
|
3
3
|
import _m0 from 'protobufjs/minimal.js';
|
|
4
4
|
export { ClientError, Status } from 'nice-grpc';
|
|
5
5
|
import '@effect/schema';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, b as BytesFromUint8Array,
|
|
1
|
+
import { s as stream } from './shared/protocol.4b1cfe2c.mjs';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, J as Client, E as ClientCallOptions, K as CreateClientOptions, c as Cursor, g as CursorFromBytes, C as CursorProto, y as Data, q as DataFinality, r as DataProduction, D as DnaStreamClient, a as DnaStreamDefinition, t as Duration, F as Finalize, M as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, w as StdErr, v as StdOut, A as StreamConfig, N as StreamDataIterable, G as StreamDataOptions, u as StreamDataRequest, z as StreamDataResponse, x as SystemMessage, T as TimeoutError, _ as _Cursor, L as createClient, d as createCursor, i as cursorFromBytes, f as cursorFromProto, h as cursorToBytes, e as cursorToProto, j as isCursor, n as normalizeCursor, l as statusRequestFromProto, k as statusRequestToProto, p as statusResponseFromProto, o as statusResponseToProto } from './shared/protocol.4b1cfe2c.mjs';
|
|
3
3
|
import _m0 from 'protobufjs/minimal.js';
|
|
4
4
|
export { ClientError, Status } from 'nice-grpc';
|
|
5
5
|
import '@effect/schema';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, b as BytesFromUint8Array,
|
|
1
|
+
import { s as stream } from './shared/protocol.4b1cfe2c.js';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, J as Client, E as ClientCallOptions, K as CreateClientOptions, c as Cursor, g as CursorFromBytes, C as CursorProto, y as Data, q as DataFinality, r as DataProduction, D as DnaStreamClient, a as DnaStreamDefinition, t as Duration, F as Finalize, M as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, w as StdErr, v as StdOut, A as StreamConfig, N as StreamDataIterable, G as StreamDataOptions, u as StreamDataRequest, z as StreamDataResponse, x as SystemMessage, T as TimeoutError, _ as _Cursor, L as createClient, d as createCursor, i as cursorFromBytes, f as cursorFromProto, h as cursorToBytes, e as cursorToProto, j as isCursor, n as normalizeCursor, l as statusRequestFromProto, k as statusRequestToProto, p as statusResponseFromProto, o as statusResponseToProto } from './shared/protocol.4b1cfe2c.js';
|
|
3
3
|
import _m0 from 'protobufjs/minimal.js';
|
|
4
4
|
export { ClientError, Status } from 'nice-grpc';
|
|
5
5
|
import '@effect/schema';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as stream, t as testing, C as Cursor, D as DnaStreamDefinition, S as StreamDataResponse } from './shared/protocol.
|
|
2
|
-
export { B as Bytes, a as BytesFromUint8Array, e as CursorFromBytes,
|
|
1
|
+
import { s as stream, t as testing, C as Cursor, D as DnaStreamDefinition, S as StreamDataResponse } from './shared/protocol.991ff9ad.mjs';
|
|
2
|
+
export { B as Bytes, a as BytesFromUint8Array, e as CursorFromBytes, q as Data, h as DataFinality, j as DataProduction, k as Duration, F as Finalize, H as Heartbeat, I as Invalidate, o as StdErr, m as StdOut, r as StreamConfig, l as StreamDataRequest, p as SystemMessage, _ as _Cursor, c as createCursor, g as cursorFromBytes, d as cursorFromProto, f as cursorToBytes, b as cursorToProto, i as isCursor, n as normalizeCursor } from './shared/protocol.991ff9ad.mjs';
|
|
3
3
|
import { Schema } from '@effect/schema';
|
|
4
4
|
import { createChannel, createClient as createClient$1 } from 'nice-grpc';
|
|
5
5
|
export { ClientError, Status } from 'nice-grpc';
|
|
@@ -454,6 +454,17 @@ declare const CursorFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8A
|
|
|
454
454
|
declare const cursorToBytes: (a: Cursor, overrideOptions?: _effect_schema_AST.ParseOptions) => Uint8Array;
|
|
455
455
|
declare const cursorFromBytes: (i: Uint8Array, overrideOptions?: _effect_schema_AST.ParseOptions) => Cursor;
|
|
456
456
|
declare function isCursor(value: unknown): value is Cursor;
|
|
457
|
+
/** Normalize a cursor.
|
|
458
|
+
*
|
|
459
|
+
* The challenge is that the `Cursor` validator expects `uniqueKey` to be either a `0x${string}`
|
|
460
|
+
* or not present at all. Setting the field to `undefined` will result in a validation error.
|
|
461
|
+
*
|
|
462
|
+
* @param cursor The cursor to normalize
|
|
463
|
+
*/
|
|
464
|
+
declare function normalizeCursor(cursor: {
|
|
465
|
+
orderKey: bigint;
|
|
466
|
+
uniqueKey: string | null;
|
|
467
|
+
}): Cursor;
|
|
457
468
|
|
|
458
469
|
/** The request to the `status` endpoint. */
|
|
459
470
|
declare const StatusRequest: Schema.Struct<{}>;
|
|
@@ -742,4 +753,4 @@ declare class StreamDataIterable<TBlock> {
|
|
|
742
753
|
[Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
|
|
743
754
|
}
|
|
744
755
|
|
|
745
|
-
export {
|
|
756
|
+
export { StreamConfig as A, Bytes as B, type CursorProto as C, type DnaStreamClient as D, type ClientCallOptions as E, Finalize as F, type StreamDataOptions as G, Heartbeat as H, Invalidate as I, type Client as J, type CreateClientOptions as K, createClient as L, GrpcClient as M, StreamDataIterable as N, DataFinality$1 as O, DataProduction$1 as P, StatusRequest as S, TimeoutError as T, _Cursor as _, DnaStreamDefinition as a, BytesFromUint8Array as b, Cursor as c, createCursor as d, cursorToProto as e, cursorFromProto as f, CursorFromBytes as g, cursorToBytes as h, cursorFromBytes as i, isCursor as j, statusRequestToProto as k, statusRequestFromProto as l, StatusResponse as m, normalizeCursor as n, statusResponseToProto as o, statusResponseFromProto as p, DataFinality as q, DataProduction as r, stream as s, Duration as t, StreamDataRequest as u, StdOut as v, StdErr as w, SystemMessage as x, Data as y, StreamDataResponse as z };
|
|
@@ -454,6 +454,17 @@ declare const CursorFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8A
|
|
|
454
454
|
declare const cursorToBytes: (a: Cursor, overrideOptions?: _effect_schema_AST.ParseOptions) => Uint8Array;
|
|
455
455
|
declare const cursorFromBytes: (i: Uint8Array, overrideOptions?: _effect_schema_AST.ParseOptions) => Cursor;
|
|
456
456
|
declare function isCursor(value: unknown): value is Cursor;
|
|
457
|
+
/** Normalize a cursor.
|
|
458
|
+
*
|
|
459
|
+
* The challenge is that the `Cursor` validator expects `uniqueKey` to be either a `0x${string}`
|
|
460
|
+
* or not present at all. Setting the field to `undefined` will result in a validation error.
|
|
461
|
+
*
|
|
462
|
+
* @param cursor The cursor to normalize
|
|
463
|
+
*/
|
|
464
|
+
declare function normalizeCursor(cursor: {
|
|
465
|
+
orderKey: bigint;
|
|
466
|
+
uniqueKey: string | null;
|
|
467
|
+
}): Cursor;
|
|
457
468
|
|
|
458
469
|
/** The request to the `status` endpoint. */
|
|
459
470
|
declare const StatusRequest: Schema.Struct<{}>;
|
|
@@ -742,4 +753,4 @@ declare class StreamDataIterable<TBlock> {
|
|
|
742
753
|
[Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
|
|
743
754
|
}
|
|
744
755
|
|
|
745
|
-
export {
|
|
756
|
+
export { StreamConfig as A, Bytes as B, type CursorProto as C, type DnaStreamClient as D, type ClientCallOptions as E, Finalize as F, type StreamDataOptions as G, Heartbeat as H, Invalidate as I, type Client as J, type CreateClientOptions as K, createClient as L, GrpcClient as M, StreamDataIterable as N, DataFinality$1 as O, DataProduction$1 as P, StatusRequest as S, TimeoutError as T, _Cursor as _, DnaStreamDefinition as a, BytesFromUint8Array as b, Cursor as c, createCursor as d, cursorToProto as e, cursorFromProto as f, CursorFromBytes as g, cursorToBytes as h, cursorFromBytes as i, isCursor as j, statusRequestToProto as k, statusRequestFromProto as l, StatusResponse as m, normalizeCursor as n, statusResponseToProto as o, statusResponseFromProto as p, DataFinality as q, DataProduction as r, stream as s, Duration as t, StreamDataRequest as u, StdOut as v, StdErr as w, SystemMessage as x, Data as y, StreamDataResponse as z };
|
|
@@ -454,6 +454,17 @@ declare const CursorFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8A
|
|
|
454
454
|
declare const cursorToBytes: (a: Cursor, overrideOptions?: _effect_schema_AST.ParseOptions) => Uint8Array;
|
|
455
455
|
declare const cursorFromBytes: (i: Uint8Array, overrideOptions?: _effect_schema_AST.ParseOptions) => Cursor;
|
|
456
456
|
declare function isCursor(value: unknown): value is Cursor;
|
|
457
|
+
/** Normalize a cursor.
|
|
458
|
+
*
|
|
459
|
+
* The challenge is that the `Cursor` validator expects `uniqueKey` to be either a `0x${string}`
|
|
460
|
+
* or not present at all. Setting the field to `undefined` will result in a validation error.
|
|
461
|
+
*
|
|
462
|
+
* @param cursor The cursor to normalize
|
|
463
|
+
*/
|
|
464
|
+
declare function normalizeCursor(cursor: {
|
|
465
|
+
orderKey: bigint;
|
|
466
|
+
uniqueKey: string | null;
|
|
467
|
+
}): Cursor;
|
|
457
468
|
|
|
458
469
|
/** The request to the `status` endpoint. */
|
|
459
470
|
declare const StatusRequest: Schema.Struct<{}>;
|
|
@@ -742,4 +753,4 @@ declare class StreamDataIterable<TBlock> {
|
|
|
742
753
|
[Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
|
|
743
754
|
}
|
|
744
755
|
|
|
745
|
-
export {
|
|
756
|
+
export { StreamConfig as A, Bytes as B, type CursorProto as C, type DnaStreamClient as D, type ClientCallOptions as E, Finalize as F, type StreamDataOptions as G, Heartbeat as H, Invalidate as I, type Client as J, type CreateClientOptions as K, createClient as L, GrpcClient as M, StreamDataIterable as N, DataFinality$1 as O, DataProduction$1 as P, StatusRequest as S, TimeoutError as T, _Cursor as _, DnaStreamDefinition as a, BytesFromUint8Array as b, Cursor as c, createCursor as d, cursorToProto as e, cursorFromProto as f, CursorFromBytes as g, cursorToBytes as h, cursorFromBytes as i, isCursor as j, statusRequestToProto as k, statusRequestFromProto as l, StatusResponse as m, normalizeCursor as n, statusResponseToProto as o, statusResponseFromProto as p, DataFinality as q, DataProduction as r, stream as s, Duration as t, StreamDataRequest as u, StdOut as v, StdErr as w, SystemMessage as x, Data as y, StreamDataResponse as z };
|
|
@@ -1147,6 +1147,18 @@ const cursorFromBytes = Schema.decodeSync(CursorFromBytes);
|
|
|
1147
1147
|
function isCursor(value) {
|
|
1148
1148
|
return Schema.is(Cursor)(value);
|
|
1149
1149
|
}
|
|
1150
|
+
function normalizeCursor(cursor) {
|
|
1151
|
+
if (cursor.uniqueKey !== null && cursor.uniqueKey.length > 0) {
|
|
1152
|
+
const uniqueKey = cursor.uniqueKey;
|
|
1153
|
+
return {
|
|
1154
|
+
orderKey: BigInt(cursor.orderKey),
|
|
1155
|
+
uniqueKey
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
return {
|
|
1159
|
+
orderKey: BigInt(cursor.orderKey)
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1150
1162
|
|
|
1151
1163
|
const DataFinality = Schema.transform(
|
|
1152
1164
|
Schema.Enums(DataFinality$1),
|
|
@@ -1293,4 +1305,4 @@ class StreamConfig {
|
|
|
1293
1305
|
}
|
|
1294
1306
|
}
|
|
1295
1307
|
|
|
1296
|
-
export { Bytes as B, Cursor as C, DnaStreamDefinition as D, Finalize as F, Heartbeat as H, Invalidate as I, MockFilter as M, StreamDataResponse as S, _Cursor as _, BytesFromUint8Array as a, cursorToProto as b, createCursor as c, cursorFromProto as d, CursorFromBytes as e, cursorToBytes as f, cursorFromBytes as g, DataFinality as h, isCursor as i, DataProduction as j, Duration as k, StreamDataRequest as l, StdOut as m,
|
|
1308
|
+
export { Bytes as B, Cursor as C, DnaStreamDefinition as D, Finalize as F, Heartbeat as H, Invalidate as I, MockFilter as M, StreamDataResponse as S, _Cursor as _, BytesFromUint8Array as a, cursorToProto as b, createCursor as c, cursorFromProto as d, CursorFromBytes as e, cursorToBytes as f, cursorFromBytes as g, DataFinality as h, isCursor as i, DataProduction as j, Duration as k, StreamDataRequest as l, StdOut as m, normalizeCursor as n, StdErr as o, SystemMessage as p, Data as q, StreamConfig as r, stream as s, testing as t, MockBlock as u };
|
|
@@ -1154,6 +1154,18 @@ const cursorFromBytes = schema.Schema.decodeSync(CursorFromBytes);
|
|
|
1154
1154
|
function isCursor(value) {
|
|
1155
1155
|
return schema.Schema.is(Cursor)(value);
|
|
1156
1156
|
}
|
|
1157
|
+
function normalizeCursor(cursor) {
|
|
1158
|
+
if (cursor.uniqueKey !== null && cursor.uniqueKey.length > 0) {
|
|
1159
|
+
const uniqueKey = cursor.uniqueKey;
|
|
1160
|
+
return {
|
|
1161
|
+
orderKey: BigInt(cursor.orderKey),
|
|
1162
|
+
uniqueKey
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
return {
|
|
1166
|
+
orderKey: BigInt(cursor.orderKey)
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1157
1169
|
|
|
1158
1170
|
const DataFinality = schema.Schema.transform(
|
|
1159
1171
|
schema.Schema.Enums(DataFinality$1),
|
|
@@ -1327,5 +1339,6 @@ exports.cursorFromProto = cursorFromProto;
|
|
|
1327
1339
|
exports.cursorToBytes = cursorToBytes;
|
|
1328
1340
|
exports.cursorToProto = cursorToProto;
|
|
1329
1341
|
exports.isCursor = isCursor;
|
|
1342
|
+
exports.normalizeCursor = normalizeCursor;
|
|
1330
1343
|
exports.stream = stream;
|
|
1331
1344
|
exports.testing = testing;
|
package/dist/testing/index.cjs
CHANGED
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as Client, u as StreamDataRequest, G as StreamDataOptions, z as StreamDataResponse, S as StatusRequest, E as ClientCallOptions, m as StatusResponse, A as StreamConfig, c as Cursor, C as CursorProto, O as DataFinality, P as DataProduction } from '../shared/protocol.4b1cfe2c.cjs';
|
|
2
2
|
import { Schema } from '@effect/schema';
|
|
3
3
|
import 'nice-grpc';
|
|
4
4
|
import 'nice-grpc-common';
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as Client, u as StreamDataRequest, G as StreamDataOptions, z as StreamDataResponse, S as StatusRequest, E as ClientCallOptions, m as StatusResponse, A as StreamConfig, c as Cursor, C as CursorProto, O as DataFinality, P as DataProduction } from '../shared/protocol.4b1cfe2c.mjs';
|
|
2
2
|
import { Schema } from '@effect/schema';
|
|
3
3
|
import 'nice-grpc';
|
|
4
4
|
import 'nice-grpc-common';
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as Client, u as StreamDataRequest, G as StreamDataOptions, z as StreamDataResponse, S as StatusRequest, E as ClientCallOptions, m as StatusResponse, A as StreamConfig, c as Cursor, C as CursorProto, O as DataFinality, P as DataProduction } from '../shared/protocol.4b1cfe2c.js';
|
|
2
2
|
import { Schema } from '@effect/schema';
|
|
3
3
|
import 'nice-grpc';
|
|
4
4
|
import 'nice-grpc-common';
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from '@effect/schema';
|
|
2
|
-
import { M as MockFilter$1,
|
|
2
|
+
import { M as MockFilter$1, u as MockBlock$1, r as StreamConfig, S as StreamDataResponse } from '../shared/protocol.991ff9ad.mjs';
|
|
3
3
|
import 'protobufjs/minimal.js';
|
|
4
4
|
import 'effect';
|
|
5
5
|
import 'viem';
|
package/package.json
CHANGED
package/src/common.ts
CHANGED
|
@@ -67,3 +67,27 @@ export const cursorFromBytes = Schema.decodeSync(CursorFromBytes);
|
|
|
67
67
|
export function isCursor(value: unknown): value is Cursor {
|
|
68
68
|
return Schema.is(Cursor)(value);
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
/** Normalize a cursor.
|
|
72
|
+
*
|
|
73
|
+
* The challenge is that the `Cursor` validator expects `uniqueKey` to be either a `0x${string}`
|
|
74
|
+
* or not present at all. Setting the field to `undefined` will result in a validation error.
|
|
75
|
+
*
|
|
76
|
+
* @param cursor The cursor to normalize
|
|
77
|
+
*/
|
|
78
|
+
export function normalizeCursor(cursor: {
|
|
79
|
+
orderKey: bigint;
|
|
80
|
+
uniqueKey: string | null;
|
|
81
|
+
}): Cursor {
|
|
82
|
+
if (cursor.uniqueKey !== null && cursor.uniqueKey.length > 0) {
|
|
83
|
+
const uniqueKey = cursor.uniqueKey as `0x${string}`;
|
|
84
|
+
return {
|
|
85
|
+
orderKey: BigInt(cursor.orderKey),
|
|
86
|
+
uniqueKey,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
orderKey: BigInt(cursor.orderKey),
|
|
92
|
+
};
|
|
93
|
+
}
|