@navios/core 0.2.2 → 0.3.0

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/README.md CHANGED
@@ -23,7 +23,6 @@ It uses Fastify under the hood, which is a fast and low-overhead web framework f
23
23
  - **Service**: A service is a class that defines the business logic for a specific resource. It is used to separate the business logic from the controller and provide a clear structure for your API.
24
24
  - **Guard**: A guard is a class that is used to validate incoming requests and ensure that they meet certain criteria. Guards can be used to validate request parameters, headers, and body. They can also be used to check authentication and authorization.
25
25
  - **Attribute**: An attribute is a decorator that is used to add metadata to a class or method. Attributes can be used in guards, controllers, modules, and endpoints to provide additional information about the class or method.
26
-
27
26
 
28
27
  ## Getting Started
29
28
 
@@ -33,6 +32,7 @@ Define your API in a shared location accessible to both the client and server. T
33
32
 
34
33
  ```ts
35
34
  import { builder } from '@navios/core'
35
+
36
36
  import { z } from 'zod'
37
37
 
38
38
  const api = builder({
@@ -66,7 +66,7 @@ const login = api.declareEndpoint({
66
66
  ### Create your server
67
67
 
68
68
  ```bash
69
- yarn install --save @navios/core @navios/common zod
69
+ yarn install --save @navios/core @navios/builder zod
70
70
  ```
71
71
 
72
72
  Create AuthService:
@@ -86,7 +86,9 @@ export class LoginService {
86
86
  Create your first Controller:
87
87
 
88
88
  ```ts
89
- import { Controller, Endpoint, type EndpointParams, syncInject } from '@navios/core'
89
+ import type { EndpointParams } from '@navios/core'
90
+
91
+ import { Controller, Endpoint, syncInject } from '@navios/core'
90
92
 
91
93
  import { AuthService } from './auth.service.mjs'
92
94
 
@@ -111,6 +113,7 @@ export class AuthController {
111
113
  }
112
114
  }
113
115
  ```
116
+
114
117
  Create your AppModule:
115
118
 
116
119
  ```ts
@@ -128,6 +131,7 @@ Create your server:
128
131
 
129
132
  ```ts
130
133
  import { NaviosFactory } from '@navios/core'
134
+
131
135
  import { AppModule } from './src/app.module.mjs'
132
136
 
133
137
  export async function boot() {
@@ -1,4 +1,4 @@
1
- import { builder } from '@navios/common'
1
+ import { builder } from '@navios/builder'
2
2
 
3
3
  import { z } from 'zod'
4
4
 
@@ -1,7 +1,7 @@
1
1
  import type { AnyZodObject } from 'zod';
2
- import type { BaseEndpointConfig } from '@navios/common';
2
+ import type { BaseEndpointConfig } from '@navios/builder';
3
3
  import { BaseInjectionTokenSchemaType } from '@navios/di';
4
- import type { BaseStreamConfig } from '@navios/common';
4
+ import type { BaseStreamConfig } from '@navios/builder';
5
5
  import { BoundInjectionToken } from '@navios/di';
6
6
  import { ChannelEmitter } from '@navios/di';
7
7
  import { ClassType } from '@navios/di';
@@ -11,7 +11,7 @@ import { ClassTypeWithInstanceAndArgument } from '@navios/di';
11
11
  import { ClassTypeWithInstanceAndOptionalArgument } from '@navios/di';
12
12
  import { ClassTypeWithOptionalArgument } from '@navios/di';
13
13
  import { CreateInjectorsOptions } from '@navios/di';
14
- import type { EndpointFunctionArgs } from '@navios/common';
14
+ import type { EndpointFunctionArgs } from '@navios/builder';
15
15
  import { ErrorsEnum } from '@navios/di';
16
16
  import { EventEmitter } from '@navios/di';
17
17
  import { EventEmitterInterface } from '@navios/di';
@@ -40,7 +40,7 @@ import { getInjectableToken } from '@navios/di';
40
40
  import { getInjectors } from '@navios/di';
41
41
  import { globalRegistry } from '@navios/di';
42
42
  import type { HttpHeader } from 'fastify/types/utils.js';
43
- import type { HttpMethod } from '@navios/common';
43
+ import type { HttpMethod } from '@navios/builder';
44
44
  import { IncomingMessage } from 'http';
45
45
  import { inject } from '@navios/di';
46
46
  import { Injectable } from '@navios/di';
@@ -80,7 +80,7 @@ import { ServiceLocatorInstanceHolderStatus } from '@navios/di';
80
80
  import { ServiceLocatorManager } from '@navios/di';
81
81
  import { syncInject } from '@navios/di';
82
82
  import { UnknownError } from '@navios/di';
83
- import type { Util_FlatObject } from '@navios/common';
83
+ import type { Util_FlatObject } from '@navios/builder';
84
84
  import { wrapSyncInit } from '@navios/di';
85
85
  import { z } from 'zod';
86
86
  import { ZodDiscriminatedUnion } from 'zod';
@@ -1,7 +1,7 @@
1
1
  import type { AnyZodObject } from 'zod';
2
- import type { BaseEndpointConfig } from '@navios/common';
2
+ import type { BaseEndpointConfig } from '@navios/builder';
3
3
  import { BaseInjectionTokenSchemaType } from '@navios/di';
4
- import type { BaseStreamConfig } from '@navios/common';
4
+ import type { BaseStreamConfig } from '@navios/builder';
5
5
  import { BoundInjectionToken } from '@navios/di';
6
6
  import { ChannelEmitter } from '@navios/di';
7
7
  import { ClassType } from '@navios/di';
@@ -11,7 +11,7 @@ import { ClassTypeWithInstanceAndArgument } from '@navios/di';
11
11
  import { ClassTypeWithInstanceAndOptionalArgument } from '@navios/di';
12
12
  import { ClassTypeWithOptionalArgument } from '@navios/di';
13
13
  import { CreateInjectorsOptions } from '@navios/di';
14
- import type { EndpointFunctionArgs } from '@navios/common';
14
+ import type { EndpointFunctionArgs } from '@navios/builder';
15
15
  import { ErrorsEnum } from '@navios/di';
16
16
  import { EventEmitter } from '@navios/di';
17
17
  import { EventEmitterInterface } from '@navios/di';
@@ -40,7 +40,7 @@ import { getInjectableToken } from '@navios/di';
40
40
  import { getInjectors } from '@navios/di';
41
41
  import { globalRegistry } from '@navios/di';
42
42
  import type { HttpHeader } from 'fastify/types/utils.js';
43
- import type { HttpMethod } from '@navios/common';
43
+ import type { HttpMethod } from '@navios/builder';
44
44
  import { IncomingMessage } from 'http';
45
45
  import { inject } from '@navios/di';
46
46
  import { Injectable } from '@navios/di';
@@ -80,7 +80,7 @@ import { ServiceLocatorInstanceHolderStatus } from '@navios/di';
80
80
  import { ServiceLocatorManager } from '@navios/di';
81
81
  import { syncInject } from '@navios/di';
82
82
  import { UnknownError } from '@navios/di';
83
- import type { Util_FlatObject } from '@navios/common';
83
+ import type { Util_FlatObject } from '@navios/builder';
84
84
  import { wrapSyncInit } from '@navios/di';
85
85
  import { z } from 'zod';
86
86
  import { ZodDiscriminatedUnion } from 'zod';
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var di = require('@navios/di');
4
4
  var zod = require('zod');
5
5
  var process$1 = require('process');
6
- var common = require('@navios/common');
6
+ var builder = require('@navios/builder');
7
7
  var util = require('util');
8
8
  var cors = require('@fastify/cors');
9
9
  var multipart = require('@fastify/multipart');
@@ -1415,7 +1415,7 @@ var _ConfigService = class _ConfigService {
1415
1415
  if (value === null) {
1416
1416
  const message = errorMessage || `Configuration value for key "${String(key)}" is not defined`;
1417
1417
  this.logger.error(message);
1418
- throw new common.NaviosException(message);
1418
+ throw new builder.NaviosException(message);
1419
1419
  }
1420
1420
  return value;
1421
1421
  }