@olane/o-core 0.1.1 → 0.1.3

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.
Files changed (98) hide show
  1. package/dist/core/core.node.js +33 -49
  2. package/dist/core/defaults/config.js +5 -11
  3. package/dist/core/defaults/index.d.ts +1 -1
  4. package/dist/core/defaults/index.d.ts.map +1 -1
  5. package/dist/core/defaults/index.js +1 -17
  6. package/dist/core/graceful-shutdown.d.ts +25 -0
  7. package/dist/core/graceful-shutdown.d.ts.map +1 -0
  8. package/dist/core/graceful-shutdown.js +84 -0
  9. package/dist/core/index.d.ts +10 -9
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +10 -25
  12. package/dist/core/interfaces/connection-manager.config.js +1 -2
  13. package/dist/core/interfaces/connection-send-params.interface.js +1 -2
  14. package/dist/core/interfaces/core-config.interface.js +1 -2
  15. package/dist/core/interfaces/index.d.ts +5 -5
  16. package/dist/core/interfaces/index.d.ts.map +1 -1
  17. package/dist/core/interfaces/index.js +5 -21
  18. package/dist/core/interfaces/node-type.enum.js +2 -5
  19. package/dist/core/interfaces/restricted-addresses.enum.js +11 -14
  20. package/dist/core/interfaces/state.enum.js +2 -5
  21. package/dist/core/interfaces/use-options.interface.js +1 -2
  22. package/dist/core/lib/index.d.ts +7 -7
  23. package/dist/core/lib/index.d.ts.map +1 -1
  24. package/dist/core/lib/index.js +7 -23
  25. package/dist/core/lib/o-address-resolution.js +6 -8
  26. package/dist/core/lib/o-address-resolver.js +5 -12
  27. package/dist/core/lib/o-connection-manager.js +4 -10
  28. package/dist/core/lib/o-connection.js +16 -26
  29. package/dist/core/lib/o-request.js +3 -11
  30. package/dist/core/lib/o-response.js +3 -10
  31. package/dist/core/lib/resolvers/anything.resolver.js +4 -8
  32. package/dist/core/lib/resolvers/index.d.ts +4 -4
  33. package/dist/core/lib/resolvers/index.d.ts.map +1 -1
  34. package/dist/core/lib/resolvers/index.js +4 -20
  35. package/dist/core/lib/resolvers/method.resolver.js +4 -8
  36. package/dist/core/lib/resolvers/next-hop.resolver.js +9 -13
  37. package/dist/core/lib/resolvers/storage.resolver.js +2 -6
  38. package/dist/core/o-address.d.ts +1 -1
  39. package/dist/core/o-address.d.ts.map +1 -1
  40. package/dist/core/o-address.js +5 -11
  41. package/dist/core/o-dependency.js +1 -7
  42. package/dist/core/o-parameter.js +1 -10
  43. package/dist/core/utils/core.utils.d.ts +1 -1
  44. package/dist/core/utils/core.utils.d.ts.map +1 -1
  45. package/dist/core/utils/core.utils.js +17 -54
  46. package/dist/core/utils/index.d.ts +3 -3
  47. package/dist/core/utils/index.d.ts.map +1 -1
  48. package/dist/core/utils/index.js +3 -19
  49. package/dist/core/utils/logger.js +9 -18
  50. package/dist/core/utils/network.utils.js +2 -6
  51. package/dist/error/enums/codes.error.js +2 -5
  52. package/dist/error/index.d.ts +2 -2
  53. package/dist/error/index.d.ts.map +1 -1
  54. package/dist/error/index.js +2 -18
  55. package/dist/error/tool.error.js +3 -8
  56. package/dist/index.d.ts +6 -6
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +6 -22
  59. package/dist/node/index.d.ts +3 -3
  60. package/dist/node/index.d.ts.map +1 -1
  61. package/dist/node/index.js +3 -19
  62. package/dist/node/lib/local-search.lib.js +1 -5
  63. package/dist/node/lib/network-activity.lib.js +3 -9
  64. package/dist/node/node.js +42 -44
  65. package/dist/node-host/host.node.js +5 -9
  66. package/dist/node-host/index.d.ts +1 -1
  67. package/dist/node-host/index.d.ts.map +1 -1
  68. package/dist/node-host/index.js +1 -17
  69. package/dist/node-virtual/index.d.ts +1 -1
  70. package/dist/node-virtual/index.d.ts.map +1 -1
  71. package/dist/node-virtual/index.js +1 -17
  72. package/dist/node-virtual/virtual.node.js +4 -8
  73. package/dist/plan/agent.plan.js +13 -17
  74. package/dist/plan/configure/configure.plan.js +6 -10
  75. package/dist/plan/error/error.plan.js +6 -11
  76. package/dist/plan/index.d.ts +4 -4
  77. package/dist/plan/index.d.ts.map +1 -1
  78. package/dist/plan/index.js +4 -20
  79. package/dist/plan/interfaces/plan-config.interface.js +1 -2
  80. package/dist/plan/interfaces/plan-result.interface.js +1 -2
  81. package/dist/plan/interfaces/plan-type.enum.js +2 -5
  82. package/dist/plan/interfaces/plan.result.js +1 -2
  83. package/dist/plan/interfaces/query.config.js +1 -2
  84. package/dist/plan/interfaces/task.config.js +1 -2
  85. package/dist/plan/o-plan.d.ts +1 -1
  86. package/dist/plan/o-plan.d.ts.map +1 -1
  87. package/dist/plan/o-plan.js +19 -60
  88. package/dist/plan/plan.context.js +2 -6
  89. package/dist/plan/prompts/agent.prompt.js +2 -6
  90. package/dist/plan/prompts/configure.prompt.js +2 -6
  91. package/dist/plan/prompts/custom.prompt.js +1 -5
  92. package/dist/plan/prompts/error.prompt.js +1 -5
  93. package/dist/plan/prompts/search.prompt.js +1 -5
  94. package/dist/plan/search/prompts/search-analysis.prompt.js +1 -5
  95. package/dist/plan/search/search.plan.js +4 -10
  96. package/dist/plan/use/index.js +1 -17
  97. package/dist/plan/use/use.plan.js +9 -13
  98. package/package.json +6 -5
@@ -1,48 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oCoreNode = void 0;
4
- const o_config_1 = require("@olane/o-config");
5
- const state_enum_1 = require("./interfaces/state.enum");
6
- const o_address_1 = require("./o-address");
7
- const logger_1 = require("./utils/logger");
8
- const node_type_enum_1 = require("./interfaces/node-type.enum");
9
- const o_address_resolution_1 = require("./lib/o-address-resolution");
10
- const o_dependency_1 = require("./o-dependency");
11
- class oCoreNode {
12
- config;
13
- p2pNode;
14
- logger;
15
- networkConfig;
16
- address;
17
- staticAddress;
18
- peerId;
19
- state = state_enum_1.NodeState.STOPPED;
20
- errors = [];
21
- connectionManager;
22
- leaders = [];
23
- addressResolution;
24
- description;
25
- dependencies;
26
- methods;
27
- successCount = 0;
28
- errorCount = 0;
1
+ import { defaultLibp2pConfig, multiaddr, } from '@olane/o-config';
2
+ import { NodeState } from './interfaces/state.enum';
3
+ import { oAddress } from './o-address';
4
+ import { Logger } from './utils/logger';
5
+ import { NodeType } from './interfaces/node-type.enum';
6
+ import { oAddressResolution } from './lib/o-address-resolution';
7
+ import { oDependency } from './o-dependency';
8
+ export class oCoreNode {
29
9
  constructor(config) {
30
10
  this.config = config;
31
- this.logger = new logger_1.Logger(this.constructor.name +
11
+ this.state = NodeState.STOPPED;
12
+ this.errors = [];
13
+ this.leaders = [];
14
+ this.successCount = 0;
15
+ this.errorCount = 0;
16
+ this.logger = new Logger(this.constructor.name +
32
17
  (config.name ? `:${config.name}` : '') +
33
18
  ':' +
34
19
  config.address.toString());
35
- this.address = config.address || new o_address_1.oAddress('o://node');
36
- this.networkConfig = config.network || o_config_1.defaultLibp2pConfig;
37
- this.addressResolution = new o_address_resolution_1.oAddressResolution();
20
+ this.address = config.address || new oAddress('o://node');
21
+ this.networkConfig = config.network || defaultLibp2pConfig;
22
+ this.addressResolution = new oAddressResolution();
38
23
  this.staticAddress = config.address;
39
24
  this.description = config.description || '';
40
25
  this.dependencies =
41
- config.dependencies?.map((d) => new o_dependency_1.oDependency(d)) || [];
26
+ config.dependencies?.map((d) => new oDependency(d)) || [];
42
27
  this.methods = config.methods || {};
43
28
  }
44
29
  get type() {
45
- return this.config.type || node_type_enum_1.NodeType.UNKNOWN;
30
+ return this.config.type || NodeType.UNKNOWN;
46
31
  }
47
32
  get transports() {
48
33
  return this.p2pNode
@@ -64,7 +49,7 @@ class oCoreNode {
64
49
  return this.config.parent || null;
65
50
  }
66
51
  get parentTransports() {
67
- return this.parent?.transports.map((t) => (0, o_config_1.multiaddr)(t)) || [];
52
+ return this.parent?.transports.map((t) => multiaddr(t)) || [];
68
53
  }
69
54
  getTransports(address) {
70
55
  let leaderTransports = address.libp2pTransports;
@@ -79,9 +64,9 @@ class oCoreNode {
79
64
  this.logger.debug('No leader transports provided, we are going to search within our own network');
80
65
  if (!this.config.leader) {
81
66
  // TODO: how do we handle when the node is the leader? // technically we are in the network
82
- if (this.type === node_type_enum_1.NodeType.LEADER) {
67
+ if (this.type === NodeType.LEADER) {
83
68
  this.logger.debug('Node is a leader, using own transports');
84
- leaderTransports = this.transports.map((t) => (0, o_config_1.multiaddr)(t));
69
+ leaderTransports = this.transports.map((t) => multiaddr(t));
85
70
  }
86
71
  else {
87
72
  this.logger.warn('We are not within a network, cannot search for addressed node without leader.');
@@ -101,7 +86,7 @@ class oCoreNode {
101
86
  // handle static address translation
102
87
  if (result.value.indexOf('o://leader') === -1) {
103
88
  // TODO: we need to be more dynamic around the o://leader prefix
104
- const response = await this.use(new o_address_1.oAddress('o://leader/register', result.transports), {
89
+ const response = await this.use(new oAddress('o://leader/register', result.transports), {
105
90
  method: 'search',
106
91
  params: { staticAddress: result.root },
107
92
  }, {
@@ -113,7 +98,7 @@ class oCoreNode {
113
98
  const remainderPaths = result.paths.split('/').slice(1);
114
99
  const resolvedAddress = searchResults[0].address +
115
100
  (remainderPaths.length > 0 ? '/' + remainderPaths.join('/') : ''); // TODO: we need to handle this better
116
- result = new o_address_1.oAddress(resolvedAddress, result.transports);
101
+ result = new oAddress(resolvedAddress, result.transports);
117
102
  }
118
103
  else {
119
104
  this.logger.warn('Failed to translate static address');
@@ -198,7 +183,7 @@ class oCoreNode {
198
183
  }
199
184
  }
200
185
  async register() {
201
- if (this.type === node_type_enum_1.NodeType.LEADER) {
186
+ if (this.type === NodeType.LEADER) {
202
187
  this.logger.debug('Skipping registration, node is leader');
203
188
  return;
204
189
  }
@@ -210,7 +195,7 @@ class oCoreNode {
210
195
  this.logger.warn('No leaders found, skipping registration');
211
196
  return;
212
197
  }
213
- const address = new o_address_1.oAddress('o://leader/register');
198
+ const address = new oAddress('o://leader/register');
214
199
  const params = {
215
200
  method: 'commit',
216
201
  params: {
@@ -261,11 +246,11 @@ class oCoreNode {
261
246
  * @param parent - The parent node
262
247
  */
263
248
  async start() {
264
- if (this.state !== state_enum_1.NodeState.STOPPED) {
249
+ if (this.state !== NodeState.STOPPED) {
265
250
  this.logger.warn('Node is not stopped, skipping start');
266
251
  return;
267
252
  }
268
- this.state = state_enum_1.NodeState.STARTING;
253
+ this.state = NodeState.STARTING;
269
254
  this.p2pNode = this.p2pNode;
270
255
  try {
271
256
  await this.initialize();
@@ -273,12 +258,12 @@ class oCoreNode {
273
258
  await this.register().catch((error) => {
274
259
  this.logger.error('Failed to register node', error);
275
260
  });
276
- this.state = state_enum_1.NodeState.RUNNING;
261
+ this.state = NodeState.RUNNING;
277
262
  }
278
263
  catch (error) {
279
264
  this.logger.error('Failed to start node', error);
280
265
  this.errors.push(error);
281
- this.state = state_enum_1.NodeState.ERROR;
266
+ this.state = NodeState.ERROR;
282
267
  await this.teardown();
283
268
  }
284
269
  }
@@ -287,17 +272,16 @@ class oCoreNode {
287
272
  */
288
273
  async stop() {
289
274
  this.logger.debug('Stop node called...');
290
- this.state = state_enum_1.NodeState.STOPPING;
275
+ this.state = NodeState.STOPPING;
291
276
  try {
292
277
  await this.teardown();
293
- this.state = state_enum_1.NodeState.STOPPED;
278
+ this.state = NodeState.STOPPED;
294
279
  this.logger.debug('Node stopped!');
295
280
  }
296
281
  catch (error) {
297
282
  this.errors.push(error);
298
- this.state = state_enum_1.NodeState.ERROR;
283
+ this.state = NodeState.ERROR;
299
284
  this.logger.error('Node failed to stop', error);
300
285
  }
301
286
  }
302
287
  }
303
- exports.oCoreNode = oCoreNode;
@@ -1,11 +1,5 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DEFAULT_CONFIG_FILE = exports.DEFAULT_NETWORKS_PATH = exports.DEFAULT_CONFIG_PATH = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const os_1 = __importDefault(require("os"));
9
- exports.DEFAULT_CONFIG_PATH = path_1.default.join(os_1.default.homedir(), '.olane');
10
- exports.DEFAULT_NETWORKS_PATH = path_1.default.join(exports.DEFAULT_CONFIG_PATH, 'networks');
11
- exports.DEFAULT_CONFIG_FILE = path_1.default.join(exports.DEFAULT_CONFIG_PATH, 'config.json');
1
+ import path from 'path';
2
+ import os from 'os';
3
+ export const DEFAULT_CONFIG_PATH = path.join(os.homedir(), '.olane');
4
+ export const DEFAULT_NETWORKS_PATH = path.join(DEFAULT_CONFIG_PATH, 'networks');
5
+ export const DEFAULT_CONFIG_FILE = path.join(DEFAULT_CONFIG_PATH, 'config.json');
@@ -1,2 +1,2 @@
1
- export * from './config';
1
+ export * from './config.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/defaults/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/defaults/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./config"), exports);
1
+ export * from './config.js';
@@ -0,0 +1,25 @@
1
+ import { Logger } from './utils';
2
+ export interface CleanupFunction {
3
+ (): Promise<void> | void;
4
+ }
5
+ export interface GracefulShutdownOptions {
6
+ timeout?: number;
7
+ logger?: Logger;
8
+ onTimeout?: () => void;
9
+ }
10
+ /**
11
+ * Sets up signal handlers for graceful shutdown
12
+ * @param cleanup Cleanup function to run on shutdown
13
+ * @param options Configuration options for graceful shutdown
14
+ */
15
+ export declare function setupGracefulShutdown(cleanup: CleanupFunction, options?: GracefulShutdownOptions): void;
16
+ /**
17
+ * Creates a cleanup function that stops multiple resources
18
+ * @param resources Array of resources with stop methods
19
+ * @param logger Logger instance for logging
20
+ */
21
+ export declare function createMultiResourceCleanup(resources: Array<{
22
+ stop(): Promise<void> | void;
23
+ address?: string;
24
+ }>, logger?: Logger): CleanupFunction;
25
+ //# sourceMappingURL=graceful-shutdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graceful-shutdown.d.ts","sourceRoot":"","sources":["../../src/core/graceful-shutdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,eAAe;IAC9B,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,EACxB,OAAO,GAAE,uBAA4B,GACpC,IAAI,CAmEN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,KAAK,CAAC;IAAE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACpE,MAAM,GAAE,MAA2C,GAClD,eAAe,CAmBjB"}
@@ -0,0 +1,84 @@
1
+ import { Logger } from './utils';
2
+ /**
3
+ * Sets up signal handlers for graceful shutdown
4
+ * @param cleanup Cleanup function to run on shutdown
5
+ * @param options Configuration options for graceful shutdown
6
+ */
7
+ export function setupGracefulShutdown(cleanup, options = {}) {
8
+ const { timeout = 30000, // 30 seconds default timeout
9
+ logger = new Logger('GracefulShutdown'), onTimeout, } = options;
10
+ let isShuttingDown = false;
11
+ const performCleanup = async (signal) => {
12
+ if (isShuttingDown) {
13
+ logger.debug('Shutdown already in progress, skipping...');
14
+ return;
15
+ }
16
+ isShuttingDown = true;
17
+ logger.info(`Received ${signal}, initiating graceful shutdown...`);
18
+ try {
19
+ // Set up timeout for cleanup operations
20
+ const timeoutPromise = new Promise((_, reject) => {
21
+ setTimeout(() => {
22
+ reject(new Error(`Cleanup timeout after ${timeout}ms`));
23
+ }, timeout);
24
+ });
25
+ // Perform cleanup with timeout
26
+ await Promise.race([Promise.resolve(cleanup()), timeoutPromise]);
27
+ logger.info('Graceful shutdown completed successfully');
28
+ }
29
+ catch (error) {
30
+ logger.error('Error during graceful shutdown:', error);
31
+ if (onTimeout) {
32
+ onTimeout();
33
+ }
34
+ }
35
+ finally {
36
+ logger.info('Process exiting');
37
+ process.exit(0);
38
+ }
39
+ };
40
+ // Handle SIGINT (Ctrl+C)
41
+ process.on('SIGINT', () => performCleanup('SIGINT'));
42
+ // Handle SIGTERM (termination signal)
43
+ process.on('SIGTERM', () => performCleanup('SIGTERM'));
44
+ // Handle SIGUSR2 (Node.js restart signal)
45
+ process.on('SIGUSR2', () => performCleanup('SIGUSR2'));
46
+ // Handle uncaught exceptions
47
+ process.on('uncaughtException', (error) => {
48
+ logger.error('Uncaught Exception:', error);
49
+ performCleanup('uncaughtException');
50
+ });
51
+ // Handle unhandled promise rejections
52
+ process.on('unhandledRejection', (reason, promise) => {
53
+ logger.error('Unhandled Rejection at:', promise, 'reason:', reason);
54
+ performCleanup('unhandledRejection');
55
+ });
56
+ // Handle process exit (synchronous cleanup)
57
+ process.on('exit', (code) => {
58
+ logger.info(`Process exiting with code: ${code}`);
59
+ });
60
+ }
61
+ /**
62
+ * Creates a cleanup function that stops multiple resources
63
+ * @param resources Array of resources with stop methods
64
+ * @param logger Logger instance for logging
65
+ */
66
+ export function createMultiResourceCleanup(resources, logger = new Logger('MultiResourceCleanup')) {
67
+ return async () => {
68
+ logger.info(`Stopping ${resources.length} resources...`);
69
+ const stopPromises = resources.map(async (resource) => {
70
+ try {
71
+ const resourceName = resource.address || resource.constructor.name;
72
+ logger.debug(`Stopping resource: ${resourceName}`);
73
+ await Promise.resolve(resource.stop());
74
+ logger.debug(`Successfully stopped resource: ${resourceName}`);
75
+ }
76
+ catch (error) {
77
+ const resourceName = resource.address || resource.constructor.name;
78
+ logger.error(`Error stopping resource ${resourceName}:`, error);
79
+ }
80
+ });
81
+ await Promise.allSettled(stopPromises);
82
+ logger.info('All resources stopped');
83
+ };
84
+ }
@@ -1,10 +1,11 @@
1
- export * from './core.node';
2
- export * from './utils/core.utils';
3
- export * from './o-address';
4
- export * from './interfaces';
5
- export * from './o-dependency';
6
- export * from './utils/logger';
7
- export * from './lib';
8
- export * from './o-parameter';
9
- export * from './defaults';
1
+ export * from './core.node.js';
2
+ export * from './utils/core.utils.js';
3
+ export * from './o-address.js';
4
+ export * from './interfaces/index.js';
5
+ export * from './o-dependency.js';
6
+ export * from './utils/logger.js';
7
+ export * from './lib/index.js';
8
+ export * from './o-parameter.js';
9
+ export * from './defaults/index.js';
10
+ export * from './graceful-shutdown.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
@@ -1,25 +1,10 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./core.node"), exports);
18
- __exportStar(require("./utils/core.utils"), exports);
19
- __exportStar(require("./o-address"), exports);
20
- __exportStar(require("./interfaces"), exports);
21
- __exportStar(require("./o-dependency"), exports);
22
- __exportStar(require("./utils/logger"), exports);
23
- __exportStar(require("./lib"), exports);
24
- __exportStar(require("./o-parameter"), exports);
25
- __exportStar(require("./defaults"), exports);
1
+ export * from './core.node.js';
2
+ export * from './utils/core.utils.js';
3
+ export * from './o-address.js';
4
+ export * from './interfaces/index.js';
5
+ export * from './o-dependency.js';
6
+ export * from './utils/logger.js';
7
+ export * from './lib/index.js';
8
+ export * from './o-parameter.js';
9
+ export * from './defaults/index.js';
10
+ export * from './graceful-shutdown.js';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,6 +1,6 @@
1
- export * from './core-config.interface';
2
- export * from './node-type.enum';
3
- export * from './restricted-addresses.enum';
4
- export * from './state.enum';
5
- export * from './use-options.interface';
1
+ export * from './core-config.interface.js';
2
+ export * from './node-type.enum.js';
3
+ export * from './restricted-addresses.enum.js';
4
+ export * from './state.enum.js';
5
+ export * from './use-options.interface.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC"}
@@ -1,21 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./core-config.interface"), exports);
18
- __exportStar(require("./node-type.enum"), exports);
19
- __exportStar(require("./restricted-addresses.enum"), exports);
20
- __exportStar(require("./state.enum"), exports);
21
- __exportStar(require("./use-options.interface"), exports);
1
+ export * from './core-config.interface.js';
2
+ export * from './node-type.enum.js';
3
+ export * from './restricted-addresses.enum.js';
4
+ export * from './state.enum.js';
5
+ export * from './use-options.interface.js';
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeType = void 0;
4
- var NodeType;
1
+ export var NodeType;
5
2
  (function (NodeType) {
6
3
  NodeType["LEADER"] = "leader";
7
4
  NodeType["ROOT"] = "root";
@@ -10,4 +7,4 @@ var NodeType;
10
7
  NodeType["AGENT"] = "agent";
11
8
  NodeType["HUMAN"] = "human";
12
9
  NodeType["UNKNOWN"] = "unknown";
13
- })(NodeType || (exports.NodeType = NodeType = {}));
10
+ })(NodeType || (NodeType = {}));
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RestrictedAddressesList = exports.AGENT_ADRESS = exports.TOOL_ADRESS = exports.LEADER_ADRESS = exports.REGISTRATION_ADRESS = exports.RestrictedAddresses = void 0;
4
- var RestrictedAddresses;
1
+ export var RestrictedAddresses;
5
2
  (function (RestrictedAddresses) {
6
3
  RestrictedAddresses["GLOBAL_PREFIX"] = "o://";
7
4
  RestrictedAddresses["REGISTRATION"] = "register";
8
5
  RestrictedAddresses["LEADER"] = "leader";
9
6
  RestrictedAddresses["TOOL"] = "tool";
10
7
  RestrictedAddresses["AGENT"] = "agent";
11
- })(RestrictedAddresses || (exports.RestrictedAddresses = RestrictedAddresses = {}));
12
- exports.REGISTRATION_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.REGISTRATION;
13
- exports.LEADER_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.LEADER;
14
- exports.TOOL_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.TOOL;
15
- exports.AGENT_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.AGENT;
16
- exports.RestrictedAddressesList = [
17
- exports.REGISTRATION_ADRESS,
18
- exports.LEADER_ADRESS,
19
- exports.TOOL_ADRESS,
20
- exports.AGENT_ADRESS,
8
+ })(RestrictedAddresses || (RestrictedAddresses = {}));
9
+ export const REGISTRATION_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.REGISTRATION;
10
+ export const LEADER_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.LEADER;
11
+ export const TOOL_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.TOOL;
12
+ export const AGENT_ADRESS = RestrictedAddresses.GLOBAL_PREFIX + RestrictedAddresses.AGENT;
13
+ export const RestrictedAddressesList = [
14
+ REGISTRATION_ADRESS,
15
+ LEADER_ADRESS,
16
+ TOOL_ADRESS,
17
+ AGENT_ADRESS,
21
18
  ];
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeState = void 0;
4
- var NodeState;
1
+ export var NodeState;
5
2
  (function (NodeState) {
6
3
  NodeState["STARTING"] = "STARTING";
7
4
  NodeState["RUNNING"] = "RUNNING";
8
5
  NodeState["STOPPING"] = "STOPPING";
9
6
  NodeState["STOPPED"] = "STOPPED";
10
7
  NodeState["ERROR"] = "ERROR";
11
- })(NodeState || (exports.NodeState = NodeState = {}));
8
+ })(NodeState || (NodeState = {}));
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,8 +1,8 @@
1
- export * from './o-request';
2
- export * from './o-response';
3
- export * from './o-connection';
4
- export * from './o-connection-manager';
5
- export * from './o-address-resolution';
6
- export * from './o-address-resolver';
7
- export * from './resolvers';
1
+ export * from './o-request.js';
2
+ export * from './o-response.js';
3
+ export * from './o-connection.js';
4
+ export * from './o-connection-manager.js';
5
+ export * from './o-address-resolution.js';
6
+ export * from './o-address-resolver.js';
7
+ export * from './resolvers/index.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
@@ -1,23 +1,7 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./o-request"), exports);
18
- __exportStar(require("./o-response"), exports);
19
- __exportStar(require("./o-connection"), exports);
20
- __exportStar(require("./o-connection-manager"), exports);
21
- __exportStar(require("./o-address-resolution"), exports);
22
- __exportStar(require("./o-address-resolver"), exports);
23
- __exportStar(require("./resolvers"), exports);
1
+ export * from './o-request.js';
2
+ export * from './o-response.js';
3
+ export * from './o-connection.js';
4
+ export * from './o-connection-manager.js';
5
+ export * from './o-address-resolution.js';
6
+ export * from './o-address-resolver.js';
7
+ export * from './resolvers/index.js';
@@ -1,9 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oAddressResolution = void 0;
4
- const o_address_1 = require("../o-address");
5
- class oAddressResolution {
6
- resolvers = [];
1
+ import { oAddress } from '../o-address';
2
+ export class oAddressResolution {
3
+ constructor() {
4
+ this.resolvers = [];
5
+ }
7
6
  addResolver(resolver) {
8
7
  this.resolvers.push(resolver);
9
8
  }
@@ -13,7 +12,7 @@ class oAddressResolution {
13
12
  }));
14
13
  }
15
14
  async resolve(address) {
16
- let resolvedAddress = new o_address_1.oAddress(address.toString(), address.transports);
15
+ let resolvedAddress = new oAddress(address.toString(), address.transports);
17
16
  for (const resolver of this.resolvers) {
18
17
  resolvedAddress = await resolver.resolve(resolvedAddress);
19
18
  }
@@ -24,4 +23,3 @@ class oAddressResolution {
24
23
  return resolvedAddress;
25
24
  }
26
25
  }
27
- exports.oAddressResolution = oAddressResolution;