@olane/o-core 0.2.3 → 0.3.2
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/core/core.node.d.ts.map +1 -1
- package/dist/core/core.node.js +13 -10
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/package.json +4 -4
- package/dist/node-host/host.node.d.ts +0 -12
- package/dist/node-host/host.node.d.ts.map +0 -1
- package/dist/node-host/host.node.js +0 -22
- package/dist/node-host/index.d.ts +0 -2
- package/dist/node-host/index.d.ts.map +0 -1
- package/dist/node-host/index.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../../src/core/core.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,YAAY,EACZ,SAAS,EAET,MAAM,EACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,8BAAsB,SAAS;IAmBjB,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AC;IA2BV,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtC;;;OAGG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBnC;;OAEG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAanC"}
|
package/dist/core/core.node.js
CHANGED
|
@@ -114,14 +114,6 @@ export class oCoreNode {
|
|
|
114
114
|
return result;
|
|
115
115
|
}
|
|
116
116
|
async translateAddress(addressWithLeaderTransports) {
|
|
117
|
-
const inputTransports = addressWithLeaderTransports.libp2pTransports;
|
|
118
|
-
let targetAddress = addressWithLeaderTransports;
|
|
119
|
-
let nextHopAddress = addressWithLeaderTransports;
|
|
120
|
-
// handle static address translation for search based upon base functionality
|
|
121
|
-
targetAddress = await this.handleStaticAddressTranslation(targetAddress);
|
|
122
|
-
nextHopAddress = await this.addressResolution.resolve(targetAddress);
|
|
123
|
-
const leaderTransports = this.getTransports(nextHopAddress);
|
|
124
|
-
nextHopAddress.setTransports(leaderTransports);
|
|
125
117
|
// determine if this is external
|
|
126
118
|
const isInternal = this.isInternalAddress(addressWithLeaderTransports);
|
|
127
119
|
if (!isInternal) {
|
|
@@ -132,6 +124,13 @@ export class oCoreNode {
|
|
|
132
124
|
targetAddress: addressWithLeaderTransports,
|
|
133
125
|
};
|
|
134
126
|
}
|
|
127
|
+
let targetAddress = addressWithLeaderTransports;
|
|
128
|
+
let nextHopAddress = addressWithLeaderTransports;
|
|
129
|
+
// handle static address translation for search based upon base functionality
|
|
130
|
+
targetAddress = await this.handleStaticAddressTranslation(targetAddress);
|
|
131
|
+
nextHopAddress = await this.addressResolution.resolve(targetAddress);
|
|
132
|
+
const leaderTransports = this.getTransports(nextHopAddress);
|
|
133
|
+
nextHopAddress.setTransports(leaderTransports);
|
|
135
134
|
return {
|
|
136
135
|
nextHopAddress,
|
|
137
136
|
targetAddress: targetAddress,
|
|
@@ -140,8 +139,12 @@ export class oCoreNode {
|
|
|
140
139
|
isInternalAddress(addressWithLeaderTransports) {
|
|
141
140
|
if (addressWithLeaderTransports.libp2pTransports?.length > 0) {
|
|
142
141
|
// transports are provided, let's see if they match our known leaders
|
|
143
|
-
const leaderTransports = this.
|
|
142
|
+
const leaderTransports = this.type === NodeType.LEADER
|
|
143
|
+
? this.address.libp2pTransports
|
|
144
|
+
: this.config.leader?.libp2pTransports;
|
|
145
|
+
this.logger.debug('Leader transports: ', leaderTransports);
|
|
144
146
|
if (leaderTransports && leaderTransports.length > 0) {
|
|
147
|
+
this.logger.debug('Address transports: ', addressWithLeaderTransports.libp2pTransports);
|
|
145
148
|
// compare against our known leaders
|
|
146
149
|
const isInternal = leaderTransports.some((t) => addressWithLeaderTransports.libp2pTransports.includes(t));
|
|
147
150
|
return isInternal;
|
|
@@ -158,7 +161,7 @@ export class oCoreNode {
|
|
|
158
161
|
*/
|
|
159
162
|
async use(addressWithLeaderTransports, data) {
|
|
160
163
|
const { nextHopAddress, targetAddress } = await this.translateAddress(addressWithLeaderTransports);
|
|
161
|
-
this.logger.debug('Using address: ', targetAddress.toString());
|
|
164
|
+
this.logger.debug('Using address, target: ', targetAddress.toString(), 'nextHop: ', nextHopAddress.toString());
|
|
162
165
|
const connection = await this.connect(nextHopAddress, targetAddress);
|
|
163
166
|
// communicate the payload to the target node
|
|
164
167
|
const response = await connection.send({
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './core/index.js';
|
|
2
2
|
export * from './node/index.js';
|
|
3
|
-
export * from './node-virtual/index.js';
|
|
4
|
-
export * from './node-host/index.js';
|
|
5
3
|
export * from './error/index.js';
|
|
6
4
|
export * from './plan/index.js';
|
|
5
|
+
export * from './node-virtual/index.js';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-core",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/olane-labs/
|
|
29
|
+
"url": "git+https://github.com/olane-labs/olane.git"
|
|
30
30
|
},
|
|
31
31
|
"author": "Olane Inc.",
|
|
32
32
|
"license": "ISC",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"typescript": "^5.8.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@olane/o-config": "^0.2
|
|
58
|
-
"@olane/o-protocol": "^0.2
|
|
57
|
+
"@olane/o-config": "^0.3.2",
|
|
58
|
+
"@olane/o-protocol": "^0.3.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"chalk": "^5.4.1",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { oNode } from '../node/node.js';
|
|
2
|
-
/**
|
|
3
|
-
* A standalone node that can be used to host other nodes.
|
|
4
|
-
* Can be useful for separating various buckets of functionality.
|
|
5
|
-
* Think about microservice best practices.
|
|
6
|
-
* These nodes are addressable via TCP/IP.
|
|
7
|
-
*/
|
|
8
|
-
export declare class oHostNode extends oNode {
|
|
9
|
-
initialize(): Promise<void>;
|
|
10
|
-
configureTransports(): any[];
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=host.node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"host.node.d.ts","sourceRoot":"","sources":["../../src/node-host/host.node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAC5B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,mBAAmB,IAAI,GAAG,EAAE;CAQ7B"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defaultLibp2pConfig, memory } from '@olane/o-config';
|
|
2
|
-
import { oNode } from '../node/node.js';
|
|
3
|
-
/**
|
|
4
|
-
* A standalone node that can be used to host other nodes.
|
|
5
|
-
* Can be useful for separating various buckets of functionality.
|
|
6
|
-
* Think about microservice best practices.
|
|
7
|
-
* These nodes are addressable via TCP/IP.
|
|
8
|
-
*/
|
|
9
|
-
export class oHostNode extends oNode {
|
|
10
|
-
async initialize() {
|
|
11
|
-
// start the current node
|
|
12
|
-
await super.initialize();
|
|
13
|
-
}
|
|
14
|
-
configureTransports() {
|
|
15
|
-
return [
|
|
16
|
-
memory(),
|
|
17
|
-
...(this.config.network?.transports ||
|
|
18
|
-
defaultLibp2pConfig.transports ||
|
|
19
|
-
[]),
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node-host/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/node-host/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './host.node.js';
|