@venizia/ignis-docs 0.0.5 → 0.0.6-1
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/package.json +1 -1
- package/wiki/best-practices/architectural-patterns.md +0 -2
- package/wiki/best-practices/architecture-decisions.md +0 -8
- package/wiki/best-practices/code-style-standards/control-flow.md +1 -1
- package/wiki/best-practices/code-style-standards/index.md +0 -1
- package/wiki/best-practices/code-style-standards/tooling.md +0 -3
- package/wiki/best-practices/contribution-workflow.md +12 -12
- package/wiki/best-practices/index.md +4 -14
- package/wiki/best-practices/performance-optimization.md +3 -3
- package/wiki/best-practices/security-guidelines.md +2 -2
- package/wiki/best-practices/troubleshooting-tips.md +1 -1
- package/wiki/guides/core-concepts/application/bootstrapping.md +6 -7
- package/wiki/guides/core-concepts/components-guide.md +1 -1
- package/wiki/guides/core-concepts/components.md +2 -2
- package/wiki/guides/core-concepts/dependency-injection.md +4 -5
- package/wiki/guides/core-concepts/persistent/datasources.md +4 -5
- package/wiki/guides/core-concepts/services.md +1 -1
- package/wiki/guides/get-started/5-minute-quickstart.md +4 -5
- package/wiki/guides/get-started/philosophy.md +12 -24
- package/wiki/guides/index.md +2 -9
- package/wiki/guides/reference/mcp-docs-server.md +13 -13
- package/wiki/guides/tutorials/building-a-crud-api.md +10 -10
- package/wiki/guides/tutorials/complete-installation.md +11 -12
- package/wiki/guides/tutorials/ecommerce-api.md +3 -3
- package/wiki/guides/tutorials/realtime-chat.md +6 -6
- package/wiki/guides/tutorials/testing.md +4 -5
- package/wiki/index.md +8 -14
- package/wiki/references/base/bootstrapping.md +0 -3
- package/wiki/references/base/components.md +2 -2
- package/wiki/references/base/controllers.md +0 -1
- package/wiki/references/base/datasources.md +1 -1
- package/wiki/references/base/dependency-injection.md +2 -2
- package/wiki/references/base/filter-system/default-filter.md +2 -3
- package/wiki/references/base/filter-system/index.md +1 -1
- package/wiki/references/base/filter-system/quick-reference.md +0 -14
- package/wiki/references/base/middlewares.md +0 -8
- package/wiki/references/base/providers.md +0 -9
- package/wiki/references/base/repositories/advanced.md +1 -1
- package/wiki/references/base/repositories/mixins.md +2 -3
- package/wiki/references/base/services.md +0 -1
- package/wiki/references/components/authentication/api.md +444 -0
- package/wiki/references/components/authentication/errors.md +177 -0
- package/wiki/references/components/authentication/index.md +571 -0
- package/wiki/references/components/authentication/usage.md +781 -0
- package/wiki/references/components/health-check.md +292 -103
- package/wiki/references/components/index.md +14 -12
- package/wiki/references/components/mail/api.md +505 -0
- package/wiki/references/components/mail/errors.md +176 -0
- package/wiki/references/components/mail/index.md +535 -0
- package/wiki/references/components/mail/usage.md +404 -0
- package/wiki/references/components/request-tracker.md +229 -25
- package/wiki/references/components/socket-io/api.md +1051 -0
- package/wiki/references/components/socket-io/errors.md +119 -0
- package/wiki/references/components/socket-io/index.md +410 -0
- package/wiki/references/components/socket-io/usage.md +322 -0
- package/wiki/references/components/static-asset/api.md +261 -0
- package/wiki/references/components/static-asset/errors.md +89 -0
- package/wiki/references/components/static-asset/index.md +617 -0
- package/wiki/references/components/static-asset/usage.md +364 -0
- package/wiki/references/components/swagger.md +390 -110
- package/wiki/references/components/template/api-page.md +125 -0
- package/wiki/references/components/template/errors-page.md +100 -0
- package/wiki/references/components/template/index.md +104 -0
- package/wiki/references/components/template/setup-page.md +134 -0
- package/wiki/references/components/template/single-page.md +132 -0
- package/wiki/references/components/template/usage-page.md +127 -0
- package/wiki/references/components/websocket/api.md +508 -0
- package/wiki/references/components/websocket/errors.md +123 -0
- package/wiki/references/components/websocket/index.md +453 -0
- package/wiki/references/components/websocket/usage.md +475 -0
- package/wiki/references/helpers/cron/index.md +224 -0
- package/wiki/references/helpers/crypto/index.md +537 -0
- package/wiki/references/helpers/env/index.md +214 -0
- package/wiki/references/helpers/error/index.md +232 -0
- package/wiki/references/helpers/index.md +16 -15
- package/wiki/references/helpers/inversion/index.md +608 -0
- package/wiki/references/helpers/logger/index.md +600 -0
- package/wiki/references/helpers/network/api.md +986 -0
- package/wiki/references/helpers/network/index.md +620 -0
- package/wiki/references/helpers/queue/index.md +589 -0
- package/wiki/references/helpers/redis/index.md +495 -0
- package/wiki/references/helpers/socket-io/api.md +497 -0
- package/wiki/references/helpers/socket-io/index.md +513 -0
- package/wiki/references/helpers/storage/api.md +705 -0
- package/wiki/references/helpers/storage/index.md +583 -0
- package/wiki/references/helpers/template/index.md +66 -0
- package/wiki/references/helpers/template/single-page.md +126 -0
- package/wiki/references/helpers/testing/index.md +510 -0
- package/wiki/references/helpers/types/index.md +512 -0
- package/wiki/references/helpers/uid/index.md +272 -0
- package/wiki/references/helpers/websocket/api.md +736 -0
- package/wiki/references/helpers/websocket/index.md +574 -0
- package/wiki/references/helpers/worker-thread/index.md +470 -0
- package/wiki/references/index.md +2 -9
- package/wiki/references/quick-reference.md +3 -18
- package/wiki/references/utilities/jsx.md +1 -8
- package/wiki/references/utilities/statuses.md +0 -7
- package/wiki/references/components/authentication.md +0 -476
- package/wiki/references/components/mail.md +0 -687
- package/wiki/references/components/socket-io.md +0 -562
- package/wiki/references/components/static-asset.md +0 -1277
- package/wiki/references/helpers/cron.md +0 -108
- package/wiki/references/helpers/crypto.md +0 -132
- package/wiki/references/helpers/env.md +0 -83
- package/wiki/references/helpers/error.md +0 -97
- package/wiki/references/helpers/inversion.md +0 -176
- package/wiki/references/helpers/logger.md +0 -296
- package/wiki/references/helpers/network.md +0 -396
- package/wiki/references/helpers/queue.md +0 -150
- package/wiki/references/helpers/redis.md +0 -142
- package/wiki/references/helpers/socket-io.md +0 -932
- package/wiki/references/helpers/storage.md +0 -665
- package/wiki/references/helpers/testing.md +0 -133
- package/wiki/references/helpers/types.md +0 -167
- package/wiki/references/helpers/uid.md +0 -167
- package/wiki/references/helpers/worker-thread.md +0 -178
- package/wiki/references/src-details/boot.md +0 -379
- package/wiki/references/src-details/core.md +0 -263
- package/wiki/references/src-details/dev-configs.md +0 -298
- package/wiki/references/src-details/docs.md +0 -71
- package/wiki/references/src-details/helpers.md +0 -211
- package/wiki/references/src-details/index.md +0 -86
- package/wiki/references/src-details/inversion.md +0 -340
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
# Types
|
|
2
|
+
|
|
3
|
+
Shared utility types, resolver functions, and constants exported from `@venizia/ignis-helpers`.
|
|
4
|
+
|
|
5
|
+
## Quick Reference
|
|
6
|
+
|
|
7
|
+
| Item | Value |
|
|
8
|
+
|------|-------|
|
|
9
|
+
| **Package** | `@venizia/ignis-helpers` |
|
|
10
|
+
| **Module** | Common types and constants |
|
|
11
|
+
| **Runtimes** | Both |
|
|
12
|
+
|
|
13
|
+
#### Import Paths
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// Types
|
|
17
|
+
import type {
|
|
18
|
+
TNullable,
|
|
19
|
+
AnyType,
|
|
20
|
+
AnyObject,
|
|
21
|
+
TOptions,
|
|
22
|
+
ValueOrPromise,
|
|
23
|
+
ValueOf,
|
|
24
|
+
ValueOptional,
|
|
25
|
+
ValueOptionalExcept,
|
|
26
|
+
TPrettify,
|
|
27
|
+
TConstructor,
|
|
28
|
+
TAbstractConstructor,
|
|
29
|
+
TClass,
|
|
30
|
+
TAbstractClass,
|
|
31
|
+
TMixinTarget,
|
|
32
|
+
TAbstractMixinTarget,
|
|
33
|
+
TResolver,
|
|
34
|
+
TAsyncResolver,
|
|
35
|
+
TValueOrResolver,
|
|
36
|
+
TValueOrAsyncResolver,
|
|
37
|
+
TStringConstValue,
|
|
38
|
+
TNumberConstValue,
|
|
39
|
+
TConstValue,
|
|
40
|
+
TFieldMappingDataType,
|
|
41
|
+
IFieldMapping,
|
|
42
|
+
TFieldMappingNames,
|
|
43
|
+
TObjectFromFieldMappings,
|
|
44
|
+
TInjectionGetter,
|
|
45
|
+
IConfigurable,
|
|
46
|
+
TPermissionEffect,
|
|
47
|
+
} from '@venizia/ignis-helpers';
|
|
48
|
+
|
|
49
|
+
// Resolver functions
|
|
50
|
+
import { resolveValue, resolveValueAsync, resolveClass } from '@venizia/ignis-helpers';
|
|
51
|
+
|
|
52
|
+
// Constants
|
|
53
|
+
import { Defaults, RuntimeModules, DataTypes, HTTP, MimeTypes } from '@venizia/ignis-helpers';
|
|
54
|
+
|
|
55
|
+
// Derived constant types
|
|
56
|
+
import type { TRuntimeModule, TMimeTypes, THttpMethod, THttpResultCode } from '@venizia/ignis-helpers';
|
|
57
|
+
|
|
58
|
+
// JSX types (re-exported from hono/jsx)
|
|
59
|
+
import type { Child, FC, PropsWithChildren } from '@venizia/ignis-helpers';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
### General Purpose Types
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
type AnyType = any;
|
|
68
|
+
type AnyObject = Record<string | symbol | number, any>;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Escape hatches for general-purpose typing. `AnyObject` is a loosely-typed record for objects whose shape is not known at compile time.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
type TOptions<T extends object = {}> = T;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Semantic wrapper for options objects. Used across the framework to signal that a parameter follows the options-object pattern.
|
|
78
|
+
|
|
79
|
+
### Nullable and Promise Types
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
type TNullable<T> = T | undefined | null;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Makes a type nullable -- the value can be `T`, `undefined`, or `null`.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
type ValueOrPromise<T> = T | Promise<T>;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
A value that may or may not be wrapped in a `Promise`. Used throughout the framework for methods that support both sync and async implementations.
|
|
92
|
+
|
|
93
|
+
### Class and Constructor Types
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
type TConstructor<T> = new (...args: any[]) => T;
|
|
97
|
+
type TAbstractConstructor<T> = abstract new (...args: any[]) => T;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Types representing concrete and abstract class constructors.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
type TClass<T> = TConstructor<T> & { [property: string]: any };
|
|
104
|
+
type TAbstractClass<T> = TAbstractConstructor<T> & { [property: string]: any };
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Class types that include static properties. `TClass` is the most commonly used -- it represents a concrete class with both a constructor and arbitrary static members.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
type TMixinTarget<T> = TConstructor<{ [P in keyof T]: T[P] }>;
|
|
111
|
+
type TAbstractMixinTarget<T> = TAbstractConstructor<{ [P in keyof T]: T[P] }>;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Types for mixin pattern targets. Used when defining mixins that extend a base class while preserving its type:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
function MyMixin<T extends TMixinTarget<BaseClass>>(Base: T) {
|
|
118
|
+
return class extends Base {
|
|
119
|
+
// additional methods
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Object Utility Types
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
type ValueOf<T> = T[keyof T];
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Extracts the union of all value types from an object type.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
type ValueOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Makes specific keys optional while keeping all others required.
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
type ValueOptionalExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The inverse -- makes everything optional except the specified keys.
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
type TPrettify<T> = { [K in keyof T]: T[K] } & {};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Flattens intersection types for better IDE display. Useful when combining multiple types with `&` produces hard-to-read hover tooltips.
|
|
149
|
+
|
|
150
|
+
### Const Value Extraction Types
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
type TStringConstValue<T extends TClass<any>> = Extract<ValueOf<T>, string>;
|
|
154
|
+
type TNumberConstValue<T extends TClass<any>> = Extract<ValueOf<T>, number>;
|
|
155
|
+
type TConstValue<T extends TClass<any>> = Extract<ValueOf<T>, string | number>;
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Extract constant value types from a class. These are used to derive union types from constant classes:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// TRuntimeModule = 'node' | 'bun'
|
|
162
|
+
type TRuntimeModule = TConstValue<typeof RuntimeModules>;
|
|
163
|
+
|
|
164
|
+
// TMimeTypes = 'unknown' | 'image' | 'video' | 'text'
|
|
165
|
+
type TMimeTypes = TConstValue<typeof MimeTypes>;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Value Resolution Types and Functions
|
|
169
|
+
|
|
170
|
+
Types and helper functions for lazy/deferred value resolution -- a core pattern in the framework's DI and configuration systems.
|
|
171
|
+
|
|
172
|
+
#### Types
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
type TResolver<T> = (...args: any[]) => T;
|
|
176
|
+
type TAsyncResolver<T> = (...args: any[]) => T | Promise<T>;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Function types that resolve to a value. `TAsyncResolver` supports both sync and async functions.
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
type TValueOrResolver<T> = T | TResolver<T>;
|
|
183
|
+
type TValueOrAsyncResolver<T> = T | TAsyncResolver<T>;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Union types allowing either a direct value or a resolver function. Used in configuration APIs where values can be provided eagerly or lazily.
|
|
187
|
+
|
|
188
|
+
#### resolveValue
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
const resolveValue: <T>(valueOrResolver: TValueOrResolver<T>) => T;
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Synchronously resolves a lazy value:
|
|
195
|
+
- **Direct values** -- returned as-is
|
|
196
|
+
- **Class constructors** -- returned as-is (not invoked)
|
|
197
|
+
- **Resolver functions** -- invoked and result returned
|
|
198
|
+
|
|
199
|
+
Class constructors are detected via `isClassConstructor()` from `@venizia/ignis-inversion` and are never called as resolver functions.
|
|
200
|
+
|
|
201
|
+
#### resolveValueAsync
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const resolveValueAsync: <T>(valueOrResolver: TValueOrAsyncResolver<T>) => Promise<T>;
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Async version of `resolveValue`. Same behavior, but awaits the result if the resolver returns a `Promise`.
|
|
208
|
+
|
|
209
|
+
#### resolveClass
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
const resolveClass: <T>(
|
|
213
|
+
ref: TClass<T> | TResolver<TClass<T>> | string,
|
|
214
|
+
) => TClass<T> | string;
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Resolves lazy class references. Handles three cases:
|
|
218
|
+
- **String binding keys** -- returned as-is (for DI key lookups)
|
|
219
|
+
- **Class constructors** -- returned as-is
|
|
220
|
+
- **Resolver functions** -- invoked and result returned
|
|
221
|
+
|
|
222
|
+
#### Resolution Example
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import { TValueOrAsyncResolver, resolveValueAsync } from '@venizia/ignis-helpers';
|
|
226
|
+
|
|
227
|
+
interface DatabaseConfig {
|
|
228
|
+
host: string;
|
|
229
|
+
port: number;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
type ConfigOption = TValueOrAsyncResolver<DatabaseConfig>;
|
|
233
|
+
|
|
234
|
+
// Direct value
|
|
235
|
+
const config1: ConfigOption = { host: 'localhost', port: 5432 };
|
|
236
|
+
|
|
237
|
+
// Sync resolver
|
|
238
|
+
const config2: ConfigOption = () => ({ host: 'localhost', port: 5432 });
|
|
239
|
+
|
|
240
|
+
// Async resolver
|
|
241
|
+
const config3: ConfigOption = async () => {
|
|
242
|
+
const config = await fetchConfigFromVault();
|
|
243
|
+
return config;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// Resolve any of the above uniformly
|
|
247
|
+
const resolved = await resolveValueAsync(config3);
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Field Mapping Types
|
|
251
|
+
|
|
252
|
+
Types for declarative field-to-type mappings, used for configuration-driven data transformation.
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
type TFieldMappingDataType = 'string' | 'number' | 'strings' | 'numbers' | 'boolean';
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Supported data types for field mappings.
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
interface IFieldMapping {
|
|
262
|
+
name: string;
|
|
263
|
+
type: TFieldMappingDataType;
|
|
264
|
+
default?: string | number | Array<string> | Array<number> | boolean;
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Defines a single field with its name, type, and optional default value.
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
type TFieldMappingNames<T extends Array<IFieldMapping>> = Extract<
|
|
272
|
+
T[number],
|
|
273
|
+
{ type: Exclude<T[number]['type'], undefined> }
|
|
274
|
+
>['name'];
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Extracts the union of field names from a field mapping array type.
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
type TObjectFromFieldMappings<
|
|
281
|
+
T extends readonly {
|
|
282
|
+
name: string;
|
|
283
|
+
type: string;
|
|
284
|
+
[extra: string | symbol]: any;
|
|
285
|
+
}[],
|
|
286
|
+
> = {
|
|
287
|
+
[K in T[number]['name']]: /* mapped to the declared type */
|
|
288
|
+
};
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Constructs a typed object from a field mapping array, where each key maps to its declared runtime type: `'string'` becomes `string`, `'number'` becomes `number`, `'strings'` becomes `string[]`, `'numbers'` becomes `number[]`, and `'boolean'` becomes `boolean`.
|
|
292
|
+
|
|
293
|
+
### DI and Lifecycle Types
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
type TInjectionGetter = <T>(opts: { key: string | symbol }) => T;
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Function type for retrieving values from the IoC container by binding key.
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
interface IConfigurable<Options extends object = any, Result = any> {
|
|
303
|
+
configure(opts?: Options): ValueOrPromise<Result>;
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Interface for components that require explicit initialization. Used by helpers and components that expose a `configure()` lifecycle method.
|
|
308
|
+
|
|
309
|
+
### Domain Types
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
type TPermissionEffect = 'allow' | 'deny';
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Permission effect for authorization rules.
|
|
316
|
+
|
|
317
|
+
### JSX Types
|
|
318
|
+
|
|
319
|
+
Re-exported from `hono/jsx` for convenience when building JSX-based views:
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
export type { Child, FC, PropsWithChildren } from 'hono/jsx';
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
- `FC` -- Function component type
|
|
326
|
+
- `Child` -- Valid child element type
|
|
327
|
+
- `PropsWithChildren` -- Props type that includes a `children` property
|
|
328
|
+
|
|
329
|
+
### Constants
|
|
330
|
+
|
|
331
|
+
#### Defaults
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
class Defaults {
|
|
335
|
+
static readonly APPLICATION_NAME: string; // process.env.APP_ENV_APPLICATION_NAME ?? 'APP'
|
|
336
|
+
static readonly QUERY_LIMIT = 50;
|
|
337
|
+
static readonly QUERY_OFFSET = 0;
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Application-wide defaults for query pagination and application naming.
|
|
342
|
+
|
|
343
|
+
#### RuntimeModules
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
class RuntimeModules {
|
|
347
|
+
static readonly NODE = 'node';
|
|
348
|
+
static readonly BUN = 'bun';
|
|
349
|
+
|
|
350
|
+
static detect(): TRuntimeModule;
|
|
351
|
+
static isBun(): boolean;
|
|
352
|
+
static isNode(): boolean;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
type TRuntimeModule = TConstValue<typeof RuntimeModules>; // 'node' | 'bun'
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Runtime detection utility. `detect()` returns `'bun'` if running in Bun, `'node'` otherwise. `isBun()` and `isNode()` are convenience methods that call `detect()` internally.
|
|
359
|
+
|
|
360
|
+
#### DataTypes
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
class DataTypes {
|
|
364
|
+
static readonly NUMBER = 'NUMBER';
|
|
365
|
+
static readonly TEXT = 'TEXT';
|
|
366
|
+
static readonly BYTE = 'BYTE';
|
|
367
|
+
static readonly JSON = 'JSON';
|
|
368
|
+
static readonly BOOLEAN = 'BOOLEAN';
|
|
369
|
+
|
|
370
|
+
static readonly SCHEME_SET: Set<string>;
|
|
371
|
+
static isValid(orgType: string): boolean;
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Schema data type constants with validation. `SCHEME_SET` contains all valid type strings, and `isValid()` checks membership.
|
|
376
|
+
|
|
377
|
+
#### HTTP
|
|
378
|
+
|
|
379
|
+
The `HTTP` class groups all HTTP-related constants into nested objects.
|
|
380
|
+
|
|
381
|
+
**Headers:**
|
|
382
|
+
|
|
383
|
+
| Constant | Value |
|
|
384
|
+
|----------|-------|
|
|
385
|
+
| `HTTP.Headers.AUTHORIZATION` | `'authorization'` |
|
|
386
|
+
| `HTTP.Headers.CACHE_CONTROL` | `'cache-control'` |
|
|
387
|
+
| `HTTP.Headers.CONTENT_DISPOSITION` | `'content-disposition'` |
|
|
388
|
+
| `HTTP.Headers.CONTENT_ENCODING` | `'content-encoding'` |
|
|
389
|
+
| `HTTP.Headers.CONTENT_LENGTH` | `'content-length'` |
|
|
390
|
+
| `HTTP.Headers.CONTENT_TYPE` | `'content-type'` |
|
|
391
|
+
| `HTTP.Headers.CONTENT_RANGE` | `'content-range'` |
|
|
392
|
+
| `HTTP.Headers.ETAG` | `'etag'` |
|
|
393
|
+
| `HTTP.Headers.LAST_MODIFIED` | `'last-modified'` |
|
|
394
|
+
| `HTTP.Headers.REQUEST_TRACING_ID` | `'x-request-id'` |
|
|
395
|
+
| `HTTP.Headers.REQUEST_DEVICE_INFO` | `'x-device-info'` |
|
|
396
|
+
| `HTTP.Headers.REQUEST_CHANNEL` | `'x-request-channel'` |
|
|
397
|
+
| `HTTP.Headers.REQUEST_COUNT_DATA` | `'x-request-count'` |
|
|
398
|
+
| `HTTP.Headers.RESPONSE_COUNT_DATA` | `'x-response-count'` |
|
|
399
|
+
| `HTTP.Headers.RESPONSE_FORMAT` | `'x-response-format'` |
|
|
400
|
+
|
|
401
|
+
**Header Values:**
|
|
402
|
+
|
|
403
|
+
| Constant | Value |
|
|
404
|
+
|----------|-------|
|
|
405
|
+
| `HTTP.HeaderValues.APPLICATION_JSON` | `'application/json'` |
|
|
406
|
+
| `HTTP.HeaderValues.APPLICATION_FORM_URLENCODED` | `'application/x-www-form-urlencoded'` |
|
|
407
|
+
| `HTTP.HeaderValues.APPPLICATION_OCTET_STREAM` | `'application/octet-stream'` |
|
|
408
|
+
| `HTTP.HeaderValues.MULTIPART_FORM_DATA` | `'multipart/form-data'` |
|
|
409
|
+
| `HTTP.HeaderValues.TEXT_PLAIN` | `'text/plain'` |
|
|
410
|
+
|
|
411
|
+
**Methods:**
|
|
412
|
+
|
|
413
|
+
| Constant | Value |
|
|
414
|
+
|----------|-------|
|
|
415
|
+
| `HTTP.Methods.GET` | `'get'` |
|
|
416
|
+
| `HTTP.Methods.POST` | `'post'` |
|
|
417
|
+
| `HTTP.Methods.PUT` | `'put'` |
|
|
418
|
+
| `HTTP.Methods.PATCH` | `'patch'` |
|
|
419
|
+
| `HTTP.Methods.DELETE` | `'delete'` |
|
|
420
|
+
| `HTTP.Methods.HEAD` | `'head'` |
|
|
421
|
+
| `HTTP.Methods.OPTIONS` | `'options'` |
|
|
422
|
+
|
|
423
|
+
**Result Codes:**
|
|
424
|
+
|
|
425
|
+
| Group | Constant | Value |
|
|
426
|
+
|-------|----------|-------|
|
|
427
|
+
| Top-level | `RS_FAIL` | `0` |
|
|
428
|
+
| | `RS_SUCCESS` | `1` |
|
|
429
|
+
| | `RS_UNKNOWN_ERROR` | `-199` |
|
|
430
|
+
| **RS_2** (2xx) | `Ok` | `200` |
|
|
431
|
+
| | `Created` | `201` |
|
|
432
|
+
| | `Accepted` | `202` |
|
|
433
|
+
| | `NonAuthoritativeInformation` | `203` |
|
|
434
|
+
| | `NoContent` | `204` |
|
|
435
|
+
| | `ResetContent` | `205` |
|
|
436
|
+
| | `PartialContent` | `206` |
|
|
437
|
+
| | `MultiStatus` | `207` |
|
|
438
|
+
| **RS_3** (3xx) | `MovedPermanently` | `301` |
|
|
439
|
+
| | `Found` | `302` |
|
|
440
|
+
| | `NotModified` | `304` |
|
|
441
|
+
| | `TemporaryRedirect` | `307` |
|
|
442
|
+
| | `PermanentRedirect` | `308` |
|
|
443
|
+
| **RS_4** (4xx) | `BadRequest` | `400` |
|
|
444
|
+
| | `Unauthorized` | `401` |
|
|
445
|
+
| | `PaymentRequired` | `402` |
|
|
446
|
+
| | `Forbidden` | `403` |
|
|
447
|
+
| | `NotFound` | `404` |
|
|
448
|
+
| | `MethodNotAllowed` | `405` |
|
|
449
|
+
| | `NotAcceptable` | `406` |
|
|
450
|
+
| | `RequestTimeout` | `408` |
|
|
451
|
+
| | `Conflict` | `409` |
|
|
452
|
+
| | `Gone` | `410` |
|
|
453
|
+
| | `LengthRequired` | `411` |
|
|
454
|
+
| | `PreconditionFailed` | `412` |
|
|
455
|
+
| | `ContentTooLarge` | `413` |
|
|
456
|
+
| | `URITooLong` | `414` |
|
|
457
|
+
| | `UnsupportedMediaType` | `415` |
|
|
458
|
+
| | `RangeNotSatisfiable` | `416` |
|
|
459
|
+
| | `ExpectationFailed` | `417` |
|
|
460
|
+
| | `UnprocessableEntity` | `422` |
|
|
461
|
+
| | `Locked` | `423` |
|
|
462
|
+
| | `FailedDependency` | `424` |
|
|
463
|
+
| | `TooEarly` | `425` |
|
|
464
|
+
| | `UpgradeRequired` | `426` |
|
|
465
|
+
| | `PreconditionRequired` | `428` |
|
|
466
|
+
| | `TooManyRequests` | `429` |
|
|
467
|
+
| | `RequestHeaderFieldsTooLarge` | `431` |
|
|
468
|
+
| | `UnavailableForLegalReasons` | `451` |
|
|
469
|
+
| **RS_5** (5xx) | `InternalServerError` | `500` |
|
|
470
|
+
| | `NotImplemented` | `501` |
|
|
471
|
+
| | `BadGateway` | `502` |
|
|
472
|
+
| | `ServiceUnavailable` | `503` |
|
|
473
|
+
| | `GatewayTimeout` | `504` |
|
|
474
|
+
| | `HTTPVersionNotSupported` | `505` |
|
|
475
|
+
| | `InsufficientStorage` | `507` |
|
|
476
|
+
| | `LoopDetected` | `508` |
|
|
477
|
+
| | `NetworkAuthenticationRequired` | `511` |
|
|
478
|
+
|
|
479
|
+
**Derived Types:**
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
type THttpMethod = ValueOf<typeof HTTP.Methods>; // 'get' | 'post' | 'put' | ...
|
|
483
|
+
type THttpResultCode = ValueOf<typeof HTTP.ResultCodes>; // 0 | 1 | -199 | { Ok: 200, ... } | ...
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
#### MimeTypes
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
class MimeTypes {
|
|
490
|
+
static readonly UNKNOWN = 'unknown';
|
|
491
|
+
static readonly IMAGE = 'image';
|
|
492
|
+
static readonly VIDEO = 'video';
|
|
493
|
+
static readonly TEXT = 'text';
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
type TMimeTypes = TConstValue<typeof MimeTypes>; // 'unknown' | 'image' | 'video' | 'text'
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Content type classification constants.
|
|
500
|
+
|
|
501
|
+
## See Also
|
|
502
|
+
|
|
503
|
+
- **Guides:**
|
|
504
|
+
- [Dependency Injection](/guides/core-concepts/dependency-injection) - DI types and patterns
|
|
505
|
+
- [Repositories](/guides/core-concepts/persistent/repositories) - Repository mixins use these types
|
|
506
|
+
|
|
507
|
+
- **References:**
|
|
508
|
+
- [Repository Mixins](/references/base/repositories/mixins) - Uses mixin types
|
|
509
|
+
- [Utilities Index](/references/utilities/index) - Type utilities
|
|
510
|
+
|
|
511
|
+
- **Best Practices:**
|
|
512
|
+
- [Architectural Patterns](/best-practices/architectural-patterns) - TypeScript patterns
|