@xyo-network/xl1-protocol-sdk 3.0.6 → 3.0.7
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/neutral/CreatableProvider/AbstractCreatableProvider.d.ts +5 -95
- package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
- package/dist/neutral/config/Actor.d.ts +30 -573
- package/dist/neutral/config/Actor.d.ts.map +1 -1
- package/dist/neutral/config/Actors.d.ts +5 -98
- package/dist/neutral/config/Actors.d.ts.map +1 -1
- package/dist/neutral/config/Base.d.ts +5 -98
- package/dist/neutral/config/Base.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +20 -386
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/HostActor.d.ts +30 -573
- package/dist/neutral/config/HostActor.d.ts.map +1 -1
- package/dist/neutral/config/index.d.ts +2 -4
- package/dist/neutral/config/index.d.ts.map +1 -1
- package/dist/neutral/config/normalizeConnectionsConfig.d.ts +2 -5
- package/dist/neutral/config/normalizeConnectionsConfig.d.ts.map +1 -1
- package/dist/neutral/config/synthesizeRpcConnectionBindings.d.ts +8 -0
- package/dist/neutral/config/synthesizeRpcConnectionBindings.d.ts.map +1 -0
- package/dist/neutral/config/transports/Mongo.d.ts +12 -0
- package/dist/neutral/config/transports/Mongo.d.ts.map +1 -0
- package/dist/neutral/config/{Remote.d.ts → transports/Rpc.d.ts} +1 -14
- package/dist/neutral/config/transports/Rpc.d.ts.map +1 -0
- package/dist/neutral/config/transports/S3.d.ts +19 -0
- package/dist/neutral/config/transports/S3.d.ts.map +1 -0
- package/dist/neutral/config/transports/Transport.d.ts +15 -6
- package/dist/neutral/config/transports/Transport.d.ts.map +1 -1
- package/dist/neutral/config/transports/index.d.ts +3 -0
- package/dist/neutral/config/transports/index.d.ts.map +1 -1
- package/dist/neutral/context/Actor.d.ts +30 -573
- package/dist/neutral/context/Actor.d.ts.map +1 -1
- package/dist/neutral/context/HostActor.d.ts +30 -573
- package/dist/neutral/context/HostActor.d.ts.map +1 -1
- package/dist/neutral/context/index.d.ts +0 -1
- package/dist/neutral/context/index.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.d.ts +10 -190
- package/dist/neutral/getFileConfig.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.mjs +133 -199
- package/dist/neutral/getFileConfig.mjs.map +4 -4
- package/dist/neutral/index.mjs +317 -567
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts +30 -573
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts.map +1 -1
- package/dist/neutral/simple/mempool/SimpleMempoolRunner.d.ts +1 -1
- package/dist/neutral/test/index.mjs +141 -207
- package/dist/neutral/test/index.mjs.map +4 -4
- package/package.json +13 -13
- package/dist/neutral/config/Evm.d.ts +0 -24
- package/dist/neutral/config/Evm.d.ts.map +0 -1
- package/dist/neutral/config/Remote.d.ts.map +0 -1
- package/dist/neutral/config/adaptLegacyConfig.d.ts +0 -8
- package/dist/neutral/config/adaptLegacyConfig.d.ts.map +0 -1
- package/dist/neutral/config/storage/Storage.d.ts +0 -45
- package/dist/neutral/config/storage/Storage.d.ts.map +0 -1
- package/dist/neutral/config/storage/driver/Mongo.d.ts +0 -25
- package/dist/neutral/config/storage/driver/Mongo.d.ts.map +0 -1
- package/dist/neutral/config/storage/driver/S3.d.ts +0 -77
- package/dist/neutral/config/storage/driver/S3.d.ts.map +0 -1
- package/dist/neutral/config/storage/driver/index.d.ts +0 -3
- package/dist/neutral/config/storage/driver/index.d.ts.map +0 -1
- package/dist/neutral/config/storage/index.d.ts +0 -3
- package/dist/neutral/config/storage/index.d.ts.map +0 -1
- package/dist/neutral/context/getEmptyProviderContext.d.ts +0 -7
- package/dist/neutral/context/getEmptyProviderContext.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/getFileConfig.ts
|
|
2
|
-
import { isDefined
|
|
2
|
+
import { isDefined, isNull } from "@xylabs/sdk-js";
|
|
3
3
|
import { cosmiconfig } from "cosmiconfig";
|
|
4
|
-
import { z as
|
|
4
|
+
import { z as z19 } from "zod/mini";
|
|
5
5
|
|
|
6
6
|
// src/config/Actor.ts
|
|
7
7
|
import {
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
zodIsFactory as zodIsFactory2,
|
|
10
10
|
zodToFactory as zodToFactory2
|
|
11
11
|
} from "@xylabs/sdk-js";
|
|
12
|
-
import { globalRegistry as
|
|
12
|
+
import { globalRegistry as globalRegistry11, z as z16 } from "zod/mini";
|
|
13
13
|
|
|
14
14
|
// src/config/Base.ts
|
|
15
|
-
import { z as
|
|
15
|
+
import { z as z15 } from "zod/mini";
|
|
16
16
|
|
|
17
17
|
// src/config/Chain.ts
|
|
18
18
|
import { HexZod } from "@xylabs/sdk-js";
|
|
@@ -32,148 +32,129 @@ var ChainConfigZod = z.object({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// src/config/transports/Transport.ts
|
|
35
|
-
import { globalRegistry as
|
|
35
|
+
import { globalRegistry as globalRegistry3, z as z4 } from "zod";
|
|
36
36
|
|
|
37
|
-
// src/config/
|
|
37
|
+
// src/config/transports/Mongo.ts
|
|
38
38
|
import { globalRegistry as globalRegistry2, z as z2 } from "zod";
|
|
39
|
-
var
|
|
40
|
-
protocol: z2.string("http").register(globalRegistry2, {
|
|
41
|
-
description: "Protocol for the RPC connection",
|
|
42
|
-
type: "string"
|
|
43
|
-
})
|
|
44
|
-
}).describe("Base configuration for the remote RPC");
|
|
45
|
-
var HttpRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
46
|
-
protocol: z2.string("http").register(globalRegistry2, {
|
|
47
|
-
description: "Protocol for the RPC connection",
|
|
48
|
-
type: "string"
|
|
49
|
-
}).default("http"),
|
|
50
|
-
url: z2.string().register(globalRegistry2, {
|
|
51
|
-
description: "URL for the Chain RPC API",
|
|
52
|
-
type: "string"
|
|
53
|
-
})
|
|
54
|
-
}).describe("Configuration for the remote RPC using Http");
|
|
55
|
-
var PostMessageRpcRemoteConfigZod = RpcRemoteConfigBaseZod.extend({
|
|
56
|
-
protocol: z2.string().register(globalRegistry2, {
|
|
57
|
-
description: "Protocol for the RPC connection",
|
|
58
|
-
type: "string"
|
|
59
|
-
}).default("postMessage"),
|
|
60
|
-
networkId: z2.string().register(globalRegistry2, {
|
|
61
|
-
description: "Network ID to use for the postMessage RPC connection",
|
|
62
|
-
type: "string"
|
|
63
|
-
}),
|
|
64
|
-
sessionId: z2.string().register(globalRegistry2, {
|
|
65
|
-
description: "Session ID to use for the postMessage RPC connection",
|
|
66
|
-
type: "string"
|
|
67
|
-
})
|
|
68
|
-
}).describe("Configuration for the remote RPC using postMessage");
|
|
69
|
-
var RpcRemoteConfigZod = z2.union([HttpRpcRemoteConfigZod, PostMessageRpcRemoteConfigZod]).describe("Configuration for a remote RPC connection, either Http or postMessage");
|
|
70
|
-
var RemoteConfigZod = z2.object({ rpc: RpcRemoteConfigZod.optional() }).describe("Configuration for remote connections, including RPC");
|
|
71
|
-
|
|
72
|
-
// src/config/storage/driver/Mongo.ts
|
|
73
|
-
import { isDefined, isUndefined } from "@xylabs/sdk-js";
|
|
74
|
-
import { globalRegistry as globalRegistry3, z as z3 } from "zod";
|
|
75
|
-
var MongoConfigZod = z3.object({
|
|
39
|
+
var MongoConfigZod = z2.object({
|
|
76
40
|
// TODO: Create from other arguments
|
|
77
|
-
connectionString:
|
|
41
|
+
connectionString: z2.string().nonempty().optional().register(globalRegistry2, {
|
|
78
42
|
description: "MongoDB connection string",
|
|
79
43
|
title: "storage.mongo.connectionString",
|
|
80
44
|
type: "string"
|
|
81
45
|
}),
|
|
82
|
-
database:
|
|
46
|
+
database: z2.string().nonempty().optional().register(globalRegistry2, {
|
|
83
47
|
description: "MongoDB database name",
|
|
84
48
|
title: "storage.mongo.database",
|
|
85
49
|
type: "string"
|
|
86
50
|
}),
|
|
87
|
-
domain:
|
|
51
|
+
domain: z2.string().nonempty().optional().register(globalRegistry2, {
|
|
88
52
|
description: "MongoDB domain",
|
|
89
53
|
title: "storage.mongo.domain",
|
|
90
54
|
type: "string"
|
|
91
55
|
}),
|
|
92
|
-
password:
|
|
56
|
+
password: z2.string().nonempty().optional().register(globalRegistry2, {
|
|
93
57
|
description: "MongoDB password",
|
|
94
58
|
title: "storage.mongo.password",
|
|
95
59
|
type: "string"
|
|
96
60
|
}),
|
|
97
|
-
username:
|
|
61
|
+
username: z2.string().nonempty().optional().register(globalRegistry2, {
|
|
98
62
|
description: "MongoDB username",
|
|
99
63
|
title: "storage.mongo.username",
|
|
100
64
|
type: "string"
|
|
101
65
|
})
|
|
102
66
|
});
|
|
103
67
|
|
|
104
|
-
// src/config/
|
|
105
|
-
import {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
secretAccessKey: z4.string().nonempty().optional().describe("S3-compatible secret access key for this bucket (overrides the shared default)")
|
|
114
|
-
});
|
|
115
|
-
var S3ConfigZod = z4.object({
|
|
116
|
-
accessKeyId: z4.string().nonempty().optional().describe("Shared S3-compatible access key id (default for all buckets)"),
|
|
117
|
-
accountId: z4.string().nonempty().optional().describe("Shared account id (default for all buckets; on Cloudflare R2 it forms the endpoint)"),
|
|
118
|
-
chainState: S3BucketConfigZod.optional().describe("Bucket for the mutable chain state (the head pointer)"),
|
|
119
|
-
finalized: S3BucketConfigZod.optional().describe("Bucket for the finalized files (blocks, payloads, manifest)"),
|
|
120
|
-
index: S3BucketConfigZod.optional().describe("Bucket for the chain index (the step-summary families)"),
|
|
121
|
-
prefix: z4.string().nonempty().optional().describe("Shared key prefix (default for all buckets)"),
|
|
122
|
-
secretAccessKey: z4.string().nonempty().optional().describe("Shared S3-compatible secret access key (default for all buckets)")
|
|
68
|
+
// src/config/transports/S3.ts
|
|
69
|
+
import { z as z3 } from "zod";
|
|
70
|
+
var S3BucketConfigZod = z3.object({
|
|
71
|
+
accessKeyId: z3.string().nonempty().optional().describe("S3-compatible access key id for this bucket (overrides the shared default)"),
|
|
72
|
+
accountId: z3.string().nonempty().optional().describe("Account id for this bucket; on Cloudflare R2 it forms the endpoint (overrides the shared default)"),
|
|
73
|
+
bucket: z3.string().nonempty().optional().describe("S3-compatible bucket name"),
|
|
74
|
+
prefix: z3.string().nonempty().optional().describe("Optional key prefix within the bucket"),
|
|
75
|
+
readUrl: z3.string().nonempty().optional().describe("Public HTTP/CDN base URL for anonymous reads of this bucket"),
|
|
76
|
+
secretAccessKey: z3.string().nonempty().optional().describe("S3-compatible secret access key for this bucket (overrides the shared default)")
|
|
123
77
|
});
|
|
124
78
|
|
|
125
79
|
// src/config/transports/Transport.ts
|
|
126
|
-
var LmdbTransportConfigZod =
|
|
127
|
-
access:
|
|
80
|
+
var LmdbTransportConfigZod = z4.object({
|
|
81
|
+
access: z4.enum(["read", "write"]).optional().register(globalRegistry3, {
|
|
128
82
|
description: "Access mode for this LMDB connection (read or write)",
|
|
129
83
|
title: "transports.lmdb.access",
|
|
130
84
|
type: "string"
|
|
131
85
|
}),
|
|
132
|
-
root:
|
|
86
|
+
root: z4.string().register(globalRegistry3, {
|
|
133
87
|
description: "Root directory for local LMDB storage",
|
|
134
88
|
title: "transports.lmdb.root",
|
|
135
89
|
type: "string"
|
|
136
90
|
}),
|
|
137
|
-
store:
|
|
91
|
+
store: z4.string().optional().register(globalRegistry3, {
|
|
138
92
|
description: "Logical store name within the LMDB root (e.g. finalized-chain, mempool)",
|
|
139
93
|
title: "transports.lmdb.store",
|
|
140
94
|
type: "string"
|
|
141
95
|
}),
|
|
142
|
-
type:
|
|
96
|
+
type: z4.literal("lmdb")
|
|
143
97
|
}).describe("LMDB local storage transport");
|
|
144
|
-
var MongoTransportConfigZod =
|
|
145
|
-
type:
|
|
98
|
+
var MongoTransportConfigZod = z4.object({
|
|
99
|
+
type: z4.literal("mongo"),
|
|
146
100
|
connectionString: MongoConfigZod.shape.connectionString,
|
|
147
101
|
database: MongoConfigZod.shape.database,
|
|
148
102
|
domain: MongoConfigZod.shape.domain,
|
|
149
103
|
password: MongoConfigZod.shape.password,
|
|
150
104
|
username: MongoConfigZod.shape.username
|
|
151
105
|
}).describe("MongoDB storage transport");
|
|
152
|
-
var RpcTransportConfigZod =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
106
|
+
var RpcTransportConfigZod = z4.object({
|
|
107
|
+
type: z4.literal("rpc"),
|
|
108
|
+
protocol: z4.string().default("http").register(globalRegistry3, {
|
|
109
|
+
description: "Protocol for the RPC connection (http or postMessage)",
|
|
110
|
+
title: "transports.rpc.protocol",
|
|
111
|
+
type: "string"
|
|
112
|
+
}),
|
|
113
|
+
url: z4.string().optional().register(globalRegistry3, {
|
|
114
|
+
description: "URL for the Chain RPC API (http protocol)",
|
|
115
|
+
title: "transports.rpc.url",
|
|
116
|
+
type: "string"
|
|
117
|
+
}),
|
|
118
|
+
networkId: z4.string().optional().register(globalRegistry3, {
|
|
119
|
+
description: "Network ID for the postMessage RPC connection",
|
|
120
|
+
title: "transports.rpc.networkId",
|
|
121
|
+
type: "string"
|
|
122
|
+
}),
|
|
123
|
+
sessionId: z4.string().optional().register(globalRegistry3, {
|
|
124
|
+
description: "Session ID for the postMessage RPC connection",
|
|
125
|
+
title: "transports.rpc.sessionId",
|
|
126
|
+
type: "string"
|
|
127
|
+
})
|
|
128
|
+
}).describe("XL1 JSON-RPC transport");
|
|
129
|
+
var RestTransportConfigZod = z4.object({
|
|
130
|
+
type: z4.literal("rest"),
|
|
131
|
+
baseUrl: z4.string().register(globalRegistry3, {
|
|
156
132
|
description: "HTTP base URL for REST reads",
|
|
157
133
|
title: "transports.rest.baseUrl",
|
|
158
134
|
type: "string"
|
|
159
135
|
})
|
|
160
136
|
}).describe("HTTP REST read transport");
|
|
161
137
|
var S3TransportConfigZod = S3BucketConfigZod.extend({
|
|
162
|
-
type:
|
|
163
|
-
accessKeyId:
|
|
164
|
-
accountId:
|
|
165
|
-
secretAccessKey:
|
|
138
|
+
type: z4.literal("s3"),
|
|
139
|
+
accessKeyId: z4.string().optional(),
|
|
140
|
+
accountId: z4.string().optional(),
|
|
141
|
+
secretAccessKey: z4.string().optional()
|
|
166
142
|
}).describe("S3-compatible object storage transport");
|
|
167
|
-
var EvmRpcTransportConfigZod =
|
|
168
|
-
type:
|
|
169
|
-
url:
|
|
143
|
+
var EvmRpcTransportConfigZod = z4.object({
|
|
144
|
+
type: z4.literal("evm-rpc"),
|
|
145
|
+
url: z4.string().register(globalRegistry3, {
|
|
170
146
|
description: "EVM JSON-RPC URL",
|
|
171
147
|
title: "transports.evm-rpc.url",
|
|
172
148
|
type: "string"
|
|
149
|
+
}),
|
|
150
|
+
chainId: z4.string().optional().register(globalRegistry3, {
|
|
151
|
+
description: "EVM chain ID for this RPC endpoint; auto-detected from the endpoint when omitted",
|
|
152
|
+
title: "transports.evm-rpc.chainId",
|
|
153
|
+
type: "string"
|
|
173
154
|
})
|
|
174
155
|
}).describe("EVM JSON-RPC transport");
|
|
175
|
-
var MemoryTransportConfigZod =
|
|
176
|
-
var TransportConfigZod =
|
|
156
|
+
var MemoryTransportConfigZod = z4.object({ type: z4.literal("memory") }).describe("In-process memory transport");
|
|
157
|
+
var TransportConfigZod = z4.discriminatedUnion("type", [
|
|
177
158
|
LmdbTransportConfigZod,
|
|
178
159
|
MongoTransportConfigZod,
|
|
179
160
|
RpcTransportConfigZod,
|
|
@@ -182,18 +163,18 @@ var TransportConfigZod = z5.discriminatedUnion("type", [
|
|
|
182
163
|
EvmRpcTransportConfigZod,
|
|
183
164
|
MemoryTransportConfigZod
|
|
184
165
|
]);
|
|
185
|
-
var TransportsConfigZod =
|
|
166
|
+
var TransportsConfigZod = z4.record(z4.string(), TransportConfigZod).default({});
|
|
186
167
|
|
|
187
168
|
// src/config/DataLake/DataLake.ts
|
|
188
|
-
import { z as
|
|
169
|
+
import { z as z8 } from "zod";
|
|
189
170
|
|
|
190
171
|
// src/config/DataLake/RestDataLakeConfig.ts
|
|
191
|
-
import { globalRegistry as
|
|
172
|
+
import { globalRegistry as globalRegistry5, z as z6 } from "zod";
|
|
192
173
|
|
|
193
174
|
// src/config/DataLake/DataLakeRemoteConfig.ts
|
|
194
|
-
import { globalRegistry as
|
|
195
|
-
var DataLakeDriverConfigBaseZod =
|
|
196
|
-
driver:
|
|
175
|
+
import { globalRegistry as globalRegistry4, z as z5 } from "zod";
|
|
176
|
+
var DataLakeDriverConfigBaseZod = z5.object({
|
|
177
|
+
driver: z5.string().register(globalRegistry4, {
|
|
197
178
|
description: "Driver for the data lake",
|
|
198
179
|
type: "string"
|
|
199
180
|
})
|
|
@@ -201,76 +182,45 @@ var DataLakeDriverConfigBaseZod = z6.object({
|
|
|
201
182
|
|
|
202
183
|
// src/config/DataLake/RestDataLakeConfig.ts
|
|
203
184
|
var RestDataLakeConfigZod = DataLakeDriverConfigBaseZod.extend({
|
|
204
|
-
driver:
|
|
185
|
+
driver: z6.literal("rest").register(globalRegistry5, {
|
|
205
186
|
description: "Driver for the REST data lake",
|
|
206
187
|
type: "string"
|
|
207
188
|
}),
|
|
208
|
-
url:
|
|
189
|
+
url: z6.string().register(globalRegistry5, {
|
|
209
190
|
description: "URL for the REST data lake",
|
|
210
191
|
type: "string"
|
|
211
192
|
})
|
|
212
193
|
}).describe("Configuration for the REST data lake driver");
|
|
213
194
|
|
|
214
195
|
// src/config/DataLake/RouterDataLakeConfig.ts
|
|
215
|
-
import { globalRegistry as
|
|
216
|
-
var RouterDataLakeConfigZod =
|
|
217
|
-
driver:
|
|
196
|
+
import { globalRegistry as globalRegistry6, z as z7 } from "zod";
|
|
197
|
+
var RouterDataLakeConfigZod = z7.object({
|
|
198
|
+
driver: z7.literal("router").register(globalRegistry6, {
|
|
218
199
|
description: "Driver for the router data lake",
|
|
219
200
|
type: "string"
|
|
220
201
|
}),
|
|
221
|
-
children:
|
|
202
|
+
children: z7.array(z7.lazy(() => DataLakeConfigZod)).register(globalRegistry6, {
|
|
222
203
|
description: "Child data lake drivers",
|
|
223
204
|
type: "array"
|
|
224
205
|
})
|
|
225
206
|
}).describe("Configuration for the router data lake driver");
|
|
226
207
|
|
|
227
208
|
// src/config/DataLake/DataLake.ts
|
|
228
|
-
var DataLakeConfigZod =
|
|
229
|
-
|
|
230
|
-
// src/config/Evm.ts
|
|
231
|
-
import { globalRegistry as globalRegistry8, z as z10 } from "zod";
|
|
232
|
-
var EvmInfuraConfigZod = z10.object({
|
|
233
|
-
projectId: z10.string().optional().register(globalRegistry8, {
|
|
234
|
-
description: "Infura project ID",
|
|
235
|
-
title: "evm.infura.projectId",
|
|
236
|
-
type: "string"
|
|
237
|
-
}),
|
|
238
|
-
projectSecret: z10.string().optional().register(globalRegistry8, {
|
|
239
|
-
description: "Infura project secret",
|
|
240
|
-
title: "evm.infura.projectSecret",
|
|
241
|
-
type: "string"
|
|
242
|
-
})
|
|
243
|
-
});
|
|
244
|
-
var EvmJsonRpcConfigZod = z10.object({
|
|
245
|
-
url: z10.url().optional().register(globalRegistry8, {
|
|
246
|
-
description: "JSON-RPC URL",
|
|
247
|
-
title: "evm.jsonRpc.url",
|
|
248
|
-
type: "string"
|
|
249
|
-
})
|
|
250
|
-
});
|
|
251
|
-
var EvmConfigZod = z10.object({
|
|
252
|
-
chainId: z10.string().optional().register(globalRegistry8, {
|
|
253
|
-
description: "EVM chain ID",
|
|
254
|
-
title: "evm.chainId",
|
|
255
|
-
type: "string"
|
|
256
|
-
}),
|
|
257
|
-
infura: EvmInfuraConfigZod.optional().describe("Infura Provider configuration"),
|
|
258
|
-
jsonRpc: EvmJsonRpcConfigZod.optional().describe("JSON-RPC Provider configuration")
|
|
259
|
-
});
|
|
209
|
+
var DataLakeConfigZod = z8.lazy(() => z8.union([RestDataLakeConfigZod, RouterDataLakeConfigZod])).describe("Configuration for a data lake");
|
|
260
210
|
|
|
261
211
|
// src/config/Log.ts
|
|
262
212
|
import { LogLevel } from "@xylabs/sdk-js";
|
|
263
|
-
import { globalRegistry as
|
|
213
|
+
import { globalRegistry as globalRegistry7, z as z9 } from "zod";
|
|
264
214
|
var LogLevelNames = Object.keys(LogLevel);
|
|
265
|
-
var LogConfigZod =
|
|
266
|
-
logLevel:
|
|
215
|
+
var LogConfigZod = z9.object({
|
|
216
|
+
logLevel: z9.enum(LogLevelNames).default("info").register(globalRegistry7, {
|
|
267
217
|
choices: LogLevelNames,
|
|
268
218
|
default: "info",
|
|
269
219
|
description: "Desired process verbosity",
|
|
270
220
|
title: "logLevel",
|
|
271
221
|
type: "string"
|
|
272
222
|
}),
|
|
273
|
-
silent:
|
|
223
|
+
silent: z9.boolean().default(false).register(globalRegistry7, {
|
|
274
224
|
default: false,
|
|
275
225
|
description: "Whether to run in silent mode",
|
|
276
226
|
title: "silent",
|
|
@@ -279,23 +229,23 @@ var LogConfigZod = z11.object({
|
|
|
279
229
|
});
|
|
280
230
|
|
|
281
231
|
// src/config/ProviderBinding.ts
|
|
282
|
-
import { globalRegistry as
|
|
283
|
-
var ProviderBindingConfigZod =
|
|
284
|
-
connection:
|
|
232
|
+
import { globalRegistry as globalRegistry8, z as z10 } from "zod";
|
|
233
|
+
var ProviderBindingConfigZod = z10.object({
|
|
234
|
+
connection: z10.string().optional().register(globalRegistry8, {
|
|
285
235
|
description: "Named connection from the top-level connections map",
|
|
286
236
|
title: "providerBindings.connection",
|
|
287
237
|
type: "string"
|
|
288
238
|
}),
|
|
289
|
-
transport:
|
|
239
|
+
transport: z10.string().optional().register(globalRegistry8, {
|
|
290
240
|
description: "Deprecated alias for connection (kept in sync during migration)",
|
|
291
241
|
title: "providerBindings.transport",
|
|
292
242
|
type: "string"
|
|
293
243
|
})
|
|
294
244
|
}).describe("Provider connection binding");
|
|
295
|
-
var ProviderBindingsConfigZod =
|
|
245
|
+
var ProviderBindingsConfigZod = z10.record(z10.string(), ProviderBindingConfigZod).default({});
|
|
296
246
|
|
|
297
247
|
// src/config/Providers.ts
|
|
298
|
-
import
|
|
248
|
+
import z12 from "zod";
|
|
299
249
|
|
|
300
250
|
// src/config/Provider.ts
|
|
301
251
|
import {
|
|
@@ -303,55 +253,43 @@ import {
|
|
|
303
253
|
zodIsFactory,
|
|
304
254
|
zodToFactory
|
|
305
255
|
} from "@xylabs/sdk-js";
|
|
306
|
-
import { z as
|
|
307
|
-
var ProviderConfigZod =
|
|
308
|
-
moniker:
|
|
309
|
-
labels:
|
|
256
|
+
import { z as z11 } from "zod";
|
|
257
|
+
var ProviderConfigZod = z11.object({
|
|
258
|
+
moniker: z11.string(),
|
|
259
|
+
labels: z11.array(z11.string()).optional()
|
|
310
260
|
}).describe("Configuration for a Provider");
|
|
311
261
|
var isProviderConfig = zodIsFactory(ProviderConfigZod);
|
|
312
262
|
var asProviderConfig = zodAsFactory(ProviderConfigZod, "asProviderConfig");
|
|
313
263
|
var toProviderConfig = zodToFactory(ProviderConfigZod, "toProviderConfig");
|
|
314
264
|
|
|
315
265
|
// src/config/Providers.ts
|
|
316
|
-
var ProvidersConfigZod =
|
|
317
|
-
|
|
318
|
-
// src/config/storage/Storage.ts
|
|
319
|
-
import { globalRegistry as globalRegistry11, z as z15 } from "zod";
|
|
320
|
-
var StorageConfigZod = z15.object({
|
|
321
|
-
mongo: MongoConfigZod.optional().describe("Configuration for the MongoD storage driver"),
|
|
322
|
-
root: z15.string().optional().register(globalRegistry11, {
|
|
323
|
-
description: "Root directory for local storage",
|
|
324
|
-
title: "storage.root",
|
|
325
|
-
type: "string"
|
|
326
|
-
}),
|
|
327
|
-
s3: S3ConfigZod.optional().describe("Configuration for S3-compatible object storage (e.g. Cloudflare R2)")
|
|
328
|
-
}).describe("Storage configuration options");
|
|
266
|
+
var ProvidersConfigZod = z12.array(ProviderConfigZod.loose()).describe("Configuration for providers").default([]);
|
|
329
267
|
|
|
330
268
|
// src/config/Telemetry.ts
|
|
331
|
-
import { globalRegistry as
|
|
332
|
-
var MetricsScrapeConfigZod =
|
|
333
|
-
path:
|
|
269
|
+
import { globalRegistry as globalRegistry9, z as z13 } from "zod";
|
|
270
|
+
var MetricsScrapeConfigZod = z13.object({
|
|
271
|
+
path: z13.string().default("/metrics").register(globalRegistry9, {
|
|
334
272
|
default: "/metrics",
|
|
335
273
|
description: "Path for the metrics scrape endpoint",
|
|
336
274
|
title: "telemetry.metrics.scrape.path",
|
|
337
275
|
type: "string"
|
|
338
276
|
}),
|
|
339
|
-
port:
|
|
340
|
-
description: "Port for the metrics scrape endpoint",
|
|
277
|
+
port: z13.coerce.number().int().nonnegative().optional().register(globalRegistry9, {
|
|
278
|
+
description: "Port for the metrics scrape endpoint (0 disables the scrape endpoint)",
|
|
341
279
|
title: "telemetry.metrics.scrape.port",
|
|
342
280
|
type: "number"
|
|
343
281
|
})
|
|
344
282
|
}).describe("Metrics scrape configuration");
|
|
345
|
-
var MetricsConfigZod =
|
|
346
|
-
var OpenTelemetryConfigZod =
|
|
283
|
+
var MetricsConfigZod = z13.object({ scrape: MetricsScrapeConfigZod }).describe("Metrics configuration options");
|
|
284
|
+
var OpenTelemetryConfigZod = z13.object({
|
|
347
285
|
// OpenTelemetry options
|
|
348
|
-
otlpEndpoint:
|
|
286
|
+
otlpEndpoint: z13.url().optional().register(globalRegistry9, {
|
|
349
287
|
description: "OTLP endpoint for exporting telemetry data",
|
|
350
288
|
title: "telemetry.otel.otlpEndpoint",
|
|
351
289
|
type: "string"
|
|
352
290
|
})
|
|
353
291
|
});
|
|
354
|
-
var TelemetryConfigZod =
|
|
292
|
+
var TelemetryConfigZod = z13.object({
|
|
355
293
|
// Metrics configuration
|
|
356
294
|
metrics: MetricsConfigZod.optional().describe("Metrics configuration"),
|
|
357
295
|
// OpenTelemetry configuration
|
|
@@ -360,31 +298,31 @@ var TelemetryConfigZod = z16.object({
|
|
|
360
298
|
|
|
361
299
|
// src/config/Validation.ts
|
|
362
300
|
import { XyoAddressZod as XyoAddressZod2 } from "@xyo-network/sdk-js";
|
|
363
|
-
import { globalRegistry as
|
|
301
|
+
import { globalRegistry as globalRegistry10, z as z14 } from "zod";
|
|
364
302
|
|
|
365
303
|
// src/primitives/uncle/findBestUncle.ts
|
|
366
304
|
var DEFAULT_MIN_CANDIDATES = 1;
|
|
367
305
|
var DEFAULT_BACKOFF_MS = 12e4;
|
|
368
306
|
|
|
369
307
|
// src/config/Validation.ts
|
|
370
|
-
var ValidationConfigZod =
|
|
371
|
-
allowedRewardRedeemers:
|
|
308
|
+
var ValidationConfigZod = z14.object({
|
|
309
|
+
allowedRewardRedeemers: z14.array(XyoAddressZod2).optional().register(globalRegistry10, {
|
|
372
310
|
description: "List of allowed reward redeemer addresses, if undefined anyone can participate",
|
|
373
311
|
title: "allowedRewardRedeemers",
|
|
374
312
|
type: "array"
|
|
375
313
|
}),
|
|
376
|
-
allowedRewardEscrowAccountSigners:
|
|
314
|
+
allowedRewardEscrowAccountSigners: z14.array(XyoAddressZod2).optional().register(globalRegistry10, {
|
|
377
315
|
description: "List of allowed reward escrow account signer addresses, if undefined anyone can participate",
|
|
378
316
|
title: "allowedRewardEscrowAccountSigners",
|
|
379
317
|
type: "array"
|
|
380
318
|
}),
|
|
381
|
-
minCandidates:
|
|
319
|
+
minCandidates: z14.coerce.number().default(DEFAULT_MIN_CANDIDATES).register(globalRegistry10, {
|
|
382
320
|
default: DEFAULT_MIN_CANDIDATES,
|
|
383
321
|
description: "Minimum number of uncle candidates before selecting the best uncle",
|
|
384
322
|
title: "validation.minCandidates",
|
|
385
323
|
type: "number"
|
|
386
324
|
}),
|
|
387
|
-
backoffMs:
|
|
325
|
+
backoffMs: z14.coerce.number().default(DEFAULT_BACKOFF_MS).register(globalRegistry10, {
|
|
388
326
|
default: DEFAULT_BACKOFF_MS,
|
|
389
327
|
description: "Back-off timeout in ms. If head age exceeds this, minCandidates is ignored",
|
|
390
328
|
title: "validation.backoffMs",
|
|
@@ -393,29 +331,25 @@ var ValidationConfigZod = z17.object({
|
|
|
393
331
|
});
|
|
394
332
|
|
|
395
333
|
// src/config/Base.ts
|
|
396
|
-
var BaseConfigZod =
|
|
397
|
-
chain:
|
|
398
|
-
dataLake:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
transports: z18._default(TransportsConfigZod, TransportsConfigZod.parse({})).check(z18.describe("Deprecated alias for connections (kept in sync during migration)")),
|
|
406
|
-
storage: z18._default(StorageConfigZod, StorageConfigZod.parse({})).check(z18.describe("Configuration for the storage")),
|
|
407
|
-
telemetry: z18._default(TelemetryConfigZod, TelemetryConfigZod.parse({})).check(z18.describe("Configuration for telemetry")),
|
|
408
|
-
validation: z18._default(ValidationConfigZod, ValidationConfigZod.parse({})).check(z18.describe("Configuration for validation"))
|
|
334
|
+
var BaseConfigZod = z15.object({
|
|
335
|
+
chain: z15._default(ChainConfigZod, ChainConfigZod.parse({})).check(z15.describe("Configuration for the chain")),
|
|
336
|
+
dataLake: z15.optional(DataLakeConfigZod).check(z15.describe("Configuration for data lakes")),
|
|
337
|
+
log: z15._default(LogConfigZod, LogConfigZod.parse({})).check(z15.describe("Configuration for logging")),
|
|
338
|
+
connections: z15._default(TransportsConfigZod, TransportsConfigZod.parse({})).check(z15.describe("Named connection profiles (rpc, rest, s3, lmdb, mongo, evm-rpc)")),
|
|
339
|
+
providerBindings: z15._default(ProviderBindingsConfigZod, ProviderBindingsConfigZod.parse({})).check(z15.describe("Per-moniker provider connection bindings")),
|
|
340
|
+
providers: z15._default(ProvidersConfigZod, ProvidersConfigZod.parse([])).check(z15.describe("Configuration for providers")),
|
|
341
|
+
telemetry: z15._default(TelemetryConfigZod, TelemetryConfigZod.parse({})).check(z15.describe("Configuration for telemetry")),
|
|
342
|
+
validation: z15._default(ValidationConfigZod, ValidationConfigZod.parse({})).check(z15.describe("Configuration for validation"))
|
|
409
343
|
});
|
|
410
344
|
|
|
411
345
|
// src/config/Actor.ts
|
|
412
|
-
var AccountPathZod =
|
|
346
|
+
var AccountPathZod = z16.string().check(z16.regex(
|
|
413
347
|
/^(m(\/\d+'?)+|\d+'?(\/\d+'?)*)$/,
|
|
414
348
|
`Invalid BIP-32 derivation path. Use either an absolute path like "m/44'/60'/0'/0/0" or a relative path like "0", "0/1", or "44'/60'/0'/0/0".`
|
|
415
349
|
));
|
|
416
|
-
var ActorConfigZod =
|
|
417
|
-
name:
|
|
418
|
-
accountPath:
|
|
350
|
+
var ActorConfigZod = z16.extend(BaseConfigZod, {
|
|
351
|
+
name: z16.string(),
|
|
352
|
+
accountPath: z16.optional(AccountPathZod).register(globalRegistry11, {
|
|
419
353
|
description: 'BIP-32 derivation path for the actor wallet. Absolute when it starts with "m/"; otherwise relative to the root wallet base path. Each actor must derive to a distinct path.',
|
|
420
354
|
title: "accountPath",
|
|
421
355
|
type: "string"
|
|
@@ -426,22 +360,22 @@ var asActorConfig = zodAsFactory2(ActorConfigZod, "asActorConfig");
|
|
|
426
360
|
var toActorConfig = zodToFactory2(ActorConfigZod, "toActorConfig");
|
|
427
361
|
|
|
428
362
|
// src/config/Actors.ts
|
|
429
|
-
import { z as
|
|
430
|
-
var ActorsConfigZod =
|
|
431
|
-
|
|
363
|
+
import { z as z17 } from "zod/mini";
|
|
364
|
+
var ActorsConfigZod = z17._default(
|
|
365
|
+
z17.array(z17.looseObject(ActorConfigZod.shape)).check(z17.describe("Actor-specific configurations that override the base configuration when the actor is running")),
|
|
432
366
|
[]
|
|
433
367
|
);
|
|
434
368
|
|
|
435
369
|
// src/config/Config.ts
|
|
436
|
-
import { globalRegistry as
|
|
437
|
-
var ConfigZod =
|
|
370
|
+
import { globalRegistry as globalRegistry12, z as z18 } from "zod/mini";
|
|
371
|
+
var ConfigZod = z18.extend(BaseConfigZod, {
|
|
438
372
|
actors: ActorsConfigZod,
|
|
439
|
-
healthCheckPort:
|
|
373
|
+
healthCheckPort: z18.optional(z18.coerce.number()).register(globalRegistry12, {
|
|
440
374
|
description: "Port for the system-wide health, readiness, and liveness endpoints (/healthz, /livez, /readyz). Set to 0 to disable.",
|
|
441
375
|
title: "healthCheckPort",
|
|
442
376
|
type: "number"
|
|
443
377
|
})
|
|
444
|
-
}).check(
|
|
378
|
+
}).check(z18.describe("The complete configuration for the protocol, including global settings and actor-specific overrides"));
|
|
445
379
|
|
|
446
380
|
// src/getFileConfig.ts
|
|
447
381
|
var configName = "xyo";
|
|
@@ -458,8 +392,8 @@ async function getFileConfig(searchPlaces) {
|
|
|
458
392
|
const result = searchResult?.config;
|
|
459
393
|
if (!isNull(result)) {
|
|
460
394
|
const section = result[configSection];
|
|
461
|
-
if (
|
|
462
|
-
return
|
|
395
|
+
if (isDefined(section) && typeof section === "object") {
|
|
396
|
+
return z19.looseObject(ConfigZod.shape).parse(section);
|
|
463
397
|
}
|
|
464
398
|
}
|
|
465
399
|
return ConfigZod.parse({});
|