@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
@@ -0,0 +1,650 @@
1
+ ---
2
+ title: Types - Full Reference
3
+ description: Complete reference for every utility type, resolver function, and constant class exported from @venizia/ignis-helpers
4
+ difficulty: intermediate
5
+ ---
6
+
7
+ # Types - Full Reference
8
+
9
+ Exhaustive reference for every utility type, resolver function, and constant class in `@venizia/ignis-helpers`, including the full `HTTP` and `GRPC` constant tables. For a readable introduction and the common tasks, start with the [Types overview](/extensions/helpers/types/).
10
+
11
+ **Files:**
12
+
13
+ - [`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
14
+ - [`packages/helpers/src/common/constants/app.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/app.ts) - `Defaults`, `RuntimeModules`, `DataTypes`
15
+ - [`packages/helpers/src/common/constants/http.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/http.ts) - `HTTP`
16
+ - [`packages/helpers/src/common/constants/grpc.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/grpc.ts) - `GRPC`
17
+ - [`packages/helpers/src/common/constants/mime.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/mime.ts) - `MimeTypes`
18
+ - [`packages/helpers/src/common/constants/index.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/index.ts) - constants barrel
19
+
20
+ ## Import paths
21
+
22
+ ```typescript
23
+ // Types
24
+ import type {
25
+ TNullable,
26
+ AnyType,
27
+ AnyObject,
28
+ TOptions,
29
+ ValueOrPromise,
30
+ ValueOf,
31
+ ValueOptional,
32
+ ValueOptionalExcept,
33
+ TPrettify,
34
+ TConstructor,
35
+ TAbstractConstructor,
36
+ TClass,
37
+ TAbstractClass,
38
+ TMixinTarget,
39
+ TAbstractMixinTarget,
40
+ TResolver,
41
+ TAsyncResolver,
42
+ TValueOrResolver,
43
+ TValueOrAsyncResolver,
44
+ TStringConstValue,
45
+ TNumberConstValue,
46
+ TConstValue,
47
+ TFieldMappingDataType,
48
+ IFieldMapping,
49
+ TFieldMappingNames,
50
+ TObjectFromFieldMappings,
51
+ TInjectionGetter,
52
+ IConfigurable,
53
+ } from '@venizia/ignis-helpers';
54
+
55
+ // isClass (source-level class-syntax check, re-exported from @venizia/ignis-inversion)
56
+ import { isClass } from '@venizia/ignis-helpers';
57
+
58
+ // Resolver functions
59
+ import { resolveValue, resolveValueAsync, resolveClass } from '@venizia/ignis-helpers';
60
+
61
+ // Constants
62
+ import { Defaults, RuntimeModules, DataTypes, HTTP, GRPC, MimeTypes } from '@venizia/ignis-helpers';
63
+
64
+ // Derived constant types
65
+ import type {
66
+ TRuntimeModule,
67
+ TMimeTypes,
68
+ THttpMethod,
69
+ THttpProtocol,
70
+ THttpResultCode,
71
+ TGrpcMethod,
72
+ TGrpcResultCode,
73
+ } from '@venizia/ignis-helpers';
74
+
75
+ // JSX types (re-exported from hono/jsx)
76
+ import type { Child, FC, PropsWithChildren } from '@venizia/ignis-helpers';
77
+ ```
78
+
79
+ All of the above resolve through the root `@venizia/ignis-helpers` barrel, which re-exports `./common` (and therefore `./common/types` and `./common/constants`) in full.
80
+
81
+ ## General Purpose Types
82
+
83
+ `Source ->` [`types.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/types.ts)
84
+
85
+ ```typescript
86
+ type AnyType = any;
87
+ type AnyObject = Record<string | symbol | number, any>;
88
+ type TOptions<T extends object = {}> = T;
89
+ ```
90
+
91
+ | Type | Meaning | Use |
92
+ |------|---------|-----|
93
+ | `AnyType` | Alias for `any` | Escape hatch when a shape truly cannot be known at compile time |
94
+ | `AnyObject` | Loosely-typed record | Objects whose keys and value types are not known at compile time |
95
+ | `TOptions<T>` | Identity wrapper around `T` (defaults to `{}`) | Semantic marker that a parameter follows the framework's options-object pattern |
96
+
97
+ ## Nullable and Promise Types
98
+
99
+ ```typescript
100
+ type TNullable<T> = T | undefined | null;
101
+ type ValueOrPromise<T> = T | Promise<T>;
102
+ ```
103
+
104
+ | Type | Meaning | Use |
105
+ |------|---------|-----|
106
+ | `TNullable<T>` | `T \| undefined \| null` | A value that may be absent in either JavaScript "no value" form |
107
+ | `ValueOrPromise<T>` | `T \| Promise<T>` | A method or callback that may be implemented sync or async |
108
+
109
+ ## Class and Constructor Types
110
+
111
+ ```typescript
112
+ type TConstructor<T> = new (...args: any[]) => T;
113
+ type TAbstractConstructor<T> = abstract new (...args: any[]) => T;
114
+ type TClass<T> = TConstructor<T> & { [property: string]: any };
115
+ type TAbstractClass<T> = TAbstractConstructor<T> & { [property: string]: any };
116
+ type TMixinTarget<T> = TConstructor<{ [P in keyof T]: T[P] }>;
117
+ type TAbstractMixinTarget<T> = TAbstractConstructor<{ [P in keyof T]: T[P] }>;
118
+ ```
119
+
120
+ | Type | Meaning | Use |
121
+ |------|---------|-----|
122
+ | `TConstructor<T>` | A concrete `new (...args) => T` constructor | Typing a parameter that must be `new`-able |
123
+ | `TAbstractConstructor<T>` | An `abstract new (...args) => T` constructor | Typing a parameter that accepts an abstract class reference |
124
+ | `TClass<T>` | `TConstructor<T>` plus an index signature for static members | The most commonly used class type - a concrete class with arbitrary static properties |
125
+ | `TAbstractClass<T>` | `TAbstractConstructor<T>` plus an index signature for static members | Same as `TClass`, for abstract classes |
126
+ | `TMixinTarget<T>` | `TConstructor` over a mapped-identity copy of `T` | Types a mixin factory's `Base` parameter so the returned class keeps `T`'s shape |
127
+ | `TAbstractMixinTarget<T>` | `TAbstractConstructor` over a mapped-identity copy of `T` | Same as `TMixinTarget`, for mixins over an abstract base |
128
+
129
+ ```typescript
130
+ function MyMixin<T extends TMixinTarget<BaseClass>>(Base: T) {
131
+ return class extends Base {
132
+ // additional methods
133
+ };
134
+ }
135
+ ```
136
+
137
+ ### isClass
138
+
139
+ `Source ->` [`packages/inversion/src/common/types.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/inversion/src/common/types.ts)
140
+
141
+ ```typescript
142
+ const isClass: <T>(target: any) => target is TClass<T>;
143
+ ```
144
+
145
+ Declared in `@venizia/ignis-inversion` and re-exported by `helpers`. The single predicate that tells a constructor from a resolver function - the boot booters, controller factories, and `resolveValue`/`resolveValueAsync`/`resolveClass` all branch on it.
146
+
147
+ - **Filters to functions with a `prototype`** - true of every non-arrow function, so this alone is not sufficient.
148
+ - **Decompiles the function via `Function.prototype.toString`** and regex-tests that the source text literally starts with the `class` keyword.
149
+ - **Sound only when targeting ES2024+** - a class is emitted as `class`, never as an ES5 constructor function. Bundling this package down to ES5 breaks the predicate.
150
+
151
+ ## Object Utility Types
152
+
153
+ ```typescript
154
+ type ValueOf<T> = T[keyof T];
155
+ type ValueOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
156
+ type ValueOptionalExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
157
+ type TPrettify<T> = { [K in keyof T]: T[K] } & {};
158
+ ```
159
+
160
+ | Type | Meaning | Use |
161
+ |------|---------|-----|
162
+ | `ValueOf<T>` | Union of all value types of `T` | Deriving a union type from an object type, most often a const class |
163
+ | `ValueOptional<T, K>` | `T` with keys `K` made optional, the rest unchanged | Relaxing specific required fields |
164
+ | `ValueOptionalExcept<T, K>` | `T` with everything optional except keys `K` | The inverse - only `K` stays required |
165
+ | `TPrettify<T>` | Flattens an intersection (`A & B`) into one object type | Readable IDE hover tooltips when combining types with `&` |
166
+
167
+ ## Const Value Extraction Types
168
+
169
+ ```typescript
170
+ type TStringConstValue<T extends TClass<any>> = Extract<ValueOf<T>, string>;
171
+ type TNumberConstValue<T extends TClass<any>> = Extract<ValueOf<T>, number>;
172
+ type TConstValue<T extends TClass<any>> = Extract<ValueOf<T>, string | number>;
173
+ ```
174
+
175
+ | Type | Meaning | Use |
176
+ |------|---------|-----|
177
+ | `TStringConstValue<T>` | The string-valued subset of `ValueOf<T>` | Deriving a string union from a const class with mixed value types |
178
+ | `TNumberConstValue<T>` | The number-valued subset of `ValueOf<T>` | Deriving a numeric union from a const class with mixed value types |
179
+ | `TConstValue<T>` | The string-or-number-valued subset of `ValueOf<T>` | The common case - deriving a union type from a const class (`RuntimeModules`, `MimeTypes`) |
180
+
181
+ ```typescript
182
+ type TRuntimeModule = TConstValue<typeof RuntimeModules>; // 'node' | 'bun'
183
+ type TMimeTypes = TConstValue<typeof MimeTypes>; // 'unknown' | 'image' | 'video' | 'text'
184
+ ```
185
+
186
+ ## Value Resolution Types and Functions
187
+
188
+ Types and functions for lazy/deferred value resolution - a core pattern in the framework's DI and configuration systems.
189
+
190
+ ### Types
191
+
192
+ ```typescript
193
+ type TResolver<T> = (...args: any[]) => T;
194
+ type TAsyncResolver<T> = (...args: any[]) => T | Promise<T>;
195
+ type TValueOrResolver<T> = T | TResolver<T>;
196
+ type TValueOrAsyncResolver<T> = T | TAsyncResolver<T>;
197
+ ```
198
+
199
+ | Type | Meaning | Use |
200
+ |------|---------|-----|
201
+ | `TResolver<T>` | A sync function returning `T` | Deferred value production |
202
+ | `TAsyncResolver<T>` | A function returning `T` or `Promise<T>` | Deferred value production that may be async |
203
+ | `TValueOrResolver<T>` | `T \| TResolver<T>` | Config options that accept an eager value or a sync resolver |
204
+ | `TValueOrAsyncResolver<T>` | `T \| TAsyncResolver<T>` | Config options that accept an eager value or a sync/async resolver |
205
+
206
+ ### resolveValue
207
+
208
+ ```typescript
209
+ const resolveValue: <T>(valueOrResolver: TValueOrResolver<T>) => T;
210
+ ```
211
+
212
+ Synchronously resolves a lazy value:
213
+
214
+ - **Non-function values** - returned as-is.
215
+ - **Class constructors** - returned as-is (detected via `isClass()`, never invoked).
216
+ - **Resolver functions** - invoked and the result returned.
217
+
218
+ ### resolveValueAsync
219
+
220
+ ```typescript
221
+ const resolveValueAsync: <T>(valueOrResolver: TValueOrAsyncResolver<T>) => Promise<T>;
222
+ ```
223
+
224
+ Async version of `resolveValue`. Same three cases, but the resolver's return value is `await`-ed before being returned.
225
+
226
+ ### resolveClass
227
+
228
+ ```typescript
229
+ const resolveClass: <T>(
230
+ ref: TClass<T> | TResolver<TClass<T>> | string,
231
+ ) => TClass<T> | string;
232
+ ```
233
+
234
+ Resolves lazy class references. Handles three cases:
235
+
236
+ - **String binding keys** - returned as-is (for DI key lookups).
237
+ - **Class constructors** - returned as-is.
238
+ - **Resolver functions** - invoked via `resolveValue` and the result returned.
239
+
240
+ ### Resolution example
241
+
242
+ ```typescript
243
+ import { TValueOrAsyncResolver, resolveValueAsync } from '@venizia/ignis-helpers';
244
+
245
+ interface DatabaseConfig {
246
+ host: string;
247
+ port: number;
248
+ }
249
+
250
+ type ConfigOption = TValueOrAsyncResolver<DatabaseConfig>;
251
+
252
+ // Direct value
253
+ const config1: ConfigOption = { host: 'localhost', port: 5432 };
254
+
255
+ // Sync resolver
256
+ const config2: ConfigOption = () => ({ host: 'localhost', port: 5432 });
257
+
258
+ // Async resolver
259
+ const config3: ConfigOption = async () => {
260
+ const config = await fetchConfigFromVault();
261
+ return config;
262
+ };
263
+
264
+ // Resolve any of the above uniformly
265
+ const resolved = await resolveValueAsync(config3);
266
+ ```
267
+
268
+ ## Field Mapping Types
269
+
270
+ Types for declarative field-to-type mappings, used for configuration-driven data transformation.
271
+
272
+ ```typescript
273
+ type TFieldMappingDataType = 'string' | 'number' | 'strings' | 'numbers' | 'boolean';
274
+
275
+ interface IFieldMapping {
276
+ name: string;
277
+ type: TFieldMappingDataType;
278
+ default?: string | number | Array<string> | Array<number> | boolean;
279
+ }
280
+
281
+ type TFieldMappingNames<T extends Array<IFieldMapping>> = Extract<
282
+ T[number],
283
+ { type: Exclude<T[number]['type'], undefined> }
284
+ >['name'];
285
+
286
+ type TObjectFromFieldMappings<
287
+ T extends readonly {
288
+ name: string;
289
+ type: string;
290
+ [extra: string | symbol]: any;
291
+ }[],
292
+ > = {
293
+ [K in T[number]['name']]: /* mapped to the declared type */
294
+ };
295
+ ```
296
+
297
+ | Type | Meaning | Use |
298
+ |------|---------|-----|
299
+ | `TFieldMappingDataType` | Union of the five supported field kinds | Constrains `IFieldMapping.type` |
300
+ | `IFieldMapping` | `{ name, type, default? }` | Declares one field's name, runtime type, and optional default |
301
+ | `TFieldMappingNames<T>` | Union of `name` values from a field-mapping array type | Extracts the set of declared field names |
302
+ | `TObjectFromFieldMappings<T>` | An object type keyed by `T[number]['name']` | Maps each declared type to its runtime TypeScript equivalent: `'string'` -> `string`, `'number'` -> `number`, `'strings'` -> `string[]`, `'numbers'` -> `number[]`, `'boolean'` -> `boolean` |
303
+
304
+ ## DI and Lifecycle Types
305
+
306
+ ```typescript
307
+ type TInjectionGetter = <T>(opts: { key: string | symbol }) => T;
308
+
309
+ interface IConfigurable<Options extends object = any, Result = any> {
310
+ configure(opts?: Options): ValueOrPromise<Result>;
311
+ }
312
+ ```
313
+
314
+ | Type | Meaning | Use |
315
+ |------|---------|-----|
316
+ | `TInjectionGetter` | A function retrieving `T` from the IoC container by binding key | Typing a container-getter parameter |
317
+ | `IConfigurable<Options, Result>` | Interface with one `configure(opts?)` method | Implemented by helpers and components that expose an explicit initialization step |
318
+
319
+ ## JSX Types
320
+
321
+ Re-exported from `hono/jsx` for convenience when building JSX-based views:
322
+
323
+ ```typescript
324
+ export type { Child, FC, PropsWithChildren } from 'hono/jsx';
325
+ ```
326
+
327
+ | Type | Meaning |
328
+ |------|---------|
329
+ | `FC` | Function component type |
330
+ | `Child` | Valid child element type |
331
+ | `PropsWithChildren` | Props type that includes a `children` property |
332
+
333
+ ## Constants
334
+
335
+ ### Defaults
336
+
337
+ `Source ->` [`constants/app.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/app.ts)
338
+
339
+ ```typescript
340
+ class Defaults {
341
+ static readonly APPLICATION_NAME: string; // process.env.APP_ENV_APPLICATION_NAME ?? 'APP'
342
+ static readonly QUERY_LIMIT = 50;
343
+ static readonly QUERY_OFFSET = 0;
344
+ }
345
+ ```
346
+
347
+ Application-wide defaults for query pagination and application naming. `APPLICATION_NAME` is evaluated once, at module load.
348
+
349
+ ### RuntimeModules
350
+
351
+ ```typescript
352
+ class RuntimeModules {
353
+ static readonly NODE = 'node';
354
+ static readonly BUN = 'bun';
355
+
356
+ static detect(): TRuntimeModule;
357
+ static isBun(): boolean;
358
+ static isNode(): boolean;
359
+ }
360
+
361
+ type TRuntimeModule = TConstValue<typeof RuntimeModules>; // 'node' | 'bun'
362
+ ```
363
+
364
+ Runtime detection utility. `detect()` returns `'bun'` if `typeof Bun !== 'undefined'`, `'node'` otherwise. `isBun()` and `isNode()` are convenience methods that call `detect()` internally on every invocation - there is no caching.
365
+
366
+ ### DataTypes
367
+
368
+ ```typescript
369
+ class DataTypes {
370
+ static readonly NUMBER = 'NUMBER';
371
+ static readonly TEXT = 'TEXT';
372
+ static readonly BYTE = 'BYTE';
373
+ static readonly JSON = 'JSON';
374
+ static readonly BOOLEAN = 'BOOLEAN';
375
+
376
+ static readonly SCHEME_SET: Set<string>;
377
+ static isValid(orgType: string): boolean;
378
+ }
379
+ ```
380
+
381
+ Schema data type constants with validation. `SCHEME_SET` contains all five valid type strings, and `isValid()` checks membership.
382
+
383
+ ### HTTP
384
+
385
+ `Source ->` [`constants/http.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/http.ts)
386
+
387
+ The `HTTP` class groups all HTTP-related constants into nested objects: `Headers`, `HeaderValues`, `Methods`, `Protocols`, and `ResultCodes`.
388
+
389
+ #### HTTP.Headers
390
+
391
+ Grouped by category, matching the source file's comments:
392
+
393
+ | Group | Constant | Value |
394
+ |-------|----------|-------|
395
+ | **Content** | `CONTENT_DISPOSITION` | `'content-disposition'` |
396
+ | | `CONTENT_ENCODING` | `'content-encoding'` |
397
+ | | `CONTENT_LENGTH` | `'content-length'` |
398
+ | | `CONTENT_TYPE` | `'content-type'` |
399
+ | | `CONTENT_RANGE` | `'content-range'` |
400
+ | | `CONTENT_SECURITY_POLICY` | `'content-security-policy'` |
401
+ | **Request** (content negotiation & conditionals) | `ACCEPT` | `'accept'` |
402
+ | | `ACCEPT_ENCODING` | `'accept-encoding'` |
403
+ | | `ACCEPT_LANGUAGE` | `'accept-language'` |
404
+ | | `AUTHORIZATION` | `'authorization'` |
405
+ | | `COOKIE` | `'cookie'` |
406
+ | | `HOST` | `'host'` |
407
+ | | `IF_MODIFIED_SINCE` | `'if-modified-since'` |
408
+ | | `IF_NONE_MATCH` | `'if-none-match'` |
409
+ | | `ORIGIN` | `'origin'` |
410
+ | | `REFERER` | `'referer'` |
411
+ | | `USER_AGENT` | `'user-agent'` |
412
+ | **Response** (caching, auth challenges & redirects) | `ALLOW` | `'allow'` |
413
+ | | `CACHE_CONTROL` | `'cache-control'` |
414
+ | | `ETAG` | `'etag'` |
415
+ | | `LAST_MODIFIED` | `'last-modified'` |
416
+ | | `LOCATION` | `'location'` |
417
+ | | `RETRY_AFTER` | `'retry-after'` |
418
+ | | `SET_COOKIE` | `'set-cookie'` |
419
+ | | `VARY` | `'vary'` |
420
+ | | `WWW_AUTHENTICATE` | `'www-authenticate'` |
421
+ | **CORS** (RFC 6454 / Fetch spec) | `ACCESS_CONTROL_ALLOW_CREDENTIALS` | `'access-control-allow-credentials'` |
422
+ | | `ACCESS_CONTROL_ALLOW_HEADERS` | `'access-control-allow-headers'` |
423
+ | | `ACCESS_CONTROL_ALLOW_METHODS` | `'access-control-allow-methods'` |
424
+ | | `ACCESS_CONTROL_ALLOW_ORIGIN` | `'access-control-allow-origin'` |
425
+ | | `ACCESS_CONTROL_EXPOSE_HEADERS` | `'access-control-expose-headers'` |
426
+ | | `ACCESS_CONTROL_MAX_AGE` | `'access-control-max-age'` |
427
+ | | `ACCESS_CONTROL_REQUEST_HEADERS` | `'access-control-request-headers'` |
428
+ | | `ACCESS_CONTROL_REQUEST_METHOD` | `'access-control-request-method'` |
429
+ | **Transport** | `CONNECTION` | `'connection'` |
430
+ | | `TRANSFER_ENCODING` | `'transfer-encoding'` |
431
+ | | `UPGRADE` | `'upgrade'` |
432
+ | **Security** | `STRICT_TRANSPORT_SECURITY` | `'strict-transport-security'` |
433
+ | | `X_CONTENT_TYPE_OPTIONS` | `'x-content-type-options'` |
434
+ | | `X_FRAME_OPTIONS` | `'x-frame-options'` |
435
+ | **Proxy / forwarding** (de facto standard) | `FORWARDED` | `'forwarded'` |
436
+ | | `X_FORWARDED_FOR` | `'x-forwarded-for'` |
437
+ | | `X_FORWARDED_HOST` | `'x-forwarded-host'` |
438
+ | | `X_FORWARDED_PROTO` | `'x-forwarded-proto'` |
439
+ | **Rate limiting** (de facto standard) | `X_RATELIMIT_LIMIT` | `'x-ratelimit-limit'` |
440
+ | | `X_RATELIMIT_REMAINING` | `'x-ratelimit-remaining'` |
441
+ | | `X_RATELIMIT_RESET` | `'x-ratelimit-reset'` |
442
+ | **Ignis custom** | `REQUEST_TRACING_ID` | `'x-request-id'` |
443
+ | | `REQUEST_DEVICE_INFO` | `'x-device-info'` |
444
+ | | `REQUEST_CHANNEL` | `'x-request-channel'` |
445
+ | | `REQUEST_COUNT_DATA` | `'x-request-count'` |
446
+ | | `RESPONSE_COUNT_DATA` | `'x-response-count'` |
447
+ | | `RESPONSE_FORMAT` | `'x-response-format'` |
448
+
449
+ #### HTTP.HeaderValues
450
+
451
+ | Group | Constant | Value |
452
+ |-------|----------|-------|
453
+ | **Application** | `APPLICATION_FORM_URLENCODED` | `'application/x-www-form-urlencoded'` |
454
+ | | `APPLICATION_GRAPHQL_JSON` | `'application/graphql+json'` |
455
+ | | `APPLICATION_GZIP` | `'application/gzip'` |
456
+ | | `APPLICATION_JAVASCRIPT` | `'application/javascript'` |
457
+ | | `APPLICATION_JSON` | `'application/json'` |
458
+ | | `APPLICATION_MSGPACK` | `'application/msgpack'` |
459
+ | | `APPLICATION_NDJSON` | `'application/x-ndjson'` |
460
+ | | `APPLICATION_OCTET_STREAM` | `'application/octet-stream'` |
461
+ | | `APPLICATION_PDF` | `'application/pdf'` |
462
+ | | `APPLICATION_PROTOBUF` | `'application/x-protobuf'` |
463
+ | | `APPLICATION_XML` | `'application/xml'` |
464
+ | | `APPLICATION_ZIP` | `'application/zip'` |
465
+ | **Multipart** | `MULTIPART_FORM_DATA` | `'multipart/form-data'` |
466
+ | **Text** | `TEXT_CSS` | `'text/css'` |
467
+ | | `TEXT_CSV` | `'text/csv'` |
468
+ | | `TEXT_EVENT_STREAM` | `'text/event-stream'` |
469
+ | | `TEXT_HTML` | `'text/html'` |
470
+ | | `TEXT_PLAIN` | `'text/plain'` |
471
+ | | `TEXT_XML` | `'text/xml'` |
472
+ | **Image** | `IMAGE_GIF` | `'image/gif'` |
473
+ | | `IMAGE_JPEG` | `'image/jpeg'` |
474
+ | | `IMAGE_PNG` | `'image/png'` |
475
+ | | `IMAGE_SVG` | `'image/svg+xml'` |
476
+ | | `IMAGE_WEBP` | `'image/webp'` |
477
+
478
+ #### HTTP.Methods
479
+
480
+ | Constant | Value |
481
+ |----------|-------|
482
+ | `HTTP.Methods.GET` | `'get'` |
483
+ | `HTTP.Methods.POST` | `'post'` |
484
+ | `HTTP.Methods.PUT` | `'put'` |
485
+ | `HTTP.Methods.PATCH` | `'patch'` |
486
+ | `HTTP.Methods.DELETE` | `'delete'` |
487
+ | `HTTP.Methods.HEAD` | `'head'` |
488
+ | `HTTP.Methods.OPTIONS` | `'options'` |
489
+ | `HTTP.Methods.QUERY` | `'query'` (RFC 10008 `QUERY` method) |
490
+
491
+ > [!IMPORTANT]
492
+ > All `HTTP.Methods.*` tokens are lowercase - `@hono/zod-openapi` route definitions accept no other case. Each network fetcher uppercases at the wire boundary (`method.toUpperCase()`): undici only normalizes `DELETE`/`GET`/`HEAD`/`OPTIONS`/`POST`/`PUT`, so a lowercase `patch` or `query` sent as-is travels verbatim over Node and the server rejects it. Bun's `fetch` uppercases everything, which hides the bug until the app runs on Node.
493
+
494
+ #### HTTP.Protocols
495
+
496
+ | Constant | Value |
497
+ |----------|-------|
498
+ | `HTTP.Protocols.HTTP` | `'http'` |
499
+ | `HTTP.Protocols.HTTPS` | `'https'` |
500
+
501
+ #### HTTP.ResultCodes
502
+
503
+ Status codes are grouped by class under `HTTP.ResultCodes.RS_1` through `HTTP.ResultCodes.RS_5` (e.g. `HTTP.ResultCodes.RS_4.NotFound`).
504
+
505
+ | Group | Constant | Value |
506
+ |-------|----------|-------|
507
+ | **RS_1** (1xx) | `Continue` | `100` |
508
+ | | `SwitchingProtocols` | `101` |
509
+ | | `EarlyHints` | `103` |
510
+ | **RS_2** (2xx) | `Ok` | `200` |
511
+ | | `Created` | `201` |
512
+ | | `Accepted` | `202` |
513
+ | | `NonAuthoritativeInformation` | `203` |
514
+ | | `NoContent` | `204` |
515
+ | | `ResetContent` | `205` |
516
+ | | `PartialContent` | `206` |
517
+ | | `MultiStatus` | `207` |
518
+ | **RS_3** (3xx) | `MovedPermanently` | `301` |
519
+ | | `Found` | `302` |
520
+ | | `NotModified` | `304` |
521
+ | | `TemporaryRedirect` | `307` |
522
+ | | `PermanentRedirect` | `308` |
523
+ | **RS_4** (4xx) | `BadRequest` | `400` |
524
+ | | `Unauthorized` | `401` |
525
+ | | `PaymentRequired` | `402` |
526
+ | | `Forbidden` | `403` |
527
+ | | `NotFound` | `404` |
528
+ | | `MethodNotAllowed` | `405` |
529
+ | | `NotAcceptable` | `406` |
530
+ | | `RequestTimeout` | `408` |
531
+ | | `Conflict` | `409` |
532
+ | | `Gone` | `410` |
533
+ | | `LengthRequired` | `411` |
534
+ | | `PreconditionFailed` | `412` |
535
+ | | `ContentTooLarge` | `413` |
536
+ | | `URITooLong` | `414` |
537
+ | | `UnsupportedMediaType` | `415` |
538
+ | | `RangeNotSatisfiable` | `416` |
539
+ | | `ExpectationFailed` | `417` |
540
+ | | `UnprocessableEntity` | `422` |
541
+ | | `Locked` | `423` |
542
+ | | `FailedDependency` | `424` |
543
+ | | `TooEarly` | `425` |
544
+ | | `UpgradeRequired` | `426` |
545
+ | | `PreconditionRequired` | `428` |
546
+ | | `TooManyRequests` | `429` |
547
+ | | `RequestHeaderFieldsTooLarge` | `431` |
548
+ | | `UnavailableForLegalReasons` | `451` |
549
+ | **RS_5** (5xx) | `InternalServerError` | `500` |
550
+ | | `NotImplemented` | `501` |
551
+ | | `BadGateway` | `502` |
552
+ | | `ServiceUnavailable` | `503` |
553
+ | | `GatewayTimeout` | `504` |
554
+ | | `HTTPVersionNotSupported` | `505` |
555
+ | | `InsufficientStorage` | `507` |
556
+ | | `LoopDetected` | `508` |
557
+ | | `NetworkAuthenticationRequired` | `511` |
558
+
559
+ #### Derived types
560
+
561
+ ```typescript
562
+ type THttpMethod = ValueOf<typeof HTTP.Methods> | Uppercase<ValueOf<typeof HTTP.Methods>>;
563
+ // 'get' | 'post' | ... | 'query' | 'GET' | 'POST' | ... | 'QUERY'
564
+
565
+ type THttpProtocol = ValueOf<typeof HTTP.Protocols> | Uppercase<ValueOf<typeof HTTP.Protocols>>;
566
+ // 'http' | 'https' | 'HTTP' | 'HTTPS'
567
+
568
+ type THttpResultCode = ValueOf<typeof HTTP.ResultCodes>;
569
+ // union of the RS_1..RS_5 group objects (not a flat number union)
570
+ ```
571
+
572
+ ### GRPC
573
+
574
+ `Source ->` [`constants/grpc.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/grpc.ts)
575
+
576
+ gRPC protocol constants for methods, headers, content types, and status codes.
577
+
578
+ | Property | Type | Description |
579
+ |----------|------|-------------|
580
+ | `GRPC.Methods.UNARY` | `'unary'` | Single request, single response |
581
+ | `GRPC.Methods.SERVER_STREAMING` | `'server_streaming'` | Single request, stream of responses |
582
+ | `GRPC.Methods.CLIENT_STREAMING` | `'client_streaming'` | Stream of requests, single response |
583
+ | `GRPC.Methods.BIDI_STREAMING` | `'bidi_streaming'` | Bidirectional streaming |
584
+ | `GRPC.Headers.CONTENT_TYPE` | `'content-type'` | HTTP content type header |
585
+ | `GRPC.Headers.TE` | `'te'` | Transfer encoding header |
586
+ | `GRPC.Headers.USER_AGENT` | `'user-agent'` | User agent header |
587
+ | `GRPC.Headers.GRPC_TIMEOUT` | `'grpc-timeout'` | gRPC timeout header |
588
+ | `GRPC.Headers.GRPC_ENCODING` | `'grpc-encoding'` | gRPC encoding header |
589
+ | `GRPC.Headers.GRPC_ACCEPT_ENCODING` | `'grpc-accept-encoding'` | gRPC accepted encodings header |
590
+ | `GRPC.Headers.GRPC_MESSAGE_TYPE` | `'grpc-message-type'` | gRPC message type header |
591
+ | `GRPC.Headers.GRPC_STATUS` | `'grpc-status'` | gRPC status code header |
592
+ | `GRPC.Headers.GRPC_MESSAGE` | `'grpc-message'` | gRPC error message header |
593
+ | `GRPC.Headers.GRPC_STATUS_DETAILS_BIN` | `'grpc-status-details-bin'` | gRPC binary status details header |
594
+ | `GRPC.Headers.GRPC_PREVIOUS_RPC_ATTEMPTS` | `'grpc-previous-rpc-attempts'` | gRPC previous RPC attempts header |
595
+ | `GRPC.Headers.GRPC_RETRY_PUSHBACK_MS` | `'grpc-retry-pushback-ms'` | gRPC retry pushback milliseconds header |
596
+ | `GRPC.Headers.GRPC_TRACE_BIN` | `'grpc-trace-bin'` | gRPC binary trace context header |
597
+ | `GRPC.Headers.GRPC_TAGS_BIN` | `'grpc-tags-bin'` | gRPC binary tags header |
598
+ | `GRPC.HeaderValues.GRPC` | `'application/grpc'` | Standard gRPC content type |
599
+ | `GRPC.HeaderValues.GRPC_PROTO` | `'application/grpc+proto'` | gRPC Protobuf content type |
600
+ | `GRPC.HeaderValues.GRPC_JSON` | `'application/grpc+json'` | gRPC JSON content type |
601
+ | `GRPC.HeaderValues.GRPC_WEB` | `'application/grpc-web'` | gRPC-Web content type |
602
+ | `GRPC.HeaderValues.GRPC_WEB_PROTO` | `'application/grpc-web+proto'` | gRPC-Web Protobuf content type |
603
+ | `GRPC.HeaderValues.GRPC_WEB_JSON` | `'application/grpc-web+json'` | gRPC-Web JSON content type |
604
+ | `GRPC.HeaderValues.GRPC_WEB_TEXT` | `'application/grpc-web-text'` | gRPC-Web text content type |
605
+ | `GRPC.ResultCodes.OK` | `0` | Success |
606
+ | `GRPC.ResultCodes.CANCELLED` | `1` | Operation cancelled |
607
+ | `GRPC.ResultCodes.UNKNOWN` | `2` | Unknown error |
608
+ | `GRPC.ResultCodes.INVALID_ARGUMENT` | `3` | Invalid argument |
609
+ | `GRPC.ResultCodes.DEADLINE_EXCEEDED` | `4` | Deadline exceeded |
610
+ | `GRPC.ResultCodes.NOT_FOUND` | `5` | Not found |
611
+ | `GRPC.ResultCodes.ALREADY_EXISTS` | `6` | Already exists |
612
+ | `GRPC.ResultCodes.PERMISSION_DENIED` | `7` | Permission denied |
613
+ | `GRPC.ResultCodes.RESOURCE_EXHAUSTED` | `8` | Resource exhausted |
614
+ | `GRPC.ResultCodes.FAILED_PRECONDITION` | `9` | Failed precondition |
615
+ | `GRPC.ResultCodes.ABORTED` | `10` | Operation aborted |
616
+ | `GRPC.ResultCodes.OUT_OF_RANGE` | `11` | Out of range |
617
+ | `GRPC.ResultCodes.UNIMPLEMENTED` | `12` | Unimplemented |
618
+ | `GRPC.ResultCodes.INTERNAL` | `13` | Internal server error |
619
+ | `GRPC.ResultCodes.UNAVAILABLE` | `14` | Service unavailable |
620
+ | `GRPC.ResultCodes.DATA_LOSS` | `15` | Unrecoverable data loss |
621
+ | `GRPC.ResultCodes.UNAUTHENTICATED` | `16` | Unauthenticated |
622
+
623
+ ```typescript
624
+ type TGrpcMethod = ValueOf<typeof GRPC.Methods>;
625
+ type TGrpcResultCode = ValueOf<typeof GRPC.ResultCodes>;
626
+ ```
627
+
628
+ ### MimeTypes
629
+
630
+ `Source ->` [`constants/mime.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/mime.ts)
631
+
632
+ ```typescript
633
+ class MimeTypes {
634
+ static readonly UNKNOWN = 'unknown';
635
+ static readonly IMAGE = 'image';
636
+ static readonly VIDEO = 'video';
637
+ static readonly TEXT = 'text';
638
+ }
639
+
640
+ type TMimeTypes = TConstValue<typeof MimeTypes>; // 'unknown' | 'image' | 'video' | 'text'
641
+ ```
642
+
643
+ Content type classification constants.
644
+
645
+ ## See also
646
+
647
+ - [Types overview](/extensions/helpers/types/) - introduction and the most common tasks
648
+ - [Dependency Injection](/guides/core-concepts/dependency-injection) - `TInjectionGetter` and DI-adjacent types in use
649
+ - [Repository Mixins](/references/base/repositories/mixins) - `TMixinTarget` in use
650
+ - [Helpers Overview](/extensions/helpers/) - all available helpers