@venizia/ignis-docs 0.2.0 → 0.2.1-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.
Files changed (142) hide show
  1. package/README.md +14 -14
  2. package/content/best-practices/api-usage-examples.md +39 -19
  3. package/content/best-practices/architectural-patterns.md +22 -11
  4. package/content/best-practices/architecture-decisions.md +29 -16
  5. package/content/best-practices/code-style-standards/advanced-patterns.md +43 -31
  6. package/content/best-practices/code-style-standards/constants-configuration.md +19 -4
  7. package/content/best-practices/code-style-standards/control-flow.md +33 -1
  8. package/content/best-practices/code-style-standards/documentation.md +28 -8
  9. package/content/best-practices/code-style-standards/function-patterns.md +15 -4
  10. package/content/best-practices/code-style-standards/index.md +7 -2
  11. package/content/best-practices/code-style-standards/naming-conventions.md +26 -2
  12. package/content/best-practices/code-style-standards/route-definitions.md +9 -5
  13. package/content/best-practices/code-style-standards/tooling.md +14 -1
  14. package/content/best-practices/code-style-standards/type-safety.md +39 -6
  15. package/content/best-practices/common-pitfalls.md +59 -35
  16. package/content/best-practices/contribution-workflow.md +6 -2
  17. package/content/best-practices/data-modeling.md +78 -62
  18. package/content/best-practices/deployment-strategies.md +56 -19
  19. package/content/best-practices/error-handling.md +182 -93
  20. package/content/best-practices/index.md +6 -0
  21. package/content/best-practices/performance-optimization.md +26 -13
  22. package/content/best-practices/security-guidelines.md +35 -9
  23. package/content/best-practices/testing-strategies.md +7 -2
  24. package/content/best-practices/troubleshooting-tips.md +27 -17
  25. package/content/extensions/components/api-reference.md +107 -322
  26. package/content/extensions/components/authentication/api.md +454 -603
  27. package/content/extensions/components/authentication/errors.md +121 -498
  28. package/content/extensions/components/authentication/index.md +88 -801
  29. package/content/extensions/components/authentication/usage.md +207 -956
  30. package/content/extensions/components/authorization/api.md +736 -656
  31. package/content/extensions/components/authorization/errors.md +168 -206
  32. package/content/extensions/components/authorization/index.md +82 -797
  33. package/content/extensions/components/authorization/usage.md +194 -527
  34. package/content/extensions/components/health-check.md +71 -243
  35. package/content/extensions/components/mail/api.md +504 -287
  36. package/content/extensions/components/mail/errors.md +73 -61
  37. package/content/extensions/components/mail/index.md +96 -467
  38. package/content/extensions/components/mail/usage.md +130 -172
  39. package/content/extensions/components/request-tracker.md +66 -173
  40. package/content/extensions/components/socket-io/api.md +195 -13
  41. package/content/extensions/components/socket-io/errors.md +3 -3
  42. package/content/extensions/components/socket-io/index.md +50 -337
  43. package/content/extensions/components/socket-io/usage.md +143 -26
  44. package/content/extensions/components/static-asset/api.md +410 -142
  45. package/content/extensions/components/static-asset/errors.md +110 -53
  46. package/content/extensions/components/static-asset/index.md +79 -608
  47. package/content/extensions/components/static-asset/usage.md +180 -300
  48. package/content/extensions/components/websocket/api.md +275 -399
  49. package/content/extensions/components/websocket/errors.md +47 -56
  50. package/content/extensions/components/websocket/index.md +74 -407
  51. package/content/extensions/components/websocket/usage.md +110 -341
  52. package/content/extensions/helpers/cron/index.md +51 -160
  53. package/content/extensions/helpers/crypto/index.md +62 -483
  54. package/content/extensions/helpers/crypto/reference.md +456 -0
  55. package/content/extensions/helpers/env/index.md +60 -178
  56. package/content/extensions/helpers/error/index.md +221 -207
  57. package/content/extensions/helpers/inversion/index.md +65 -556
  58. package/content/extensions/helpers/inversion/reference.md +522 -0
  59. package/content/extensions/helpers/kafka/admin.md +20 -1
  60. package/content/extensions/helpers/kafka/compile-binary.md +41 -35
  61. package/content/extensions/helpers/kafka/consumer.md +54 -20
  62. package/content/extensions/helpers/kafka/examples.md +21 -16
  63. package/content/extensions/helpers/kafka/index.md +80 -610
  64. package/content/extensions/helpers/kafka/producer.md +134 -5
  65. package/content/extensions/helpers/kafka/schema-registry.md +45 -70
  66. package/content/extensions/helpers/logger/hf-logger.md +193 -0
  67. package/content/extensions/helpers/logger/index.md +64 -563
  68. package/content/extensions/helpers/logger/pino.md +85 -0
  69. package/content/extensions/helpers/logger/reference.md +746 -0
  70. package/content/extensions/helpers/network/api.md +241 -195
  71. package/content/extensions/helpers/network/index.md +72 -530
  72. package/content/extensions/helpers/queue/index.md +72 -900
  73. package/content/extensions/helpers/queue/reference.md +467 -0
  74. package/content/extensions/helpers/redis/index.md +73 -645
  75. package/content/extensions/helpers/redis/reference.md +727 -0
  76. package/content/extensions/helpers/secrets/index.md +66 -0
  77. package/content/extensions/helpers/socket-io/api.md +305 -203
  78. package/content/extensions/helpers/socket-io/index.md +66 -432
  79. package/content/extensions/helpers/storage/api.md +564 -462
  80. package/content/extensions/helpers/storage/index.md +77 -573
  81. package/content/extensions/helpers/types/index.md +66 -499
  82. package/content/extensions/helpers/types/reference.md +650 -0
  83. package/content/extensions/helpers/uid/index.md +58 -227
  84. package/content/extensions/helpers/websocket/api.md +329 -216
  85. package/content/extensions/helpers/websocket/index.md +65 -503
  86. package/content/extensions/helpers/worker-thread/index.md +58 -396
  87. package/content/extensions/helpers/worker-thread/reference.md +428 -0
  88. package/content/guides/core-concepts/persistent/models.md +1 -1
  89. package/content/guides/core-concepts/persistent/search-typesense.md +3 -3
  90. package/content/guides/core-concepts/persistent/transactions.md +1 -1
  91. package/content/guides/core-concepts/secrets-vault.md +177 -0
  92. package/content/guides/core-concepts/services.md +1 -1
  93. package/content/guides/migrations/redis-helpers-migration.md +1 -1
  94. package/content/guides/migrations/unified-connectors-migration.md +2 -2
  95. package/content/guides/tutorials/ecommerce-api.md +3 -8
  96. package/content/references/base/application.md +1 -1
  97. package/content/references/base/connectors.md +79 -136
  98. package/content/references/base/datasources-reference.md +599 -0
  99. package/content/references/base/datasources.md +84 -444
  100. package/content/references/base/dependency-injection.md +17 -39
  101. package/content/references/base/filter-system/application-usage.md +69 -121
  102. package/content/references/base/filter-system/array-operators.md +12 -0
  103. package/content/references/base/filter-system/comparison-operators.md +12 -0
  104. package/content/references/base/filter-system/default-filter.md +136 -348
  105. package/content/references/base/filter-system/fields-order-pagination.md +38 -16
  106. package/content/references/base/filter-system/index.md +106 -257
  107. package/content/references/base/filter-system/json-filtering.md +12 -2
  108. package/content/references/base/filter-system/list-operators.md +16 -2
  109. package/content/references/base/filter-system/logical-operators.md +13 -0
  110. package/content/references/base/filter-system/null-operators.md +13 -0
  111. package/content/references/base/filter-system/pattern-matching.md +12 -0
  112. package/content/references/base/filter-system/quick-reference.md +11 -2
  113. package/content/references/base/filter-system/range-operators.md +12 -0
  114. package/content/references/base/filter-system/tips.md +70 -133
  115. package/content/references/base/filter-system/use-cases.md +156 -233
  116. package/content/references/base/middlewares.md +35 -21
  117. package/content/references/base/models-reference.md +886 -0
  118. package/content/references/base/models.md +80 -1452
  119. package/content/references/base/repositories/advanced.md +156 -192
  120. package/content/references/base/repositories/index.md +77 -650
  121. package/content/references/base/repositories/mixins.md +22 -18
  122. package/content/references/base/repositories/relations.md +123 -171
  123. package/content/references/base/repositories/soft-deletable.md +58 -56
  124. package/content/references/base/secrets.md +263 -0
  125. package/content/references/base/services.md +2 -2
  126. package/content/references/configuration/environment-variables.md +48 -4
  127. package/content/references/configuration/index.md +49 -31
  128. package/content/references/quick-reference.md +3 -16
  129. package/content/references/utilities/crypto.md +35 -76
  130. package/content/references/utilities/date.md +33 -73
  131. package/content/references/utilities/index.md +1 -1
  132. package/content/references/utilities/jsx-reference.md +298 -0
  133. package/content/references/utilities/jsx.md +82 -525
  134. package/content/references/utilities/module.md +29 -62
  135. package/content/references/utilities/parse.md +34 -64
  136. package/content/references/utilities/performance.md +33 -58
  137. package/content/references/utilities/promise.md +28 -62
  138. package/content/references/utilities/request.md +57 -218
  139. package/content/references/utilities/schema.md +43 -137
  140. package/content/references/utilities/statuses-reference.md +361 -0
  141. package/content/references/utilities/statuses.md +63 -667
  142. package/package.json +8 -8
@@ -1,562 +1,129 @@
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
- | **Source** | `packages/helpers/src/common/types.ts` (types + resolvers), `packages/helpers/src/common/constants/` (constants) |
12
- | **Runtimes** | Both |
13
-
14
- #### Import Paths
15
-
16
- ```typescript
17
- // Types
18
- import type {
19
- TNullable,
20
- AnyType,
21
- AnyObject,
22
- TOptions,
23
- ValueOrPromise,
24
- ValueOf,
25
- ValueOptional,
26
- ValueOptionalExcept,
27
- TPrettify,
28
- TConstructor,
29
- TAbstractConstructor,
30
- TClass,
31
- TAbstractClass,
32
- TMixinTarget,
33
- TAbstractMixinTarget,
34
- TResolver,
35
- TAsyncResolver,
36
- TValueOrResolver,
37
- TValueOrAsyncResolver,
38
- TStringConstValue,
39
- TNumberConstValue,
40
- TConstValue,
41
- TFieldMappingDataType,
42
- IFieldMapping,
43
- TFieldMappingNames,
44
- TObjectFromFieldMappings,
45
- TInjectionGetter,
46
- IConfigurable,
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, GRPC, MimeTypes } from '@venizia/ignis-helpers';
54
-
55
- // Derived constant types
56
- import type { TRuntimeModule, TMimeTypes, THttpMethod, THttpResultCode, TGrpcMethod, TGrpcResultCode } 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
- ```
1
+ ---
2
+ title: Types
3
+ description: Shared utility types, resolver functions, and constant classes exported from @venizia/ignis-helpers
4
+ difficulty: beginner
5
+ ---
76
6
 
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
- ```
7
+ # Types
99
8
 
100
- Types representing concrete and abstract class constructors.
9
+ `@venizia/ignis-helpers` exports the utility types, lazy-value resolvers, and constant classes (`HTTP`, `GRPC`, `RuntimeModules`, ...) that the rest of the Ignis stack builds on.
101
10
 
102
- ```typescript
103
- type TClass<T> = TConstructor<T> & { [property: string]: any };
104
- type TAbstractClass<T> = TAbstractConstructor<T> & { [property: string]: any };
105
- ```
11
+ ## In one example
106
12
 
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.
13
+ `TValueOrResolver` plus `resolveValue` is the core pattern for an option that can be given eagerly or lazily.
108
14
 
109
15
  ```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:
16
+ import { TValueOrResolver, resolveValue } from '@venizia/ignis-helpers';
115
17
 
116
- ```typescript
117
- function MyMixin<T extends TMixinTarget<BaseClass>>(Base: T) {
118
- return class extends Base {
119
- // additional methods
120
- };
18
+ function configure(opts: { timeout: TValueOrResolver<number> }) {
19
+ const timeout = resolveValue(opts.timeout);
20
+ // works whether opts.timeout is 5000 or () => 5000
121
21
  }
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
22
 
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>;
23
+ configure({ timeout: 5000 });
24
+ configure({ timeout: () => 5000 });
177
25
  ```
178
26
 
179
- Function types that resolve to a value. `TAsyncResolver` supports both sync and async functions.
27
+ ## How it works
180
28
 
181
- ```typescript
182
- type TValueOrResolver<T> = T | TResolver<T>;
183
- type TValueOrAsyncResolver<T> = T | TAsyncResolver<T>;
184
- ```
29
+ - **Escape hatches, not the norm.** `AnyType` (`any`) and `AnyObject` (`Record<string | symbol | number, any>`) exist for the rare case a shape truly cannot be known at compile time - the framework itself prefers types derived from definitions (`typeof X.schema`) everywhere else.
30
+ - **Nullable and async are explicit.** `TNullable<T>` (`T | undefined | null`) and `ValueOrPromise<T>` (`T | Promise<T>`) appear on most framework method signatures, since sync and async implementations share one type.
31
+ - **Resolvers defer construction.** `TResolver`/`TAsyncResolver` and their `TValueOrResolver`/`TValueOrAsyncResolver` unions let a config option be given eagerly or lazily. `resolveValue`/`resolveValueAsync` collapse either shape to a value - class constructors are always passed through untouched, detected via `isClass()` (re-exported from `@venizia/ignis-inversion`), never invoked as a resolver.
32
+ - **Const classes replace string unions.** A class of `static readonly` fields (`HTTP`, `GRPC`, `RuntimeModules`, `MimeTypes`, `DataTypes`) is both a value namespace and, via `TConstValue<typeof X>`, the source of its own union type - one declaration, no duplicated string literals.
185
33
 
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
- ```
34
+ ## Common tasks
193
35
 
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
36
+ ### Type an options object with a sync-or-async callback
198
37
 
199
- Class constructors are detected via `isClass()` (a source-level class-syntax check), which lives in `@venizia/ignis-inversion` and is re-exported by `helpers`; they are never called as resolver functions. `isClassConstructor` does not exist.
200
-
201
- #### resolveValueAsync
38
+ `ValueOrPromise<T>` is the standard shape for a callback that may or may not be async.
202
39
 
203
40
  ```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
41
+ import { ValueOrPromise } from '@venizia/ignis-helpers';
210
42
 
211
- ```typescript
212
- const resolveClass: <T>(
213
- ref: TClass<T> | TResolver<TClass<T>> | string,
214
- ) => TClass<T> | string;
43
+ function connect(opts: { host: string; onReady?: () => ValueOrPromise<void> }) {}
215
44
  ```
216
45
 
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
46
+ ### Detect the current runtime
221
47
 
222
- #### Resolution Example
48
+ `RuntimeModules.detect()` returns `'bun'` when `typeof Bun !== 'undefined'`, `'node'` otherwise.
223
49
 
224
50
  ```typescript
225
- import { TValueOrAsyncResolver, resolveValueAsync } from '@venizia/ignis-helpers';
51
+ import { RuntimeModules } from '@venizia/ignis-helpers';
226
52
 
227
- interface DatabaseConfig {
228
- host: string;
229
- port: number;
53
+ if (RuntimeModules.isBun()) {
54
+ // Bun-specific path
230
55
  }
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
56
  ```
257
57
 
258
- Supported data types for field mappings.
58
+ ### Derive a union type from a constant class
259
59
 
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.
60
+ `TConstValue<typeof X>` extracts the union of a const class's static values, so the type never drifts from the values.
269
61
 
270
62
  ```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.
63
+ import { TConstValue, RuntimeModules } from '@venizia/ignis-helpers';
278
64
 
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
- };
65
+ type TRuntimeModule = TConstValue<typeof RuntimeModules>; // 'node' | 'bun'
289
66
  ```
290
67
 
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`.
68
+ ### Resolve a value that may be eager or lazy, sync or async
292
69
 
293
- ### DI and Lifecycle Types
70
+ `resolveValueAsync` accepts a direct value, a sync resolver, or an async resolver, and always returns a `Promise`.
294
71
 
295
72
  ```typescript
296
- type TInjectionGetter = <T>(opts: { key: string | symbol }) => T;
297
- ```
73
+ import { TValueOrAsyncResolver, resolveValueAsync } from '@venizia/ignis-helpers';
298
74
 
299
- Function type for retrieving values from the IoC container by binding key.
75
+ type ConfigOption = TValueOrAsyncResolver<{ host: string }>;
300
76
 
301
- ```typescript
302
- interface IConfigurable<Options extends object = any, Result = any> {
303
- configure(opts?: Options): ValueOrPromise<Result>;
304
- }
77
+ const fromEnv: ConfigOption = async () => ({ host: process.env.DB_HOST! });
78
+ const resolved = await resolveValueAsync(fromEnv);
305
79
  ```
306
80
 
307
- Interface for components that require explicit initialization. Used by helpers and components that expose a `configure()` lifecycle method.
308
-
309
- ### JSX Types
81
+ ### Look up an HTTP header, content type, or status constant
310
82
 
311
- Re-exported from `hono/jsx` for convenience when building JSX-based views:
83
+ `HTTP` groups headers, header values, methods, and status codes under one class.
312
84
 
313
85
  ```typescript
314
- export type { Child, FC, PropsWithChildren } from 'hono/jsx';
315
- ```
316
-
317
- - `FC` -- Function component type
318
- - `Child` -- Valid child element type
319
- - `PropsWithChildren` -- Props type that includes a `children` property
320
-
321
- ### Constants
322
-
323
- #### Defaults
86
+ import { HTTP } from '@venizia/ignis-helpers';
324
87
 
325
- ```typescript
326
- class Defaults {
327
- static readonly APPLICATION_NAME: string; // process.env.APP_ENV_APPLICATION_NAME ?? 'APP'
328
- static readonly QUERY_LIMIT = 50;
329
- static readonly QUERY_OFFSET = 0;
330
- }
88
+ response.header(HTTP.Headers.CONTENT_TYPE, HTTP.HeaderValues.APPLICATION_JSON);
89
+ response.status(HTTP.ResultCodes.RS_4.NotFound);
331
90
  ```
332
91
 
333
- Application-wide defaults for query pagination and application naming.
92
+ ### Constrain a mixin's base class
334
93
 
335
- #### RuntimeModules
94
+ `TMixinTarget<T>` types a mixin factory's `Base` parameter so the returned class keeps `T`'s shape.
336
95
 
337
96
  ```typescript
338
- class RuntimeModules {
339
- static readonly NODE = 'node';
340
- static readonly BUN = 'bun';
341
-
342
- static detect(): TRuntimeModule;
343
- static isBun(): boolean;
344
- static isNode(): boolean;
345
- }
346
-
347
- type TRuntimeModule = TConstValue<typeof RuntimeModules>; // 'node' | 'bun'
348
- ```
349
-
350
- Runtime detection utility. `detect()` returns `'bun'` if `typeof Bun !== 'undefined'`, `'node'` otherwise. `isBun()` and `isNode()` are convenience methods that call `detect()` internally.
97
+ import { TMixinTarget } from '@venizia/ignis-helpers';
351
98
 
352
- #### DataTypes
353
-
354
- ```typescript
355
- class DataTypes {
356
- static readonly NUMBER = 'NUMBER';
357
- static readonly TEXT = 'TEXT';
358
- static readonly BYTE = 'BYTE';
359
- static readonly JSON = 'JSON';
360
- static readonly BOOLEAN = 'BOOLEAN';
361
-
362
- static readonly SCHEME_SET: Set<string>;
363
- static isValid(orgType: string): boolean;
99
+ function WithTimestamps<T extends TMixinTarget<BaseEntity>>(Base: T) {
100
+ return class extends Base {
101
+ createdAt = new Date();
102
+ };
364
103
  }
365
104
  ```
366
105
 
367
- Schema data type constants with validation. `SCHEME_SET` contains all valid type strings, and `isValid()` checks membership.
368
-
369
- #### HTTP
370
-
371
- The `HTTP` class groups all HTTP-related constants into nested objects.
372
-
373
- **Headers** (commonly used subset -- the full list in `packages/helpers/src/common/constants/http.ts` also covers content negotiation, CORS, security, proxy/forwarding, and rate-limit headers):
374
-
375
- | Constant | Value |
376
- |----------|-------|
377
- | `HTTP.Headers.AUTHORIZATION` | `'authorization'` |
378
- | `HTTP.Headers.CACHE_CONTROL` | `'cache-control'` |
379
- | `HTTP.Headers.CONTENT_DISPOSITION` | `'content-disposition'` |
380
- | `HTTP.Headers.CONTENT_ENCODING` | `'content-encoding'` |
381
- | `HTTP.Headers.CONTENT_LENGTH` | `'content-length'` |
382
- | `HTTP.Headers.CONTENT_TYPE` | `'content-type'` |
383
- | `HTTP.Headers.CONTENT_RANGE` | `'content-range'` |
384
- | `HTTP.Headers.ETAG` | `'etag'` |
385
- | `HTTP.Headers.LAST_MODIFIED` | `'last-modified'` |
386
- | `HTTP.Headers.REQUEST_TRACING_ID` | `'x-request-id'` |
387
- | `HTTP.Headers.REQUEST_DEVICE_INFO` | `'x-device-info'` |
388
- | `HTTP.Headers.REQUEST_CHANNEL` | `'x-request-channel'` |
389
- | `HTTP.Headers.REQUEST_COUNT_DATA` | `'x-request-count'` |
390
- | `HTTP.Headers.RESPONSE_COUNT_DATA` | `'x-response-count'` |
391
- | `HTTP.Headers.RESPONSE_FORMAT` | `'x-response-format'` |
392
-
393
- **Header Values** (commonly used subset -- the full list also covers XML, PDF, zip, image, CSS/CSV/HTML, and event-stream types):
394
-
395
- | Constant | Value |
396
- |----------|-------|
397
- | `HTTP.HeaderValues.APPLICATION_JSON` | `'application/json'` |
398
- | `HTTP.HeaderValues.APPLICATION_FORM_URLENCODED` | `'application/x-www-form-urlencoded'` |
399
- | `HTTP.HeaderValues.APPLICATION_OCTET_STREAM` | `'application/octet-stream'` |
400
- | `HTTP.HeaderValues.MULTIPART_FORM_DATA` | `'multipart/form-data'` |
401
- | `HTTP.HeaderValues.TEXT_PLAIN` | `'text/plain'` |
402
-
403
- **Methods:**
404
-
405
- | Constant | Value |
406
- |----------|-------|
407
- | `HTTP.Methods.GET` | `'get'` |
408
- | `HTTP.Methods.POST` | `'post'` |
409
- | `HTTP.Methods.PUT` | `'put'` |
410
- | `HTTP.Methods.PATCH` | `'patch'` |
411
- | `HTTP.Methods.DELETE` | `'delete'` |
412
- | `HTTP.Methods.HEAD` | `'head'` |
413
- | `HTTP.Methods.OPTIONS` | `'options'` |
414
-
415
- **Result Codes:**
416
-
417
- Status codes are grouped by class under `HTTP.ResultCodes.RS_1` through `HTTP.ResultCodes.RS_5` (e.g. `HTTP.ResultCodes.RS_4.NotFound`).
418
-
419
- | Group | Constant | Value |
420
- |-------|----------|-------|
421
- | **RS_1** (1xx) | `Continue` | `100` |
422
- | | `SwitchingProtocols` | `101` |
423
- | | `EarlyHints` | `103` |
424
- | **RS_2** (2xx) | `Ok` | `200` |
425
- | | `Created` | `201` |
426
- | | `Accepted` | `202` |
427
- | | `NonAuthoritativeInformation` | `203` |
428
- | | `NoContent` | `204` |
429
- | | `ResetContent` | `205` |
430
- | | `PartialContent` | `206` |
431
- | | `MultiStatus` | `207` |
432
- | **RS_3** (3xx) | `MovedPermanently` | `301` |
433
- | | `Found` | `302` |
434
- | | `NotModified` | `304` |
435
- | | `TemporaryRedirect` | `307` |
436
- | | `PermanentRedirect` | `308` |
437
- | **RS_4** (4xx) | `BadRequest` | `400` |
438
- | | `Unauthorized` | `401` |
439
- | | `PaymentRequired` | `402` |
440
- | | `Forbidden` | `403` |
441
- | | `NotFound` | `404` |
442
- | | `MethodNotAllowed` | `405` |
443
- | | `NotAcceptable` | `406` |
444
- | | `RequestTimeout` | `408` |
445
- | | `Conflict` | `409` |
446
- | | `Gone` | `410` |
447
- | | `LengthRequired` | `411` |
448
- | | `PreconditionFailed` | `412` |
449
- | | `ContentTooLarge` | `413` |
450
- | | `URITooLong` | `414` |
451
- | | `UnsupportedMediaType` | `415` |
452
- | | `RangeNotSatisfiable` | `416` |
453
- | | `ExpectationFailed` | `417` |
454
- | | `UnprocessableEntity` | `422` |
455
- | | `Locked` | `423` |
456
- | | `FailedDependency` | `424` |
457
- | | `TooEarly` | `425` |
458
- | | `UpgradeRequired` | `426` |
459
- | | `PreconditionRequired` | `428` |
460
- | | `TooManyRequests` | `429` |
461
- | | `RequestHeaderFieldsTooLarge` | `431` |
462
- | | `UnavailableForLegalReasons` | `451` |
463
- | **RS_5** (5xx) | `InternalServerError` | `500` |
464
- | | `NotImplemented` | `501` |
465
- | | `BadGateway` | `502` |
466
- | | `ServiceUnavailable` | `503` |
467
- | | `GatewayTimeout` | `504` |
468
- | | `HTTPVersionNotSupported` | `505` |
469
- | | `InsufficientStorage` | `507` |
470
- | | `LoopDetected` | `508` |
471
- | | `NetworkAuthenticationRequired` | `511` |
472
-
473
- **Derived Types:**
474
-
475
- ```typescript
476
- type THttpMethod = ValueOf<typeof HTTP.Methods>; // 'get' | 'post' | 'put' | ...
477
- type THttpResultCode = ValueOf<typeof HTTP.ResultCodes>; // union of the RS_1..RS_5 group objects
478
- ```
479
-
480
- #### GRPC
106
+ ### Flatten an intersection type for readable hover tooltips
481
107
 
482
- gRPC protocol constants for headers, methods, content types, and status codes.
108
+ `TPrettify<T>` collapses `A & B` into a single flat object type, which IDE tooltips render far more readably than a chain of intersections.
483
109
 
484
110
  ```typescript
485
- import { GRPC } from '@venizia/ignis-helpers';
486
- ```
487
-
488
- | Property | Type | Description |
489
- |----------|------|-------------|
490
- | `GRPC.Methods.UNARY` | `'unary'` | Single request, single response |
491
- | `GRPC.Methods.SERVER_STREAMING` | `'server_streaming'` | Single request, stream of responses |
492
- | `GRPC.Methods.CLIENT_STREAMING` | `'client_streaming'` | Stream of requests, single response |
493
- | `GRPC.Methods.BIDI_STREAMING` | `'bidi_streaming'` | Bidirectional streaming |
494
- | `GRPC.Headers.CONTENT_TYPE` | `'content-type'` | HTTP content type header |
495
- | `GRPC.Headers.TE` | `'te'` | Transfer encoding header |
496
- | `GRPC.Headers.USER_AGENT` | `'user-agent'` | User agent header |
497
- | `GRPC.Headers.GRPC_TIMEOUT` | `'grpc-timeout'` | gRPC timeout header |
498
- | `GRPC.Headers.GRPC_ENCODING` | `'grpc-encoding'` | gRPC encoding header |
499
- | `GRPC.Headers.GRPC_ACCEPT_ENCODING` | `'grpc-accept-encoding'` | gRPC accepted encodings header |
500
- | `GRPC.Headers.GRPC_MESSAGE_TYPE` | `'grpc-message-type'` | gRPC message type header |
501
- | `GRPC.Headers.GRPC_STATUS` | `'grpc-status'` | gRPC status code header |
502
- | `GRPC.Headers.GRPC_MESSAGE` | `'grpc-message'` | gRPC error message header |
503
- | `GRPC.Headers.GRPC_STATUS_DETAILS_BIN` | `'grpc-status-details-bin'` | gRPC binary status details header |
504
- | `GRPC.Headers.GRPC_PREVIOUS_RPC_ATTEMPTS` | `'grpc-previous-rpc-attempts'` | gRPC previous RPC attempts header |
505
- | `GRPC.Headers.GRPC_RETRY_PUSHBACK_MS` | `'grpc-retry-pushback-ms'` | gRPC retry pushback milliseconds header |
506
- | `GRPC.Headers.GRPC_TRACE_BIN` | `'grpc-trace-bin'` | gRPC binary trace context header |
507
- | `GRPC.Headers.GRPC_TAGS_BIN` | `'grpc-tags-bin'` | gRPC binary tags header |
508
- | `GRPC.HeaderValues.GRPC` | `'application/grpc'` | Standard gRPC content type |
509
- | `GRPC.HeaderValues.GRPC_PROTO` | `'application/grpc+proto'` | gRPC Protobuf content type |
510
- | `GRPC.HeaderValues.GRPC_JSON` | `'application/grpc+json'` | gRPC JSON content type |
511
- | `GRPC.HeaderValues.GRPC_WEB` | `'application/grpc-web'` | gRPC-Web content type |
512
- | `GRPC.HeaderValues.GRPC_WEB_PROTO` | `'application/grpc-web+proto'` | gRPC-Web Protobuf content type |
513
- | `GRPC.HeaderValues.GRPC_WEB_JSON` | `'application/grpc-web+json'` | gRPC-Web JSON content type |
514
- | `GRPC.HeaderValues.GRPC_WEB_TEXT` | `'application/grpc-web-text'` | gRPC-Web text content type |
515
- | `GRPC.ResultCodes.OK` | `0` | Success |
516
- | `GRPC.ResultCodes.CANCELLED` | `1` | Operation cancelled |
517
- | `GRPC.ResultCodes.UNKNOWN` | `2` | Unknown error |
518
- | `GRPC.ResultCodes.INVALID_ARGUMENT` | `3` | Invalid argument |
519
- | `GRPC.ResultCodes.DEADLINE_EXCEEDED` | `4` | Deadline exceeded |
520
- | `GRPC.ResultCodes.NOT_FOUND` | `5` | Not found |
521
- | `GRPC.ResultCodes.ALREADY_EXISTS` | `6` | Already exists |
522
- | `GRPC.ResultCodes.PERMISSION_DENIED` | `7` | Permission denied |
523
- | `GRPC.ResultCodes.RESOURCE_EXHAUSTED` | `8` | Resource exhausted |
524
- | `GRPC.ResultCodes.FAILED_PRECONDITION` | `9` | Failed precondition |
525
- | `GRPC.ResultCodes.ABORTED` | `10` | Operation aborted |
526
- | `GRPC.ResultCodes.OUT_OF_RANGE` | `11` | Out of range |
527
- | `GRPC.ResultCodes.UNIMPLEMENTED` | `12` | Unimplemented |
528
- | `GRPC.ResultCodes.INTERNAL` | `13` | Internal server error |
529
- | `GRPC.ResultCodes.UNAVAILABLE` | `14` | Service unavailable |
530
- | `GRPC.ResultCodes.DATA_LOSS` | `15` | Unrecoverable data loss |
531
- | `GRPC.ResultCodes.UNAUTHENTICATED` | `16` | Unauthenticated |
111
+ import { TPrettify } from '@venizia/ignis-helpers';
532
112
 
533
- ```typescript
534
- // Derived types
535
- type TGrpcMethod = ValueOf<typeof GRPC.Methods>;
536
- type TGrpcResultCode = ValueOf<typeof GRPC.ResultCodes>;
113
+ type Merged = TPrettify<{ id: string } & { name: string }>;
114
+ // Hovers as { id: string; name: string } instead of { id: string } & { name: string }
537
115
  ```
538
116
 
539
- #### MimeTypes
540
-
541
- ```typescript
542
- class MimeTypes {
543
- static readonly UNKNOWN = 'unknown';
544
- static readonly IMAGE = 'image';
545
- static readonly VIDEO = 'video';
546
- static readonly TEXT = 'text';
547
- }
548
-
549
- type TMimeTypes = TConstValue<typeof MimeTypes>; // 'unknown' | 'image' | 'video' | 'text'
550
- ```
117
+ Every type, resolver function, and constant (including the full `HTTP.Headers`, `HTTP.ResultCodes`, and `GRPC` tables) is in the [Full reference](/extensions/helpers/types/reference).
551
118
 
552
- Content type classification constants.
119
+ ## See also
553
120
 
554
- ## See Also
121
+ - [Full reference](/extensions/helpers/types/reference) - every type, resolver, and constant class
122
+ - [Dependency Injection](/guides/core-concepts/dependency-injection) - `TInjectionGetter` and DI-adjacent types in use
123
+ - [Repository Mixins](/references/base/repositories/mixins) - `TMixinTarget` in use
124
+ - [Helpers Overview](/extensions/helpers/) - all available helpers
555
125
 
556
- - **Guides:**
557
- - [Dependency Injection](/guides/core-concepts/dependency-injection) - DI types and patterns
558
- - [Repositories](/guides/core-concepts/persistent/repositories) - Repository mixins use these types
126
+ **Files:**
559
127
 
560
- - **References:**
561
- - [Repository Mixins](/references/base/repositories/mixins) - Uses mixin types
562
- - [Utilities Index](/references/utilities/index) - Type utilities
128
+ - [`packages/helpers/src/common/types.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/types.ts) - utility types, resolvers, field-mapping types
129
+ - [`packages/helpers/src/common/constants/index.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/index.ts) - constants barrel