@apibara/protocol 0.4.9 → 2.0.0-beta.1
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/CHANGELOG.md +103 -0
- package/buf.gen.yaml +14 -0
- package/build.config.ts +11 -0
- package/dist/index.cjs +189 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.mts +72 -0
- package/dist/index.d.ts +72 -4
- package/dist/index.mjs +153 -0
- package/dist/shared/protocol.6b1bdade.cjs +1060 -0
- package/dist/shared/protocol.a07a51b5.mjs +1028 -0
- package/dist/shared/protocol.e9aed6a3.d.cts +549 -0
- package/dist/shared/protocol.e9aed6a3.d.mts +549 -0
- package/dist/shared/protocol.e9aed6a3.d.ts +549 -0
- package/dist/testing/index.cjs +105 -0
- package/dist/testing/index.d.cts +70 -0
- package/dist/testing/index.d.mts +70 -0
- package/dist/testing/index.d.ts +70 -0
- package/dist/testing/index.mjs +97 -0
- package/package.json +46 -24
- package/proto/common.proto +22 -0
- package/proto/stream.proto +83 -0
- package/proto/testing.proto +11 -0
- package/src/client.ts +113 -333
- package/src/common.test.ts +67 -0
- package/src/common.ts +65 -0
- package/src/config.ts +38 -0
- package/src/index.ts +10 -3
- package/src/proto/common.ts +279 -0
- package/src/proto/index.ts +3 -1
- package/src/proto/stream.ts +728 -17
- package/src/proto/testing.ts +143 -8
- package/src/rate.ts +54 -0
- package/src/status.test.ts +51 -0
- package/src/status.ts +22 -0
- package/src/stream.test-d.ts +33 -0
- package/src/stream.test.ts +238 -0
- package/src/stream.ts +128 -0
- package/src/testing/client.test.ts +71 -0
- package/src/testing/client.ts +49 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/mock.test.ts +35 -0
- package/src/testing/mock.ts +71 -0
- package/tsconfig.json +12 -0
- package/dist/client.d.ts +0 -130
- package/dist/client.js +0 -215
- package/dist/client.js.map +0 -1
- package/dist/cursor.d.ts +0 -35
- package/dist/cursor.js +0 -67
- package/dist/cursor.js.map +0 -1
- package/dist/cursor.test.d.ts +0 -1
- package/dist/cursor.test.js +0 -22
- package/dist/cursor.test.js.map +0 -1
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/Cursor.d.ts +0 -10
- package/dist/proto/apibara/node/v1alpha2/Cursor.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/Cursor.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/Data.d.ts +0 -15
- package/dist/proto/apibara/node/v1alpha2/Data.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/Data.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/DataFinality.d.ts +0 -8
- package/dist/proto/apibara/node/v1alpha2/DataFinality.js +0 -11
- package/dist/proto/apibara/node/v1alpha2/DataFinality.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/Heartbeat.d.ts +0 -4
- package/dist/proto/apibara/node/v1alpha2/Heartbeat.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/Heartbeat.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/Invalidate.d.ts +0 -7
- package/dist/proto/apibara/node/v1alpha2/Invalidate.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/Invalidate.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/Stream.d.ts +0 -16
- package/dist/proto/apibara/node/v1alpha2/Stream.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/Stream.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/StreamDataRequest.d.ts +0 -24
- package/dist/proto/apibara/node/v1alpha2/StreamDataRequest.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/StreamDataRequest.js.map +0 -1
- package/dist/proto/apibara/node/v1alpha2/StreamDataResponse.d.ts +0 -18
- package/dist/proto/apibara/node/v1alpha2/StreamDataResponse.js +0 -4
- package/dist/proto/apibara/node/v1alpha2/StreamDataResponse.js.map +0 -1
- package/dist/proto/index.d.ts +0 -1
- package/dist/proto/index.js +0 -28
- package/dist/proto/index.js.map +0 -1
- package/dist/proto/stream.d.ts +0 -25
- package/dist/proto/stream.js +0 -3
- package/dist/proto/stream.js.map +0 -1
- package/dist/proto/stream.proto +0 -76
- package/dist/proto/testing.d.ts +0 -5
- package/dist/proto/testing.js +0 -24
- package/dist/proto/testing.js.map +0 -1
- package/dist/proto/v1alpha2.d.ts +0 -11
- package/dist/proto/v1alpha2.js +0 -15
- package/dist/proto/v1alpha2.js.map +0 -1
- package/dist/request.d.ts +0 -36
- package/dist/request.js +0 -58
- package/dist/request.js.map +0 -1
- package/dist/request.test.d.ts +0 -1
- package/dist/request.test.js +0 -28
- package/dist/request.test.js.map +0 -1
- package/src/cursor.test.ts +0 -21
- package/src/cursor.ts +0 -67
- package/src/proto/apibara/node/v1alpha2/Cursor.ts +0 -13
- package/src/proto/apibara/node/v1alpha2/Data.ts +0 -18
- package/src/proto/apibara/node/v1alpha2/DataFinality.ts +0 -20
- package/src/proto/apibara/node/v1alpha2/Heartbeat.ts +0 -8
- package/src/proto/apibara/node/v1alpha2/Invalidate.ts +0 -11
- package/src/proto/apibara/node/v1alpha2/Stream.ts +0 -23
- package/src/proto/apibara/node/v1alpha2/StreamDataRequest.ts +0 -27
- package/src/proto/apibara/node/v1alpha2/StreamDataResponse.ts +0 -22
- package/src/proto/stream.proto +0 -76
- package/src/proto/v1alpha2.ts +0 -24
- package/src/request.test.ts +0 -30
- package/src/request.ts +0 -64
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# @apibara/protocol
|
|
2
|
+
|
|
3
|
+
## 0.4.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#58](https://github.com/apibara/typescript-sdk/pull/58) [`97a7c35685ae015cd06f88576ba4c6dbd37e2f9c`](https://github.com/apibara/typescript-sdk/commit/97a7c35685ae015cd06f88576ba4c6dbd37e2f9c) Thanks [@fracek](https://github.com/fracek)! - Fix stream client to yield heartbeat messages
|
|
8
|
+
|
|
9
|
+
## 0.4.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#39](https://github.com/apibara/typescript-sdk/pull/39) [`b8f9240`](https://github.com/apibara/typescript-sdk/commit/b8f9240bb851aa8b0ac35d726fba578ca384e7f4) Thanks [@fracek](https://github.com/fracek)! - Add Cursor helpers to convert to/from javascript objects
|
|
14
|
+
|
|
15
|
+
## 0.4.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#38](https://github.com/apibara/typescript-sdk/pull/38) [`a59f20e`](https://github.com/apibara/typescript-sdk/commit/a59f20eea4d651b6b750bd65e5287a80803545c5) Thanks [@fracek](https://github.com/fracek)! - Set virtual oneof field
|
|
20
|
+
|
|
21
|
+
## 0.4.6
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#33](https://github.com/apibara/typescript-sdk/pull/33) [`3c13249`](https://github.com/apibara/typescript-sdk/commit/3c132497743cd541805cf14a822e6cd54dc82c59) Thanks [@fracek](https://github.com/fracek)! - Add message timeout option
|
|
26
|
+
|
|
27
|
+
## 0.4.5
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [#31](https://github.com/apibara/typescript-sdk/pull/31) [`936c3c3`](https://github.com/apibara/typescript-sdk/commit/936c3c3a4a5ba2e85a37a1316ed29c2ad58bb4cf) Thanks [@fracek](https://github.com/fracek)! - Add auth token to all secure credentials
|
|
32
|
+
|
|
33
|
+
## 0.4.4
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [#27](https://github.com/apibara/typescript-sdk/pull/27) [`e083d82`](https://github.com/apibara/typescript-sdk/commit/e083d824ad2f8885492b4b181c728ee2190c7373) Thanks [@fracek](https://github.com/fracek)! - Allow to connect to insecure endpoint
|
|
38
|
+
|
|
39
|
+
## 0.4.3
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- [#25](https://github.com/apibara/typescript-sdk/pull/25) [`51c3c9c`](https://github.com/apibara/typescript-sdk/commit/51c3c9cc19a33b4018c192ddfde905e90921598c) Thanks [@fracek](https://github.com/fracek)! - Handle client-server connection hanging
|
|
44
|
+
|
|
45
|
+
## 0.4.2
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- [#23](https://github.com/apibara/typescript-sdk/pull/23) [`056c9db`](https://github.com/apibara/typescript-sdk/commit/056c9db21a3bf9b0842f3cf19ff175b38d9eb69b) Thanks [@fracek](https://github.com/fracek)! - Add option to send auth token
|
|
50
|
+
|
|
51
|
+
## 0.4.1
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- [#20](https://github.com/apibara/typescript-sdk/pull/20) [`9a58f52`](https://github.com/apibara/typescript-sdk/commit/9a58f5223fad6ccb067dcb7303d7f5f559a1b9b5) Thanks [@fracek](https://github.com/fracek)! - Rethrow error if not reconnecting
|
|
56
|
+
|
|
57
|
+
## 0.4.0
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
60
|
+
|
|
61
|
+
- [#13](https://github.com/apibara/typescript-sdk/pull/13) [`0a1a959`](https://github.com/apibara/typescript-sdk/commit/0a1a9599a482520b426b0026d3a98f08cbdbb51f) Thanks [@fracek](https://github.com/fracek)! - Implement v1alpha2 protocol
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- [#17](https://github.com/apibara/typescript-sdk/pull/17) [`ec2dc90`](https://github.com/apibara/typescript-sdk/commit/ec2dc90a548e07bc6afd20662fec5109fdc80d65) Thanks [@fracek](https://github.com/fracek)! - Support protocolo v1alpha2
|
|
66
|
+
|
|
67
|
+
- [#13](https://github.com/apibara/typescript-sdk/pull/13) [`ef58eb0`](https://github.com/apibara/typescript-sdk/commit/ef58eb0c9132c0c41d2c74acfb896c5fdd5b9ecc) Thanks [@fracek](https://github.com/fracek)! - Add helper to create cursors
|
|
68
|
+
|
|
69
|
+
## 0.4.0-next.1
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- [#13](https://github.com/apibara/typescript-sdk/pull/13) [`ef58eb0`](https://github.com/apibara/typescript-sdk/commit/ef58eb0c9132c0c41d2c74acfb896c5fdd5b9ecc) Thanks [@fracek](https://github.com/fracek)! - Add helper to create cursors
|
|
74
|
+
|
|
75
|
+
## 0.4.0-next.0
|
|
76
|
+
|
|
77
|
+
### Minor Changes
|
|
78
|
+
|
|
79
|
+
- [`57f19af`](https://github.com/apibara/typescript-sdk/commit/57f19af61daae6594214e87ca3a7baae0d5ee86a) Thanks [@fracek](https://github.com/fracek)! - Implement v1alpha2 protocol
|
|
80
|
+
|
|
81
|
+
## 0.3.0
|
|
82
|
+
|
|
83
|
+
### Minor Changes
|
|
84
|
+
|
|
85
|
+
- [#8](https://github.com/apibara/typescript-sdk/pull/8) [`7f1def7`](https://github.com/apibara/typescript-sdk/commit/7f1def70426e8b5704599d2e989e5db5461aa9ac) Thanks [@fracek](https://github.com/fracek)! - Add option to automatically reconnect stream
|
|
86
|
+
|
|
87
|
+
## 0.2.0
|
|
88
|
+
|
|
89
|
+
### Minor Changes
|
|
90
|
+
|
|
91
|
+
- [#6](https://github.com/apibara/typescript-sdk/pull/6) [`439a61f`](https://github.com/apibara/typescript-sdk/commit/439a61f36e14f3b69ba6cdf9032f87f81d6475ef) Thanks [@fracek](https://github.com/fracek)! - Add pending data
|
|
92
|
+
|
|
93
|
+
## 0.1.2
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- [#4](https://github.com/apibara/typescript-sdk/pull/4) [`5383826`](https://github.com/apibara/typescript-sdk/commit/538382698f03dc1623a66c24bfef67e3e629b06d) Thanks [@fracek](https://github.com/fracek)! - Export proto module
|
|
98
|
+
|
|
99
|
+
## 0.1.1
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- [`163a28b`](https://github.com/apibara/typescript-sdk/commit/163a28b808a8d15bd927f7feaf34546a681c346e) Thanks [@fracek](https://github.com/fracek)! - Initial release
|
package/buf.gen.yaml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
version: v2
|
|
2
|
+
plugins:
|
|
3
|
+
- remote: buf.build/community/stephenh-ts-proto:v1.176.0
|
|
4
|
+
out: src/proto/
|
|
5
|
+
opt:
|
|
6
|
+
- outputServices=nice-grpc
|
|
7
|
+
- outputServices=generic-definitions
|
|
8
|
+
- useExactTypes=false
|
|
9
|
+
- useOptionals=messages
|
|
10
|
+
- useReadonlyTypes=true
|
|
11
|
+
- forceLong=bigint
|
|
12
|
+
- esModuleInterop=true
|
|
13
|
+
- removeEnumPrefix=true
|
|
14
|
+
- oneof=unions
|
package/build.config.ts
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('./shared/protocol.6b1bdade.cjs');
|
|
4
|
+
const schema = require('@effect/schema');
|
|
5
|
+
const niceGrpc = require('nice-grpc');
|
|
6
|
+
require('protobufjs/minimal');
|
|
7
|
+
const assert = require('node:assert');
|
|
8
|
+
require('effect');
|
|
9
|
+
require('viem');
|
|
10
|
+
require('long');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
13
|
+
|
|
14
|
+
const assert__default = /*#__PURE__*/_interopDefaultCompat(assert);
|
|
15
|
+
|
|
16
|
+
const index = {
|
|
17
|
+
__proto__: null,
|
|
18
|
+
common: config.common,
|
|
19
|
+
stream: config.stream,
|
|
20
|
+
testing: config.testing
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const StatusRequest = schema.Schema.Struct({});
|
|
24
|
+
const statusRequestToProto = schema.Schema.encodeSync(StatusRequest);
|
|
25
|
+
const statusRequestFromProto = schema.Schema.decodeSync(StatusRequest);
|
|
26
|
+
const StatusResponse = schema.Schema.Struct({
|
|
27
|
+
currentHead: schema.Schema.optional(config.Cursor),
|
|
28
|
+
lastIngested: schema.Schema.optional(config.Cursor)
|
|
29
|
+
});
|
|
30
|
+
const statusResponseToProto = schema.Schema.encodeSync(StatusResponse);
|
|
31
|
+
const statusResponseFromProto = schema.Schema.decodeSync(StatusResponse);
|
|
32
|
+
|
|
33
|
+
var __defProp$1 = Object.defineProperty;
|
|
34
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
35
|
+
var __publicField$1 = (obj, key, value) => {
|
|
36
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
+
return value;
|
|
38
|
+
};
|
|
39
|
+
function createClient(config$1, streamUrl, defaultCallOptions) {
|
|
40
|
+
const channel = niceGrpc.createChannel(streamUrl);
|
|
41
|
+
const client = niceGrpc.createClient(
|
|
42
|
+
config.DnaStreamDefinition,
|
|
43
|
+
channel,
|
|
44
|
+
defaultCallOptions
|
|
45
|
+
);
|
|
46
|
+
return new GrpcClient(config$1, client);
|
|
47
|
+
}
|
|
48
|
+
class GrpcClient {
|
|
49
|
+
constructor(config, client) {
|
|
50
|
+
this.config = config;
|
|
51
|
+
this.client = client;
|
|
52
|
+
__publicField$1(this, "encodeRequest");
|
|
53
|
+
this.encodeRequest = schema.Schema.encodeSync(config.Request);
|
|
54
|
+
}
|
|
55
|
+
async status(request, options) {
|
|
56
|
+
const response = await this.client.status(
|
|
57
|
+
statusRequestToProto(request ?? {}),
|
|
58
|
+
options
|
|
59
|
+
);
|
|
60
|
+
return statusResponseFromProto(response);
|
|
61
|
+
}
|
|
62
|
+
streamData(request, options) {
|
|
63
|
+
const it = this.client.streamData(this.encodeRequest(request), options);
|
|
64
|
+
return new StreamDataIterable(it, this.config.Block, options);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class StreamDataIterable {
|
|
68
|
+
constructor(it, schema, options) {
|
|
69
|
+
this.it = it;
|
|
70
|
+
this.schema = schema;
|
|
71
|
+
this.options = options;
|
|
72
|
+
}
|
|
73
|
+
[Symbol.asyncIterator]() {
|
|
74
|
+
const inner = this.it[Symbol.asyncIterator]();
|
|
75
|
+
const schema$1 = config.StreamDataResponse(this.schema);
|
|
76
|
+
const decoder = schema.Schema.decodeSync(schema$1);
|
|
77
|
+
const { endingCursor } = this.options ?? {};
|
|
78
|
+
let shouldStop = false;
|
|
79
|
+
return {
|
|
80
|
+
async next() {
|
|
81
|
+
if (shouldStop) {
|
|
82
|
+
return { done: true, value: void 0 };
|
|
83
|
+
}
|
|
84
|
+
const { done, value } = await inner.next();
|
|
85
|
+
if (done || value.message === void 0) {
|
|
86
|
+
return { done: true, value: void 0 };
|
|
87
|
+
}
|
|
88
|
+
const decodedMessage = decoder(value.message);
|
|
89
|
+
if (endingCursor) {
|
|
90
|
+
assert__default(value.message.$case === "data");
|
|
91
|
+
assert__default(decodedMessage._tag === "data");
|
|
92
|
+
const { orderKey, uniqueKey } = endingCursor;
|
|
93
|
+
const endCursor = decodedMessage.data.endCursor;
|
|
94
|
+
if (orderKey === endCursor?.orderKey) {
|
|
95
|
+
if (!uniqueKey || uniqueKey === endCursor.uniqueKey) {
|
|
96
|
+
shouldStop = true;
|
|
97
|
+
return { done: false, value: decodedMessage };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
done: false,
|
|
103
|
+
value: decodedMessage
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var __defProp = Object.defineProperty;
|
|
111
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
112
|
+
var __publicField = (obj, key, value) => {
|
|
113
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
114
|
+
return value;
|
|
115
|
+
};
|
|
116
|
+
class RateGauge {
|
|
117
|
+
constructor(intervalSeconds) {
|
|
118
|
+
__publicField(this, "interval");
|
|
119
|
+
__publicField(this, "prev");
|
|
120
|
+
__publicField(this, "rateMs");
|
|
121
|
+
__publicField(this, "var");
|
|
122
|
+
this.interval = intervalSeconds * 1e3;
|
|
123
|
+
this.var = 0;
|
|
124
|
+
}
|
|
125
|
+
record(items) {
|
|
126
|
+
const prev = this.prev;
|
|
127
|
+
const now = process.hrtime.bigint();
|
|
128
|
+
this.prev = now;
|
|
129
|
+
if (!prev) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const deltaMs = Number(now - prev) / 1e6;
|
|
133
|
+
const rateMs = items / deltaMs;
|
|
134
|
+
if (this.rateMs === void 0) {
|
|
135
|
+
this.rateMs = rateMs;
|
|
136
|
+
this.var = 0;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const alpha = 1 - Math.exp(-deltaMs / this.interval);
|
|
140
|
+
this.rateMs = alpha * rateMs + (1 - alpha) * this.rateMs;
|
|
141
|
+
const diff = rateMs - this.rateMs;
|
|
142
|
+
const incr = alpha * diff;
|
|
143
|
+
this.var = (1 - alpha) * (this.var + incr * diff);
|
|
144
|
+
}
|
|
145
|
+
/** Returns the average rate per second. */
|
|
146
|
+
average() {
|
|
147
|
+
if (this.rateMs === void 0) {
|
|
148
|
+
return void 0;
|
|
149
|
+
}
|
|
150
|
+
return this.rateMs * 1e3;
|
|
151
|
+
}
|
|
152
|
+
/** Returns the variance. */
|
|
153
|
+
variance() {
|
|
154
|
+
return this.var;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
exports.Bytes = config.Bytes;
|
|
159
|
+
exports.BytesFromUint8Array = config.BytesFromUint8Array;
|
|
160
|
+
exports.Cursor = config.Cursor;
|
|
161
|
+
exports.CursorFromBytes = config.CursorFromBytes;
|
|
162
|
+
exports.Data = config.Data;
|
|
163
|
+
exports.DataFinality = config.DataFinality;
|
|
164
|
+
exports.DnaStreamDefinition = config.DnaStreamDefinition;
|
|
165
|
+
exports.Heartbeat = config.Heartbeat;
|
|
166
|
+
exports.Invalidate = config.Invalidate;
|
|
167
|
+
exports.StdErr = config.StdErr;
|
|
168
|
+
exports.StdOut = config.StdOut;
|
|
169
|
+
exports.StreamConfig = config.StreamConfig;
|
|
170
|
+
exports.StreamDataRequest = config.StreamDataRequest;
|
|
171
|
+
exports.StreamDataResponse = config.StreamDataResponse;
|
|
172
|
+
exports.SystemMessage = config.SystemMessage;
|
|
173
|
+
exports._Cursor = config._Cursor;
|
|
174
|
+
exports.createCursor = config.createCursor;
|
|
175
|
+
exports.cursorFromBytes = config.cursorFromBytes;
|
|
176
|
+
exports.cursorFromProto = config.cursorFromProto;
|
|
177
|
+
exports.cursorToBytes = config.cursorToBytes;
|
|
178
|
+
exports.cursorToProto = config.cursorToProto;
|
|
179
|
+
exports.GrpcClient = GrpcClient;
|
|
180
|
+
exports.RateGauge = RateGauge;
|
|
181
|
+
exports.StatusRequest = StatusRequest;
|
|
182
|
+
exports.StatusResponse = StatusResponse;
|
|
183
|
+
exports.StreamDataIterable = StreamDataIterable;
|
|
184
|
+
exports.createClient = createClient;
|
|
185
|
+
exports.proto = index;
|
|
186
|
+
exports.statusRequestFromProto = statusRequestFromProto;
|
|
187
|
+
exports.statusRequestToProto = statusRequestToProto;
|
|
188
|
+
exports.statusResponseFromProto = statusResponseFromProto;
|
|
189
|
+
exports.statusResponseToProto = statusResponseToProto;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { c as common, s as stream } from './shared/protocol.e9aed6a3.cjs';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, A as Client, y as ClientCallOptions, d as Cursor, h as CursorFromBytes, C as CursorProto, v as Data, p as DataFinality, D as DnaStreamClient, a as DnaStreamDefinition, G as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, t as StdErr, r as StdOut, x as StreamConfig, F as StreamDataIterable, z as StreamDataOptions, q as StreamDataRequest, w as StreamDataResponse, u as SystemMessage, _ as _Cursor, E as createClient, e as createCursor, j as cursorFromBytes, g as cursorFromProto, i as cursorToBytes, f as cursorToProto, l as statusRequestFromProto, k as statusRequestToProto, o as statusResponseFromProto, n as statusResponseToProto } from './shared/protocol.e9aed6a3.cjs';
|
|
3
|
+
import _m0 from 'protobufjs/minimal';
|
|
4
|
+
import '@effect/schema';
|
|
5
|
+
import 'nice-grpc';
|
|
6
|
+
import 'nice-grpc-common';
|
|
7
|
+
import '@effect/schema/AST';
|
|
8
|
+
|
|
9
|
+
declare const protobufPackage = "dna.v2.testing";
|
|
10
|
+
interface MockFilter {
|
|
11
|
+
readonly filter?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
declare const MockFilter: {
|
|
14
|
+
encode(message: MockFilter, writer?: _m0.Writer): _m0.Writer;
|
|
15
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MockFilter;
|
|
16
|
+
fromJSON(object: any): MockFilter;
|
|
17
|
+
toJSON(message: MockFilter): unknown;
|
|
18
|
+
create(base?: DeepPartial<MockFilter>): MockFilter;
|
|
19
|
+
fromPartial(object: DeepPartial<MockFilter>): MockFilter;
|
|
20
|
+
};
|
|
21
|
+
interface MockBlock {
|
|
22
|
+
readonly data?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
declare const MockBlock: {
|
|
25
|
+
encode(message: MockBlock, writer?: _m0.Writer): _m0.Writer;
|
|
26
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MockBlock;
|
|
27
|
+
fromJSON(object: any): MockBlock;
|
|
28
|
+
toJSON(message: MockBlock): unknown;
|
|
29
|
+
create(base?: DeepPartial<MockBlock>): MockBlock;
|
|
30
|
+
fromPartial(object: DeepPartial<MockBlock>): MockBlock;
|
|
31
|
+
};
|
|
32
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
33
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
34
|
+
readonly $case: string;
|
|
35
|
+
} ? {
|
|
36
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
37
|
+
} & {
|
|
38
|
+
readonly $case: T["$case"];
|
|
39
|
+
} : T extends {} ? {
|
|
40
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
41
|
+
} : Partial<T>;
|
|
42
|
+
|
|
43
|
+
type testing_DeepPartial<T> = DeepPartial<T>;
|
|
44
|
+
declare const testing_MockBlock: typeof MockBlock;
|
|
45
|
+
declare const testing_MockFilter: typeof MockFilter;
|
|
46
|
+
declare const testing_protobufPackage: typeof protobufPackage;
|
|
47
|
+
declare namespace testing {
|
|
48
|
+
export { type testing_DeepPartial as DeepPartial, testing_MockBlock as MockBlock, testing_MockFilter as MockFilter, testing_protobufPackage as protobufPackage };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare const index_common: typeof common;
|
|
52
|
+
declare const index_stream: typeof stream;
|
|
53
|
+
declare const index_testing: typeof testing;
|
|
54
|
+
declare namespace index {
|
|
55
|
+
export { index_common as common, index_stream as stream, index_testing as testing };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Track data rate using high precision timers. */
|
|
59
|
+
declare class RateGauge {
|
|
60
|
+
private interval;
|
|
61
|
+
private prev?;
|
|
62
|
+
private rateMs?;
|
|
63
|
+
private var;
|
|
64
|
+
constructor(intervalSeconds: number);
|
|
65
|
+
record(items: number): void;
|
|
66
|
+
/** Returns the average rate per second. */
|
|
67
|
+
average(): number | undefined;
|
|
68
|
+
/** Returns the variance. */
|
|
69
|
+
variance(): number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { RateGauge, index as proto };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { c as common, s as stream } from './shared/protocol.e9aed6a3.mjs';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, A as Client, y as ClientCallOptions, d as Cursor, h as CursorFromBytes, C as CursorProto, v as Data, p as DataFinality, D as DnaStreamClient, a as DnaStreamDefinition, G as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, t as StdErr, r as StdOut, x as StreamConfig, F as StreamDataIterable, z as StreamDataOptions, q as StreamDataRequest, w as StreamDataResponse, u as SystemMessage, _ as _Cursor, E as createClient, e as createCursor, j as cursorFromBytes, g as cursorFromProto, i as cursorToBytes, f as cursorToProto, l as statusRequestFromProto, k as statusRequestToProto, o as statusResponseFromProto, n as statusResponseToProto } from './shared/protocol.e9aed6a3.mjs';
|
|
3
|
+
import _m0 from 'protobufjs/minimal';
|
|
4
|
+
import '@effect/schema';
|
|
5
|
+
import 'nice-grpc';
|
|
6
|
+
import 'nice-grpc-common';
|
|
7
|
+
import '@effect/schema/AST';
|
|
8
|
+
|
|
9
|
+
declare const protobufPackage = "dna.v2.testing";
|
|
10
|
+
interface MockFilter {
|
|
11
|
+
readonly filter?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
declare const MockFilter: {
|
|
14
|
+
encode(message: MockFilter, writer?: _m0.Writer): _m0.Writer;
|
|
15
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MockFilter;
|
|
16
|
+
fromJSON(object: any): MockFilter;
|
|
17
|
+
toJSON(message: MockFilter): unknown;
|
|
18
|
+
create(base?: DeepPartial<MockFilter>): MockFilter;
|
|
19
|
+
fromPartial(object: DeepPartial<MockFilter>): MockFilter;
|
|
20
|
+
};
|
|
21
|
+
interface MockBlock {
|
|
22
|
+
readonly data?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
declare const MockBlock: {
|
|
25
|
+
encode(message: MockBlock, writer?: _m0.Writer): _m0.Writer;
|
|
26
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MockBlock;
|
|
27
|
+
fromJSON(object: any): MockBlock;
|
|
28
|
+
toJSON(message: MockBlock): unknown;
|
|
29
|
+
create(base?: DeepPartial<MockBlock>): MockBlock;
|
|
30
|
+
fromPartial(object: DeepPartial<MockBlock>): MockBlock;
|
|
31
|
+
};
|
|
32
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
33
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
34
|
+
readonly $case: string;
|
|
35
|
+
} ? {
|
|
36
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
37
|
+
} & {
|
|
38
|
+
readonly $case: T["$case"];
|
|
39
|
+
} : T extends {} ? {
|
|
40
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
41
|
+
} : Partial<T>;
|
|
42
|
+
|
|
43
|
+
type testing_DeepPartial<T> = DeepPartial<T>;
|
|
44
|
+
declare const testing_MockBlock: typeof MockBlock;
|
|
45
|
+
declare const testing_MockFilter: typeof MockFilter;
|
|
46
|
+
declare const testing_protobufPackage: typeof protobufPackage;
|
|
47
|
+
declare namespace testing {
|
|
48
|
+
export { type testing_DeepPartial as DeepPartial, testing_MockBlock as MockBlock, testing_MockFilter as MockFilter, testing_protobufPackage as protobufPackage };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare const index_common: typeof common;
|
|
52
|
+
declare const index_stream: typeof stream;
|
|
53
|
+
declare const index_testing: typeof testing;
|
|
54
|
+
declare namespace index {
|
|
55
|
+
export { index_common as common, index_stream as stream, index_testing as testing };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Track data rate using high precision timers. */
|
|
59
|
+
declare class RateGauge {
|
|
60
|
+
private interval;
|
|
61
|
+
private prev?;
|
|
62
|
+
private rateMs?;
|
|
63
|
+
private var;
|
|
64
|
+
constructor(intervalSeconds: number);
|
|
65
|
+
record(items: number): void;
|
|
66
|
+
/** Returns the average rate per second. */
|
|
67
|
+
average(): number | undefined;
|
|
68
|
+
/** Returns the variance. */
|
|
69
|
+
variance(): number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { RateGauge, index as proto };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { c as common, s as stream } from './shared/protocol.e9aed6a3.js';
|
|
2
|
+
export { B as Bytes, b as BytesFromUint8Array, A as Client, y as ClientCallOptions, d as Cursor, h as CursorFromBytes, C as CursorProto, v as Data, p as DataFinality, D as DnaStreamClient, a as DnaStreamDefinition, G as GrpcClient, H as Heartbeat, I as Invalidate, S as StatusRequest, m as StatusResponse, t as StdErr, r as StdOut, x as StreamConfig, F as StreamDataIterable, z as StreamDataOptions, q as StreamDataRequest, w as StreamDataResponse, u as SystemMessage, _ as _Cursor, E as createClient, e as createCursor, j as cursorFromBytes, g as cursorFromProto, i as cursorToBytes, f as cursorToProto, l as statusRequestFromProto, k as statusRequestToProto, o as statusResponseFromProto, n as statusResponseToProto } from './shared/protocol.e9aed6a3.js';
|
|
3
|
+
import _m0 from 'protobufjs/minimal';
|
|
4
|
+
import '@effect/schema';
|
|
5
|
+
import 'nice-grpc';
|
|
6
|
+
import 'nice-grpc-common';
|
|
7
|
+
import '@effect/schema/AST';
|
|
8
|
+
|
|
9
|
+
declare const protobufPackage = "dna.v2.testing";
|
|
10
|
+
interface MockFilter {
|
|
11
|
+
readonly filter?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
declare const MockFilter: {
|
|
14
|
+
encode(message: MockFilter, writer?: _m0.Writer): _m0.Writer;
|
|
15
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MockFilter;
|
|
16
|
+
fromJSON(object: any): MockFilter;
|
|
17
|
+
toJSON(message: MockFilter): unknown;
|
|
18
|
+
create(base?: DeepPartial<MockFilter>): MockFilter;
|
|
19
|
+
fromPartial(object: DeepPartial<MockFilter>): MockFilter;
|
|
20
|
+
};
|
|
21
|
+
interface MockBlock {
|
|
22
|
+
readonly data?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
declare const MockBlock: {
|
|
25
|
+
encode(message: MockBlock, writer?: _m0.Writer): _m0.Writer;
|
|
26
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MockBlock;
|
|
27
|
+
fromJSON(object: any): MockBlock;
|
|
28
|
+
toJSON(message: MockBlock): unknown;
|
|
29
|
+
create(base?: DeepPartial<MockBlock>): MockBlock;
|
|
30
|
+
fromPartial(object: DeepPartial<MockBlock>): MockBlock;
|
|
31
|
+
};
|
|
32
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
33
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
|
|
34
|
+
readonly $case: string;
|
|
35
|
+
} ? {
|
|
36
|
+
[K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
|
|
37
|
+
} & {
|
|
38
|
+
readonly $case: T["$case"];
|
|
39
|
+
} : T extends {} ? {
|
|
40
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
41
|
+
} : Partial<T>;
|
|
42
|
+
|
|
43
|
+
type testing_DeepPartial<T> = DeepPartial<T>;
|
|
44
|
+
declare const testing_MockBlock: typeof MockBlock;
|
|
45
|
+
declare const testing_MockFilter: typeof MockFilter;
|
|
46
|
+
declare const testing_protobufPackage: typeof protobufPackage;
|
|
47
|
+
declare namespace testing {
|
|
48
|
+
export { type testing_DeepPartial as DeepPartial, testing_MockBlock as MockBlock, testing_MockFilter as MockFilter, testing_protobufPackage as protobufPackage };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare const index_common: typeof common;
|
|
52
|
+
declare const index_stream: typeof stream;
|
|
53
|
+
declare const index_testing: typeof testing;
|
|
54
|
+
declare namespace index {
|
|
55
|
+
export { index_common as common, index_stream as stream, index_testing as testing };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Track data rate using high precision timers. */
|
|
59
|
+
declare class RateGauge {
|
|
60
|
+
private interval;
|
|
61
|
+
private prev?;
|
|
62
|
+
private rateMs?;
|
|
63
|
+
private var;
|
|
64
|
+
constructor(intervalSeconds: number);
|
|
65
|
+
record(items: number): void;
|
|
66
|
+
/** Returns the average rate per second. */
|
|
67
|
+
average(): number | undefined;
|
|
68
|
+
/** Returns the variance. */
|
|
69
|
+
variance(): number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { RateGauge, index as proto };
|