@decaf-ts/integrations 0.3.12 → 0.4.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 (196) hide show
  1. package/README.md +11 -3
  2. package/dist/integrations.cjs +445 -7
  3. package/dist/integrations.js +479 -8
  4. package/jest.config.cjs +1 -1
  5. package/lib/cjs/feature-flags/constants.cjs +16 -0
  6. package/lib/cjs/feature-flags/decorators.cjs +65 -0
  7. package/lib/cjs/feature-flags/environment.cjs +26 -0
  8. package/lib/cjs/feature-flags/index.cjs +31 -0
  9. package/lib/cjs/feature-flags/models/FeatureFlag.model.cjs +81 -0
  10. package/lib/cjs/feature-flags/models/FeatureFlagAccess.model.cjs +78 -0
  11. package/lib/cjs/feature-flags/readers/FeatureFlagReader.cjs +25 -0
  12. package/lib/cjs/feature-flags/readers/index.cjs +19 -0
  13. package/lib/cjs/feature-flags/services/FeatureFlag.service.cjs +259 -0
  14. package/lib/cjs/feature-flags/types.cjs +4 -0
  15. package/lib/cjs/feature-flags/utils.cjs +141 -0
  16. package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs +9 -9
  17. package/lib/cjs/graph/shared/nodes/flow-control.cjs +4 -3
  18. package/lib/cjs/graph/shared/types.cjs +2 -2
  19. package/lib/cjs/index.cjs +6 -5
  20. package/lib/cjs/kibana/builders/KibanaIndexBuilder.cjs +329 -0
  21. package/lib/cjs/kibana/builders/KibanaIndexBuilderCollection.cjs +37 -0
  22. package/lib/cjs/kibana/builders/index.cjs +20 -0
  23. package/lib/cjs/kibana/helpers.cjs +20 -16
  24. package/lib/cjs/kibana/index.cjs +3 -2
  25. package/lib/cjs/kibana/types.cjs +11 -2
  26. package/lib/cjs/loader/ObjectLoader.cjs +154 -0
  27. package/lib/cjs/loader/families.cjs +78 -0
  28. package/lib/cjs/loader/index.cjs +28 -0
  29. package/lib/cjs/loader/types.cjs +4 -0
  30. package/lib/cjs/nest/decorators.cjs +17 -0
  31. package/lib/cjs/nest/index.cjs +3 -3
  32. package/lib/cjs/nest/keycloakAuthHandler.cjs +74 -35
  33. package/lib/cjs/nest/keycloakModule.cjs +7 -10
  34. package/lib/cjs/nest/types.cjs +2 -2
  35. package/lib/cjs/nest/utils.cjs +58 -50
  36. package/lib/cjs/plugins/contract.cjs +76 -0
  37. package/lib/cjs/plugins/index.cjs +35 -0
  38. package/lib/cjs/plugins/kibana/host.cjs +24 -0
  39. package/lib/cjs/plugins/kibana/index.cjs +38 -0
  40. package/lib/cjs/plugins/kibana/installer.cjs +180 -0
  41. package/lib/cjs/plugins/kibana/manifest.cjs +33 -0
  42. package/lib/cjs/plugins/kibana/templates.cjs +503 -0
  43. package/lib/cjs/plugins/kibana/types.cjs +33 -0
  44. package/lib/cjs/plugins/superset/host.cjs +26 -0
  45. package/lib/cjs/plugins/superset/index.cjs +40 -0
  46. package/lib/cjs/plugins/superset/installer.cjs +232 -0
  47. package/lib/cjs/plugins/superset/manifest.cjs +35 -0
  48. package/lib/cjs/plugins/superset/templates.cjs +844 -0
  49. package/lib/cjs/plugins/superset/types.cjs +39 -0
  50. package/lib/esm/feature-flags/constants.js +12 -0
  51. package/lib/esm/feature-flags/decorators.js +49 -0
  52. package/lib/esm/feature-flags/environment.js +18 -0
  53. package/lib/esm/feature-flags/index.js +14 -0
  54. package/lib/esm/feature-flags/models/FeatureFlag.model.js +72 -0
  55. package/lib/esm/feature-flags/models/FeatureFlagAccess.model.js +69 -0
  56. package/lib/esm/feature-flags/readers/FeatureFlagReader.js +19 -0
  57. package/lib/esm/feature-flags/readers/index.js +2 -0
  58. package/lib/esm/feature-flags/services/FeatureFlag.service.js +250 -0
  59. package/lib/esm/feature-flags/types.js +2 -0
  60. package/lib/esm/feature-flags/utils.js +126 -0
  61. package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js +8 -8
  62. package/lib/esm/graph/shared/nodes/flow-control.js +3 -2
  63. package/lib/esm/graph/shared/types.js +1 -1
  64. package/lib/esm/index.js +5 -4
  65. package/lib/esm/kibana/builders/KibanaIndexBuilder.js +319 -0
  66. package/lib/esm/kibana/builders/KibanaIndexBuilderCollection.js +32 -0
  67. package/lib/esm/kibana/builders/index.js +3 -0
  68. package/lib/esm/kibana/helpers.js +19 -15
  69. package/lib/esm/kibana/index.js +2 -1
  70. package/lib/esm/kibana/types.js +13 -2
  71. package/lib/esm/loader/ObjectLoader.js +115 -0
  72. package/lib/esm/loader/families.js +66 -0
  73. package/lib/esm/loader/index.js +11 -0
  74. package/lib/esm/loader/types.js +2 -0
  75. package/lib/esm/nest/decorators.js +12 -0
  76. package/lib/esm/nest/index.js +2 -2
  77. package/lib/esm/nest/keycloakAuthHandler.js +67 -35
  78. package/lib/esm/nest/keycloakModule.js +7 -10
  79. package/lib/esm/nest/types.js +1 -1
  80. package/lib/esm/nest/utils.js +55 -46
  81. package/lib/esm/plugins/contract.js +68 -0
  82. package/lib/esm/plugins/index.js +18 -0
  83. package/lib/esm/plugins/kibana/host.js +19 -0
  84. package/lib/esm/plugins/kibana/index.js +14 -0
  85. package/lib/esm/plugins/kibana/installer.js +140 -0
  86. package/lib/esm/plugins/kibana/manifest.js +32 -0
  87. package/lib/esm/plugins/kibana/templates.js +499 -0
  88. package/lib/esm/plugins/kibana/types.js +10 -0
  89. package/lib/esm/plugins/superset/host.js +21 -0
  90. package/lib/esm/plugins/superset/index.js +16 -0
  91. package/lib/esm/plugins/superset/installer.js +192 -0
  92. package/lib/esm/plugins/superset/manifest.js +30 -0
  93. package/lib/esm/plugins/superset/templates.js +840 -0
  94. package/lib/esm/plugins/superset/types.js +11 -0
  95. package/lib/types/feature-flags/constants.d.cts +11 -0
  96. package/lib/types/feature-flags/constants.d.mts +11 -0
  97. package/lib/types/feature-flags/decorators.d.cts +11 -0
  98. package/lib/types/feature-flags/decorators.d.mts +11 -0
  99. package/lib/types/feature-flags/environment.d.cts +11 -0
  100. package/lib/types/feature-flags/environment.d.mts +11 -0
  101. package/lib/types/feature-flags/index.d.cts +13 -0
  102. package/lib/types/feature-flags/index.d.mts +13 -0
  103. package/lib/types/feature-flags/models/FeatureFlag.model.d.cts +16 -0
  104. package/lib/types/feature-flags/models/FeatureFlag.model.d.mts +16 -0
  105. package/lib/types/feature-flags/models/FeatureFlagAccess.model.d.cts +15 -0
  106. package/lib/types/feature-flags/models/FeatureFlagAccess.model.d.mts +15 -0
  107. package/lib/types/feature-flags/readers/FeatureFlagReader.d.cts +10 -0
  108. package/lib/types/feature-flags/readers/FeatureFlagReader.d.mts +10 -0
  109. package/lib/types/feature-flags/readers/index.d.cts +1 -0
  110. package/lib/types/feature-flags/readers/index.d.mts +1 -0
  111. package/lib/types/feature-flags/services/FeatureFlag.service.d.cts +43 -0
  112. package/lib/types/feature-flags/services/FeatureFlag.service.d.mts +43 -0
  113. package/lib/types/feature-flags/types.d.cts +39 -0
  114. package/lib/types/feature-flags/types.d.mts +39 -0
  115. package/lib/types/feature-flags/utils.d.cts +13 -0
  116. package/lib/types/feature-flags/utils.d.mts +13 -0
  117. package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.cts +2 -2
  118. package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.mts +2 -2
  119. package/lib/types/graph/shared/types.d.cts +3 -3
  120. package/lib/types/graph/shared/types.d.mts +3 -3
  121. package/lib/types/index.d.cts +3 -2
  122. package/lib/types/index.d.mts +3 -2
  123. package/lib/types/kibana/builders/KibanaIndexBuilder.d.cts +67 -0
  124. package/lib/types/kibana/builders/KibanaIndexBuilder.d.mts +67 -0
  125. package/lib/types/kibana/builders/KibanaIndexBuilderCollection.d.cts +17 -0
  126. package/lib/types/kibana/builders/KibanaIndexBuilderCollection.d.mts +17 -0
  127. package/lib/types/kibana/builders/index.d.cts +2 -0
  128. package/lib/types/kibana/builders/index.d.mts +2 -0
  129. package/lib/types/kibana/index.d.cts +1 -0
  130. package/lib/types/kibana/index.d.mts +1 -0
  131. package/lib/types/kibana/types.d.cts +11 -0
  132. package/lib/types/kibana/types.d.mts +11 -0
  133. package/lib/types/loader/ObjectLoader.d.cts +27 -0
  134. package/lib/types/loader/ObjectLoader.d.mts +27 -0
  135. package/lib/types/loader/families.d.cts +34 -0
  136. package/lib/types/loader/families.d.mts +34 -0
  137. package/lib/types/loader/index.d.cts +10 -0
  138. package/lib/types/loader/index.d.mts +10 -0
  139. package/lib/types/loader/types.d.cts +24 -0
  140. package/lib/types/loader/types.d.mts +24 -0
  141. package/lib/types/nest/decorators.d.cts +8 -0
  142. package/lib/types/nest/decorators.d.mts +8 -0
  143. package/lib/types/nest/index.d.cts +1 -1
  144. package/lib/types/nest/index.d.mts +1 -1
  145. package/lib/types/nest/keycloakAuthHandler.d.cts +19 -42
  146. package/lib/types/nest/keycloakAuthHandler.d.mts +19 -42
  147. package/lib/types/nest/keycloakModule.d.cts +3 -5
  148. package/lib/types/nest/keycloakModule.d.mts +3 -5
  149. package/lib/types/nest/types.d.cts +2 -0
  150. package/lib/types/nest/types.d.mts +2 -0
  151. package/lib/types/nest/utils.d.cts +3 -4
  152. package/lib/types/nest/utils.d.mts +3 -4
  153. package/lib/types/plugins/contract.d.cts +180 -0
  154. package/lib/types/plugins/contract.d.mts +180 -0
  155. package/lib/types/plugins/index.d.cts +17 -0
  156. package/lib/types/plugins/index.d.mts +17 -0
  157. package/lib/types/plugins/kibana/host.d.cts +18 -0
  158. package/lib/types/plugins/kibana/host.d.mts +18 -0
  159. package/lib/types/plugins/kibana/index.d.cts +13 -0
  160. package/lib/types/plugins/kibana/index.d.mts +13 -0
  161. package/lib/types/plugins/kibana/installer.d.cts +45 -0
  162. package/lib/types/plugins/kibana/installer.d.mts +45 -0
  163. package/lib/types/plugins/kibana/manifest.d.cts +31 -0
  164. package/lib/types/plugins/kibana/manifest.d.mts +31 -0
  165. package/lib/types/plugins/kibana/templates.d.cts +12 -0
  166. package/lib/types/plugins/kibana/templates.d.mts +12 -0
  167. package/lib/types/plugins/kibana/types.d.cts +9 -0
  168. package/lib/types/plugins/kibana/types.d.mts +9 -0
  169. package/lib/types/plugins/superset/host.d.cts +20 -0
  170. package/lib/types/plugins/superset/host.d.mts +20 -0
  171. package/lib/types/plugins/superset/index.d.cts +15 -0
  172. package/lib/types/plugins/superset/index.d.mts +15 -0
  173. package/lib/types/plugins/superset/installer.d.cts +70 -0
  174. package/lib/types/plugins/superset/installer.d.mts +70 -0
  175. package/lib/types/plugins/superset/manifest.d.cts +28 -0
  176. package/lib/types/plugins/superset/manifest.d.mts +28 -0
  177. package/lib/types/plugins/superset/templates.d.cts +12 -0
  178. package/lib/types/plugins/superset/templates.d.mts +12 -0
  179. package/lib/types/plugins/superset/types.d.cts +10 -0
  180. package/lib/types/plugins/superset/types.d.mts +10 -0
  181. package/package.json +62 -3
  182. package/plugins/kibana/.gitignore +16 -0
  183. package/plugins/kibana/Dockerfile +19 -0
  184. package/plugins/kibana/docker-compose.yml +50 -0
  185. package/plugins/kibana/host/index.html +101 -0
  186. package/plugins/kibana/setup-dashboards.sh +84 -0
  187. package/plugins/superset/.gitignore +17 -0
  188. package/plugins/superset/Dockerfile +79 -0
  189. package/plugins/superset/docker-compose.yml +62 -0
  190. package/plugins/superset/host/index.html +168 -0
  191. package/plugins/superset/setup-dashboards.sh +106 -0
  192. package/plugins/superset/superset_config.py +49 -0
  193. package/lib/cjs/nest/authService.cjs +0 -91
  194. package/lib/esm/nest/authService.js +0 -86
  195. package/lib/types/nest/authService.d.cts +0 -63
  196. package/lib/types/nest/authService.d.mts +0 -63
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module integrations/kibana/builders/KibanaIndexBuilderCollection
3
+ * @summary Collection builder for multiple Kibana data views.
4
+ * @description Provides a fluent chain for building multiple
5
+ * `KibanaDataViewConfig` objects in one call, directly consumable by
6
+ * `KibanaDataViewService.createDataViews()`.
7
+ */
8
+ import { Model, ModelArg } from "@decaf-ts/decorator-validation";
9
+ import { KibanaDataViewConfig } from "../types.d.cts";
10
+ import { KibanaIndexBuilder } from "./KibanaIndexBuilder.d.cts";
11
+ export declare class KibanaIndexBuilderCollection extends Model {
12
+ builders: KibanaIndexBuilder[];
13
+ constructor(arg?: ModelArg<KibanaIndexBuilderCollection>);
14
+ static for(...builders: KibanaIndexBuilder[]): KibanaIndexBuilderCollection;
15
+ add(builder: KibanaIndexBuilder): this;
16
+ build(): KibanaDataViewConfig[];
17
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module integrations/kibana/builders/KibanaIndexBuilderCollection
3
+ * @summary Collection builder for multiple Kibana data views.
4
+ * @description Provides a fluent chain for building multiple
5
+ * `KibanaDataViewConfig` objects in one call, directly consumable by
6
+ * `KibanaDataViewService.createDataViews()`.
7
+ */
8
+ import { Model, ModelArg } from "@decaf-ts/decorator-validation";
9
+ import { KibanaDataViewConfig } from "../types.d.mts";
10
+ import { KibanaIndexBuilder } from "./KibanaIndexBuilder.d.mts";
11
+ export declare class KibanaIndexBuilderCollection extends Model {
12
+ builders: KibanaIndexBuilder[];
13
+ constructor(arg?: ModelArg<KibanaIndexBuilderCollection>);
14
+ static for(...builders: KibanaIndexBuilder[]): KibanaIndexBuilderCollection;
15
+ add(builder: KibanaIndexBuilder): this;
16
+ build(): KibanaDataViewConfig[];
17
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./KibanaIndexBuilder.d.cts";
2
+ export * from "./KibanaIndexBuilderCollection.d.cts";
@@ -0,0 +1,2 @@
1
+ export * from "./KibanaIndexBuilder.d.mts";
2
+ export * from "./KibanaIndexBuilderCollection.d.mts";
@@ -1,5 +1,6 @@
1
1
  export * from "./types.d.cts";
2
2
  export * from "./helpers.d.cts";
3
+ export * from "./builders/index.d.cts";
3
4
  export * from "./services/index.d.cts";
4
5
  /**
5
6
  * @summary Kibana integrations.
@@ -1,5 +1,6 @@
1
1
  export * from "./types.d.mts";
2
2
  export * from "./helpers.d.mts";
3
+ export * from "./builders/index.d.mts";
3
4
  export * from "./services/index.d.mts";
4
5
  /**
5
6
  * @summary Kibana integrations.
@@ -38,6 +38,17 @@ export interface KibanaDataViewConfig {
38
38
  fieldAttrs?: Record<string, unknown>;
39
39
  allowNoIndex?: boolean;
40
40
  }
41
+ /**
42
+ * Matching strategy for composing Kibana index pattern titles.
43
+ */
44
+ export declare enum KibanaIndexMatchMode {
45
+ /** Single, fully-qualified index name — no wildcards. */
46
+ EXACT = "exact",
47
+ /** Wildcard pattern matching all indices with a shared prefix (e.g. "filebeat-*"). */
48
+ PREFIX = "prefix",
49
+ /** Index name segments derived from registered LogParameterDescriptor keys. */
50
+ LOGGER_GENERATED = "logger-generated"
51
+ }
41
52
  export interface KibanaRoleConfig {
42
53
  name: string;
43
54
  indices?: Array<{
@@ -38,6 +38,17 @@ export interface KibanaDataViewConfig {
38
38
  fieldAttrs?: Record<string, unknown>;
39
39
  allowNoIndex?: boolean;
40
40
  }
41
+ /**
42
+ * Matching strategy for composing Kibana index pattern titles.
43
+ */
44
+ export declare enum KibanaIndexMatchMode {
45
+ /** Single, fully-qualified index name — no wildcards. */
46
+ EXACT = "exact",
47
+ /** Wildcard pattern matching all indices with a shared prefix (e.g. "filebeat-*"). */
48
+ PREFIX = "prefix",
49
+ /** Index name segments derived from registered LogParameterDescriptor keys. */
50
+ LOGGER_GENERATED = "logger-generated"
51
+ }
41
52
  export interface KibanaRoleConfig {
42
53
  name: string;
43
54
  indices?: Array<{
@@ -0,0 +1,27 @@
1
+ import type { ObjectLoaderExportSelection, ObjectLoaderFamily, ObjectLoaderHook, ObjectLoaderHookContext, ObjectLoaderLoadOptions, ObjectLoaderOptions, ObjectLoaderSource } from "./types.d.cts";
2
+ /**
3
+ * @module integrations/loader
4
+ * @summary Dynamic TypeScript object loader utilities.
5
+ * @description Base loader and concrete family loaders for dynamically
6
+ * resolving Decaf integration objects without forcing callers to duplicate
7
+ * import, selection, or post-load hook logic.
8
+ */
9
+ export declare class ObjectLoader {
10
+ readonly family: ObjectLoaderFamily;
11
+ readonly defaultExportName: string;
12
+ protected readonly hooks: readonly ObjectLoaderHook[];
13
+ constructor(options?: ObjectLoaderOptions);
14
+ protected normalizeSource(source: ObjectLoaderSource): string;
15
+ protected importModule(source: ObjectLoaderSource): Promise<Readonly<Record<string, unknown>>>;
16
+ protected resolveExport(module: Readonly<Record<string, unknown>>, exportName: string, source: string): unknown;
17
+ protected applyHooks<T>(value: T, context: ObjectLoaderHookContext, hooks: readonly ObjectLoaderHook[]): Promise<T>;
18
+ protected createInstance(options: ObjectLoaderOptions): this;
19
+ loadModule(source: ObjectLoaderSource): Promise<Readonly<Record<string, unknown>>>;
20
+ loadExport<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
21
+ loadDefault<T = unknown>(source: ObjectLoaderSource, options?: ObjectLoaderLoadOptions): Promise<T>;
22
+ load<T = unknown>(source: ObjectLoaderSource, options?: ObjectLoaderLoadOptions): Promise<T>;
23
+ withHooks(...hooks: ObjectLoaderHook[]): this;
24
+ withOptions(options: Partial<ObjectLoaderOptions>): this;
25
+ }
26
+ export declare function createLoaderHookContext(loader: ObjectLoader, module: Readonly<Record<string, unknown>>, source: string, exportName: string): ObjectLoaderHookContext;
27
+ export type { ObjectLoaderExportSelection };
@@ -0,0 +1,27 @@
1
+ import type { ObjectLoaderExportSelection, ObjectLoaderFamily, ObjectLoaderHook, ObjectLoaderHookContext, ObjectLoaderLoadOptions, ObjectLoaderOptions, ObjectLoaderSource } from "./types.d.mts";
2
+ /**
3
+ * @module integrations/loader
4
+ * @summary Dynamic TypeScript object loader utilities.
5
+ * @description Base loader and concrete family loaders for dynamically
6
+ * resolving Decaf integration objects without forcing callers to duplicate
7
+ * import, selection, or post-load hook logic.
8
+ */
9
+ export declare class ObjectLoader {
10
+ readonly family: ObjectLoaderFamily;
11
+ readonly defaultExportName: string;
12
+ protected readonly hooks: readonly ObjectLoaderHook[];
13
+ constructor(options?: ObjectLoaderOptions);
14
+ protected normalizeSource(source: ObjectLoaderSource): string;
15
+ protected importModule(source: ObjectLoaderSource): Promise<Readonly<Record<string, unknown>>>;
16
+ protected resolveExport(module: Readonly<Record<string, unknown>>, exportName: string, source: string): unknown;
17
+ protected applyHooks<T>(value: T, context: ObjectLoaderHookContext, hooks: readonly ObjectLoaderHook[]): Promise<T>;
18
+ protected createInstance(options: ObjectLoaderOptions): this;
19
+ loadModule(source: ObjectLoaderSource): Promise<Readonly<Record<string, unknown>>>;
20
+ loadExport<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
21
+ loadDefault<T = unknown>(source: ObjectLoaderSource, options?: ObjectLoaderLoadOptions): Promise<T>;
22
+ load<T = unknown>(source: ObjectLoaderSource, options?: ObjectLoaderLoadOptions): Promise<T>;
23
+ withHooks(...hooks: ObjectLoaderHook[]): this;
24
+ withOptions(options: Partial<ObjectLoaderOptions>): this;
25
+ }
26
+ export declare function createLoaderHookContext(loader: ObjectLoader, module: Readonly<Record<string, unknown>>, source: string, exportName: string): ObjectLoaderHookContext;
27
+ export type { ObjectLoaderExportSelection };
@@ -0,0 +1,34 @@
1
+ import { ObjectLoader } from "./ObjectLoader.d.cts";
2
+ import type { ObjectLoaderLoadOptions, ObjectLoaderOptions, ObjectLoaderSource } from "./types.d.cts";
3
+ export declare class ModelObjectLoader extends ObjectLoader {
4
+ constructor(options?: ObjectLoaderOptions);
5
+ loadModel<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
6
+ }
7
+ export declare class AdapterObjectLoader extends ObjectLoader {
8
+ constructor(options?: ObjectLoaderOptions);
9
+ loadAdapter<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
10
+ }
11
+ export declare class RepositoryObjectLoader extends ObjectLoader {
12
+ constructor(options?: ObjectLoaderOptions);
13
+ loadRepository<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
14
+ }
15
+ export declare class ServiceObjectLoader extends ObjectLoader {
16
+ constructor(options?: ObjectLoaderOptions);
17
+ loadService<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
18
+ }
19
+ export declare class ControllerObjectLoader extends ObjectLoader {
20
+ constructor(options?: ObjectLoaderOptions);
21
+ loadController<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
22
+ }
23
+ export declare class EnvironmentObjectLoader extends ObjectLoader {
24
+ constructor(options?: ObjectLoaderOptions);
25
+ loadEnvironment<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
26
+ }
27
+ export declare class AngularComponentObjectLoader extends ObjectLoader {
28
+ constructor(options?: ObjectLoaderOptions);
29
+ loadComponent<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
30
+ }
31
+ export declare class GraphNodeObjectLoader extends ObjectLoader {
32
+ constructor(options?: ObjectLoaderOptions);
33
+ loadNode<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
34
+ }
@@ -0,0 +1,34 @@
1
+ import { ObjectLoader } from "./ObjectLoader.d.mts";
2
+ import type { ObjectLoaderLoadOptions, ObjectLoaderOptions, ObjectLoaderSource } from "./types.d.mts";
3
+ export declare class ModelObjectLoader extends ObjectLoader {
4
+ constructor(options?: ObjectLoaderOptions);
5
+ loadModel<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
6
+ }
7
+ export declare class AdapterObjectLoader extends ObjectLoader {
8
+ constructor(options?: ObjectLoaderOptions);
9
+ loadAdapter<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
10
+ }
11
+ export declare class RepositoryObjectLoader extends ObjectLoader {
12
+ constructor(options?: ObjectLoaderOptions);
13
+ loadRepository<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
14
+ }
15
+ export declare class ServiceObjectLoader extends ObjectLoader {
16
+ constructor(options?: ObjectLoaderOptions);
17
+ loadService<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
18
+ }
19
+ export declare class ControllerObjectLoader extends ObjectLoader {
20
+ constructor(options?: ObjectLoaderOptions);
21
+ loadController<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
22
+ }
23
+ export declare class EnvironmentObjectLoader extends ObjectLoader {
24
+ constructor(options?: ObjectLoaderOptions);
25
+ loadEnvironment<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
26
+ }
27
+ export declare class AngularComponentObjectLoader extends ObjectLoader {
28
+ constructor(options?: ObjectLoaderOptions);
29
+ loadComponent<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
30
+ }
31
+ export declare class GraphNodeObjectLoader extends ObjectLoader {
32
+ constructor(options?: ObjectLoaderOptions);
33
+ loadNode<T = unknown>(source: ObjectLoaderSource, exportName?: string, options?: ObjectLoaderLoadOptions): Promise<T>;
34
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module integrations/loader
3
+ * @summary Dynamic TypeScript object loader exports.
4
+ * @description Dedicated loader surface for resolving Decaf integration
5
+ * objects with reusable post-load hooks. This subpath intentionally keeps the
6
+ * loader code isolated from the package root export surface.
7
+ */
8
+ export * from "./types.d.cts";
9
+ export * from "./ObjectLoader.d.cts";
10
+ export * from "./families.d.cts";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module integrations/loader
3
+ * @summary Dynamic TypeScript object loader exports.
4
+ * @description Dedicated loader surface for resolving Decaf integration
5
+ * objects with reusable post-load hooks. This subpath intentionally keeps the
6
+ * loader code isolated from the package root export surface.
7
+ */
8
+ export * from "./types.d.mts";
9
+ export * from "./ObjectLoader.d.mts";
10
+ export * from "./families.d.mts";
@@ -0,0 +1,24 @@
1
+ import type { Constructor } from "@decaf-ts/decoration";
2
+ export type ObjectLoaderFamily = "generic" | "model" | "adapter" | "repository" | "service" | "controller" | "environment" | "component" | "node";
3
+ export type ObjectLoaderSource = string | URL;
4
+ export type MaybePromise<T> = T | Promise<T>;
5
+ export interface ObjectLoaderHookContext {
6
+ readonly family: ObjectLoaderFamily;
7
+ readonly source: string;
8
+ readonly exportName: string;
9
+ readonly module: Readonly<Record<string, unknown>>;
10
+ readonly loaderName: string;
11
+ }
12
+ export type ObjectLoaderHook = (value: unknown, context: ObjectLoaderHookContext) => MaybePromise<unknown | void>;
13
+ export interface ObjectLoaderOptions {
14
+ readonly family?: ObjectLoaderFamily;
15
+ readonly hooks?: readonly ObjectLoaderHook[];
16
+ readonly defaultExportName?: string;
17
+ }
18
+ export interface ObjectLoaderLoadOptions {
19
+ readonly hooks?: readonly ObjectLoaderHook[];
20
+ }
21
+ export interface ObjectLoaderExportSelection {
22
+ readonly exportName?: string;
23
+ }
24
+ export type ObjectLoaderConstructor<T = object> = Constructor<T>;
@@ -0,0 +1,24 @@
1
+ import type { Constructor } from "@decaf-ts/decoration";
2
+ export type ObjectLoaderFamily = "generic" | "model" | "adapter" | "repository" | "service" | "controller" | "environment" | "component" | "node";
3
+ export type ObjectLoaderSource = string | URL;
4
+ export type MaybePromise<T> = T | Promise<T>;
5
+ export interface ObjectLoaderHookContext {
6
+ readonly family: ObjectLoaderFamily;
7
+ readonly source: string;
8
+ readonly exportName: string;
9
+ readonly module: Readonly<Record<string, unknown>>;
10
+ readonly loaderName: string;
11
+ }
12
+ export type ObjectLoaderHook = (value: unknown, context: ObjectLoaderHookContext) => MaybePromise<unknown | void>;
13
+ export interface ObjectLoaderOptions {
14
+ readonly family?: ObjectLoaderFamily;
15
+ readonly hooks?: readonly ObjectLoaderHook[];
16
+ readonly defaultExportName?: string;
17
+ }
18
+ export interface ObjectLoaderLoadOptions {
19
+ readonly hooks?: readonly ObjectLoaderHook[];
20
+ }
21
+ export interface ObjectLoaderExportSelection {
22
+ readonly exportName?: string;
23
+ }
24
+ export type ObjectLoaderConstructor<T = object> = Constructor<T>;
@@ -0,0 +1,8 @@
1
+ export declare const AUTH_NAMESPACE_KEY = "auth-namespace";
2
+ /**
3
+ * Marks a model as namespace-scoped for auth handlers.
4
+ *
5
+ * This decorator mirrors the role metadata pattern, but stores namespace scopes
6
+ * that downstream auth handlers compare against the authenticated principal.
7
+ */
8
+ export declare function namespace(namespaces: string[]): (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;
@@ -0,0 +1,8 @@
1
+ export declare const AUTH_NAMESPACE_KEY = "auth-namespace";
2
+ /**
3
+ * Marks a model as namespace-scoped for auth handlers.
4
+ *
5
+ * This decorator mirrors the role metadata pattern, but stores namespace scopes
6
+ * that downstream auth handlers compare against the authenticated principal.
7
+ */
8
+ export declare function namespace(namespaces: string[]): (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;
@@ -1,6 +1,6 @@
1
1
  export * from "./types.d.cts";
2
2
  export * from "./utils.d.cts";
3
- export * from "./authService.d.cts";
3
+ export * from "./decorators.d.cts";
4
4
  export * from "./keycloakAuthHandler.d.cts";
5
5
  export * from "./keycloakModule.d.cts";
6
6
  import "./logging";
@@ -1,6 +1,6 @@
1
1
  export * from "./types.d.mts";
2
2
  export * from "./utils.d.mts";
3
- export * from "./authService.d.mts";
3
+ export * from "./decorators.d.mts";
4
4
  export * from "./keycloakAuthHandler.d.mts";
5
5
  export * from "./keycloakModule.d.mts";
6
6
  import "./logging";
@@ -1,30 +1,9 @@
1
- /**
2
- * @module integrations/nest/keycloakAuthHandler
3
- * @summary Keycloak request auth handler.
4
- * @description Translates Keycloak JWT payloads into Decaf-friendly auth data.
5
- * Extends the framework-agnostic {@link AuthHandler} from `@decaf-ts/for-http/server`.
6
- *
7
- * Only overrides the two extension points:
8
- * - {@link KeycloakAuthHandler.extractFromAuth} — decodes the JWT and returns auth data (no validation).
9
- * Returns empty data for public routes without requiring a token.
10
- * - {@link KeycloakAuthHandler.validate} — validates the JWT via {@link AuthService.assertValidToken},
11
- * then delegates to the base class for route-level and model-level role checks.
12
- * Skips entirely for public routes.
13
- *
14
- * Does NOT override `bindToContext` — the base class default `ctx.accumulate(data)`
15
- * is sufficient. Does NOT override `authorize`.
16
- */
17
- import type { Constructor } from "@decaf-ts/decoration";
18
- import { Context, ContextualArgs } from "@decaf-ts/core";
19
1
  import { AuthHandler, AuthData } from "@decaf-ts/for-http/server";
20
- import { AuthService, type AuthServiceOptions } from "./authService.d.cts";
21
- import type { AuthExecutionContextLike } from "./types.d.cts";
22
- import { getClientRoles } from "./utils.d.cts";
2
+ import type { Context } from "@decaf-ts/core";
3
+ import { JwtService } from "@decaf-ts/crypto/integration/services/jwt";
4
+ import type { AuthExecutionContextLike, AuthRequestLike } from "./types.d.cts";
23
5
  /**
24
- * Auth data returned by {@link KeycloakAuthHandler.extractFromAuth}.
25
- *
26
- * Carries the raw JWT `token` so that {@link KeycloakAuthHandler.validate} can
27
- * validate it against the Keycloak instance (signature, expiry, revocation, etc.).
6
+ * Auth data returned by {@link KeycloakAuthHandler.extractFromRequest}.
28
7
  */
29
8
  export interface KeycloakAuthData extends AuthData {
30
9
  /** The raw JWT extracted from the request. Empty for public routes. */
@@ -33,21 +12,19 @@ export interface KeycloakAuthData extends AuthData {
33
12
  isPublic: boolean;
34
13
  }
35
14
  export declare class KeycloakAuthHandler extends AuthHandler<AuthExecutionContextLike, Context, KeycloakAuthData> {
36
- /**
37
- * @param authService An {@link AuthService} configured with JWKS verification
38
- * options. When omitted a default decode-only service is
39
- * used.
40
- * @param authServiceOptions Convenience: if `authService` is omitted, these
41
- * options are used to construct one.
42
- */
43
- constructor(authService?: AuthService, authServiceOptions?: AuthServiceOptions);
44
- protected readonly authService: AuthService;
45
- protected extractFromAuth(ctx: AuthExecutionContextLike): KeycloakAuthData;
46
- /**
47
- * Validates the JWT against the Keycloak instance (signature, expiry, etc.)
48
- * via {@link AuthService.assertValidToken}, then delegates to the base class
49
- * for route-level and model-level role checks. Skips entirely for public routes.
50
- */
51
- protected validate(data: KeycloakAuthData, routeRoles: string[] | undefined, model: string | Constructor, ...args: ContextualArgs<Context>): Promise<void>;
15
+ constructor();
16
+ protected readonly jwtService?: JwtService;
17
+ protected jwt(): JwtService;
18
+ protected requestFromContext(ctx: AuthExecutionContextLike): AuthRequestLike;
19
+ protected isPublicRequest(request: AuthRequestLike): boolean;
20
+ protected parseFromRequest(request: AuthRequestLike): KeycloakAuthData;
21
+ protected extractFromRequest(request: AuthRequestLike): KeycloakAuthData;
22
+ protected validateAuth(data: KeycloakAuthData, _request: AuthRequestLike): Promise<void>;
23
+ }
24
+ /**
25
+ * Keycloak handler variant that also extracts namespace scopes from the token.
26
+ */
27
+ export declare class KeycloakNamespaceAuthHandler extends KeycloakAuthHandler {
28
+ protected parseFromRequest(request: AuthRequestLike): KeycloakAuthData;
52
29
  }
53
- export { getClientRoles };
30
+ export { getClientRoles } from "./utils.d.cts";
@@ -1,30 +1,9 @@
1
- /**
2
- * @module integrations/nest/keycloakAuthHandler
3
- * @summary Keycloak request auth handler.
4
- * @description Translates Keycloak JWT payloads into Decaf-friendly auth data.
5
- * Extends the framework-agnostic {@link AuthHandler} from `@decaf-ts/for-http/server`.
6
- *
7
- * Only overrides the two extension points:
8
- * - {@link KeycloakAuthHandler.extractFromAuth} — decodes the JWT and returns auth data (no validation).
9
- * Returns empty data for public routes without requiring a token.
10
- * - {@link KeycloakAuthHandler.validate} — validates the JWT via {@link AuthService.assertValidToken},
11
- * then delegates to the base class for route-level and model-level role checks.
12
- * Skips entirely for public routes.
13
- *
14
- * Does NOT override `bindToContext` — the base class default `ctx.accumulate(data)`
15
- * is sufficient. Does NOT override `authorize`.
16
- */
17
- import type { Constructor } from "@decaf-ts/decoration";
18
- import { Context, ContextualArgs } from "@decaf-ts/core";
19
1
  import { AuthHandler, AuthData } from "@decaf-ts/for-http/server";
20
- import { AuthService, type AuthServiceOptions } from "./authService.d.mts";
21
- import type { AuthExecutionContextLike } from "./types.d.mts";
22
- import { getClientRoles } from "./utils.d.mts";
2
+ import type { Context } from "@decaf-ts/core";
3
+ import { JwtService } from "@decaf-ts/crypto/integration/services/jwt";
4
+ import type { AuthExecutionContextLike, AuthRequestLike } from "./types.d.mts";
23
5
  /**
24
- * Auth data returned by {@link KeycloakAuthHandler.extractFromAuth}.
25
- *
26
- * Carries the raw JWT `token` so that {@link KeycloakAuthHandler.validate} can
27
- * validate it against the Keycloak instance (signature, expiry, revocation, etc.).
6
+ * Auth data returned by {@link KeycloakAuthHandler.extractFromRequest}.
28
7
  */
29
8
  export interface KeycloakAuthData extends AuthData {
30
9
  /** The raw JWT extracted from the request. Empty for public routes. */
@@ -33,21 +12,19 @@ export interface KeycloakAuthData extends AuthData {
33
12
  isPublic: boolean;
34
13
  }
35
14
  export declare class KeycloakAuthHandler extends AuthHandler<AuthExecutionContextLike, Context, KeycloakAuthData> {
36
- /**
37
- * @param authService An {@link AuthService} configured with JWKS verification
38
- * options. When omitted a default decode-only service is
39
- * used.
40
- * @param authServiceOptions Convenience: if `authService` is omitted, these
41
- * options are used to construct one.
42
- */
43
- constructor(authService?: AuthService, authServiceOptions?: AuthServiceOptions);
44
- protected readonly authService: AuthService;
45
- protected extractFromAuth(ctx: AuthExecutionContextLike): KeycloakAuthData;
46
- /**
47
- * Validates the JWT against the Keycloak instance (signature, expiry, etc.)
48
- * via {@link AuthService.assertValidToken}, then delegates to the base class
49
- * for route-level and model-level role checks. Skips entirely for public routes.
50
- */
51
- protected validate(data: KeycloakAuthData, routeRoles: string[] | undefined, model: string | Constructor, ...args: ContextualArgs<Context>): Promise<void>;
15
+ constructor();
16
+ protected readonly jwtService?: JwtService;
17
+ protected jwt(): JwtService;
18
+ protected requestFromContext(ctx: AuthExecutionContextLike): AuthRequestLike;
19
+ protected isPublicRequest(request: AuthRequestLike): boolean;
20
+ protected parseFromRequest(request: AuthRequestLike): KeycloakAuthData;
21
+ protected extractFromRequest(request: AuthRequestLike): KeycloakAuthData;
22
+ protected validateAuth(data: KeycloakAuthData, _request: AuthRequestLike): Promise<void>;
23
+ }
24
+ /**
25
+ * Keycloak handler variant that also extracts namespace scopes from the token.
26
+ */
27
+ export declare class KeycloakNamespaceAuthHandler extends KeycloakAuthHandler {
28
+ protected parseFromRequest(request: AuthRequestLike): KeycloakAuthData;
52
29
  }
53
- export { getClientRoles };
30
+ export { getClientRoles } from "./utils.d.mts";
@@ -1,15 +1,13 @@
1
1
  /**
2
2
  * @module integrations/nest/keycloakModule
3
3
  * @summary Nest module wiring for Keycloak auth.
4
- * @description Exposes the Nest module setup for the integration auth service and Keycloak handler.
4
+ * @description Exposes the Nest module setup for the Keycloak auth handlers.
5
5
  */
6
- import { AuthService, type AuthServiceOptions } from "./authService.d.cts";
7
6
  import { KeycloakAuthHandler } from "./keycloakAuthHandler.d.cts";
8
7
  export declare class KeycloakModule {
9
- readonly authService: AuthService;
10
8
  readonly authHandler: KeycloakAuthHandler;
11
- constructor(authService: AuthService, authHandler: KeycloakAuthHandler);
12
- static create(options?: AuthServiceOptions): KeycloakModule;
9
+ constructor(authHandler: KeycloakAuthHandler);
10
+ static create(): KeycloakModule;
13
11
  }
14
12
  export declare class AuthModule extends KeycloakModule {
15
13
  }
@@ -1,15 +1,13 @@
1
1
  /**
2
2
  * @module integrations/nest/keycloakModule
3
3
  * @summary Nest module wiring for Keycloak auth.
4
- * @description Exposes the Nest module setup for the integration auth service and Keycloak handler.
4
+ * @description Exposes the Nest module setup for the Keycloak auth handlers.
5
5
  */
6
- import { AuthService, type AuthServiceOptions } from "./authService.d.mts";
7
6
  import { KeycloakAuthHandler } from "./keycloakAuthHandler.d.mts";
8
7
  export declare class KeycloakModule {
9
- readonly authService: AuthService;
10
8
  readonly authHandler: KeycloakAuthHandler;
11
- constructor(authService: AuthService, authHandler: KeycloakAuthHandler);
12
- static create(options?: AuthServiceOptions): KeycloakModule;
9
+ constructor(authHandler: KeycloakAuthHandler);
10
+ static create(): KeycloakModule;
13
11
  }
14
12
  export declare class AuthModule extends KeycloakModule {
15
13
  }
@@ -35,6 +35,8 @@ export interface KeycloakAccessTokenPayload {
35
35
  iss?: string;
36
36
  aud?: string;
37
37
  azp?: string;
38
+ namespace?: string | string[];
39
+ namespaces?: string[];
38
40
  realm_access?: {
39
41
  roles?: string[];
40
42
  };
@@ -35,6 +35,8 @@ export interface KeycloakAccessTokenPayload {
35
35
  iss?: string;
36
36
  aud?: string;
37
37
  azp?: string;
38
+ namespace?: string | string[];
39
+ namespaces?: string[];
38
40
  realm_access?: {
39
41
  roles?: string[];
40
42
  };
@@ -3,10 +3,11 @@
3
3
  * @summary Nest integration utilities.
4
4
  * @description Helper functions used by the Nest auth and request-context adapters.
5
5
  */
6
- import type { KeycloakAccessTokenPayload, KeycloakUser } from "./types.d.cts";
6
+ import type { KeycloakAccessTokenPayload } from "./types.d.cts";
7
7
  export declare const DECAF_ADAPTER_OPTIONS: unique symbol;
8
- export declare function getTokenPayload(jwt: string): KeycloakAccessTokenPayload | null;
9
8
  export declare function extractKeycloakRoles(payload: KeycloakAccessTokenPayload | null): string[];
9
+ export declare function extractKeycloakNamespaces(payload: KeycloakAccessTokenPayload | null | undefined): string[];
10
+ export declare function getRealmFromIssuer(jwt: string): string;
10
11
  /**
11
12
  * Extracts roles from the `resource_access` claim only, optionally excluding
12
13
  * specified client IDs (e.g. `"account"`). Unlike {@link extractKeycloakRoles}
@@ -16,5 +17,3 @@ export declare function extractKeycloakRoles(payload: KeycloakAccessTokenPayload
16
17
  * @param excluded Client IDs to skip. @default ["account"]
17
18
  */
18
19
  export declare function getClientRoles(payload: KeycloakAccessTokenPayload | null, excluded?: string[]): string[];
19
- export declare function getUser(jwt: string): KeycloakUser | undefined;
20
- export declare function getRealmFromIssuer(jwt: string): string;
@@ -3,10 +3,11 @@
3
3
  * @summary Nest integration utilities.
4
4
  * @description Helper functions used by the Nest auth and request-context adapters.
5
5
  */
6
- import type { KeycloakAccessTokenPayload, KeycloakUser } from "./types.d.mts";
6
+ import type { KeycloakAccessTokenPayload } from "./types.d.mts";
7
7
  export declare const DECAF_ADAPTER_OPTIONS: unique symbol;
8
- export declare function getTokenPayload(jwt: string): KeycloakAccessTokenPayload | null;
9
8
  export declare function extractKeycloakRoles(payload: KeycloakAccessTokenPayload | null): string[];
9
+ export declare function extractKeycloakNamespaces(payload: KeycloakAccessTokenPayload | null | undefined): string[];
10
+ export declare function getRealmFromIssuer(jwt: string): string;
10
11
  /**
11
12
  * Extracts roles from the `resource_access` claim only, optionally excluding
12
13
  * specified client IDs (e.g. `"account"`). Unlike {@link extractKeycloakRoles}
@@ -16,5 +17,3 @@ export declare function extractKeycloakRoles(payload: KeycloakAccessTokenPayload
16
17
  * @param excluded Client IDs to skip. @default ["account"]
17
18
  */
18
19
  export declare function getClientRoles(payload: KeycloakAccessTokenPayload | null, excluded?: string[]): string[];
19
- export declare function getUser(jwt: string): KeycloakUser | undefined;
20
- export declare function getRealmFromIssuer(jwt: string): string;