@nosana/node 1.0.0 → 1.0.1-rc

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 (66) hide show
  1. package/dist/NodeManager/configs/configs.d.ts +1 -0
  2. package/dist/NodeManager/configs/configs.js +1 -0
  3. package/dist/NodeManager/node/api/routes/post/node-validation.js +2 -2
  4. package/dist/NodeManager/provider/Provider.js +1 -1
  5. package/dist/NodeManager/provider/containerOrchestration/docker/createDockerRunOptions.d.ts +3 -0
  6. package/dist/NodeManager/provider/containerOrchestration/docker/createDockerRunOptions.js +61 -0
  7. package/dist/NodeManager/provider/containerOrchestration/docker/index.d.ts +1 -1
  8. package/dist/NodeManager/provider/containerOrchestration/docker/index.js +5 -64
  9. package/dist/NodeManager/provider/containerOrchestration/podman/index.d.ts +1 -0
  10. package/dist/NodeManager/provider/containerOrchestration/podman/index.js +20 -0
  11. package/dist/NodeManager/utils/utils.d.ts +1 -1
  12. package/dist/NodeManager/utils/utils.js +4 -1
  13. package/dist/cli/{address → commands/address}/action.js +1 -1
  14. package/dist/cli/{node → commands}/prune/action.js +1 -0
  15. package/dist/cli/{node → commands}/prune/command.js +0 -3
  16. package/dist/cli/{node → commands}/run/__tests__/command.spec.js +2 -3
  17. package/dist/cli/{node → commands}/run/action.js +1 -0
  18. package/dist/cli/{node → commands}/run/command.js +1 -4
  19. package/dist/cli/{node → commands}/start/__tests__/command.spec.js +2 -3
  20. package/dist/cli/{node → commands}/start/action.js +1 -0
  21. package/dist/cli/{node → commands}/start/command.js +1 -4
  22. package/dist/cli/createNosanaCli.d.ts +3 -0
  23. package/dist/cli/createNosanaCli.js +10 -3
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +1 -1
  26. package/npm-shrinkwrap.json +2 -2
  27. package/package.json +1 -1
  28. package/dist/cli/node/__tests__/index.spec.d.ts +0 -1
  29. package/dist/cli/node/__tests__/index.spec.js +0 -10
  30. package/dist/cli/node/index.d.ts +0 -5
  31. package/dist/cli/node/index.js +0 -12
  32. /package/dist/cli/{address → commands/address}/__tests__/command.spec.d.ts +0 -0
  33. /package/dist/cli/{address → commands/address}/__tests__/command.spec.js +0 -0
  34. /package/dist/cli/{address → commands/address}/action.d.ts +0 -0
  35. /package/dist/cli/{address → commands/address}/command.d.ts +0 -0
  36. /package/dist/cli/{address → commands/address}/command.js +0 -0
  37. /package/dist/cli/{node → commands}/prune/action.d.ts +0 -0
  38. /package/dist/cli/{node → commands}/prune/command.d.ts +0 -0
  39. /package/dist/cli/{node → commands}/run/__tests__/command.spec.d.ts +0 -0
  40. /package/dist/cli/{node → commands}/run/action.d.ts +0 -0
  41. /package/dist/cli/{node → commands}/run/command.d.ts +0 -0
  42. /package/dist/cli/{node → commands}/run/generateDeploymentEndpointsTable.d.ts +0 -0
  43. /package/dist/cli/{node → commands}/run/generateDeploymentEndpointsTable.js +0 -0
  44. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--api.d.ts +0 -0
  45. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--api.js +0 -0
  46. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--format.d.ts +0 -0
  47. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--format.js +0 -0
  48. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--gpu.d.ts +0 -0
  49. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--gpu.js +0 -0
  50. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--network.d.ts +0 -0
  51. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--network.js +0 -0
  52. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--port.d.ts +0 -0
  53. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--port.js +0 -0
  54. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--rpc.d.ts +0 -0
  55. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--rpc.js +0 -0
  56. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--timeout.d.ts +0 -0
  57. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--timeout.js +0 -0
  58. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--verbose.d.ts +0 -0
  59. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--verbose.js +0 -0
  60. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--wallet.d.ts +0 -0
  61. /package/dist/cli/{sharedOptions → commands/sharedOptions}/--wallet.js +0 -0
  62. /package/dist/cli/{sharedOptions → commands/sharedOptions}/index.d.ts +0 -0
  63. /package/dist/cli/{sharedOptions → commands/sharedOptions}/index.js +0 -0
  64. /package/dist/cli/{node → commands}/start/__tests__/command.spec.d.ts +0 -0
  65. /package/dist/cli/{node → commands}/start/action.d.ts +0 -0
  66. /package/dist/cli/{node → commands}/start/command.d.ts +0 -0
@@ -9,6 +9,7 @@ export type configType = {
9
9
  serverAddr: string;
10
10
  serverPort: number;
11
11
  containerImage: string;
12
+ nodeInternalHostName: string;
12
13
  };
13
14
  api: {
14
15
  port: number;
@@ -13,6 +13,7 @@ export const configs = (options) => {
13
13
  serverAddr: loadConfigurationValue('FRP_SERVER_ADDRESS'),
14
14
  serverPort: parseInt(loadConfigurationValue('FRP_SERVER_PORT')),
15
15
  containerImage: loadConfigurationValue('FRP_SERVER_IMAGE'),
16
+ nodeInternalHostName: loadConfigurationValue('FRP_NODE_INTERNAL_HOSTNAME', "nosana-node"),
16
17
  },
17
18
  api: {
18
19
  port: parseInt(loadConfigurationValue('API_PORT')),
@@ -162,7 +162,7 @@ export async function postNodeValidation(req, res) {
162
162
  return false;
163
163
  const a = Number(match[1]), b = Number(match[2]);
164
164
  return a < b;
165
- })())) && (undefined === input.type || "websocket" === input.type || "web" === input.type || "api" === input.type || "webapi" === input.type || "none" === input.type) && (undefined === input.health_checks || Array.isArray(input.health_checks) && input.health_checks.every((elem, _index8) => "object" === typeof elem && null !== elem && _iu1(elem, true && _exceptionable))) && (1 === Object.keys(input).length || Object.keys(input).every(key => {
165
+ })())) && (undefined === input.type || "api" === input.type || "websocket" === input.type || "web" === input.type || "webapi" === input.type || "none" === input.type) && (undefined === input.health_checks || Array.isArray(input.health_checks) && input.health_checks.every((elem, _index8) => "object" === typeof elem && null !== elem && _iu1(elem, true && _exceptionable))) && (1 === Object.keys(input).length || Object.keys(input).every(key => {
166
166
  if (["port", "type", "health_checks"].some(prop => key === prop))
167
167
  return true;
168
168
  const value = input[key];
@@ -1012,7 +1012,7 @@ export async function postNodeValidation(req, res) {
1012
1012
  path: _path + ".port",
1013
1013
  expected: "((string & TagBase<__type>) | number)",
1014
1014
  value: input.port
1015
- }), undefined === input.type || "websocket" === input.type || "web" === input.type || "api" === input.type || "webapi" === input.type || "none" === input.type || _report(_exceptionable, {
1015
+ }), undefined === input.type || "api" === input.type || "websocket" === input.type || "web" === input.type || "webapi" === input.type || "none" === input.type || _report(_exceptionable, {
1016
1016
  path: _path + ".type",
1017
1017
  expected: "(\"api\" | \"none\" | \"web\" | \"webapi\" | \"websocket\" | undefined)",
1018
1018
  value: input.type
@@ -41,7 +41,7 @@ export class Provider {
41
41
  // set up reverse proxy api for api handler
42
42
  async setUpReverseProxyApi(address, port) {
43
43
  try {
44
- const nodeName = `nosana-node`;
44
+ const nodeName = configs().frp.nodeInternalHostName;
45
45
  const networkName = `api-${address}`;
46
46
  const frpc_name = `frpc-api-${address}`;
47
47
  await this.containerOrchestration.createNetwork(networkName);
@@ -0,0 +1,3 @@
1
+ import { ContainerCreateOptions } from "dockerode";
2
+ import { RunContainerArgs } from "../interface";
3
+ export declare function createDockerRunOptions(image: string, { name, cmd, gpu, volumes, env, work_dir, entrypoint, aliases, restart_policy, }: RunContainerArgs, gpuOption: string): ContainerCreateOptions;
@@ -0,0 +1,61 @@
1
+ function parseRestartPolicy(restart_policy) {
2
+ if (typeof restart_policy === 'string') {
3
+ return restart_policy ? { Name: restart_policy, MaximumRetryCount: 0 } : undefined;
4
+ }
5
+ if (typeof restart_policy === 'object' && 'policy' in restart_policy) {
6
+ return {
7
+ Name: restart_policy.policy,
8
+ MaximumRetryCount: restart_policy.restart_tries || 0,
9
+ };
10
+ }
11
+ return undefined;
12
+ }
13
+ export function createDockerRunOptions(image, { name, cmd, gpu, volumes, env, work_dir, entrypoint, aliases, restart_policy, }, gpuOption) {
14
+ const devices = [];
15
+ if (gpu) {
16
+ devices.push({
17
+ ...(gpuOption === 'all'
18
+ ? { Count: -1 }
19
+ : { device_ids: gpuOption.split(',') }),
20
+ Driver: 'nvidia',
21
+ Capabilities: [['gpu']],
22
+ });
23
+ }
24
+ ;
25
+ return {
26
+ name: name,
27
+ Hostname: '',
28
+ User: '',
29
+ AttachStdin: false,
30
+ AttachStdout: true,
31
+ AttachStderr: true,
32
+ Tty: false,
33
+ OpenStdin: false,
34
+ StdinOnce: false,
35
+ Env: Object.entries(env ?? {}).map(([key, value]) => `${key}=${value.toString()}`),
36
+ Cmd: cmd,
37
+ Image: image,
38
+ WorkingDir: work_dir,
39
+ Entrypoint: entrypoint,
40
+ NetworkingConfig: {
41
+ EndpointsConfig: {
42
+ NOSANA_GATEWAY: aliases ? { Aliases: aliases } : {},
43
+ },
44
+ },
45
+ HostConfig: {
46
+ ExtraHosts: [
47
+ 'host.docker.internal:8.8.8.8',
48
+ 'host.containers.internal:8.8.8.8',
49
+ ],
50
+ Mounts: volumes?.map(({ dest, name, readonly }) => ({
51
+ Target: dest,
52
+ Source: name,
53
+ Type: 'volume',
54
+ ReadOnly: readonly || false,
55
+ })),
56
+ NetworkMode: 'bridge',
57
+ DeviceRequests: devices,
58
+ RestartPolicy: parseRestartPolicy(restart_policy),
59
+ },
60
+ };
61
+ }
@@ -20,7 +20,7 @@ export declare class DockerContainerOrchestration implements ContainerOrchestrat
20
20
  getImage(image: string): Promise<Image>;
21
21
  listImages(): Promise<ImageInfo[]>;
22
22
  deleteImage(image: string, controller?: AbortController): Promise<void>;
23
- createNetwork(name: string, controller?: AbortController): Promise<void>;
23
+ createNetwork(_name: string, controller?: AbortController): Promise<void>;
24
24
  hasNetwork(name: string): Promise<boolean>;
25
25
  deleteNetwork(name: string, controller?: AbortController): Promise<void>;
26
26
  createVolume(name?: string, controller?: AbortController): Promise<VolumeCreateResponse>;
@@ -2,6 +2,7 @@ import os from 'os';
2
2
  import { DockerExtended } from './dockerExtended/index.js';
3
3
  import { createSeverObject } from './utils/createServerObject.js';
4
4
  import { checkDeprecationDeadline } from './utils/deadline.js';
5
+ import { createDockerRunOptions } from './createDockerRunOptions.js';
5
6
  export class DockerContainerOrchestration {
6
7
  constructor(server, gpu) {
7
8
  this.name = 'docker';
@@ -91,14 +92,15 @@ export class DockerContainerOrchestration {
91
92
  .remove({ force: true, abortSignal: controller?.signal });
92
93
  }
93
94
  }
94
- async createNetwork(name, controller) {
95
+ async createNetwork(_name, controller) {
95
96
  try {
96
97
  if (await this.hasNetwork('NOSANA_GATEWAY'))
97
98
  return;
98
99
  await this.docker.createNetwork({
99
100
  Name: 'NOSANA_GATEWAY',
101
+ Driver: 'bridge',
100
102
  IPAM: {
101
- Driver: 'bridge',
103
+ Driver: 'default',
102
104
  Config: [{ Subnet: '192.168.101.0/24', Gateway: '192.168.101.1' }],
103
105
  },
104
106
  abortSignal: controller?.signal,
@@ -223,7 +225,7 @@ export class DockerContainerOrchestration {
223
225
  throw controller.signal.reason;
224
226
  }
225
227
  const container = await this.docker.createContainer({
226
- ...mapRunContainerArgsToContainerCreateOpts(image, args, this.gpu),
228
+ ...createDockerRunOptions(image, args, this.gpu),
227
229
  abortSignal: controller?.signal,
228
230
  });
229
231
  await container.start();
@@ -303,64 +305,3 @@ export class DockerContainerOrchestration {
303
305
  return `${this.protocol}://${this.host}:${this.port}`;
304
306
  }
305
307
  }
306
- function mapRunContainerArgsToContainerCreateOpts(image, { name, cmd, gpu, volumes, env, work_dir, entrypoint, aliases, }, gpuOption) {
307
- const devices = gpu
308
- ? [
309
- {
310
- ...(gpuOption === 'all'
311
- ? { Count: -1 }
312
- : { device_ids: gpuOption.split(',') }),
313
- Driver: 'nvidia',
314
- Capabilities: [['gpu']],
315
- },
316
- ]
317
- : [];
318
- const dockerVolumes = [];
319
- if (volumes && volumes.length > 0) {
320
- for (let i = 0; i < volumes.length; i++) {
321
- const volume = volumes[i];
322
- dockerVolumes.push({
323
- Target: volume.dest,
324
- Source: volume.name,
325
- Type: 'volume',
326
- ReadOnly: volume.readonly || false,
327
- });
328
- }
329
- }
330
- const vars = [];
331
- if (env) {
332
- for (const [key, value] of Object.entries(env)) {
333
- vars.push(`${key}=${value}`);
334
- }
335
- }
336
- return {
337
- name: name,
338
- Hostname: '',
339
- User: '',
340
- AttachStdin: false,
341
- AttachStdout: true,
342
- AttachStderr: true,
343
- Tty: false,
344
- OpenStdin: false,
345
- StdinOnce: false,
346
- Env: vars,
347
- Cmd: cmd,
348
- Image: image,
349
- WorkingDir: work_dir,
350
- Entrypoint: entrypoint,
351
- NetworkingConfig: {
352
- EndpointsConfig: {
353
- NOSANA_GATEWAY: aliases ? { Aliases: aliases } : {},
354
- },
355
- },
356
- HostConfig: {
357
- ExtraHosts: [
358
- 'host.docker.internal:8.8.8.8',
359
- 'host.containers.internal:8.8.8.8',
360
- ],
361
- Mounts: dockerVolumes,
362
- NetworkMode: 'bridge',
363
- DeviceRequests: devices,
364
- },
365
- };
366
- }
@@ -7,5 +7,6 @@ export declare class PodmanContainerOrchestration extends DockerContainerOrchest
7
7
  name: string;
8
8
  constructor(server: string, gpu: string);
9
9
  libPodAPICall(path: string, options: RequestInit): Promise<Response>;
10
+ createNetwork(_name: string, controller?: AbortController): Promise<void>;
10
11
  runFlowContainer(image: string, args: RunContainerArgs, controller?: AbortController): Promise<Container>;
11
12
  }
@@ -22,6 +22,26 @@ export class PodmanContainerOrchestration extends DockerContainerOrchestration {
22
22
  }
23
23
  return fetch(`${this.api}${path}`, options);
24
24
  }
25
+ async createNetwork(_name, controller) {
26
+ try {
27
+ if (await this.hasNetwork('NOSANA_GATEWAY'))
28
+ return;
29
+ await this.docker.createNetwork({
30
+ Name: 'NOSANA_GATEWAY',
31
+ IPAM: {
32
+ Driver: 'bridge',
33
+ Config: [{ Subnet: '192.168.101.0/24', Gateway: '192.168.101.1' }],
34
+ },
35
+ abortSignal: controller?.signal,
36
+ });
37
+ }
38
+ catch (error) {
39
+ if (error instanceof Error) {
40
+ error.eventType = 'resource-error';
41
+ }
42
+ throw error;
43
+ }
44
+ }
25
45
  async runFlowContainer(image, args, controller) {
26
46
  try {
27
47
  let error;
@@ -36,4 +36,4 @@ export { logTable, now, sleep, clearLine, askYesNoQuestion, colors, ifStringCast
36
36
  * @return {string} The value of the specified environment variable.
37
37
  * @throws {Error} If the environment variable is not defined.
38
38
  */
39
- export declare function loadConfigurationValue(key: string): string;
39
+ export declare function loadConfigurationValue(key: string, defaultValue?: string): string;
@@ -98,9 +98,12 @@ export { logTable, now, sleep, clearLine, askYesNoQuestion, colors, ifStringCast
98
98
  * @return {string} The value of the specified environment variable.
99
99
  * @throws {Error} If the environment variable is not defined.
100
100
  */
101
- export function loadConfigurationValue(key) {
101
+ export function loadConfigurationValue(key, defaultValue) {
102
102
  let value = process.env[key];
103
103
  if (!value) {
104
+ if (defaultValue !== undefined) {
105
+ return defaultValue;
106
+ }
104
107
  throw new Error(`Missing environment variable ${key}`);
105
108
  }
106
109
  return value;
@@ -1,4 +1,4 @@
1
- import { getSDK } from '../../NodeManager/sdk/index.js';
1
+ import { getSDK } from '../../../NodeManager/sdk/index.js';
2
2
  export async function getAddress(options, cmd) {
3
3
  const nosana = getSDK();
4
4
  }
@@ -4,6 +4,7 @@ import { selectContainerOrchestrationProvider } from '../../../NodeManager/provi
4
4
  import { NodeRepository } from '../../../NodeManager/repository/NodeRepository.js';
5
5
  export * from './action.js';
6
6
  export async function pruneResources(options) {
7
+ options.provider = process.argv.some(arg => arg === '--docker') ? 'docker' : 'podman';
7
8
  try {
8
9
  const db = new DB(options.config).db;
9
10
  const repository = new NodeRepository(db);
@@ -2,9 +2,6 @@ import { Command, Option } from 'commander';
2
2
  import { pruneResources } from './action.js';
3
3
  export const nodePruneCommand = new Command('prune')
4
4
  .description('Safely prune none required images and resources.')
5
- .addOption(new Option('--provider <provider>', 'provider used to run the job')
6
- .choices(['docker', 'podman'])
7
- .default('podman'))
8
5
  .addOption(new Option('--docker, --podman <URI>', 'Podman/Docker connection URI').default('~/.nosana/podman/podman.sock'))
9
6
  .addOption(new Option('-c, --config <path>', 'Config path (to store the flows database and other config)').default('~/.nosana/'))
10
7
  .action(pruneResources);
@@ -18,11 +18,10 @@ describe('runNodeCommand', () => {
18
18
  runNodeCommand.parse(parseArgs);
19
19
  expect(runNodeCommand.args[0]).toBe('job definition path');
20
20
  });
21
- it('should have 7 options', () => {
22
- expect(runNodeCommand.options.length).toBe(7);
21
+ it('should have 6 options', () => {
22
+ expect(runNodeCommand.options.length).toBe(6);
23
23
  });
24
24
  it.each([
25
- ['--provider', undefined, 'podman'],
26
25
  ['--config', '-c', '~/.nosana/'],
27
26
  ['--podman', '--docker', '~/.nosana/podman/podman.sock'],
28
27
  ['--url', undefined, undefined],
@@ -14,6 +14,7 @@ import { generateRandomId } from '../../../NodeManager/node/utils/generateRandom
14
14
  import { getSDK } from '../../../NodeManager/sdk/index.js';
15
15
  import { createLoggingProxy } from '../../../NodeManager/monitoring/proxy/loggingProxy.js';
16
16
  export async function runJob(jobDefinitionFile, options) {
17
+ options.provider = process.argv.some(arg => arg === '--docker') ? 'docker' : 'podman';
17
18
  try {
18
19
  const sdk = getSDK();
19
20
  const jobDefinition = await resolveJobDefinition(options, jobDefinitionFile);
@@ -1,13 +1,10 @@
1
1
  import { Argument, Command, Option } from 'commander';
2
2
  import { runJob } from './action.js';
3
- import { gpuOption, verboseOption, walletOption } from '../../sharedOptions/index.js';
3
+ import { gpuOption, verboseOption, walletOption } from '../sharedOptions/index.js';
4
4
  export * from './action.js';
5
5
  export const runNodeCommand = new Command('run')
6
6
  .description('Run Job Definition File')
7
7
  .addArgument(new Argument('<job-definition-file>', 'Job Definition File').argOptional())
8
- .addOption(new Option('--provider <provider>', 'provider used to run the job definition')
9
- .choices(['docker', 'podman'])
10
- .default('podman'))
11
8
  .addOption(new Option('--url <url>', 'Url path for the JSON flow'))
12
9
  .addOption(new Option('-c, --config <path>', 'Config path (to store the flows database and other config)').default('~/.nosana/'))
13
10
  .addOption(new Option('--docker, --podman <URI>', 'Podman/Docker connection URI').default('~/.nosana/podman/podman.sock'))
@@ -18,14 +18,13 @@ describe('startNodeCommand', () => {
18
18
  startNodeCommand.parse(parseArgs);
19
19
  expect(startNodeCommand.args[0]).toBe('market address');
20
20
  });
21
- it('should have 9 options', () => {
22
- expect(startNodeCommand.options.length).toBe(9);
21
+ it('should have 8 options', () => {
22
+ expect(startNodeCommand.options.length).toBe(8);
23
23
  });
24
24
  it.each([
25
25
  ['--network', '-n', 'mainnet'],
26
26
  ['--rpc', undefined, undefined],
27
27
  ['--wallet', '-w', '~/.nosana/nosana_key.json'],
28
- ['--provider', undefined, 'podman'],
29
28
  ['--config', '-c', '~/.nosana/'],
30
29
  ['--port', '-p', 5001],
31
30
  ['--podman', '--docker', '~/.nosana/podman/podman.sock'],
@@ -1,6 +1,7 @@
1
1
  import 'rpc-websockets/dist/lib/client.js';
2
2
  import NodeManager from '../../../NodeManager/index.js';
3
3
  export async function startNode(market, options) {
4
+ options.provider = process.argv.some(arg => arg === '--docker') ? 'docker' : 'podman';
4
5
  const nodeManager = new NodeManager(options);
5
6
  while (true) {
6
7
  try {
@@ -1,6 +1,6 @@
1
1
  import { Command, Option } from 'commander';
2
2
  import { startNode } from './action.js';
3
- import { networkOption, portOption, rpcOption, walletOption, verboseOption, gpuOption } from '../../sharedOptions/index.js';
3
+ import { networkOption, portOption, rpcOption, walletOption, verboseOption, gpuOption } from '../sharedOptions/index.js';
4
4
  export * from './action.js';
5
5
  export const startNodeCommand = new Command('start')
6
6
  .description('Start Nosana Node')
@@ -8,9 +8,6 @@ export const startNodeCommand = new Command('start')
8
8
  .addOption(networkOption)
9
9
  .addOption(rpcOption)
10
10
  .addOption(walletOption)
11
- .addOption(new Option('--provider <provider>', 'provider used to run the job')
12
- .choices(['docker', 'podman'])
13
- .default('podman'))
14
11
  .addOption(new Option('--docker, --podman <URI>', 'Podman/Docker connection URI').default('~/.nosana/podman/podman.sock'))
15
12
  .addOption(new Option('-c, --config <path>', 'Config path (to store the flows database and other config)').default('~/.nosana/'))
16
13
  .addOption(gpuOption)
@@ -1,2 +1,5 @@
1
1
  import { Command } from 'commander';
2
+ export * from './commands/run/command.js';
3
+ export * from './commands/start/command.js';
4
+ export * from './commands/prune/command.js';
2
5
  export declare const createNosanaCLI: (version: string) => Command;
@@ -1,12 +1,17 @@
1
1
  import { Command, Option } from 'commander';
2
- import { nodeCommand } from './node/index.js';
3
- import { addressCommand } from './address/command.js';
2
+ import { addressCommand } from './commands/address/command.js';
4
3
  import { OUTPUT_EVENTS } from '../output-formatter/outputEvents.js';
5
4
  import { outputFormatArgumentParser } from '../output-formatter/outputFormatArgumentParser.js';
6
5
  import { outputFormatSelector } from '../output-formatter/outputFormatSelector.js';
7
6
  import { setSDK } from '../NodeManager/sdk/index.js';
8
7
  import { configs } from '../NodeManager/configs/configs.js';
9
8
  import { NodeConfigsSingleton } from '../NodeManager/configs/NodeConfigs.js';
9
+ import { runNodeCommand } from './commands/run/command.js';
10
+ import { startNodeCommand } from './commands/start/command.js';
11
+ import { nodePruneCommand } from './commands/prune/command.js';
12
+ export * from './commands/run/command.js';
13
+ export * from './commands/start/command.js';
14
+ export * from './commands/prune/command.js';
10
15
  export const createNosanaCLI = (version) => new Command()
11
16
  .name('nosana-node')
12
17
  .description('Nosana Node')
@@ -28,5 +33,7 @@ export const createNosanaCLI = (version) => new Command()
28
33
  .addOption(new Option('--log <logLevel>', 'Log level')
29
34
  .default('debug')
30
35
  .choices(['info', 'none', 'debug', 'trace']))
31
- .addCommand(nodeCommand)
36
+ .addCommand(nodePruneCommand)
37
+ .addCommand(runNodeCommand)
38
+ .addCommand(startNodeCommand)
32
39
  .addCommand(addressCommand);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
  /// <reference path="../src/global.d.ts" />
3
- export * from './cli/node/index.js';
3
+ export * from './cli/createNosanaCli.js';
package/dist/index.js CHANGED
@@ -4,4 +4,4 @@ import { pkg } from './static/index.js';
4
4
  import { startCLI } from './cli/index.js';
5
5
  const VERSION = pkg.version;
6
6
  startCLI(VERSION);
7
- export * from './cli/node/index.js';
7
+ export * from './cli/createNosanaCli.js';
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-rc",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@nosana/node",
9
- "version": "1.0.0",
9
+ "version": "1.0.1-rc",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@coral-xyz/anchor": "^0.28.1-beta.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-rc",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { nodeCommand } from '../';
2
- describe('nodeCommand', () => {
3
- it('should have only three commands', () => {
4
- expect(nodeCommand.commands.length).toBe(3);
5
- });
6
- it.each([['run'], ['start'], ['prune']])('should contain %s command', (command) => {
7
- // @ts-ignore
8
- expect(nodeCommand.commands.map((command) => command._name)).toContain(command);
9
- });
10
- });
@@ -1,5 +0,0 @@
1
- import { Command } from 'commander';
2
- export * from './run/command.js';
3
- export * from './start/command.js';
4
- export * from './prune/command.js';
5
- export declare const nodeCommand: Command;
@@ -1,12 +0,0 @@
1
- import { program } from 'commander';
2
- import { runNodeCommand } from './run/command.js';
3
- import { startNodeCommand } from './start/command.js';
4
- import { nodePruneCommand } from './prune/command.js';
5
- export * from './run/command.js';
6
- export * from './start/command.js';
7
- export * from './prune/command.js';
8
- export const nodeCommand = program
9
- .command('node')
10
- .addCommand(nodePruneCommand)
11
- .addCommand(runNodeCommand)
12
- .addCommand(startNodeCommand);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes