@olane/o-node 0.7.15 → 0.7.17

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.
@@ -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,MAAM,EAAE,UAAU,EAAU,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAOhD,QAAQ,CAAC,MAAM,EAAE,4BAA4B;IANzD,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAAS;IACvC,OAAO,CAAC,yBAAyB,CAAsC;IACvE,OAAO,CAAC,0BAA0B,CAA+C;gBAE5D,MAAM,EAAE,4BAA4B;IAWzD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAiBlC;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAatB,qBAAqB,CACzB,cAAc,EAAE,QAAQ,EACxB,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,UAAU,CAAC;YAsDR,WAAW;IAwBzB;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IA8BlE;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAoCpC;;;;OAIG;IACH,yBAAyB,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI;IA+C/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H,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAoCpC;;;;OAIG;IACH,yBAAyB,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI;IA+C/D;;;OAGG;IACH,aAAa,IAAI;QACf,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC9D;IAaD;;;OAGG;IACH,uBAAuB,IAAI,MAAM;CAalC"}
@@ -72,6 +72,9 @@ export class oNodeConnectionManager extends oConnectionManager {
72
72
  }
73
73
  }
74
74
  async getOrCreateConnection(nextHopAddress, address) {
75
+ if (!nextHopAddress) {
76
+ throw new Error('Invalid address passed');
77
+ }
75
78
  // Build a transport-based cache key from the next hop address
76
79
  const transportKey = this.getTransportKeyFromAddress(nextHopAddress);
77
80
  if (!transportKey) {
@@ -428,7 +428,7 @@ export class oNode extends oToolBase {
428
428
  this.router.addResolver(new oMethodResolver(this.address));
429
429
  this.router.addResolver(new oNodeResolver(this.address));
430
430
  // setup a fallback resolver for non-leader nodes
431
- if (this.isLeader === false && !!this.leader) {
431
+ if (this.isLeader === false) {
432
432
  this.logger.debug('Adding leader resolver fallback...');
433
433
  this.router.addResolver(new oLeaderResolverFallback(this.address));
434
434
  }
@@ -1 +1 @@
1
- {"version":3,"file":"o-node.router.d.ts","sourceRoot":"","sources":["../../../src/router/o-node.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAML,cAAc,EAGd,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,qBAAa,WAAY,SAAQ,WAAW;IAC1C,O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C;IA+B3E;;;OAGG;IACH,UAAU,CAAC,qBAAqB,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO;CAGtE"}
@@ -141,6 +141,7 @@ export class oNodeRouter extends oToolRouter {
141
141
  }
142
142
  catch (error) {
143
143
  if (error?.name === 'UnsupportedProtocolError') {
144
+ this.logger.warn('Invalid protocol attempt. Ensure that you are trying to hit a supported protocol for the respective transport.');
144
145
  throw new oError(oErrorCodes.NOT_FOUND, 'Address not found: ' + address.value);
145
146
  }
146
147
  throw error;
@@ -152,26 +153,23 @@ export class oNodeRouter extends oToolRouter {
152
153
  */
153
154
  async translate(address, node) {
154
155
  // Apply resolver chain for internal routing
155
- if (!node.parent && !node.leader && address.transports?.length > 0) {
156
- // independent node
157
- return {
158
- nextHopAddress: address,
159
- targetAddress: address,
160
- };
156
+ // Check if external routing is needed for leader routing
157
+ const externalRoute = this.routingPolicy.getExternalRoutingStrategy(address, node);
158
+ if (externalRoute) {
159
+ return externalRoute;
161
160
  }
161
+ // if (!node.parent && !node.leader && address.transports?.length > 0) {
162
+ // // independent node
163
+ // return {
164
+ // nextHopAddress: address,
165
+ // targetAddress: address,
166
+ // }
167
+ // }
162
168
  const { nextHopAddress, targetAddress, requestOverride } = await this.addressResolution.resolve({
163
169
  address,
164
170
  node,
165
171
  targetAddress: address,
166
172
  });
167
- // if we defaulted back to the leader
168
- if (nextHopAddress.value === oAddress.leader().value) {
169
- // Check if external routing is needed for leader routing
170
- const externalRoute = this.routingPolicy.getExternalRoutingStrategy(address, node);
171
- if (externalRoute) {
172
- return externalRoute;
173
- }
174
- }
175
173
  return {
176
174
  nextHopAddress,
177
175
  targetAddress: targetAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-node",
3
- "version": "0.7.15",
3
+ "version": "0.7.17",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "devDependencies": {
41
41
  "@eslint/eslintrc": "^3.3.1",
42
42
  "@eslint/js": "^9.29.0",
43
- "@olane/o-test": "0.7.15",
43
+ "@olane/o-test": "0.7.17",
44
44
  "@tsconfig/node20": "^20.1.6",
45
45
  "@types/jest": "^30.0.0",
46
46
  "@typescript-eslint/eslint-plugin": "^8.34.1",
@@ -59,12 +59,12 @@
59
59
  "typescript": "5.4.5"
60
60
  },
61
61
  "dependencies": {
62
- "@olane/o-config": "0.7.15",
63
- "@olane/o-core": "0.7.15",
64
- "@olane/o-protocol": "0.7.15",
65
- "@olane/o-tool": "0.7.15",
62
+ "@olane/o-config": "0.7.17",
63
+ "@olane/o-core": "0.7.17",
64
+ "@olane/o-protocol": "0.7.17",
65
+ "@olane/o-tool": "0.7.17",
66
66
  "debug": "^4.4.1",
67
67
  "dotenv": "^16.5.0"
68
68
  },
69
- "gitHead": "26cc66170f6ae094b38ab90069d41e68d95c3c3f"
69
+ "gitHead": "fee4fd4a87a1d9b69578e49735609ebef699db8b"
70
70
  }