@veloxts/core 0.1.0 → 0.2.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/README.md +7 -5
- package/dist/app.d.ts +3 -3
- package/dist/app.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/config.d.ts +6 -6
- package/dist/utils/config.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @veloxts/core
|
|
2
2
|
|
|
3
|
+
> **Alpha Release** - This framework is in early development. APIs may change between versions. Not recommended for production use yet.
|
|
4
|
+
|
|
3
5
|
Foundation package for the VeloxTS framework - provides the core Fastify wrapper, plugin system, and base context.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
@@ -17,7 +19,7 @@ import { createVeloxApp } from '@veloxts/core';
|
|
|
17
19
|
|
|
18
20
|
// Create application
|
|
19
21
|
const app = await createVeloxApp({
|
|
20
|
-
port:
|
|
22
|
+
port: 3210,
|
|
21
23
|
host: '0.0.0.0',
|
|
22
24
|
logger: true,
|
|
23
25
|
});
|
|
@@ -381,7 +383,7 @@ app.server.get('/users/:id', async (request, reply) => {
|
|
|
381
383
|
|
|
382
384
|
```typescript
|
|
383
385
|
{
|
|
384
|
-
port:
|
|
386
|
+
port: 3210,
|
|
385
387
|
host: '0.0.0.0',
|
|
386
388
|
logger: process.env.NODE_ENV !== 'production',
|
|
387
389
|
}
|
|
@@ -391,7 +393,7 @@ app.server.get('/users/:id', async (request, reply) => {
|
|
|
391
393
|
|
|
392
394
|
```typescript
|
|
393
395
|
const app = await createVeloxApp({
|
|
394
|
-
port: Number(process.env.PORT) ||
|
|
396
|
+
port: Number(process.env.PORT) || 3210,
|
|
395
397
|
host: process.env.HOST || '0.0.0.0',
|
|
396
398
|
logger: process.env.NODE_ENV !== 'production',
|
|
397
399
|
fastify: {
|
|
@@ -404,7 +406,7 @@ const app = await createVeloxApp({
|
|
|
404
406
|
|
|
405
407
|
```typescript
|
|
406
408
|
const app = await createVeloxApp({
|
|
407
|
-
port:
|
|
409
|
+
port: 3210,
|
|
408
410
|
host: '0.0.0.0',
|
|
409
411
|
logger: {
|
|
410
412
|
level: 'warn',
|
|
@@ -527,7 +529,7 @@ import { userProcedures } from './procedures/users';
|
|
|
527
529
|
// Initialize
|
|
528
530
|
const prisma = new PrismaClient();
|
|
529
531
|
const app = await createVeloxApp({
|
|
530
|
-
port: Number(process.env.PORT) ||
|
|
532
|
+
port: Number(process.env.PORT) || 3210,
|
|
531
533
|
logger: true,
|
|
532
534
|
});
|
|
533
535
|
|
package/dist/app.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { FrozenVeloxAppConfig, VeloxAppConfig } from './utils/config.js';
|
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
21
21
|
* const app = await createVeloxApp({
|
|
22
|
-
* port:
|
|
22
|
+
* port: 3210,
|
|
23
23
|
* logger: true
|
|
24
24
|
* });
|
|
25
25
|
*
|
|
@@ -206,7 +206,7 @@ export declare class VeloxApp {
|
|
|
206
206
|
* @example
|
|
207
207
|
* ```typescript
|
|
208
208
|
* const app = await createVeloxApp({
|
|
209
|
-
* port:
|
|
209
|
+
* port: 3210,
|
|
210
210
|
* host: '0.0.0.0',
|
|
211
211
|
* logger: true
|
|
212
212
|
* });
|
|
@@ -216,7 +216,7 @@ export declare class VeloxApp {
|
|
|
216
216
|
* ```typescript
|
|
217
217
|
* // With default configuration
|
|
218
218
|
* const app = await createVeloxApp();
|
|
219
|
-
* await app.start(); // Listens on port
|
|
219
|
+
* await app.start(); // Listens on port 3210
|
|
220
220
|
* ```
|
|
221
221
|
*
|
|
222
222
|
* @example
|
package/dist/app.js
CHANGED
|
@@ -22,7 +22,7 @@ import { LifecycleManager } from './utils/lifecycle.js';
|
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
24
|
* const app = await createVeloxApp({
|
|
25
|
-
* port:
|
|
25
|
+
* port: 3210,
|
|
26
26
|
* logger: true
|
|
27
27
|
* });
|
|
28
28
|
*
|
|
@@ -347,7 +347,7 @@ export class VeloxApp {
|
|
|
347
347
|
* @example
|
|
348
348
|
* ```typescript
|
|
349
349
|
* const app = await createVeloxApp({
|
|
350
|
-
* port:
|
|
350
|
+
* port: 3210,
|
|
351
351
|
* host: '0.0.0.0',
|
|
352
352
|
* logger: true
|
|
353
353
|
* });
|
|
@@ -357,7 +357,7 @@ export class VeloxApp {
|
|
|
357
357
|
* ```typescript
|
|
358
358
|
* // With default configuration
|
|
359
359
|
* const app = await createVeloxApp();
|
|
360
|
-
* await app.start(); // Listens on port
|
|
360
|
+
* await app.start(); // Listens on port 3210
|
|
361
361
|
* ```
|
|
362
362
|
*
|
|
363
363
|
* @example
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/utils/config.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare const ValidPortBrand: unique symbol;
|
|
|
19
19
|
* // port is guaranteed to be 0-65535
|
|
20
20
|
* }
|
|
21
21
|
*
|
|
22
|
-
* const port =
|
|
22
|
+
* const port = 3210;
|
|
23
23
|
* if (isValidPort(port)) {
|
|
24
24
|
* listen(port); // TypeScript knows port is ValidPort here
|
|
25
25
|
* }
|
|
@@ -66,7 +66,7 @@ export type VeloxFastifyOptions = Omit<FastifyServerOptions, 'logger'>;
|
|
|
66
66
|
* @example
|
|
67
67
|
* ```typescript
|
|
68
68
|
* const config: VeloxAppConfig = {
|
|
69
|
-
* port:
|
|
69
|
+
* port: 3210,
|
|
70
70
|
* host: '0.0.0.0',
|
|
71
71
|
* logger: true
|
|
72
72
|
* };
|
|
@@ -75,7 +75,7 @@ export type VeloxFastifyOptions = Omit<FastifyServerOptions, 'logger'>;
|
|
|
75
75
|
export interface VeloxAppConfig {
|
|
76
76
|
/**
|
|
77
77
|
* Port to listen on
|
|
78
|
-
* @default
|
|
78
|
+
* @default 3210
|
|
79
79
|
*/
|
|
80
80
|
port?: number;
|
|
81
81
|
/**
|
|
@@ -118,7 +118,7 @@ export type FrozenVeloxAppConfig = Readonly<{
|
|
|
118
118
|
* Default configuration values
|
|
119
119
|
*/
|
|
120
120
|
export declare const DEFAULT_CONFIG: {
|
|
121
|
-
readonly port:
|
|
121
|
+
readonly port: 3210;
|
|
122
122
|
readonly host: "0.0.0.0";
|
|
123
123
|
readonly logger: boolean;
|
|
124
124
|
};
|
|
@@ -130,7 +130,7 @@ export declare const DEFAULT_CONFIG: {
|
|
|
130
130
|
*
|
|
131
131
|
* @example
|
|
132
132
|
* ```typescript
|
|
133
|
-
* const port =
|
|
133
|
+
* const port = 3210;
|
|
134
134
|
* if (isValidPort(port)) {
|
|
135
135
|
* // port is narrowed to ValidPort
|
|
136
136
|
* startServer(port);
|
|
@@ -170,7 +170,7 @@ export declare function mergeConfig(userConfig?: VeloxAppConfig): Required<Velox
|
|
|
170
170
|
*
|
|
171
171
|
* @example
|
|
172
172
|
* ```typescript
|
|
173
|
-
* const merged = mergeConfig({ port:
|
|
173
|
+
* const merged = mergeConfig({ port: 3210 });
|
|
174
174
|
* const validated = validateConfig(merged);
|
|
175
175
|
* // validated.port is ValidPort (branded type)
|
|
176
176
|
* // validated is frozen (immutable at runtime)
|
package/dist/utils/config.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Default configuration values
|
|
7
7
|
*/
|
|
8
8
|
export const DEFAULT_CONFIG = {
|
|
9
|
-
port:
|
|
9
|
+
port: 3210,
|
|
10
10
|
host: '0.0.0.0',
|
|
11
11
|
logger: process.env.NODE_ENV !== 'production',
|
|
12
12
|
};
|
|
@@ -21,7 +21,7 @@ export const DEFAULT_CONFIG = {
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
|
-
* const port =
|
|
24
|
+
* const port = 3210;
|
|
25
25
|
* if (isValidPort(port)) {
|
|
26
26
|
* // port is narrowed to ValidPort
|
|
27
27
|
* startServer(port);
|
|
@@ -75,7 +75,7 @@ export function mergeConfig(userConfig = {}) {
|
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* ```typescript
|
|
78
|
-
* const merged = mergeConfig({ port:
|
|
78
|
+
* const merged = mergeConfig({ port: 3210 });
|
|
79
79
|
* const validated = validateConfig(merged);
|
|
80
80
|
* // validated.port is ValidPort (branded type)
|
|
81
81
|
* // validated is frozen (immutable at runtime)
|