@no-witness-labs/midday-sdk 0.1.1 → 0.2.0
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/devnet/Cluster.d.ts +282 -0
- package/dist/devnet/Cluster.d.ts.map +1 -0
- package/dist/devnet/Cluster.js +487 -0
- package/dist/devnet/Cluster.js.map +1 -0
- package/dist/devnet/Config.d.ts +119 -0
- package/dist/devnet/Config.d.ts.map +1 -0
- package/dist/devnet/Config.js +75 -0
- package/dist/devnet/Config.js.map +1 -0
- package/dist/devnet/Container.d.ts +180 -0
- package/dist/devnet/Container.d.ts.map +1 -0
- package/dist/devnet/Container.js +390 -0
- package/dist/devnet/Container.js.map +1 -0
- package/dist/devnet/Health.d.ts +129 -0
- package/dist/devnet/Health.d.ts.map +1 -0
- package/dist/devnet/Health.js +304 -0
- package/dist/devnet/Health.js.map +1 -0
- package/dist/devnet/Images.d.ts +43 -0
- package/dist/devnet/Images.d.ts.map +1 -0
- package/dist/devnet/Images.js +96 -0
- package/dist/devnet/Images.js.map +1 -0
- package/dist/devnet/errors.d.ts +65 -0
- package/dist/devnet/errors.d.ts.map +1 -0
- package/dist/devnet/errors.js +40 -0
- package/dist/devnet/errors.js.map +1 -0
- package/dist/devnet/index.d.ts +72 -0
- package/dist/devnet/index.d.ts.map +1 -0
- package/dist/devnet/index.js +73 -0
- package/dist/devnet/index.js.map +1 -0
- package/package.json +14 -4
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DevNet cluster orchestration.
|
|
3
|
+
*
|
|
4
|
+
* Manages the lifecycle of a complete Midnight development environment
|
|
5
|
+
* consisting of a node, indexer, and proof server.
|
|
6
|
+
*
|
|
7
|
+
* ## API Design
|
|
8
|
+
*
|
|
9
|
+
* This module uses an **instance-based pattern**:
|
|
10
|
+
*
|
|
11
|
+
* - **Stateful**: A Cluster holds references to Docker containers
|
|
12
|
+
* - **Instance methods**: `cluster.start()`, `cluster.stop()`, etc.
|
|
13
|
+
* - **Effect-first**: Internal implementation uses Effect
|
|
14
|
+
* - **Promise wrapper**: `.effect` namespace exposes raw Effects
|
|
15
|
+
*
|
|
16
|
+
* ### Usage Patterns
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Promise user (majority)
|
|
20
|
+
* const cluster = await Cluster.make();
|
|
21
|
+
* await cluster.start(); // instance method
|
|
22
|
+
* const config = cluster.networkConfig; // accessor
|
|
23
|
+
* await cluster.stop();
|
|
24
|
+
*
|
|
25
|
+
* // Effect user (composable)
|
|
26
|
+
* const cluster = yield* Cluster.effect.make();
|
|
27
|
+
* yield* cluster.effect.start(); // raw Effect access
|
|
28
|
+
*
|
|
29
|
+
* // Effect DI user (dependency injection)
|
|
30
|
+
* const cluster = yield* ClusterService;
|
|
31
|
+
* yield* cluster.effect.start();
|
|
32
|
+
* // provide with: Effect.provide(Cluster.Live) or Cluster.layer({ ... })
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @since 0.2.0
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
import { Context, Effect, Layer } from 'effect';
|
|
39
|
+
import * as Config from './Config.js';
|
|
40
|
+
import * as Container from './Container.js';
|
|
41
|
+
import * as Health from './Health.js';
|
|
42
|
+
import { ClusterError } from './errors.js';
|
|
43
|
+
/**
|
|
44
|
+
* Context.Tag for ClusterService dependency injection.
|
|
45
|
+
*
|
|
46
|
+
* Yields a Cluster instance directly. Use `Cluster.layer()` to provide
|
|
47
|
+
* with custom configuration.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { Effect } from 'effect';
|
|
52
|
+
* import { Cluster, ClusterService } from '@no-witness-labs/midday-sdk/devnet';
|
|
53
|
+
*
|
|
54
|
+
* const program = Effect.gen(function* () {
|
|
55
|
+
* const cluster = yield* ClusterService;
|
|
56
|
+
* yield* cluster.effect.start();
|
|
57
|
+
* return cluster.networkConfig;
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* // With default config
|
|
61
|
+
* await Effect.runPromise(program.pipe(Effect.provide(Cluster.Live)));
|
|
62
|
+
*
|
|
63
|
+
* // With custom config
|
|
64
|
+
* await Effect.runPromise(program.pipe(
|
|
65
|
+
* Effect.provide(Cluster.layer({ clusterName: 'my-devnet' }))
|
|
66
|
+
* ));
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @since 0.2.0
|
|
70
|
+
* @category service
|
|
71
|
+
*/
|
|
72
|
+
export class ClusterService extends Context.Tag('ClusterService')() {
|
|
73
|
+
}
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// Internal Effect Implementations
|
|
76
|
+
// =============================================================================
|
|
77
|
+
/**
|
|
78
|
+
* Internal Effect implementation for creating a cluster.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
const makeEffect = (config = {}) => Effect.gen(function* () {
|
|
82
|
+
// Resolve configuration with defaults
|
|
83
|
+
const fullConfig = {
|
|
84
|
+
clusterName: config.clusterName ?? Config.DEFAULT_DEVNET_CONFIG.clusterName,
|
|
85
|
+
node: {
|
|
86
|
+
...Config.DEFAULT_NODE_CONFIG,
|
|
87
|
+
...config.node,
|
|
88
|
+
},
|
|
89
|
+
indexer: {
|
|
90
|
+
...Config.DEFAULT_INDEXER_CONFIG,
|
|
91
|
+
...config.indexer,
|
|
92
|
+
},
|
|
93
|
+
proofServer: {
|
|
94
|
+
...Config.DEFAULT_PROOF_SERVER_CONFIG,
|
|
95
|
+
...config.proofServer,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
// Clean up existing containers
|
|
99
|
+
const containerNames = [
|
|
100
|
+
`${fullConfig.clusterName}-node`,
|
|
101
|
+
`${fullConfig.clusterName}-indexer`,
|
|
102
|
+
`${fullConfig.clusterName}-proof-server`,
|
|
103
|
+
];
|
|
104
|
+
yield* Effect.tryPromise({
|
|
105
|
+
try: async () => {
|
|
106
|
+
for (const name of containerNames) {
|
|
107
|
+
try {
|
|
108
|
+
await Container.removeByName(name);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// Ignore cleanup errors
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
catch: (cause) => new ClusterError({ operation: 'cleanup', cause }),
|
|
116
|
+
});
|
|
117
|
+
// Create node first (indexer depends on it via Docker links)
|
|
118
|
+
const nodeContainer = yield* Effect.tryPromise({
|
|
119
|
+
try: () => Container.createNode(fullConfig),
|
|
120
|
+
catch: (cause) => new ClusterError({ operation: 'create', cause }),
|
|
121
|
+
});
|
|
122
|
+
// Create indexer and proof server in parallel (both depend on node existing)
|
|
123
|
+
const [indexerContainer, proofServerContainer] = yield* Effect.all([
|
|
124
|
+
Effect.tryPromise({
|
|
125
|
+
try: () => Container.createIndexer(fullConfig),
|
|
126
|
+
catch: (cause) => new ClusterError({ operation: 'create', cause }),
|
|
127
|
+
}),
|
|
128
|
+
Effect.tryPromise({
|
|
129
|
+
try: () => Container.createProofServer(fullConfig),
|
|
130
|
+
catch: (cause) => new ClusterError({ operation: 'create', cause }),
|
|
131
|
+
}),
|
|
132
|
+
], { concurrency: 2 });
|
|
133
|
+
const data = {
|
|
134
|
+
node: {
|
|
135
|
+
id: nodeContainer.id,
|
|
136
|
+
name: `${fullConfig.clusterName}-node`,
|
|
137
|
+
},
|
|
138
|
+
indexer: {
|
|
139
|
+
id: indexerContainer.id,
|
|
140
|
+
name: `${fullConfig.clusterName}-indexer`,
|
|
141
|
+
},
|
|
142
|
+
proofServer: {
|
|
143
|
+
id: proofServerContainer.id,
|
|
144
|
+
name: `${fullConfig.clusterName}-proof-server`,
|
|
145
|
+
},
|
|
146
|
+
config: fullConfig,
|
|
147
|
+
};
|
|
148
|
+
// Create instance with bound methods
|
|
149
|
+
const cluster = {
|
|
150
|
+
...data,
|
|
151
|
+
networkConfig: Config.toNetworkConfig({
|
|
152
|
+
node: fullConfig.node.port,
|
|
153
|
+
indexer: fullConfig.indexer.port,
|
|
154
|
+
proofServer: fullConfig.proofServer.port,
|
|
155
|
+
}),
|
|
156
|
+
// Promise lifecycle methods
|
|
157
|
+
start: () => Effect.runPromise(startEffect(data)),
|
|
158
|
+
stop: () => Effect.runPromise(stopEffect(data)),
|
|
159
|
+
remove: () => Effect.runPromise(removeEffect(data)),
|
|
160
|
+
isRunning: () => isRunningImpl(data),
|
|
161
|
+
// Effect namespace
|
|
162
|
+
effect: {
|
|
163
|
+
start: () => startEffect(data),
|
|
164
|
+
stop: () => stopEffect(data),
|
|
165
|
+
remove: () => removeEffect(data),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
return cluster;
|
|
169
|
+
});
|
|
170
|
+
/**
|
|
171
|
+
* Internal Effect implementation for starting a cluster.
|
|
172
|
+
* @internal
|
|
173
|
+
*/
|
|
174
|
+
const startEffect = (data) => Effect.gen(function* () {
|
|
175
|
+
// Start node first
|
|
176
|
+
yield* Effect.tryPromise({
|
|
177
|
+
try: () => Container.start(data.node),
|
|
178
|
+
catch: (cause) => new ClusterError({
|
|
179
|
+
operation: 'start',
|
|
180
|
+
cluster: data.node.name,
|
|
181
|
+
cause,
|
|
182
|
+
}),
|
|
183
|
+
});
|
|
184
|
+
// Wait for node to be ready
|
|
185
|
+
yield* Effect.tryPromise({
|
|
186
|
+
try: () => Health.waitForNode(data.config.node.port),
|
|
187
|
+
catch: (cause) => new ClusterError({
|
|
188
|
+
operation: 'start',
|
|
189
|
+
cluster: data.node.name,
|
|
190
|
+
cause,
|
|
191
|
+
}),
|
|
192
|
+
});
|
|
193
|
+
// Start indexer (depends on node)
|
|
194
|
+
yield* Effect.tryPromise({
|
|
195
|
+
try: () => Container.start(data.indexer),
|
|
196
|
+
catch: (cause) => new ClusterError({
|
|
197
|
+
operation: 'start',
|
|
198
|
+
cluster: data.indexer.name,
|
|
199
|
+
cause,
|
|
200
|
+
}),
|
|
201
|
+
});
|
|
202
|
+
// Wait for indexer to be ready
|
|
203
|
+
yield* Effect.tryPromise({
|
|
204
|
+
try: () => Health.waitForIndexer(data.config.indexer.port),
|
|
205
|
+
catch: (cause) => new ClusterError({
|
|
206
|
+
operation: 'start',
|
|
207
|
+
cluster: data.indexer.name,
|
|
208
|
+
cause,
|
|
209
|
+
}),
|
|
210
|
+
});
|
|
211
|
+
// Start proof server (independent)
|
|
212
|
+
yield* Effect.tryPromise({
|
|
213
|
+
try: () => Container.start(data.proofServer),
|
|
214
|
+
catch: (cause) => new ClusterError({
|
|
215
|
+
operation: 'start',
|
|
216
|
+
cluster: data.proofServer.name,
|
|
217
|
+
cause,
|
|
218
|
+
}),
|
|
219
|
+
});
|
|
220
|
+
// Wait for proof server to be ready
|
|
221
|
+
yield* Effect.tryPromise({
|
|
222
|
+
try: () => Health.waitForProofServer(data.config.proofServer.port),
|
|
223
|
+
catch: (cause) => new ClusterError({
|
|
224
|
+
operation: 'start',
|
|
225
|
+
cluster: data.proofServer.name,
|
|
226
|
+
cause,
|
|
227
|
+
}),
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* Internal Effect implementation for stopping a cluster.
|
|
232
|
+
* @internal
|
|
233
|
+
*/
|
|
234
|
+
const stopEffect = (data) => Effect.gen(function* () {
|
|
235
|
+
// Stop in reverse order, collecting errors but continuing
|
|
236
|
+
yield* Effect.all([
|
|
237
|
+
Effect.tryPromise({
|
|
238
|
+
try: () => Container.stop(data.proofServer),
|
|
239
|
+
catch: (cause) => new ClusterError({
|
|
240
|
+
operation: 'stop',
|
|
241
|
+
cluster: data.proofServer.name,
|
|
242
|
+
cause,
|
|
243
|
+
}),
|
|
244
|
+
}).pipe(Effect.either),
|
|
245
|
+
Effect.tryPromise({
|
|
246
|
+
try: () => Container.stop(data.indexer),
|
|
247
|
+
catch: (cause) => new ClusterError({
|
|
248
|
+
operation: 'stop',
|
|
249
|
+
cluster: data.indexer.name,
|
|
250
|
+
cause,
|
|
251
|
+
}),
|
|
252
|
+
}).pipe(Effect.either),
|
|
253
|
+
Effect.tryPromise({
|
|
254
|
+
try: () => Container.stop(data.node),
|
|
255
|
+
catch: (cause) => new ClusterError({
|
|
256
|
+
operation: 'stop',
|
|
257
|
+
cluster: data.node.name,
|
|
258
|
+
cause,
|
|
259
|
+
}),
|
|
260
|
+
}).pipe(Effect.either),
|
|
261
|
+
], { concurrency: 3 });
|
|
262
|
+
});
|
|
263
|
+
/**
|
|
264
|
+
* Internal Effect implementation for removing a cluster.
|
|
265
|
+
* @internal
|
|
266
|
+
*/
|
|
267
|
+
const removeEffect = (data) => Effect.gen(function* () {
|
|
268
|
+
// Remove in reverse order, collecting errors but continuing
|
|
269
|
+
yield* Effect.all([
|
|
270
|
+
Effect.tryPromise({
|
|
271
|
+
try: () => Container.remove(data.proofServer),
|
|
272
|
+
catch: (cause) => new ClusterError({
|
|
273
|
+
operation: 'remove',
|
|
274
|
+
cluster: data.proofServer.name,
|
|
275
|
+
cause,
|
|
276
|
+
}),
|
|
277
|
+
}).pipe(Effect.either),
|
|
278
|
+
Effect.tryPromise({
|
|
279
|
+
try: () => Container.remove(data.indexer),
|
|
280
|
+
catch: (cause) => new ClusterError({
|
|
281
|
+
operation: 'remove',
|
|
282
|
+
cluster: data.indexer.name,
|
|
283
|
+
cause,
|
|
284
|
+
}),
|
|
285
|
+
}).pipe(Effect.either),
|
|
286
|
+
Effect.tryPromise({
|
|
287
|
+
try: () => Container.remove(data.node),
|
|
288
|
+
catch: (cause) => new ClusterError({
|
|
289
|
+
operation: 'remove',
|
|
290
|
+
cluster: data.node.name,
|
|
291
|
+
cause,
|
|
292
|
+
}),
|
|
293
|
+
}).pipe(Effect.either),
|
|
294
|
+
], { concurrency: 3 });
|
|
295
|
+
});
|
|
296
|
+
// =============================================================================
|
|
297
|
+
// Promise API (Default)
|
|
298
|
+
// =============================================================================
|
|
299
|
+
/**
|
|
300
|
+
* Create a new DevNet cluster instance.
|
|
301
|
+
*
|
|
302
|
+
* Returns a cluster with bound lifecycle methods.
|
|
303
|
+
* This creates the containers but does not start them.
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
|
|
308
|
+
*
|
|
309
|
+
* const cluster = await Cluster.make();
|
|
310
|
+
* await cluster.start();
|
|
311
|
+
*
|
|
312
|
+
* // Access network config directly
|
|
313
|
+
* const client = await Midday.Client.create({
|
|
314
|
+
* networkConfig: cluster.networkConfig,
|
|
315
|
+
* seed: 'your-wallet-seed',
|
|
316
|
+
* });
|
|
317
|
+
*
|
|
318
|
+
* // ... run tests ...
|
|
319
|
+
*
|
|
320
|
+
* await cluster.remove();
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @since 0.2.0
|
|
324
|
+
* @category constructors
|
|
325
|
+
*/
|
|
326
|
+
export const make = (config) => Effect.runPromise(makeEffect(config));
|
|
327
|
+
/**
|
|
328
|
+
* Internal implementation for checking if a cluster is running.
|
|
329
|
+
* @internal
|
|
330
|
+
*/
|
|
331
|
+
const isRunningImpl = async (data) => {
|
|
332
|
+
const [nodeRunning, indexerRunning, proofServerRunning] = await Promise.all([
|
|
333
|
+
Container.isRunning(data.node),
|
|
334
|
+
Container.isRunning(data.indexer),
|
|
335
|
+
Container.isRunning(data.proofServer),
|
|
336
|
+
]);
|
|
337
|
+
return nodeRunning && indexerRunning && proofServerRunning;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Get the network configuration for use with midday-sdk client.
|
|
341
|
+
*
|
|
342
|
+
* @deprecated Prefer using `cluster.networkConfig` property instead.
|
|
343
|
+
*
|
|
344
|
+
* @since 0.2.0
|
|
345
|
+
* @category utilities
|
|
346
|
+
*/
|
|
347
|
+
export const toNetworkConfig = (cluster) => Config.toNetworkConfig({
|
|
348
|
+
node: cluster.config.node.port,
|
|
349
|
+
indexer: cluster.config.indexer.port,
|
|
350
|
+
proofServer: cluster.config.proofServer.port,
|
|
351
|
+
});
|
|
352
|
+
/**
|
|
353
|
+
* Helper function to run code with an automatically managed cluster.
|
|
354
|
+
* The cluster is created, started, and cleaned up automatically.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```typescript
|
|
358
|
+
* import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
|
|
359
|
+
*
|
|
360
|
+
* await Cluster.withCluster(async (cluster) => {
|
|
361
|
+
* // Use cluster.networkConfig directly
|
|
362
|
+
* const config = cluster.networkConfig;
|
|
363
|
+
* // Your code here - cluster will be cleaned up automatically
|
|
364
|
+
* return config;
|
|
365
|
+
* });
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @since 0.2.0
|
|
369
|
+
* @category utilities
|
|
370
|
+
*/
|
|
371
|
+
export const withCluster = async (fn, config) => {
|
|
372
|
+
const cluster = await make(config);
|
|
373
|
+
try {
|
|
374
|
+
await cluster.start();
|
|
375
|
+
return await fn(cluster);
|
|
376
|
+
}
|
|
377
|
+
finally {
|
|
378
|
+
await cluster.remove();
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
// =============================================================================
|
|
382
|
+
// Effect Namespace (Advanced)
|
|
383
|
+
// =============================================================================
|
|
384
|
+
/**
|
|
385
|
+
* Effect API for advanced users who want full composability,
|
|
386
|
+
* type-safe errors, retries, and other Effect benefits.
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* import { Effect } from 'effect';
|
|
391
|
+
* import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
|
|
392
|
+
*
|
|
393
|
+
* const program = Effect.gen(function* () {
|
|
394
|
+
* const cluster = yield* Cluster.effect.make();
|
|
395
|
+
* yield* cluster.effect.start(); // Use instance method
|
|
396
|
+
* return cluster;
|
|
397
|
+
* }).pipe(
|
|
398
|
+
* Effect.retry({ times: 3 }),
|
|
399
|
+
* Effect.timeout('5 minutes')
|
|
400
|
+
* );
|
|
401
|
+
*
|
|
402
|
+
* await Effect.runPromise(program);
|
|
403
|
+
* ```
|
|
404
|
+
*
|
|
405
|
+
* @since 0.2.0
|
|
406
|
+
* @category effect
|
|
407
|
+
*/
|
|
408
|
+
export const effect = {
|
|
409
|
+
/**
|
|
410
|
+
* Create a cluster instance (returns raw Effect).
|
|
411
|
+
*
|
|
412
|
+
* The returned cluster has an `.effect` namespace for lifecycle methods.
|
|
413
|
+
*
|
|
414
|
+
* @since 0.2.0
|
|
415
|
+
*/
|
|
416
|
+
make: makeEffect,
|
|
417
|
+
/**
|
|
418
|
+
* Run code with an automatically managed cluster (returns raw Effect).
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```typescript
|
|
422
|
+
* import { Effect } from 'effect';
|
|
423
|
+
* import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
|
|
424
|
+
*
|
|
425
|
+
* const program = Cluster.effect.withCluster((cluster) =>
|
|
426
|
+
* Effect.gen(function* () {
|
|
427
|
+
* const config = cluster.networkConfig;
|
|
428
|
+
* return config;
|
|
429
|
+
* })
|
|
430
|
+
* );
|
|
431
|
+
*
|
|
432
|
+
* await Effect.runPromise(program);
|
|
433
|
+
* ```
|
|
434
|
+
*
|
|
435
|
+
* @since 0.2.0
|
|
436
|
+
*/
|
|
437
|
+
withCluster: (fn, config) => Effect.gen(function* () {
|
|
438
|
+
const cluster = yield* makeEffect(config);
|
|
439
|
+
yield* cluster.effect.start();
|
|
440
|
+
return yield* fn(cluster).pipe(Effect.ensuring(cluster.effect.remove().pipe(Effect.ignore)));
|
|
441
|
+
}),
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Create a Layer that provides ClusterService with custom configuration.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```typescript
|
|
448
|
+
* import { Effect } from 'effect';
|
|
449
|
+
* import { Cluster, ClusterService } from '@no-witness-labs/midday-sdk/devnet';
|
|
450
|
+
*
|
|
451
|
+
* const program = Effect.gen(function* () {
|
|
452
|
+
* const cluster = yield* ClusterService;
|
|
453
|
+
* yield* cluster.effect.start();
|
|
454
|
+
* return cluster;
|
|
455
|
+
* });
|
|
456
|
+
*
|
|
457
|
+
* await Effect.runPromise(program.pipe(
|
|
458
|
+
* Effect.provide(Cluster.layer({ clusterName: 'my-devnet' }))
|
|
459
|
+
* ));
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* @since 0.2.0
|
|
463
|
+
* @category layer
|
|
464
|
+
*/
|
|
465
|
+
export const layer = (config) => Layer.effect(ClusterService, makeEffect(config));
|
|
466
|
+
/**
|
|
467
|
+
* Live Layer for ClusterService with default configuration.
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* import { Effect } from 'effect';
|
|
472
|
+
* import { Cluster, ClusterService } from '@no-witness-labs/midday-sdk/devnet';
|
|
473
|
+
*
|
|
474
|
+
* const program = Effect.gen(function* () {
|
|
475
|
+
* const cluster = yield* ClusterService;
|
|
476
|
+
* yield* cluster.effect.start();
|
|
477
|
+
* return cluster;
|
|
478
|
+
* });
|
|
479
|
+
*
|
|
480
|
+
* await Effect.runPromise(program.pipe(Effect.provide(Cluster.Live)));
|
|
481
|
+
* ```
|
|
482
|
+
*
|
|
483
|
+
* @since 0.2.0
|
|
484
|
+
* @category layer
|
|
485
|
+
*/
|
|
486
|
+
export const Live = layer();
|
|
487
|
+
//# sourceMappingURL=Cluster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cluster.js","sourceRoot":"","sources":["../../src/devnet/Cluster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;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,KAAK,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAC7D,CAAC;IACJ,CAAC,CAAC;CACI,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAAqB,EACsB,EAAE,CAC7C,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,IAAI,GAA8C,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for Midnight DevNet.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.2.0
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { NetworkConfig } from '../Config.js';
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for the Midnight node container.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.2.0
|
|
12
|
+
* @category model
|
|
13
|
+
*/
|
|
14
|
+
export interface NodeConfig {
|
|
15
|
+
readonly image?: string;
|
|
16
|
+
readonly port?: number;
|
|
17
|
+
/** Node configuration preset (default: 'dev') */
|
|
18
|
+
readonly cfgPreset?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for the indexer container.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.2.0
|
|
24
|
+
* @category model
|
|
25
|
+
*/
|
|
26
|
+
export interface IndexerConfig {
|
|
27
|
+
readonly image?: string;
|
|
28
|
+
readonly port?: number;
|
|
29
|
+
readonly logLevel?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Configuration for the proof server container.
|
|
33
|
+
*
|
|
34
|
+
* @since 0.2.0
|
|
35
|
+
* @category model
|
|
36
|
+
*/
|
|
37
|
+
export interface ProofServerConfig {
|
|
38
|
+
readonly image?: string;
|
|
39
|
+
readonly port?: number;
|
|
40
|
+
/** Path to ZK params directory on host */
|
|
41
|
+
readonly zkParamsPath?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Configuration interface for Midnight DevNet setup.
|
|
45
|
+
* All properties are optional, with sensible defaults provided.
|
|
46
|
+
*
|
|
47
|
+
* @since 0.2.0
|
|
48
|
+
* @category model
|
|
49
|
+
*/
|
|
50
|
+
export interface DevNetConfig {
|
|
51
|
+
/** Unique name for this cluster (default: 'midday-devnet') */
|
|
52
|
+
readonly clusterName?: string;
|
|
53
|
+
/** Node configuration */
|
|
54
|
+
readonly node?: NodeConfig;
|
|
55
|
+
/** Indexer configuration */
|
|
56
|
+
readonly indexer?: IndexerConfig;
|
|
57
|
+
/** Proof server configuration */
|
|
58
|
+
readonly proofServer?: ProofServerConfig;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Fully resolved DevNet configuration with all defaults applied.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.2.0
|
|
64
|
+
* @category model
|
|
65
|
+
*/
|
|
66
|
+
export interface ResolvedDevNetConfig {
|
|
67
|
+
readonly clusterName: string;
|
|
68
|
+
readonly node: Required<NodeConfig>;
|
|
69
|
+
readonly indexer: Required<IndexerConfig>;
|
|
70
|
+
readonly proofServer: Required<ProofServerConfig>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Default Midnight node configuration.
|
|
74
|
+
*
|
|
75
|
+
* @since 0.2.0
|
|
76
|
+
* @category constants
|
|
77
|
+
*/
|
|
78
|
+
export declare const DEFAULT_NODE_CONFIG: Required<NodeConfig>;
|
|
79
|
+
/**
|
|
80
|
+
* Default indexer configuration.
|
|
81
|
+
*
|
|
82
|
+
* @since 0.2.0
|
|
83
|
+
* @category constants
|
|
84
|
+
*/
|
|
85
|
+
export declare const DEFAULT_INDEXER_CONFIG: Required<IndexerConfig>;
|
|
86
|
+
/**
|
|
87
|
+
* Default proof server configuration.
|
|
88
|
+
*
|
|
89
|
+
* @since 0.2.0
|
|
90
|
+
* @category constants
|
|
91
|
+
*/
|
|
92
|
+
export declare const DEFAULT_PROOF_SERVER_CONFIG: Required<ProofServerConfig>;
|
|
93
|
+
/**
|
|
94
|
+
* Default DevNet configuration.
|
|
95
|
+
*
|
|
96
|
+
* @since 0.2.0
|
|
97
|
+
* @category constants
|
|
98
|
+
*/
|
|
99
|
+
export declare const DEFAULT_DEVNET_CONFIG: Required<DevNetConfig>;
|
|
100
|
+
/**
|
|
101
|
+
* Indexer secret for local development (matches docker-compose).
|
|
102
|
+
* DO NOT use in production.
|
|
103
|
+
*
|
|
104
|
+
* @since 0.2.0
|
|
105
|
+
* @category constants
|
|
106
|
+
*/
|
|
107
|
+
export declare const DEV_INDEXER_SECRET = "303132333435363738393031323334353637383930313233343536373839303132";
|
|
108
|
+
/**
|
|
109
|
+
* Convert cluster ports to a NetworkConfig compatible with midday-sdk.
|
|
110
|
+
*
|
|
111
|
+
* @since 0.2.0
|
|
112
|
+
* @category utilities
|
|
113
|
+
*/
|
|
114
|
+
export declare function toNetworkConfig(ports: {
|
|
115
|
+
node: number;
|
|
116
|
+
indexer: number;
|
|
117
|
+
proofServer: number;
|
|
118
|
+
}): NetworkConfig;
|
|
119
|
+
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/devnet/Config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,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IjD,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,iBAAiB,CAI1D,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAK/C,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uEACuC,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,aAAa,CAQhB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for Midnight DevNet.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.2.0
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Default Midnight node configuration.
|
|
9
|
+
*
|
|
10
|
+
* @since 0.2.0
|
|
11
|
+
* @category constants
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_NODE_CONFIG = {
|
|
14
|
+
image: 'midnightntwrk/midnight-node:0.18.0',
|
|
15
|
+
port: 9944,
|
|
16
|
+
cfgPreset: 'dev',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Default indexer configuration.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.2.0
|
|
22
|
+
* @category constants
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_INDEXER_CONFIG = {
|
|
25
|
+
image: 'midnightntwrk/indexer-standalone:3.0.0-alpha.20',
|
|
26
|
+
port: 8088,
|
|
27
|
+
logLevel: 'info',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Default proof server configuration.
|
|
31
|
+
*
|
|
32
|
+
* @since 0.2.0
|
|
33
|
+
* @category constants
|
|
34
|
+
*/
|
|
35
|
+
export const DEFAULT_PROOF_SERVER_CONFIG = {
|
|
36
|
+
image: 'bricktowers/proof-server:6.1.0-alpha.6',
|
|
37
|
+
port: 6300,
|
|
38
|
+
zkParamsPath: '',
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Default DevNet configuration.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.2.0
|
|
44
|
+
* @category constants
|
|
45
|
+
*/
|
|
46
|
+
export const DEFAULT_DEVNET_CONFIG = {
|
|
47
|
+
clusterName: 'midday-devnet',
|
|
48
|
+
node: DEFAULT_NODE_CONFIG,
|
|
49
|
+
indexer: DEFAULT_INDEXER_CONFIG,
|
|
50
|
+
proofServer: DEFAULT_PROOF_SERVER_CONFIG,
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Indexer secret for local development (matches docker-compose).
|
|
54
|
+
* DO NOT use in production.
|
|
55
|
+
*
|
|
56
|
+
* @since 0.2.0
|
|
57
|
+
* @category constants
|
|
58
|
+
*/
|
|
59
|
+
export const DEV_INDEXER_SECRET = '303132333435363738393031323334353637383930313233343536373839303132';
|
|
60
|
+
/**
|
|
61
|
+
* Convert cluster ports to a NetworkConfig compatible with midday-sdk.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.2.0
|
|
64
|
+
* @category utilities
|
|
65
|
+
*/
|
|
66
|
+
export function toNetworkConfig(ports) {
|
|
67
|
+
return {
|
|
68
|
+
networkId: 'undeployed',
|
|
69
|
+
indexer: `http://localhost:${ports.indexer}/api/v3/graphql`,
|
|
70
|
+
indexerWS: `ws://localhost:${ports.indexer}/api/v3/graphql/ws`,
|
|
71
|
+
node: `ws://localhost:${ports.node}`,
|
|
72
|
+
proofServer: `http://localhost:${ports.proofServer}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=Config.js.map
|