@veloxts/core 0.3.4 → 0.3.5
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/dist/app.d.ts.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/context.d.ts +26 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +29 -0
- package/dist/context.js.map +1 -1
- package/dist/di/container.d.ts.map +1 -1
- package/dist/di/container.js +14 -8
- package/dist/di/container.js.map +1 -1
- package/dist/di/decorators.d.ts +22 -8
- package/dist/di/decorators.d.ts.map +1 -1
- package/dist/di/decorators.js.map +1 -1
- package/dist/di/index.d.ts +2 -2
- package/dist/di/index.d.ts.map +1 -1
- package/dist/di/index.js +7 -7
- package/dist/di/index.js.map +1 -1
- package/dist/di/providers.d.ts +48 -8
- package/dist/di/providers.d.ts.map +1 -1
- package/dist/di/providers.js.map +1 -1
- package/dist/di/scope.d.ts +21 -0
- package/dist/di/scope.d.ts.map +1 -1
- package/dist/di/scope.js +32 -0
- package/dist/di/scope.js.map +1 -1
- package/dist/errors/catalog.d.ts +79 -0
- package/dist/errors/catalog.d.ts.map +1 -0
- package/dist/errors/catalog.js +492 -0
- package/dist/errors/catalog.js.map +1 -0
- package/dist/errors/formatter.d.ts +101 -0
- package/dist/errors/formatter.d.ts.map +1 -0
- package/dist/errors/formatter.js +330 -0
- package/dist/errors/formatter.js.map +1 -0
- package/dist/errors/index.d.ts +14 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +16 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors.d.ts +35 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +57 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/package.json +12 -1
package/dist/errors.js
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* Provides base error classes with HTTP status codes and discriminated unions
|
|
4
4
|
* @module errors
|
|
5
5
|
*/
|
|
6
|
+
// Import catalog for use in error classes
|
|
7
|
+
import { ERROR_CATALOG } from './errors/catalog.js';
|
|
8
|
+
import { formatError as _formatError } from './errors/formatter.js';
|
|
9
|
+
// Re-export the enhanced error catalog and formatter
|
|
10
|
+
export { ERROR_CATALOG, ERROR_DOMAINS, extractErrorLocation, formatError, formatErrorForApi, formatErrorOneLine, getDocsUrl, getErrorEntry, getErrorsByDomain, isKnownErrorCode, logDeprecation, logError, logWarning, } from './errors/index.js';
|
|
6
11
|
/**
|
|
7
12
|
* Type guard for validation error responses
|
|
8
13
|
*/
|
|
@@ -28,11 +33,19 @@ export function isNotFoundErrorResponse(response) {
|
|
|
28
33
|
*
|
|
29
34
|
* @example
|
|
30
35
|
* ```typescript
|
|
36
|
+
* // Basic usage
|
|
31
37
|
* throw new VeloxError('Something went wrong', 500);
|
|
32
38
|
* ```
|
|
33
39
|
*
|
|
34
40
|
* @example
|
|
35
41
|
* ```typescript
|
|
42
|
+
* // With catalog code for rich error details
|
|
43
|
+
* throw new VeloxError('Database connection failed', 503, 'VELOX-4001');
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // With legacy string code
|
|
36
49
|
* throw new VeloxError('Database connection failed', 503, 'DB_CONNECTION_ERROR');
|
|
37
50
|
* ```
|
|
38
51
|
*/
|
|
@@ -42,21 +55,38 @@ export class VeloxError extends Error {
|
|
|
42
55
|
*/
|
|
43
56
|
statusCode;
|
|
44
57
|
/**
|
|
45
|
-
*
|
|
58
|
+
* Error code for programmatic error handling
|
|
59
|
+
* Can be a catalog code (VELOX-XXXX) or legacy string code
|
|
46
60
|
*/
|
|
47
61
|
code;
|
|
62
|
+
/**
|
|
63
|
+
* Fix suggestion for developers (populated from catalog)
|
|
64
|
+
*/
|
|
65
|
+
fix;
|
|
66
|
+
/**
|
|
67
|
+
* Documentation URL for this error
|
|
68
|
+
*/
|
|
69
|
+
docsUrl;
|
|
48
70
|
/**
|
|
49
71
|
* Creates a new VeloxError instance
|
|
50
72
|
*
|
|
51
73
|
* @param message - Human-readable error message
|
|
52
74
|
* @param statusCode - HTTP status code (default: 500)
|
|
53
|
-
* @param code - Optional error code
|
|
75
|
+
* @param code - Optional error code (VELOX-XXXX catalog code or legacy string)
|
|
54
76
|
*/
|
|
55
77
|
constructor(message, statusCode = 500, code) {
|
|
56
78
|
super(message);
|
|
57
79
|
this.name = 'VeloxError';
|
|
58
80
|
this.statusCode = statusCode;
|
|
59
81
|
this.code = code;
|
|
82
|
+
// Look up catalog entry for enhanced error info
|
|
83
|
+
if (code && typeof code === 'string' && code.startsWith('VELOX-')) {
|
|
84
|
+
const entry = ERROR_CATALOG[code];
|
|
85
|
+
if (entry) {
|
|
86
|
+
this.fix = entry.fix?.suggestion;
|
|
87
|
+
this.docsUrl = entry.docsUrl;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
60
90
|
// Maintains proper stack trace for where error was thrown (V8 only)
|
|
61
91
|
if (Error.captureStackTrace) {
|
|
62
92
|
Error.captureStackTrace(this, VeloxError);
|
|
@@ -65,15 +95,38 @@ export class VeloxError extends Error {
|
|
|
65
95
|
/**
|
|
66
96
|
* Converts error to JSON format for API responses
|
|
67
97
|
*
|
|
68
|
-
* @returns Error response object
|
|
98
|
+
* @returns Error response object with optional fix suggestion in development
|
|
69
99
|
*/
|
|
70
100
|
toJSON() {
|
|
71
|
-
|
|
101
|
+
const response = {
|
|
72
102
|
error: this.name,
|
|
73
103
|
message: this.message,
|
|
74
104
|
statusCode: this.statusCode,
|
|
75
105
|
code: this.code,
|
|
76
106
|
};
|
|
107
|
+
// Include fix suggestion in development only
|
|
108
|
+
if (process.env.NODE_ENV !== 'production' && this.fix) {
|
|
109
|
+
response.fix = this.fix;
|
|
110
|
+
}
|
|
111
|
+
// Always include docs URL if available
|
|
112
|
+
if (this.docsUrl) {
|
|
113
|
+
response.docs = this.docsUrl;
|
|
114
|
+
}
|
|
115
|
+
return response;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Format error for terminal display with colors and fix suggestions
|
|
119
|
+
*
|
|
120
|
+
* @returns Formatted error string
|
|
121
|
+
*/
|
|
122
|
+
format() {
|
|
123
|
+
return _formatError(this, this.code);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Log this error with pretty formatting
|
|
127
|
+
*/
|
|
128
|
+
log() {
|
|
129
|
+
console.error(this.format());
|
|
77
130
|
}
|
|
78
131
|
}
|
|
79
132
|
/**
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0CAA0C;AAC1C,OAAO,EAAmC,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEpE,qDAAqD;AACrD,OAAO,EACL,aAAa,EACb,aAAa,EAIb,oBAAoB,EAEpB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,UAAU,GACX,MAAM,mBAAmB,CAAC;AA8G3B;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAuB;IAEvB,OAAO,QAAQ,CAAC,KAAK,KAAK,iBAAiB,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAAuB;IAEvB,OAAO,QAAQ,CAAC,KAAK,KAAK,eAAe,CAAC;AAC5C,CAAC;AAED,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;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tD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,KAAK,YAAY,eAAe,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,KAAK,YAAY,aAAa,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,KAAK,YAAY,kBAAkB,CAAC;AAC7C,CAAC;AAED,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
import 'reflect-metadata';
|
|
19
19
|
/** VeloxTS framework version */
|
|
20
20
|
export declare const VELOX_VERSION: string;
|
|
21
|
-
export {
|
|
21
|
+
export { createVeloxApp, VeloxApp, veloxApp } from './app.js';
|
|
22
22
|
export type { BaseContext } from './context.js';
|
|
23
|
-
export { createContext, isContext } from './context.js';
|
|
23
|
+
export { createContext, isContext, setupTestContext } from './context.js';
|
|
24
|
+
export type { AbstractClass, ClassConstructor, ClassProvider, ContainerOptions, ExistingProvider, FactoryProvider, InjectableOptions, InjectionToken, Provider, ResolutionContext, StringToken, SymbolToken, TokenType, ValueProvider, } from './di/index.js';
|
|
25
|
+
export { asClass, asExisting, asFactory, asValue, Container, container, createContainer, createStringToken, createSymbolToken, factory, getConstructorTokens, getExplicitInjectTokens, getInjectableScope, getOptionalParams, getTokenName, Inject, Injectable, isClassProvider, isClassToken, isExistingProvider, isFactoryProvider, isInjectable, isStringToken, isSymbolToken, isValueProvider, makeInjectable, Optional, Scope, ScopeManager, scoped, setInjectTokens, singleton, token, transient, validateProvider, validateToken, value, } from './di/index.js';
|
|
24
26
|
export type { ErrorResponse, GenericErrorResponse, NotFoundErrorResponse, ValidationErrorResponse, VeloxCoreErrorCode, VeloxErrorCode, VeloxErrorCodeRegistry, } from './errors.js';
|
|
25
27
|
export { assertNever, ConfigurationError, isConfigurationError, isNotFoundError, isNotFoundErrorResponse, isValidationError, isValidationErrorResponse, isVeloxError, NotFoundError, ValidationError, VeloxError, } from './errors.js';
|
|
26
28
|
export type { InferPluginOptions, PluginMetadata, PluginOptions, VeloxPlugin } from './plugin.js';
|
|
@@ -28,6 +30,4 @@ export { definePlugin, isVeloxPlugin, validatePluginMetadata } from './plugin.js
|
|
|
28
30
|
export type { AsyncHandler, JsonArray, JsonObject, JsonPrimitive, JsonValue, LifecycleHook, ShutdownHandler, SyncHandler, } from './types.js';
|
|
29
31
|
export type { FrozenVeloxAppConfig, ValidHost, ValidPort, VeloxAppConfig, VeloxFastifyOptions, } from './utils/config.js';
|
|
30
32
|
export { isValidHost, isValidPort } from './utils/config.js';
|
|
31
|
-
export { Container, container, createContainer, Injectable, Inject, Optional, isInjectable, getInjectableScope, getConstructorTokens, getExplicitInjectTokens, getOptionalParams, makeInjectable, setInjectTokens, singleton, scoped, transient, value, factory, asClass, asFactory, asValue, asExisting, isClassProvider, isFactoryProvider, isValueProvider, isExistingProvider, validateProvider, Scope, ScopeManager, token, createStringToken, createSymbolToken, getTokenName, isClassToken, isStringToken, isSymbolToken, validateToken, } from './di/index.js';
|
|
32
|
-
export type { ContainerOptions, ResolutionContext, InjectableOptions, Provider, ClassProvider, FactoryProvider, ValueProvider, ExistingProvider, InjectionToken, ClassConstructor, AbstractClass, StringToken, SymbolToken, TokenType, } from './di/index.js';
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAElF,YAAY,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,cAAc,EACd,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -24,30 +24,30 @@ const packageJson = require('../package.json');
|
|
|
24
24
|
/** VeloxTS framework version */
|
|
25
25
|
export const VELOX_VERSION = packageJson.version ?? '0.0.0-unknown';
|
|
26
26
|
// App creation and types
|
|
27
|
-
export {
|
|
28
|
-
export { createContext, isContext } from './context.js';
|
|
29
|
-
export { assertNever, ConfigurationError, isConfigurationError, isNotFoundError, isNotFoundErrorResponse, isValidationError, isValidationErrorResponse, isVeloxError, NotFoundError, ValidationError, VeloxError, } from './errors.js';
|
|
30
|
-
// Plugin system
|
|
31
|
-
export { definePlugin, isVeloxPlugin, validatePluginMetadata } from './plugin.js';
|
|
32
|
-
export { isValidHost, isValidPort } from './utils/config.js';
|
|
27
|
+
export { createVeloxApp, VeloxApp, veloxApp } from './app.js';
|
|
28
|
+
export { createContext, isContext, setupTestContext } from './context.js';
|
|
33
29
|
// Dependency Injection
|
|
34
30
|
export {
|
|
31
|
+
// Provider helpers (legacy)
|
|
32
|
+
asClass, asExisting, asFactory, asValue,
|
|
35
33
|
// Container
|
|
36
34
|
Container, container, createContainer,
|
|
35
|
+
// Tokens (legacy - deprecated)
|
|
36
|
+
createStringToken, createSymbolToken, factory, getConstructorTokens, getExplicitInjectTokens, getInjectableScope, getOptionalParams, getTokenName, Inject,
|
|
37
37
|
// Decorators
|
|
38
|
-
Injectable,
|
|
39
|
-
// Decorator utilities
|
|
40
|
-
isInjectable, getInjectableScope, getConstructorTokens, getExplicitInjectTokens, getOptionalParams, makeInjectable, setInjectTokens,
|
|
41
|
-
// Provider helpers (succinct API)
|
|
42
|
-
singleton, scoped, transient, value, factory,
|
|
43
|
-
// Provider helpers (legacy)
|
|
44
|
-
asClass, asFactory, asValue, asExisting,
|
|
38
|
+
Injectable,
|
|
45
39
|
// Provider type guards
|
|
46
|
-
isClassProvider,
|
|
40
|
+
isClassProvider, isClassToken, isExistingProvider, isFactoryProvider,
|
|
41
|
+
// Decorator utilities
|
|
42
|
+
isInjectable, isStringToken, isSymbolToken, isValueProvider, makeInjectable, Optional,
|
|
47
43
|
// Scope
|
|
48
|
-
Scope, ScopeManager,
|
|
44
|
+
Scope, ScopeManager, scoped, setInjectTokens,
|
|
45
|
+
// Provider helpers (succinct API)
|
|
46
|
+
singleton,
|
|
49
47
|
// Tokens (succinct API)
|
|
50
|
-
token,
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
token, transient, validateProvider, validateToken, value, } from './di/index.js';
|
|
49
|
+
export { assertNever, ConfigurationError, isConfigurationError, isNotFoundError, isNotFoundErrorResponse, isValidationError, isValidationErrorResponse, isVeloxError, NotFoundError, ValidationError, VeloxError, } from './errors.js';
|
|
50
|
+
// Plugin system
|
|
51
|
+
export { definePlugin, isVeloxPlugin, validatePluginMetadata } from './plugin.js';
|
|
52
|
+
export { isValidHost, isValidPort } from './utils/config.js';
|
|
53
53
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gDAAgD;AAChD,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,6CAA6C;AAC7C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,gCAAgC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAW,WAAW,CAAC,OAAO,IAAI,eAAe,CAAC;AAE5E,yBAAyB;AACzB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gDAAgD;AAChD,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,6CAA6C;AAC7C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,gCAAgC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAW,WAAW,CAAC,OAAO,IAAI,eAAe,CAAC;AAE5E,yBAAyB;AACzB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAqB1E,uBAAuB;AACvB,OAAO;AACL,4BAA4B;AAC5B,OAAO,EACP,UAAU,EACV,SAAS,EACT,OAAO;AACP,YAAY;AACZ,SAAS,EACT,SAAS,EACT,eAAe;AACf,+BAA+B;AAC/B,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,EACP,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,MAAM;AACN,aAAa;AACb,UAAU;AACV,uBAAuB;AACvB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB;AACjB,sBAAsB;AACtB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,QAAQ;AACR,QAAQ;AACR,KAAK,EACL,YAAY,EACZ,MAAM,EACN,eAAe;AACf,kCAAkC;AAClC,SAAS;AACT,wBAAwB;AACxB,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,KAAK,GACN,MAAM,eAAe,CAAC;AAWvB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAoBlF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Fastify wrapper, DI container, and plugin system for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,6 +15,16 @@
|
|
|
15
15
|
"dist",
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
|
+
"tsd": {
|
|
19
|
+
"directory": "src/__type-tests__",
|
|
20
|
+
"compilerOptions": {
|
|
21
|
+
"paths": {
|
|
22
|
+
"@veloxts/core": [
|
|
23
|
+
"dist"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
18
28
|
"dependencies": {
|
|
19
29
|
"fastify": "5.6.2",
|
|
20
30
|
"fastify-plugin": "5.1.0",
|
|
@@ -48,6 +58,7 @@
|
|
|
48
58
|
"build": "tsc",
|
|
49
59
|
"dev": "tsc --watch",
|
|
50
60
|
"type-check": "tsc --noEmit",
|
|
61
|
+
"test:types": "tsd",
|
|
51
62
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
52
63
|
"test": "vitest run",
|
|
53
64
|
"test:watch": "vitest",
|