@olane/o-node 0.7.12-alpha.27 → 0.7.12-alpha.29
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/src/connection/o-node-connection.manager.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection.manager.js +1 -1
- package/dist/src/interfaces/o-node.config.d.ts +0 -17
- package/dist/src/interfaces/o-node.config.d.ts.map +1 -1
- package/dist/src/o-node.d.ts +1 -10
- package/dist/src/o-node.d.ts.map +1 -1
- package/dist/src/o-node.js +18 -22
- package/dist/src/utils/index.d.ts +0 -2
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +0 -2
- package/dist/test/helpers/test-node.tool.d.ts +15 -0
- package/dist/test/helpers/test-node.tool.d.ts.map +1 -0
- package/dist/test/helpers/test-node.tool.js +27 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-node-connection.manager.d.ts","sourceRoot":"","sources":["../../../src/connection/o-node-connection.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAAS;gBAE3B,MAAM,EAAE,4BAA4B;IAOhD;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"o-node-connection.manager.d.ts","sourceRoot":"","sources":["../../../src/connection/o-node-connection.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAAS;gBAE3B,MAAM,EAAE,4BAA4B;IAOhD;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IA+FlE,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIpC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI;CAe3D"}
|
|
@@ -60,7 +60,7 @@ export class oNodeConnectionManager extends oConnectionManager {
|
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
62
|
lastError = error;
|
|
63
|
-
this.logger.warn(`[${callerAddress?.toString() || 'unknown'}] Connection attempt ${attempt + 1}/${MAX_RETRIES + 1} failed for ${nextHopAddress.toString()}
|
|
63
|
+
this.logger.warn(`[${callerAddress?.toString() || 'unknown'}] Connection attempt ${attempt + 1}/${MAX_RETRIES + 1} failed for ${nextHopAddress.toString()}:`, error);
|
|
64
64
|
// Don't retry on the last attempt
|
|
65
65
|
if (attempt === MAX_RETRIES) {
|
|
66
66
|
break;
|
|
@@ -29,23 +29,6 @@ export interface oNodeConfig extends oCoreConfig {
|
|
|
29
29
|
parentDiscoveryIntervalMs?: number;
|
|
30
30
|
parentDiscoveryMaxDelayMs?: number;
|
|
31
31
|
};
|
|
32
|
-
/**
|
|
33
|
-
* Leader request retry configuration
|
|
34
|
-
* Handles temporary leader unavailability (healing, maintenance)
|
|
35
|
-
*/
|
|
36
|
-
leaderRetry?: {
|
|
37
|
-
enabled?: boolean;
|
|
38
|
-
maxAttempts?: number;
|
|
39
|
-
baseDelayMs?: number;
|
|
40
|
-
maxDelayMs?: number;
|
|
41
|
-
timeoutMs?: number;
|
|
42
|
-
circuitBreaker?: {
|
|
43
|
-
enabled?: boolean;
|
|
44
|
-
failureThreshold?: number;
|
|
45
|
-
openTimeoutMs?: number;
|
|
46
|
-
halfOpenMaxAttempts?: number;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
32
|
/**
|
|
50
33
|
* Connection timeout configuration
|
|
51
34
|
* Controls timeouts for stream read and drain operations in connections
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-node.config.d.ts","sourceRoot":"","sources":["../../../src/interfaces/o-node.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAE5B;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QACpB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IAEF;;;OAGG;IACH,YAAY,CAAC,EAAE;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC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c,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH"}
|
package/dist/src/o-node.d.ts
CHANGED
|
@@ -3,14 +3,13 @@ import { PeerId } from '@olane/o-config';
|
|
|
3
3
|
import { oNodeHierarchyManager } from './o-node.hierarchy-manager.js';
|
|
4
4
|
import { oNodeConfig } from './interfaces/o-node.config.js';
|
|
5
5
|
import { oNodeTransport } from './router/o-node.transport.js';
|
|
6
|
-
import {
|
|
6
|
+
import { oRequest, oNotificationManager } from '@olane/o-core';
|
|
7
7
|
import { oNodeAddress } from './router/o-node.address.js';
|
|
8
8
|
import { oNodeConnection } from './connection/o-node-connection.js';
|
|
9
9
|
import { oNodeConnectionManager } from './connection/o-node-connection.manager.js';
|
|
10
10
|
import { oToolBase } from '@olane/o-tool';
|
|
11
11
|
import { oConnectionHeartbeatManager } from './managers/o-connection-heartbeat.manager.js';
|
|
12
12
|
import { oReconnectionManager } from './managers/o-reconnection.manager.js';
|
|
13
|
-
import { LeaderRequestWrapper } from './utils/leader-request-wrapper.js';
|
|
14
13
|
import { oNodeConnectionConfig } from './connection/index.js';
|
|
15
14
|
export declare class oNode extends oToolBase {
|
|
16
15
|
peerId: PeerId;
|
|
@@ -21,7 +20,6 @@ export declare class oNode extends oToolBase {
|
|
|
21
20
|
hierarchyManager: oNodeHierarchyManager;
|
|
22
21
|
connectionHeartbeatManager?: oConnectionHeartbeatManager;
|
|
23
22
|
reconnectionManager?: oReconnectionManager;
|
|
24
|
-
leaderRequestWrapper: LeaderRequestWrapper;
|
|
25
23
|
protected didRegister: boolean;
|
|
26
24
|
constructor(config: oNodeConfig);
|
|
27
25
|
get leader(): oNodeAddress | null;
|
|
@@ -55,13 +53,6 @@ export declare class oNode extends oToolBase {
|
|
|
55
53
|
/**
|
|
56
54
|
* Override use() to wrap leader/registry requests with retry logic
|
|
57
55
|
*/
|
|
58
|
-
use(address: oAddress, data?: {
|
|
59
|
-
method?: string;
|
|
60
|
-
params?: {
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
};
|
|
63
|
-
id?: string;
|
|
64
|
-
}, options?: UseOptions): Promise<any>;
|
|
65
56
|
teardown(): Promise<void>;
|
|
66
57
|
getLeaders(): oNodeAddress[];
|
|
67
58
|
getParents(): oNodeAddress[];
|
package/dist/src/o-node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-node.d.ts","sourceRoot":"","sources":["../../src/o-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACN,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"o-node.d.ts","sourceRoot":"","sources":["../../src/o-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACN,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAKL,QAAQ,EAER,oBAAoB,EAGrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,OAAO,EAAmB,SAAS,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C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AS,IAAI,OAAO,CAAC,YAAY,CAAC;cA2HxB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAMvC,OAAO,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsBhE,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtC,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBxC,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBlC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAwCjC;;OAEG;IAiBG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAc/B,UAAU,IAAI,YAAY,EAAE;IAI5B,UAAU,IAAI,YAAY,EAAE;IAI5B,WAAW,IAAI,YAAY,EAAE;IAI7B,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;CAG9C"}
|
package/dist/src/o-node.js
CHANGED
|
@@ -12,7 +12,6 @@ import { oLeaderResolverFallback } from './router/index.js';
|
|
|
12
12
|
import { oNodeNotificationManager } from './o-node.notification-manager.js';
|
|
13
13
|
import { oConnectionHeartbeatManager } from './managers/o-connection-heartbeat.manager.js';
|
|
14
14
|
import { oReconnectionManager } from './managers/o-reconnection.manager.js';
|
|
15
|
-
import { LeaderRequestWrapper } from './utils/leader-request-wrapper.js';
|
|
16
15
|
export class oNode extends oToolBase {
|
|
17
16
|
constructor(config) {
|
|
18
17
|
super(config);
|
|
@@ -244,6 +243,10 @@ export class oNode extends oToolBase {
|
|
|
244
243
|
if (this.hierarchyManager.children.some((c) => c.libp2pTransports.some((t) => t.toPeerId() === peerId.toString()))) {
|
|
245
244
|
return false;
|
|
246
245
|
}
|
|
246
|
+
// check for standalone node
|
|
247
|
+
if (!this.config.parent && !this.config.leader) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
247
250
|
return true;
|
|
248
251
|
},
|
|
249
252
|
// who can call us?
|
|
@@ -352,23 +355,6 @@ export class oNode extends oToolBase {
|
|
|
352
355
|
this.peerId = this.p2pNode.peerId;
|
|
353
356
|
// initialize connection manager
|
|
354
357
|
await this.initConnectionManager();
|
|
355
|
-
// Initialize leader request wrapper with circuit breaker
|
|
356
|
-
this.leaderRequestWrapper = new LeaderRequestWrapper({
|
|
357
|
-
enabled: this.config.leaderRetry?.enabled ?? true,
|
|
358
|
-
maxAttempts: this.config.leaderRetry?.maxAttempts ?? 20,
|
|
359
|
-
baseDelayMs: this.config.leaderRetry?.baseDelayMs ?? 2000,
|
|
360
|
-
maxDelayMs: this.config.leaderRetry?.maxDelayMs ?? 30000,
|
|
361
|
-
timeoutMs: this.config.leaderRetry?.timeoutMs ?? 120000,
|
|
362
|
-
circuitBreaker: {
|
|
363
|
-
enabled: this.config.leaderRetry?.circuitBreaker?.enabled ?? true,
|
|
364
|
-
failureThreshold: this.config.leaderRetry?.circuitBreaker?.failureThreshold ?? 3,
|
|
365
|
-
openTimeoutMs: this.config.leaderRetry?.circuitBreaker?.openTimeoutMs ?? 30000,
|
|
366
|
-
halfOpenMaxAttempts: this.config.leaderRetry?.circuitBreaker?.halfOpenMaxAttempts ?? 1,
|
|
367
|
-
},
|
|
368
|
-
});
|
|
369
|
-
this.logger.info(`Leader retry config: enabled=${this.leaderRequestWrapper.getConfig().enabled}, ` +
|
|
370
|
-
`maxAttempts=${this.leaderRequestWrapper.getConfig().maxAttempts}, ` +
|
|
371
|
-
`circuitBreaker.enabled=${this.leaderRequestWrapper.getConfig().circuitBreaker?.enabled}`);
|
|
372
358
|
// initialize address resolution
|
|
373
359
|
this.router.addResolver(new oMethodResolver(this.address));
|
|
374
360
|
this.router.addResolver(new oNodeResolver(this.address));
|
|
@@ -384,10 +370,20 @@ export class oNode extends oToolBase {
|
|
|
384
370
|
/**
|
|
385
371
|
* Override use() to wrap leader/registry requests with retry logic
|
|
386
372
|
*/
|
|
387
|
-
async use(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
373
|
+
// async use(
|
|
374
|
+
// address: oAddress,
|
|
375
|
+
// data?: {
|
|
376
|
+
// method?: string;
|
|
377
|
+
// params?: { [key: string]: any };
|
|
378
|
+
// id?: string;
|
|
379
|
+
// },
|
|
380
|
+
// options?: UseOptions,
|
|
381
|
+
// ): Promise<any> {
|
|
382
|
+
// // Wrap leader/registry requests with retry logic
|
|
383
|
+
// return super.use(address, data, options),
|
|
384
|
+
// address,
|
|
385
|
+
// data?.method,
|
|
386
|
+
// }
|
|
391
387
|
async teardown() {
|
|
392
388
|
// Stop heartbeat before parent teardown
|
|
393
389
|
if (this.connectionHeartbeatManager) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
package/dist/src/utils/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { oNodeTool } from '../../src/o-node.tool.js';
|
|
2
|
+
/**
|
|
3
|
+
* Test-only extension of oNodeTool that adds streaming test methods.
|
|
4
|
+
* This class should only be used in test files and is not part of the production code.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TestNodeTool extends oNodeTool {
|
|
7
|
+
/**
|
|
8
|
+
* Test method that emits chunks for 10 seconds at 100ms intervals.
|
|
9
|
+
* Used for testing streaming functionality across hierarchical networks.
|
|
10
|
+
*
|
|
11
|
+
* @returns AsyncGenerator that yields 100 chunks over 10 seconds
|
|
12
|
+
*/
|
|
13
|
+
_tool_test_stream(): AsyncGenerator<any>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=test-node.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-node.tool.d.ts","sourceRoot":"","sources":["../../../test/helpers/test-node.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC;;;;;OAKG;IACI,iBAAiB,IAAI,cAAc,CAAC,GAAG,CAAC;CAehD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { oNodeTool } from '../../src/o-node.tool.js';
|
|
2
|
+
/**
|
|
3
|
+
* Test-only extension of oNodeTool that adds streaming test methods.
|
|
4
|
+
* This class should only be used in test files and is not part of the production code.
|
|
5
|
+
*/
|
|
6
|
+
export class TestNodeTool extends oNodeTool {
|
|
7
|
+
/**
|
|
8
|
+
* Test method that emits chunks for 10 seconds at 100ms intervals.
|
|
9
|
+
* Used for testing streaming functionality across hierarchical networks.
|
|
10
|
+
*
|
|
11
|
+
* @returns AsyncGenerator that yields 100 chunks over 10 seconds
|
|
12
|
+
*/
|
|
13
|
+
async *_tool_test_stream() {
|
|
14
|
+
const totalDuration = 10000; // 10 seconds
|
|
15
|
+
const intervalMs = 100; // 100ms between chunks
|
|
16
|
+
const totalChunks = totalDuration / intervalMs; // 100 chunks
|
|
17
|
+
for (let i = 0; i < totalChunks; i++) {
|
|
18
|
+
yield {
|
|
19
|
+
chunk: i + 1,
|
|
20
|
+
timestamp: new Date().toISOString(),
|
|
21
|
+
nodeAddress: this.address.toString(),
|
|
22
|
+
message: `Chunk ${i + 1} of ${totalChunks}`,
|
|
23
|
+
};
|
|
24
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-node",
|
|
3
|
-
"version": "0.7.12-alpha.
|
|
3
|
+
"version": "0.7.12-alpha.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"typescript": "5.4.5"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@olane/o-config": "0.7.12-alpha.
|
|
58
|
-
"@olane/o-core": "0.7.12-alpha.
|
|
59
|
-
"@olane/o-protocol": "0.7.12-alpha.
|
|
60
|
-
"@olane/o-tool": "0.7.12-alpha.
|
|
57
|
+
"@olane/o-config": "0.7.12-alpha.29",
|
|
58
|
+
"@olane/o-core": "0.7.12-alpha.29",
|
|
59
|
+
"@olane/o-protocol": "0.7.12-alpha.29",
|
|
60
|
+
"@olane/o-tool": "0.7.12-alpha.29",
|
|
61
61
|
"debug": "^4.4.1",
|
|
62
62
|
"dotenv": "^16.5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "b8c692a1b5ef2d0e974ccfe501841be852b17dbc"
|
|
65
65
|
}
|