@olane/o-node 0.7.12-alpha.5 → 0.7.12-alpha.51
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/interfaces/o-node-connection-manager.config.d.ts +1 -0
- package/dist/src/connection/interfaces/o-node-connection-manager.config.d.ts.map +1 -1
- package/dist/src/connection/interfaces/o-node-connection.config.d.ts +1 -0
- package/dist/src/connection/interfaces/o-node-connection.config.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection.d.ts +5 -2
- package/dist/src/connection/o-node-connection.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection.js +86 -26
- package/dist/src/connection/o-node-connection.manager.d.ts +18 -4
- package/dist/src/connection/o-node-connection.manager.d.ts.map +1 -1
- package/dist/src/connection/o-node-connection.manager.js +79 -65
- package/dist/src/connection/o-stream.request.d.ts +11 -0
- package/dist/src/connection/o-stream.request.d.ts.map +1 -0
- package/dist/src/connection/o-stream.request.js +7 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/interfaces/i-heartbeatable-node.d.ts +49 -0
- package/dist/src/interfaces/i-heartbeatable-node.d.ts.map +1 -0
- package/dist/src/interfaces/i-heartbeatable-node.js +1 -0
- package/dist/src/interfaces/i-reconnectable-node.d.ts +46 -0
- package/dist/src/interfaces/i-reconnectable-node.d.ts.map +1 -0
- package/dist/src/interfaces/i-reconnectable-node.js +1 -0
- package/dist/src/interfaces/o-node.config.d.ts +43 -0
- package/dist/src/interfaces/o-node.config.d.ts.map +1 -1
- package/dist/src/managers/o-connection-heartbeat.manager.d.ts +63 -0
- package/dist/src/managers/o-connection-heartbeat.manager.d.ts.map +1 -0
- package/dist/src/managers/o-connection-heartbeat.manager.js +227 -0
- package/dist/src/managers/o-reconnection.manager.d.ts +51 -0
- package/dist/src/managers/o-reconnection.manager.d.ts.map +1 -0
- package/dist/src/managers/o-reconnection.manager.js +266 -0
- package/dist/src/o-node.d.ts +30 -2
- package/dist/src/o-node.d.ts.map +1 -1
- package/dist/src/o-node.js +245 -33
- package/dist/src/o-node.notification-manager.d.ts +52 -0
- package/dist/src/o-node.notification-manager.d.ts.map +1 -0
- package/dist/src/o-node.notification-manager.js +188 -0
- package/dist/src/o-node.tool.d.ts.map +1 -1
- package/dist/src/o-node.tool.js +33 -22
- package/dist/src/router/o-node.router.d.ts +1 -0
- package/dist/src/router/o-node.router.d.ts.map +1 -1
- package/dist/src/router/o-node.router.js +62 -9
- package/dist/src/router/o-node.routing-policy.d.ts.map +1 -1
- package/dist/src/router/o-node.routing-policy.js +7 -2
- package/dist/src/router/resolvers/o-node.resolver.d.ts.map +1 -1
- package/dist/src/router/resolvers/o-node.resolver.js +5 -1
- package/dist/src/router/resolvers/o-node.search-resolver.d.ts.map +1 -1
- package/dist/src/router/resolvers/o-node.search-resolver.js +34 -9
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/stream.utils.d.ts +6 -0
- package/dist/src/utils/stream.utils.d.ts.map +1 -0
- package/dist/src/utils/stream.utils.js +31 -0
- 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
- package/dist/src/router/resolvers/o-node.child-resolver.d.ts +0 -11
- package/dist/src/router/resolvers/o-node.child-resolver.d.ts.map +0 -1
- package/dist/src/router/resolvers/o-node.child-resolver.js +0 -58
|
@@ -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.51",
|
|
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.51",
|
|
58
|
+
"@olane/o-core": "0.7.12-alpha.51",
|
|
59
|
+
"@olane/o-protocol": "0.7.12-alpha.51",
|
|
60
|
+
"@olane/o-tool": "0.7.12-alpha.51",
|
|
61
61
|
"debug": "^4.4.1",
|
|
62
62
|
"dotenv": "^16.5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "b877e1e95a2bf32845ec30072eb72422fd25aba7"
|
|
65
65
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { oAddressResolver, TransportType } from '@olane/o-core';
|
|
2
|
-
import { oNodeAddress } from '../o-node.address.js';
|
|
3
|
-
import { oNodeRouterResponse } from '../interfaces/o-node-router.response.js';
|
|
4
|
-
import { ResolveRequest } from '@olane/o-core';
|
|
5
|
-
export declare class oNodeChildResolver extends oAddressResolver {
|
|
6
|
-
protected readonly address: oNodeAddress;
|
|
7
|
-
constructor(address: oNodeAddress);
|
|
8
|
-
get supportedTransports(): TransportType[];
|
|
9
|
-
resolve(routeRequest: ResolveRequest): Promise<oNodeRouterResponse>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=o-node.child-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o-node.child-resolver.d.ts","sourceRoot":"","sources":["../../../../src/router/resolvers/o-node.child-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,aAAa,EAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,qBAAa,kBAAmB,SAAQ,gBAAgB;IAC1C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY;gBAArB,OAAO,EAAE,YAAY;IAIpD,IAAI,mBAAmB,IAAI,aAAa,EAAE,CAEzC;IAEK,OAAO,CAAC,YAAY,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA4D1E"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { oAddressResolver, TransportType, } from '@olane/o-core';
|
|
2
|
-
export class oNodeChildResolver extends oAddressResolver {
|
|
3
|
-
constructor(address) {
|
|
4
|
-
super(address);
|
|
5
|
-
this.address = address;
|
|
6
|
-
}
|
|
7
|
-
get supportedTransports() {
|
|
8
|
-
return [TransportType.LIBP2P];
|
|
9
|
-
}
|
|
10
|
-
async resolve(routeRequest) {
|
|
11
|
-
const { address, node, request } = routeRequest;
|
|
12
|
-
if (!node) {
|
|
13
|
-
return {
|
|
14
|
-
nextHopAddress: address,
|
|
15
|
-
targetAddress: address,
|
|
16
|
-
requestOverride: request,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
// if we are the same address, return the address
|
|
20
|
-
if (address.toStaticAddress().equals(node.address.toStaticAddress())) {
|
|
21
|
-
return {
|
|
22
|
-
nextHopAddress: node.address,
|
|
23
|
-
targetAddress: node.address,
|
|
24
|
-
requestOverride: request,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
// get the next node & check for child address existence
|
|
28
|
-
const remainingPath = address.protocol.replace(node.address.protocol + '/', '');
|
|
29
|
-
// ensure this is going down in the hierarchy
|
|
30
|
-
if (remainingPath === address.protocol && node.isLeader === false) {
|
|
31
|
-
return {
|
|
32
|
-
nextHopAddress: node.address,
|
|
33
|
-
targetAddress: address,
|
|
34
|
-
requestOverride: request,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
// static resolver
|
|
38
|
-
this.logger.debug(`[${node?.address}]: Next node: ${address.toString()}`);
|
|
39
|
-
const childAddress = node?.hierarchyManager.getChild(address);
|
|
40
|
-
this.logger.debug(`[${node?.address}]: Children: ${node?.hierarchyManager.children.map((c) => c.toString()).join(', ')}`);
|
|
41
|
-
this.logger.debug(`[${node?.address}]: Resolving address: ${address.toString()} and child address: ${childAddress?.toString()}`);
|
|
42
|
-
this.logger.debug('Child transports: ' +
|
|
43
|
-
childAddress?.transports.map((t) => t.toString()).join(', '));
|
|
44
|
-
// get the child address from hierarchy (which includes transports)
|
|
45
|
-
if (childAddress) {
|
|
46
|
-
return {
|
|
47
|
-
nextHopAddress: childAddress,
|
|
48
|
-
targetAddress: address,
|
|
49
|
-
requestOverride: request,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
nextHopAddress: address,
|
|
54
|
-
targetAddress: address,
|
|
55
|
-
requestOverride: request,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|