@apibara/protocol 2.1.0-beta.22 → 2.1.0-beta.24

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 (36) hide show
  1. package/dist/codec.cjs +241 -0
  2. package/dist/codec.d.cts +81 -0
  3. package/dist/codec.d.mts +81 -0
  4. package/dist/codec.d.ts +81 -0
  5. package/dist/codec.mjs +223 -0
  6. package/dist/index.cjs +15 -29
  7. package/dist/index.d.cts +3 -4
  8. package/dist/index.d.mts +3 -4
  9. package/dist/index.d.ts +3 -4
  10. package/dist/index.mjs +14 -19
  11. package/dist/shared/{protocol.4b1cfe2c.d.cts → protocol.68a15d69.d.mts} +398 -247
  12. package/dist/shared/{protocol.4b1cfe2c.d.mts → protocol.8b5e318a.d.ts} +398 -247
  13. package/dist/shared/{protocol.991ff9ad.mjs → protocol.a64f7660.mjs} +173 -170
  14. package/dist/shared/{protocol.e39e40d6.cjs → protocol.d8bad371.cjs} +174 -176
  15. package/dist/shared/{protocol.4b1cfe2c.d.ts → protocol.f52df848.d.cts} +398 -247
  16. package/dist/testing/index.cjs +23 -37
  17. package/dist/testing/index.d.cts +107 -54
  18. package/dist/testing/index.d.mts +107 -54
  19. package/dist/testing/index.d.ts +107 -54
  20. package/dist/testing/index.mjs +23 -37
  21. package/package.json +7 -3
  22. package/src/client.ts +7 -12
  23. package/src/codec.ts +662 -0
  24. package/src/common.ts +70 -53
  25. package/src/config.ts +3 -4
  26. package/src/proto/google/protobuf/duration.ts +8 -6
  27. package/src/proto/stream.ts +38 -24
  28. package/src/status.ts +9 -16
  29. package/src/stream.ts +145 -144
  30. package/src/testing/mock.ts +35 -38
  31. package/src/common.test.ts +0 -67
  32. package/src/status.test.ts +0 -51
  33. package/src/stream.test-d.ts +0 -33
  34. package/src/stream.test.ts +0 -254
  35. package/src/testing/client.test.ts +0 -97
  36. package/src/testing/mock.test.ts +0 -35
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const schema = require('@effect/schema');
4
- const config = require('../shared/protocol.e39e40d6.cjs');
3
+ const codec = require('../codec.cjs');
4
+ const config = require('../shared/protocol.d8bad371.cjs');
5
5
  require('protobufjs/minimal.js');
6
- require('effect');
7
6
  require('viem');
8
7
  require('long');
9
8
 
@@ -41,44 +40,31 @@ class StreamDataIterable {
41
40
  }
42
41
  }
43
42
 
44
- const MockFilter = schema.Schema.Struct({
45
- filter: schema.Schema.optional(schema.Schema.String)
43
+ const MockFilter = codec.MessageCodec({
44
+ filter: codec.OptionalCodec(codec.StringCodec)
46
45
  });
47
- const MockFilterFromBytes = schema.Schema.transform(
48
- schema.Schema.Uint8ArrayFromSelf,
49
- MockFilter,
50
- {
51
- strict: false,
52
- decode(value) {
53
- return config.MockFilter.decode(value);
54
- },
55
- encode(value) {
56
- return config.MockFilter.encode(value).finish();
57
- }
46
+ const MockFilterFromBytes = {
47
+ decode(value) {
48
+ return config.MockFilter.decode(value);
49
+ },
50
+ encode(value) {
51
+ return config.MockFilter.encode(value).finish();
58
52
  }
59
- );
60
- const MockBlock = schema.Schema.Struct({
61
- data: schema.Schema.optional(schema.Schema.String)
62
- });
63
- const MockBlockFromBytes = schema.Schema.transform(
64
- schema.Schema.Uint8ArrayFromSelf,
65
- schema.Schema.NullOr(MockBlock),
66
- {
67
- strict: false,
68
- decode(value) {
69
- if (value.length === 0) {
70
- return null;
71
- }
72
- return config.MockBlock.decode(value);
73
- },
74
- encode(value) {
75
- if (value === null) {
76
- return new Uint8Array();
77
- }
78
- return config.MockBlock.encode(value).finish();
53
+ };
54
+ const MockBlockFromBytes = {
55
+ decode(value) {
56
+ if (value.length === 0) {
57
+ return null;
58
+ }
59
+ return config.MockBlock.decode(value);
60
+ },
61
+ encode(value) {
62
+ if (value === null) {
63
+ return new Uint8Array();
79
64
  }
65
+ return config.MockBlock.encode(value).finish();
80
66
  }
81
- );
67
+ };
82
68
  function mergeMockFilter(a, b) {
83
69
  let filter = "";
84
70
  if (a.filter) {
@@ -1,9 +1,8 @@
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
- import { Schema } from '@effect/schema';
3
- import 'nice-grpc';
1
+ import { w as Client, l as StreamDataRequest, v as StreamDataOptions, r as StreamDataResponse, S as StatusRequest, u as ClientCallOptions, f as StatusResponse, t as StreamConfig, B as Bytes, A as Cursor, E as DataFinality, J as DataProduction } from '../shared/protocol.f52df848.cjs';
2
+ import { MessageCodec, Codec, CodecType } from '../codec.cjs';
4
3
  import 'nice-grpc-common';
5
4
  import 'protobufjs/minimal.js';
6
- import '@effect/schema/AST';
5
+ import 'nice-grpc';
7
6
 
8
7
  declare class MockClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
9
8
  private messageFactory;
@@ -17,60 +16,114 @@ declare class StreamDataIterable<TBlock> {
17
16
  [Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
18
17
  }
19
18
 
20
- declare const MockFilter: Schema.Struct<{
21
- filter: Schema.optional<typeof Schema.String>;
19
+ declare const MockFilter: MessageCodec<{
20
+ filter: Codec<string | undefined, string | undefined>;
22
21
  }>;
23
- type MockFilter = typeof MockFilter.Type;
24
- declare const MockFilterFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.Struct<{
25
- filter: Schema.optional<typeof Schema.String>;
26
- }>>;
27
- declare const MockBlock: Schema.Struct<{
28
- data: Schema.optional<typeof Schema.String>;
22
+ type MockFilter = CodecType<typeof MockFilter>;
23
+ declare const MockFilterFromBytes: Codec<MockFilter, Uint8Array>;
24
+ declare const MockBlock: MessageCodec<{
25
+ data: Codec<string | undefined, string | undefined>;
29
26
  }>;
30
- type MockBlock = typeof MockBlock.Type;
31
- declare const MockBlockFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.NullOr<Schema.Struct<{
32
- data: Schema.optional<typeof Schema.String>;
33
- }>>>;
27
+ type MockBlock = CodecType<typeof MockBlock>;
28
+ declare const MockBlockFromBytes: Codec<MockBlock | null, Uint8Array>;
34
29
  declare const MockStream: StreamConfig<{
35
- readonly filter?: string | undefined;
30
+ filter?: string | undefined;
36
31
  }, {
37
- readonly data?: string | undefined;
32
+ data?: string | undefined;
38
33
  }>;
39
- declare const MockStreamResponse: Schema.Union<[Schema.Struct<{
40
- _tag: Schema.PropertySignature<":", "data", "$case", ":", "data", false, never>;
41
- data: Schema.Struct<{
42
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
43
- endCursor: Schema.Schema<Cursor, CursorProto, never>;
44
- finality: Schema.transform<Schema.Enums<typeof DataFinality>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
45
- production: Schema.transform<Schema.Enums<typeof DataProduction>, Schema.Literal<["backfill", "live", "unknown"]>>;
46
- data: Schema.Array$<Schema.Schema<{
47
- readonly data?: string | undefined;
48
- } | null, Uint8Array, never>>;
49
- }>;
50
- }>, Schema.Struct<{
51
- _tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
52
- invalidate: Schema.Struct<{
53
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
54
- }>;
55
- }>, Schema.Struct<{
56
- _tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
57
- finalize: Schema.Struct<{
58
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
59
- }>;
60
- }>, Schema.Struct<{
61
- _tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
62
- }>, Schema.Struct<{
63
- _tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
64
- systemMessage: Schema.Struct<{
65
- output: Schema.Union<[Schema.Struct<{
66
- _tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
67
- stdout: typeof Schema.String;
68
- }>, Schema.Struct<{
69
- _tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
70
- stderr: typeof Schema.String;
71
- }>]>;
72
- }>;
73
- }>]>;
74
- type MockStreamResponse = typeof MockStreamResponse.Type;
34
+ declare const MockStreamResponse: Codec<{
35
+ _tag: "heartbeat";
36
+ } | ({
37
+ _tag: "data";
38
+ } & {
39
+ data: {
40
+ cursor?: {
41
+ orderKey: bigint;
42
+ uniqueKey?: Bytes | undefined;
43
+ } | undefined;
44
+ endCursor: {
45
+ orderKey: bigint;
46
+ uniqueKey?: Bytes | undefined;
47
+ };
48
+ finality: "finalized" | "accepted" | "pending" | "unknown";
49
+ production: "unknown" | "backfill" | "live";
50
+ data: readonly ({
51
+ data?: string | undefined;
52
+ } | null)[];
53
+ };
54
+ }) | ({
55
+ _tag: "invalidate";
56
+ } & {
57
+ invalidate: {
58
+ cursor?: {
59
+ orderKey: bigint;
60
+ uniqueKey?: Bytes | undefined;
61
+ } | undefined;
62
+ };
63
+ }) | ({
64
+ _tag: "finalize";
65
+ } & {
66
+ finalize: {
67
+ cursor?: {
68
+ orderKey: bigint;
69
+ uniqueKey?: Bytes | undefined;
70
+ } | undefined;
71
+ };
72
+ }) | ({
73
+ _tag: "systemMessage";
74
+ } & {
75
+ systemMessage: {
76
+ output: ({
77
+ _tag: "stdout";
78
+ } & {
79
+ stdout: string;
80
+ }) | ({
81
+ _tag: "stderr";
82
+ } & {
83
+ stderr: string;
84
+ });
85
+ };
86
+ }), ({
87
+ $case: "data";
88
+ } & {
89
+ data: {
90
+ cursor?: Cursor | undefined;
91
+ endCursor: Cursor;
92
+ finality: DataFinality;
93
+ production: DataProduction;
94
+ data?: readonly Uint8Array[] | undefined;
95
+ };
96
+ }) | ({
97
+ $case: "invalidate";
98
+ } & {
99
+ invalidate: {
100
+ cursor?: Cursor | undefined;
101
+ };
102
+ }) | ({
103
+ $case: "finalize";
104
+ } & {
105
+ finalize: {
106
+ cursor?: Cursor | undefined;
107
+ };
108
+ }) | ({
109
+ $case: "heartbeat";
110
+ } & {
111
+ heartbeat: undefined;
112
+ }) | ({
113
+ $case: "systemMessage";
114
+ } & {
115
+ systemMessage: {
116
+ output: ({
117
+ $case: "stdout";
118
+ } & {
119
+ stdout: string;
120
+ }) | ({
121
+ $case: "stderr";
122
+ } & {
123
+ stderr: string;
124
+ });
125
+ };
126
+ })>;
127
+ type MockStreamResponse = CodecType<typeof MockStreamResponse>;
75
128
 
76
129
  export { MockBlock, MockBlockFromBytes, MockClient, MockFilter, MockFilterFromBytes, MockStream, MockStreamResponse, StreamDataIterable };
@@ -1,9 +1,8 @@
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
- import { Schema } from '@effect/schema';
3
- import 'nice-grpc';
1
+ import { w as Client, l as StreamDataRequest, v as StreamDataOptions, r as StreamDataResponse, S as StatusRequest, u as ClientCallOptions, f as StatusResponse, t as StreamConfig, B as Bytes, A as Cursor, E as DataFinality, J as DataProduction } from '../shared/protocol.68a15d69.mjs';
2
+ import { MessageCodec, Codec, CodecType } from '../codec.mjs';
4
3
  import 'nice-grpc-common';
5
4
  import 'protobufjs/minimal.js';
6
- import '@effect/schema/AST';
5
+ import 'nice-grpc';
7
6
 
8
7
  declare class MockClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
9
8
  private messageFactory;
@@ -17,60 +16,114 @@ declare class StreamDataIterable<TBlock> {
17
16
  [Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
18
17
  }
19
18
 
20
- declare const MockFilter: Schema.Struct<{
21
- filter: Schema.optional<typeof Schema.String>;
19
+ declare const MockFilter: MessageCodec<{
20
+ filter: Codec<string | undefined, string | undefined>;
22
21
  }>;
23
- type MockFilter = typeof MockFilter.Type;
24
- declare const MockFilterFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.Struct<{
25
- filter: Schema.optional<typeof Schema.String>;
26
- }>>;
27
- declare const MockBlock: Schema.Struct<{
28
- data: Schema.optional<typeof Schema.String>;
22
+ type MockFilter = CodecType<typeof MockFilter>;
23
+ declare const MockFilterFromBytes: Codec<MockFilter, Uint8Array>;
24
+ declare const MockBlock: MessageCodec<{
25
+ data: Codec<string | undefined, string | undefined>;
29
26
  }>;
30
- type MockBlock = typeof MockBlock.Type;
31
- declare const MockBlockFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.NullOr<Schema.Struct<{
32
- data: Schema.optional<typeof Schema.String>;
33
- }>>>;
27
+ type MockBlock = CodecType<typeof MockBlock>;
28
+ declare const MockBlockFromBytes: Codec<MockBlock | null, Uint8Array>;
34
29
  declare const MockStream: StreamConfig<{
35
- readonly filter?: string | undefined;
30
+ filter?: string | undefined;
36
31
  }, {
37
- readonly data?: string | undefined;
32
+ data?: string | undefined;
38
33
  }>;
39
- declare const MockStreamResponse: Schema.Union<[Schema.Struct<{
40
- _tag: Schema.PropertySignature<":", "data", "$case", ":", "data", false, never>;
41
- data: Schema.Struct<{
42
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
43
- endCursor: Schema.Schema<Cursor, CursorProto, never>;
44
- finality: Schema.transform<Schema.Enums<typeof DataFinality>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
45
- production: Schema.transform<Schema.Enums<typeof DataProduction>, Schema.Literal<["backfill", "live", "unknown"]>>;
46
- data: Schema.Array$<Schema.Schema<{
47
- readonly data?: string | undefined;
48
- } | null, Uint8Array, never>>;
49
- }>;
50
- }>, Schema.Struct<{
51
- _tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
52
- invalidate: Schema.Struct<{
53
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
54
- }>;
55
- }>, Schema.Struct<{
56
- _tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
57
- finalize: Schema.Struct<{
58
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
59
- }>;
60
- }>, Schema.Struct<{
61
- _tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
62
- }>, Schema.Struct<{
63
- _tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
64
- systemMessage: Schema.Struct<{
65
- output: Schema.Union<[Schema.Struct<{
66
- _tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
67
- stdout: typeof Schema.String;
68
- }>, Schema.Struct<{
69
- _tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
70
- stderr: typeof Schema.String;
71
- }>]>;
72
- }>;
73
- }>]>;
74
- type MockStreamResponse = typeof MockStreamResponse.Type;
34
+ declare const MockStreamResponse: Codec<{
35
+ _tag: "heartbeat";
36
+ } | ({
37
+ _tag: "data";
38
+ } & {
39
+ data: {
40
+ cursor?: {
41
+ orderKey: bigint;
42
+ uniqueKey?: Bytes | undefined;
43
+ } | undefined;
44
+ endCursor: {
45
+ orderKey: bigint;
46
+ uniqueKey?: Bytes | undefined;
47
+ };
48
+ finality: "finalized" | "accepted" | "pending" | "unknown";
49
+ production: "unknown" | "backfill" | "live";
50
+ data: readonly ({
51
+ data?: string | undefined;
52
+ } | null)[];
53
+ };
54
+ }) | ({
55
+ _tag: "invalidate";
56
+ } & {
57
+ invalidate: {
58
+ cursor?: {
59
+ orderKey: bigint;
60
+ uniqueKey?: Bytes | undefined;
61
+ } | undefined;
62
+ };
63
+ }) | ({
64
+ _tag: "finalize";
65
+ } & {
66
+ finalize: {
67
+ cursor?: {
68
+ orderKey: bigint;
69
+ uniqueKey?: Bytes | undefined;
70
+ } | undefined;
71
+ };
72
+ }) | ({
73
+ _tag: "systemMessage";
74
+ } & {
75
+ systemMessage: {
76
+ output: ({
77
+ _tag: "stdout";
78
+ } & {
79
+ stdout: string;
80
+ }) | ({
81
+ _tag: "stderr";
82
+ } & {
83
+ stderr: string;
84
+ });
85
+ };
86
+ }), ({
87
+ $case: "data";
88
+ } & {
89
+ data: {
90
+ cursor?: Cursor | undefined;
91
+ endCursor: Cursor;
92
+ finality: DataFinality;
93
+ production: DataProduction;
94
+ data?: readonly Uint8Array[] | undefined;
95
+ };
96
+ }) | ({
97
+ $case: "invalidate";
98
+ } & {
99
+ invalidate: {
100
+ cursor?: Cursor | undefined;
101
+ };
102
+ }) | ({
103
+ $case: "finalize";
104
+ } & {
105
+ finalize: {
106
+ cursor?: Cursor | undefined;
107
+ };
108
+ }) | ({
109
+ $case: "heartbeat";
110
+ } & {
111
+ heartbeat: undefined;
112
+ }) | ({
113
+ $case: "systemMessage";
114
+ } & {
115
+ systemMessage: {
116
+ output: ({
117
+ $case: "stdout";
118
+ } & {
119
+ stdout: string;
120
+ }) | ({
121
+ $case: "stderr";
122
+ } & {
123
+ stderr: string;
124
+ });
125
+ };
126
+ })>;
127
+ type MockStreamResponse = CodecType<typeof MockStreamResponse>;
75
128
 
76
129
  export { MockBlock, MockBlockFromBytes, MockClient, MockFilter, MockFilterFromBytes, MockStream, MockStreamResponse, StreamDataIterable };
@@ -1,9 +1,8 @@
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
- import { Schema } from '@effect/schema';
3
- import 'nice-grpc';
1
+ import { w as Client, l as StreamDataRequest, v as StreamDataOptions, r as StreamDataResponse, S as StatusRequest, u as ClientCallOptions, f as StatusResponse, t as StreamConfig, B as Bytes, A as Cursor, E as DataFinality, J as DataProduction } from '../shared/protocol.8b5e318a.js';
2
+ import { MessageCodec, Codec, CodecType } from '../codec.js';
4
3
  import 'nice-grpc-common';
5
4
  import 'protobufjs/minimal.js';
6
- import '@effect/schema/AST';
5
+ import 'nice-grpc';
7
6
 
8
7
  declare class MockClient<TFilter, TBlock> implements Client<TFilter, TBlock> {
9
8
  private messageFactory;
@@ -17,60 +16,114 @@ declare class StreamDataIterable<TBlock> {
17
16
  [Symbol.asyncIterator](): AsyncIterator<StreamDataResponse<TBlock>>;
18
17
  }
19
18
 
20
- declare const MockFilter: Schema.Struct<{
21
- filter: Schema.optional<typeof Schema.String>;
19
+ declare const MockFilter: MessageCodec<{
20
+ filter: Codec<string | undefined, string | undefined>;
22
21
  }>;
23
- type MockFilter = typeof MockFilter.Type;
24
- declare const MockFilterFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.Struct<{
25
- filter: Schema.optional<typeof Schema.String>;
26
- }>>;
27
- declare const MockBlock: Schema.Struct<{
28
- data: Schema.optional<typeof Schema.String>;
22
+ type MockFilter = CodecType<typeof MockFilter>;
23
+ declare const MockFilterFromBytes: Codec<MockFilter, Uint8Array>;
24
+ declare const MockBlock: MessageCodec<{
25
+ data: Codec<string | undefined, string | undefined>;
29
26
  }>;
30
- type MockBlock = typeof MockBlock.Type;
31
- declare const MockBlockFromBytes: Schema.transform<Schema.Schema<Uint8Array, Uint8Array, never>, Schema.NullOr<Schema.Struct<{
32
- data: Schema.optional<typeof Schema.String>;
33
- }>>>;
27
+ type MockBlock = CodecType<typeof MockBlock>;
28
+ declare const MockBlockFromBytes: Codec<MockBlock | null, Uint8Array>;
34
29
  declare const MockStream: StreamConfig<{
35
- readonly filter?: string | undefined;
30
+ filter?: string | undefined;
36
31
  }, {
37
- readonly data?: string | undefined;
32
+ data?: string | undefined;
38
33
  }>;
39
- declare const MockStreamResponse: Schema.Union<[Schema.Struct<{
40
- _tag: Schema.PropertySignature<":", "data", "$case", ":", "data", false, never>;
41
- data: Schema.Struct<{
42
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
43
- endCursor: Schema.Schema<Cursor, CursorProto, never>;
44
- finality: Schema.transform<Schema.Enums<typeof DataFinality>, Schema.Literal<["finalized", "accepted", "pending", "unknown"]>>;
45
- production: Schema.transform<Schema.Enums<typeof DataProduction>, Schema.Literal<["backfill", "live", "unknown"]>>;
46
- data: Schema.Array$<Schema.Schema<{
47
- readonly data?: string | undefined;
48
- } | null, Uint8Array, never>>;
49
- }>;
50
- }>, Schema.Struct<{
51
- _tag: Schema.PropertySignature<":", "invalidate", "$case", ":", "invalidate", false, never>;
52
- invalidate: Schema.Struct<{
53
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
54
- }>;
55
- }>, Schema.Struct<{
56
- _tag: Schema.PropertySignature<":", "finalize", "$case", ":", "finalize", false, never>;
57
- finalize: Schema.Struct<{
58
- cursor: Schema.optional<Schema.Schema<Cursor, CursorProto, never>>;
59
- }>;
60
- }>, Schema.Struct<{
61
- _tag: Schema.PropertySignature<":", "heartbeat", "$case", ":", "heartbeat", false, never>;
62
- }>, Schema.Struct<{
63
- _tag: Schema.PropertySignature<":", "systemMessage", "$case", ":", "systemMessage", false, never>;
64
- systemMessage: Schema.Struct<{
65
- output: Schema.Union<[Schema.Struct<{
66
- _tag: Schema.PropertySignature<":", "stdout", "$case", ":", "stdout", false, never>;
67
- stdout: typeof Schema.String;
68
- }>, Schema.Struct<{
69
- _tag: Schema.PropertySignature<":", "stderr", "$case", ":", "stderr", false, never>;
70
- stderr: typeof Schema.String;
71
- }>]>;
72
- }>;
73
- }>]>;
74
- type MockStreamResponse = typeof MockStreamResponse.Type;
34
+ declare const MockStreamResponse: Codec<{
35
+ _tag: "heartbeat";
36
+ } | ({
37
+ _tag: "data";
38
+ } & {
39
+ data: {
40
+ cursor?: {
41
+ orderKey: bigint;
42
+ uniqueKey?: Bytes | undefined;
43
+ } | undefined;
44
+ endCursor: {
45
+ orderKey: bigint;
46
+ uniqueKey?: Bytes | undefined;
47
+ };
48
+ finality: "finalized" | "accepted" | "pending" | "unknown";
49
+ production: "unknown" | "backfill" | "live";
50
+ data: readonly ({
51
+ data?: string | undefined;
52
+ } | null)[];
53
+ };
54
+ }) | ({
55
+ _tag: "invalidate";
56
+ } & {
57
+ invalidate: {
58
+ cursor?: {
59
+ orderKey: bigint;
60
+ uniqueKey?: Bytes | undefined;
61
+ } | undefined;
62
+ };
63
+ }) | ({
64
+ _tag: "finalize";
65
+ } & {
66
+ finalize: {
67
+ cursor?: {
68
+ orderKey: bigint;
69
+ uniqueKey?: Bytes | undefined;
70
+ } | undefined;
71
+ };
72
+ }) | ({
73
+ _tag: "systemMessage";
74
+ } & {
75
+ systemMessage: {
76
+ output: ({
77
+ _tag: "stdout";
78
+ } & {
79
+ stdout: string;
80
+ }) | ({
81
+ _tag: "stderr";
82
+ } & {
83
+ stderr: string;
84
+ });
85
+ };
86
+ }), ({
87
+ $case: "data";
88
+ } & {
89
+ data: {
90
+ cursor?: Cursor | undefined;
91
+ endCursor: Cursor;
92
+ finality: DataFinality;
93
+ production: DataProduction;
94
+ data?: readonly Uint8Array[] | undefined;
95
+ };
96
+ }) | ({
97
+ $case: "invalidate";
98
+ } & {
99
+ invalidate: {
100
+ cursor?: Cursor | undefined;
101
+ };
102
+ }) | ({
103
+ $case: "finalize";
104
+ } & {
105
+ finalize: {
106
+ cursor?: Cursor | undefined;
107
+ };
108
+ }) | ({
109
+ $case: "heartbeat";
110
+ } & {
111
+ heartbeat: undefined;
112
+ }) | ({
113
+ $case: "systemMessage";
114
+ } & {
115
+ systemMessage: {
116
+ output: ({
117
+ $case: "stdout";
118
+ } & {
119
+ stdout: string;
120
+ }) | ({
121
+ $case: "stderr";
122
+ } & {
123
+ stderr: string;
124
+ });
125
+ };
126
+ })>;
127
+ type MockStreamResponse = CodecType<typeof MockStreamResponse>;
75
128
 
76
129
  export { MockBlock, MockBlockFromBytes, MockClient, MockFilter, MockFilterFromBytes, MockStream, MockStreamResponse, StreamDataIterable };