@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,180 @@
1
+ /**
2
+ * @module integrations/plugins/contract
3
+ * @summary Shared, DOM-free contract for BI dashboard embed plugins.
4
+ * @description Defines the message protocol, embed URL options, install
5
+ * options/result, plugin descriptor, and the `DashboardEmbedPlugin` interface
6
+ * that both the Kibana and Superset plugins implement with the exact same API.
7
+ *
8
+ * This contract is intentionally DOM-free (no `window` / `HTMLIFrameElement`)
9
+ * so it builds under the Node `lib: ["es2022"]` tsconfig and is consumable from
10
+ * both Node and the browser. The Angular host supplies a DOM-free
11
+ * `EmbedMessageTarget` (typically `iframe.contentWindow`).
12
+ */
13
+ import type { MaybeContextualArg } from "@decaf-ts/core";
14
+ /**
15
+ * Message type constants shared between the embedded plugin and the host.
16
+ * The plugin is org-agnostic: there is never space switching; the current
17
+ * Kibana space comes from the request/session/proxy context.
18
+ */
19
+ export declare const EMBED_MESSAGE_TYPE: {
20
+ readonly SWITCH: "ORG_DASHBOARD_EMBED_SWITCH_DASHBOARD";
21
+ readonly READY: "ORG_DASHBOARD_EMBED_READY";
22
+ readonly RENDERED: "ORG_DASHBOARD_EMBED_RENDERED";
23
+ readonly ERROR: "ORG_DASHBOARD_EMBED_ERROR";
24
+ };
25
+ export type EmbedMessageType = (typeof EMBED_MESSAGE_TYPE)[keyof typeof EMBED_MESSAGE_TYPE];
26
+ export interface DashboardQuery {
27
+ language: "kuery" | "lucene";
28
+ query: string;
29
+ }
30
+ export interface DashboardTimeRange {
31
+ from: string;
32
+ to: string;
33
+ }
34
+ /**
35
+ * Payload used to switch dashboards at runtime.
36
+ *
37
+ * `guestToken` is used by Superset (which requires a dashboard-scoped guest
38
+ * token for each switch) and ignored by Kibana (which relies on the session
39
+ * space context). This keeps the payload shape identical across both plugins.
40
+ */
41
+ export interface SwitchDashboardPayload {
42
+ dashboardId: string;
43
+ timeRange?: DashboardTimeRange;
44
+ query?: DashboardQuery;
45
+ filters?: unknown[];
46
+ /** Superset-only: dashboard-scoped guest token. Kibana ignores this. */
47
+ guestToken?: string;
48
+ }
49
+ export interface SwitchDashboardMessage extends SwitchDashboardPayload {
50
+ type: typeof EMBED_MESSAGE_TYPE.SWITCH;
51
+ }
52
+ export interface EmbedReadyMessage {
53
+ type: typeof EMBED_MESSAGE_TYPE.READY;
54
+ dashboardId: string | null;
55
+ }
56
+ export interface EmbedRenderedMessage {
57
+ type: typeof EMBED_MESSAGE_TYPE.RENDERED;
58
+ dashboardId: string;
59
+ }
60
+ export interface EmbedErrorMessage {
61
+ type: typeof EMBED_MESSAGE_TYPE.ERROR;
62
+ dashboardId: string | null;
63
+ message: string;
64
+ }
65
+ /**
66
+ * Union of messages the embedded plugin posts back to the parent host.
67
+ */
68
+ export type EmbedParentMessage = EmbedReadyMessage | EmbedRenderedMessage | EmbedErrorMessage;
69
+ /**
70
+ * DOM-free message target. Both Kibana and Superset use the same interface;
71
+ * each tool uses a different mechanism:
72
+ *
73
+ * - **Kibana:** the Angular host passes `iframe.contentWindow`, which provides
74
+ * `postMessage`. `switchDashboard` is unused.
75
+ * - **Superset:** the Angular host passes the embedded SDK's
76
+ * `EmbeddedDashboard` handle (wrapped), which provides `switchDashboard`.
77
+ * `postMessage` is unused.
78
+ *
79
+ * At least one of the two methods must be present; each plugin checks for the
80
+ * mechanism it needs and throws an `UnsupportedError` if absent.
81
+ */
82
+ export interface EmbedMessageTarget {
83
+ /** Kibana mechanism: post a message to the iframe window. */
84
+ postMessage?(message: unknown, targetOrigin: string): void;
85
+ /** Superset mechanism: call the SDK's switchDashboard method. */
86
+ switchDashboard?(dashboardId: string, guestToken?: string): Promise<unknown>;
87
+ }
88
+ export interface EmbedViewOptions {
89
+ showTimeFilter?: boolean;
90
+ showQueryInput?: boolean;
91
+ showFilterBar?: boolean;
92
+ hidePanelTitles?: boolean;
93
+ timeRange?: DashboardTimeRange;
94
+ }
95
+ export interface EmbedUrlOptions {
96
+ /** Host without protocol, e.g. "ptp.host". */
97
+ host: string;
98
+ /** Base path, e.g. "kibana". Defaults to the tool default. */
99
+ basePath?: string;
100
+ /** Initial dashboard id to render. */
101
+ dashboardId: string;
102
+ /** Parent origin allowlist (comma-separated) passed to the plugin. */
103
+ parentOrigin: string;
104
+ /** Optional view overrides. */
105
+ view?: EmbedViewOptions;
106
+ }
107
+ export type BiTool = "kibana" | "superset";
108
+ export interface DashboardEmbedPluginDescriptor {
109
+ /** Plugin id (e.g. "orgDashboardEmbed"). */
110
+ id: string;
111
+ /** Kibana application id (e.g. "org_dashboard_embed"). */
112
+ appId: string;
113
+ /** Plugin version. */
114
+ version: string;
115
+ /** Target BI tool version this plugin is built against. */
116
+ targetVersion: string;
117
+ /** BI tool this plugin targets. */
118
+ tool: BiTool;
119
+ }
120
+ export interface PluginInstallOptions {
121
+ /** Directory to materialize the plugin into. */
122
+ targetPath: string;
123
+ /** Overrides `descriptor.targetVersion` when provided. */
124
+ targetVersion?: string;
125
+ /** Attempt to build the plugin after writing files (best-effort). */
126
+ build?: boolean;
127
+ /** Overwrite an existing plugin directory. */
128
+ overwrite?: boolean;
129
+ /** Optional context for tracing/logging. */
130
+ context?: MaybeContextualArg<any>;
131
+ }
132
+ export interface PluginInstallResult {
133
+ /** Absolute path to the materialized plugin directory. */
134
+ pluginPath: string;
135
+ /** Descriptor used for this install. */
136
+ descriptor: DashboardEmbedPluginDescriptor;
137
+ /** Relative file paths written. */
138
+ files: string[];
139
+ /** Whether a build was attempted and reported success. */
140
+ built: boolean;
141
+ /** Captured build output (stdout/stderr) when `build` was requested. */
142
+ buildOutput?: string;
143
+ }
144
+ /**
145
+ * Contract both BI dashboard embed plugins implement. Both Kibana and
146
+ * Superset plugins expose the exact same API surface.
147
+ */
148
+ export interface DashboardEmbedPlugin {
149
+ readonly descriptor: DashboardEmbedPluginDescriptor;
150
+ /** Build the BI-tool manifest (e.g. kibana.json) for a target version. */
151
+ manifest(targetVersion?: string): Record<string, unknown>;
152
+ /** Build the stable iframe embed URL. */
153
+ buildEmbedUrl(options: EmbedUrlOptions): string;
154
+ /** Create a switch-dashboard message object. */
155
+ createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
156
+ /** Send a switch-dashboard message to the embedded plugin via `postMessage`. */
157
+ sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
158
+ /** Materialize (and optionally build) the plugin into a target directory. */
159
+ install(options: PluginInstallOptions): Promise<PluginInstallResult>;
160
+ }
161
+ /**
162
+ * Type guard for the switch-dashboard message received by the embedded plugin.
163
+ */
164
+ export declare function isSwitchDashboardMessage(data: unknown): data is SwitchDashboardMessage;
165
+ /**
166
+ * Type guard for parent-bound messages emitted by the embedded plugin.
167
+ */
168
+ export declare function isEmbedParentMessage(data: unknown): data is EmbedParentMessage;
169
+ /**
170
+ * Build a switch-dashboard message from a payload (shared by both plugins).
171
+ */
172
+ export declare function createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
173
+ /**
174
+ * Send a switch-dashboard message to a DOM-free target.
175
+ *
176
+ * If the target supports `postMessage` (Kibana), the message is posted
177
+ * directly. If the target supports `switchDashboard` (Superset SDK handle),
178
+ * the SDK method is invoked instead. Both paths use the same payload shape.
179
+ */
180
+ export declare function sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @module integrations/plugins/contract
3
+ * @summary Shared, DOM-free contract for BI dashboard embed plugins.
4
+ * @description Defines the message protocol, embed URL options, install
5
+ * options/result, plugin descriptor, and the `DashboardEmbedPlugin` interface
6
+ * that both the Kibana and Superset plugins implement with the exact same API.
7
+ *
8
+ * This contract is intentionally DOM-free (no `window` / `HTMLIFrameElement`)
9
+ * so it builds under the Node `lib: ["es2022"]` tsconfig and is consumable from
10
+ * both Node and the browser. The Angular host supplies a DOM-free
11
+ * `EmbedMessageTarget` (typically `iframe.contentWindow`).
12
+ */
13
+ import type { MaybeContextualArg } from "@decaf-ts/core";
14
+ /**
15
+ * Message type constants shared between the embedded plugin and the host.
16
+ * The plugin is org-agnostic: there is never space switching; the current
17
+ * Kibana space comes from the request/session/proxy context.
18
+ */
19
+ export declare const EMBED_MESSAGE_TYPE: {
20
+ readonly SWITCH: "ORG_DASHBOARD_EMBED_SWITCH_DASHBOARD";
21
+ readonly READY: "ORG_DASHBOARD_EMBED_READY";
22
+ readonly RENDERED: "ORG_DASHBOARD_EMBED_RENDERED";
23
+ readonly ERROR: "ORG_DASHBOARD_EMBED_ERROR";
24
+ };
25
+ export type EmbedMessageType = (typeof EMBED_MESSAGE_TYPE)[keyof typeof EMBED_MESSAGE_TYPE];
26
+ export interface DashboardQuery {
27
+ language: "kuery" | "lucene";
28
+ query: string;
29
+ }
30
+ export interface DashboardTimeRange {
31
+ from: string;
32
+ to: string;
33
+ }
34
+ /**
35
+ * Payload used to switch dashboards at runtime.
36
+ *
37
+ * `guestToken` is used by Superset (which requires a dashboard-scoped guest
38
+ * token for each switch) and ignored by Kibana (which relies on the session
39
+ * space context). This keeps the payload shape identical across both plugins.
40
+ */
41
+ export interface SwitchDashboardPayload {
42
+ dashboardId: string;
43
+ timeRange?: DashboardTimeRange;
44
+ query?: DashboardQuery;
45
+ filters?: unknown[];
46
+ /** Superset-only: dashboard-scoped guest token. Kibana ignores this. */
47
+ guestToken?: string;
48
+ }
49
+ export interface SwitchDashboardMessage extends SwitchDashboardPayload {
50
+ type: typeof EMBED_MESSAGE_TYPE.SWITCH;
51
+ }
52
+ export interface EmbedReadyMessage {
53
+ type: typeof EMBED_MESSAGE_TYPE.READY;
54
+ dashboardId: string | null;
55
+ }
56
+ export interface EmbedRenderedMessage {
57
+ type: typeof EMBED_MESSAGE_TYPE.RENDERED;
58
+ dashboardId: string;
59
+ }
60
+ export interface EmbedErrorMessage {
61
+ type: typeof EMBED_MESSAGE_TYPE.ERROR;
62
+ dashboardId: string | null;
63
+ message: string;
64
+ }
65
+ /**
66
+ * Union of messages the embedded plugin posts back to the parent host.
67
+ */
68
+ export type EmbedParentMessage = EmbedReadyMessage | EmbedRenderedMessage | EmbedErrorMessage;
69
+ /**
70
+ * DOM-free message target. Both Kibana and Superset use the same interface;
71
+ * each tool uses a different mechanism:
72
+ *
73
+ * - **Kibana:** the Angular host passes `iframe.contentWindow`, which provides
74
+ * `postMessage`. `switchDashboard` is unused.
75
+ * - **Superset:** the Angular host passes the embedded SDK's
76
+ * `EmbeddedDashboard` handle (wrapped), which provides `switchDashboard`.
77
+ * `postMessage` is unused.
78
+ *
79
+ * At least one of the two methods must be present; each plugin checks for the
80
+ * mechanism it needs and throws an `UnsupportedError` if absent.
81
+ */
82
+ export interface EmbedMessageTarget {
83
+ /** Kibana mechanism: post a message to the iframe window. */
84
+ postMessage?(message: unknown, targetOrigin: string): void;
85
+ /** Superset mechanism: call the SDK's switchDashboard method. */
86
+ switchDashboard?(dashboardId: string, guestToken?: string): Promise<unknown>;
87
+ }
88
+ export interface EmbedViewOptions {
89
+ showTimeFilter?: boolean;
90
+ showQueryInput?: boolean;
91
+ showFilterBar?: boolean;
92
+ hidePanelTitles?: boolean;
93
+ timeRange?: DashboardTimeRange;
94
+ }
95
+ export interface EmbedUrlOptions {
96
+ /** Host without protocol, e.g. "ptp.host". */
97
+ host: string;
98
+ /** Base path, e.g. "kibana". Defaults to the tool default. */
99
+ basePath?: string;
100
+ /** Initial dashboard id to render. */
101
+ dashboardId: string;
102
+ /** Parent origin allowlist (comma-separated) passed to the plugin. */
103
+ parentOrigin: string;
104
+ /** Optional view overrides. */
105
+ view?: EmbedViewOptions;
106
+ }
107
+ export type BiTool = "kibana" | "superset";
108
+ export interface DashboardEmbedPluginDescriptor {
109
+ /** Plugin id (e.g. "orgDashboardEmbed"). */
110
+ id: string;
111
+ /** Kibana application id (e.g. "org_dashboard_embed"). */
112
+ appId: string;
113
+ /** Plugin version. */
114
+ version: string;
115
+ /** Target BI tool version this plugin is built against. */
116
+ targetVersion: string;
117
+ /** BI tool this plugin targets. */
118
+ tool: BiTool;
119
+ }
120
+ export interface PluginInstallOptions {
121
+ /** Directory to materialize the plugin into. */
122
+ targetPath: string;
123
+ /** Overrides `descriptor.targetVersion` when provided. */
124
+ targetVersion?: string;
125
+ /** Attempt to build the plugin after writing files (best-effort). */
126
+ build?: boolean;
127
+ /** Overwrite an existing plugin directory. */
128
+ overwrite?: boolean;
129
+ /** Optional context for tracing/logging. */
130
+ context?: MaybeContextualArg<any>;
131
+ }
132
+ export interface PluginInstallResult {
133
+ /** Absolute path to the materialized plugin directory. */
134
+ pluginPath: string;
135
+ /** Descriptor used for this install. */
136
+ descriptor: DashboardEmbedPluginDescriptor;
137
+ /** Relative file paths written. */
138
+ files: string[];
139
+ /** Whether a build was attempted and reported success. */
140
+ built: boolean;
141
+ /** Captured build output (stdout/stderr) when `build` was requested. */
142
+ buildOutput?: string;
143
+ }
144
+ /**
145
+ * Contract both BI dashboard embed plugins implement. Both Kibana and
146
+ * Superset plugins expose the exact same API surface.
147
+ */
148
+ export interface DashboardEmbedPlugin {
149
+ readonly descriptor: DashboardEmbedPluginDescriptor;
150
+ /** Build the BI-tool manifest (e.g. kibana.json) for a target version. */
151
+ manifest(targetVersion?: string): Record<string, unknown>;
152
+ /** Build the stable iframe embed URL. */
153
+ buildEmbedUrl(options: EmbedUrlOptions): string;
154
+ /** Create a switch-dashboard message object. */
155
+ createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
156
+ /** Send a switch-dashboard message to the embedded plugin via `postMessage`. */
157
+ sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
158
+ /** Materialize (and optionally build) the plugin into a target directory. */
159
+ install(options: PluginInstallOptions): Promise<PluginInstallResult>;
160
+ }
161
+ /**
162
+ * Type guard for the switch-dashboard message received by the embedded plugin.
163
+ */
164
+ export declare function isSwitchDashboardMessage(data: unknown): data is SwitchDashboardMessage;
165
+ /**
166
+ * Type guard for parent-bound messages emitted by the embedded plugin.
167
+ */
168
+ export declare function isEmbedParentMessage(data: unknown): data is EmbedParentMessage;
169
+ /**
170
+ * Build a switch-dashboard message from a payload (shared by both plugins).
171
+ */
172
+ export declare function createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
173
+ /**
174
+ * Send a switch-dashboard message to a DOM-free target.
175
+ *
176
+ * If the target supports `postMessage` (Kibana), the message is posted
177
+ * directly. If the target supports `switchDashboard` (Superset SDK handle),
178
+ * the SDK method is invoked instead. Both paths use the same payload shape.
179
+ */
180
+ export declare function sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module integrations/plugins
3
+ * @summary BI dashboard embed plugin surface.
4
+ * @description Aggregates the shared DOM-free contract and both BI tool
5
+ * plugins (Kibana + Superset). Both plugins implement the exact same
6
+ * `DashboardEmbedPlugin` API.
7
+ *
8
+ * - **Kibana:** generated plugin source + installer (writes files, optional build).
9
+ * - **Superset:** patch-and-build strategy (patches Superset's internal source,
10
+ * builds SDK + frontend + optionally Docker image).
11
+ *
12
+ * Both are org-agnostic: there is never space switching. The current BI space
13
+ * comes from the request/session/proxy context, not from the plugin.
14
+ */
15
+ export * from "./contract.d.cts";
16
+ export * from "./kibana/index.d.cts";
17
+ export * from "./superset/index.d.cts";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module integrations/plugins
3
+ * @summary BI dashboard embed plugin surface.
4
+ * @description Aggregates the shared DOM-free contract and both BI tool
5
+ * plugins (Kibana + Superset). Both plugins implement the exact same
6
+ * `DashboardEmbedPlugin` API.
7
+ *
8
+ * - **Kibana:** generated plugin source + installer (writes files, optional build).
9
+ * - **Superset:** patch-and-build strategy (patches Superset's internal source,
10
+ * builds SDK + frontend + optionally Docker image).
11
+ *
12
+ * Both are org-agnostic: there is never space switching. The current BI space
13
+ * comes from the request/session/proxy context, not from the plugin.
14
+ */
15
+ export * from "./contract.d.mts";
16
+ export * from "./kibana/index.d.mts";
17
+ export * from "./superset/index.d.mts";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module integrations/plugins/kibana/host
3
+ * @summary Angular host-side helpers for the Kibana embed plugin.
4
+ * @description DOM-free convenience helpers the Angular host uses to build the
5
+ * stable iframe URL and send switch-dashboard messages to the embedded plugin.
6
+ */
7
+ import { type EmbedMessageTarget, type EmbedUrlOptions, type SwitchDashboardPayload } from "../contract.d.cts";
8
+ import { buildKibanaEmbedUrl } from "./installer.d.cts";
9
+ export { buildKibanaEmbedUrl };
10
+ /**
11
+ * Send a switch-dashboard message to the embedded Kibana plugin.
12
+ *
13
+ * The Angular host passes `iframe.contentWindow` (which satisfies
14
+ * `EmbedMessageTarget`) and the Kibana origin as `targetOrigin`.
15
+ */
16
+ export declare function sendKibanaSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
17
+ /** Re-export the URL options type for host convenience. */
18
+ export type { EmbedUrlOptions };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module integrations/plugins/kibana/host
3
+ * @summary Angular host-side helpers for the Kibana embed plugin.
4
+ * @description DOM-free convenience helpers the Angular host uses to build the
5
+ * stable iframe URL and send switch-dashboard messages to the embedded plugin.
6
+ */
7
+ import { type EmbedMessageTarget, type EmbedUrlOptions, type SwitchDashboardPayload } from "../contract.d.mts";
8
+ import { buildKibanaEmbedUrl } from "./installer.d.mts";
9
+ export { buildKibanaEmbedUrl };
10
+ /**
11
+ * Send a switch-dashboard message to the embedded Kibana plugin.
12
+ *
13
+ * The Angular host passes `iframe.contentWindow` (which satisfies
14
+ * `EmbedMessageTarget`) and the Kibana origin as `targetOrigin`.
15
+ */
16
+ export declare function sendKibanaSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
17
+ /** Re-export the URL options type for host convenience. */
18
+ export type { EmbedUrlOptions };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module integrations/plugins/kibana
3
+ * @summary Kibana dashboard embed plugin surface.
4
+ * @description Org-agnostic multi-tenant Kibana dashboard embed plugin,
5
+ * installer, and host helpers. There is never space switching; the current
6
+ * Kibana space comes from the request/session/proxy context.
7
+ */
8
+ export * from "../contract.d.cts";
9
+ export * from "./types.d.cts";
10
+ export * from "./manifest.d.cts";
11
+ export * from "./templates.d.cts";
12
+ export { KibanaDashboardEmbedPlugin, kibanaDashboardEmbedPlugin, createKibanaDashboardEmbedPlugin, buildKibanaEmbedUrl, KIBANA_DEFAULT_BASE_PATH, } from "./installer.d.cts";
13
+ export { sendKibanaSwitchDashboardMessage, } from "./host.d.cts";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module integrations/plugins/kibana
3
+ * @summary Kibana dashboard embed plugin surface.
4
+ * @description Org-agnostic multi-tenant Kibana dashboard embed plugin,
5
+ * installer, and host helpers. There is never space switching; the current
6
+ * Kibana space comes from the request/session/proxy context.
7
+ */
8
+ export * from "../contract.d.mts";
9
+ export * from "./types.d.mts";
10
+ export * from "./manifest.d.mts";
11
+ export * from "./templates.d.mts";
12
+ export { KibanaDashboardEmbedPlugin, kibanaDashboardEmbedPlugin, createKibanaDashboardEmbedPlugin, buildKibanaEmbedUrl, KIBANA_DEFAULT_BASE_PATH, } from "./installer.d.mts";
13
+ export { sendKibanaSwitchDashboardMessage, } from "./host.d.mts";
@@ -0,0 +1,45 @@
1
+ import { type DashboardEmbedPlugin, type DashboardEmbedPluginDescriptor, type EmbedUrlOptions, type PluginInstallOptions, type PluginInstallResult, type SwitchDashboardPayload, type SwitchDashboardMessage, type EmbedMessageTarget } from "../contract.d.cts";
2
+ /** Default Kibana base path when none is provided. */
3
+ export declare const KIBANA_DEFAULT_BASE_PATH = "kibana";
4
+ /**
5
+ * Build the stable Kibana embed iframe URL.
6
+ *
7
+ * @example
8
+ * buildKibanaEmbedUrl({ host: "ptp.host", dashboardId: "abc", parentOrigin: "https://app.example.com" })
9
+ * // => "//ptp.host/kibana/app/org_dashboard_embed?dashboardId=abc&parentOrigin=https%3A%2F%2Fapp.example.com"
10
+ */
11
+ export declare function buildKibanaEmbedUrl(options: EmbedUrlOptions): string;
12
+ /**
13
+ * @class KibanaDashboardEmbedPlugin
14
+ * @summary Kibana implementation of the `DashboardEmbedPlugin` contract.
15
+ * @description Org-agnostic multi-tenant dashboard embed plugin for Kibana.
16
+ */
17
+ export declare class KibanaDashboardEmbedPlugin implements DashboardEmbedPlugin {
18
+ readonly descriptor: DashboardEmbedPluginDescriptor;
19
+ constructor(targetVersion?: string);
20
+ manifest(targetVersion?: string): Record<string, unknown>;
21
+ buildEmbedUrl(options: EmbedUrlOptions): string;
22
+ createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
23
+ sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
24
+ /**
25
+ * Materialize the generated Kibana plugin into `targetPath/org_dashboard_embed/`.
26
+ *
27
+ * Kibana plugins must be built within the Kibana repo against the exact
28
+ * Kibana version. When `build` is true, this attempts `yarn build` in the
29
+ * plugin directory (best-effort); real builds require the Kibana plugin
30
+ * helpers environment.
31
+ */
32
+ install(options: PluginInstallOptions): Promise<PluginInstallResult>;
33
+ /**
34
+ * Best-effort `yarn build` in the plugin directory. Real builds require the
35
+ * Kibana plugin helpers environment; failures are captured, not thrown.
36
+ */
37
+ protected runBuild(pluginDir: string): Promise<{
38
+ ok: boolean;
39
+ output: string;
40
+ }>;
41
+ }
42
+ /** Default singleton instance. */
43
+ export declare const kibanaDashboardEmbedPlugin: KibanaDashboardEmbedPlugin;
44
+ /** Factory accepting a target Kibana version. */
45
+ export declare function createKibanaDashboardEmbedPlugin(targetVersion: string): KibanaDashboardEmbedPlugin;
@@ -0,0 +1,45 @@
1
+ import { type DashboardEmbedPlugin, type DashboardEmbedPluginDescriptor, type EmbedUrlOptions, type PluginInstallOptions, type PluginInstallResult, type SwitchDashboardPayload, type SwitchDashboardMessage, type EmbedMessageTarget } from "../contract.d.mts";
2
+ /** Default Kibana base path when none is provided. */
3
+ export declare const KIBANA_DEFAULT_BASE_PATH = "kibana";
4
+ /**
5
+ * Build the stable Kibana embed iframe URL.
6
+ *
7
+ * @example
8
+ * buildKibanaEmbedUrl({ host: "ptp.host", dashboardId: "abc", parentOrigin: "https://app.example.com" })
9
+ * // => "//ptp.host/kibana/app/org_dashboard_embed?dashboardId=abc&parentOrigin=https%3A%2F%2Fapp.example.com"
10
+ */
11
+ export declare function buildKibanaEmbedUrl(options: EmbedUrlOptions): string;
12
+ /**
13
+ * @class KibanaDashboardEmbedPlugin
14
+ * @summary Kibana implementation of the `DashboardEmbedPlugin` contract.
15
+ * @description Org-agnostic multi-tenant dashboard embed plugin for Kibana.
16
+ */
17
+ export declare class KibanaDashboardEmbedPlugin implements DashboardEmbedPlugin {
18
+ readonly descriptor: DashboardEmbedPluginDescriptor;
19
+ constructor(targetVersion?: string);
20
+ manifest(targetVersion?: string): Record<string, unknown>;
21
+ buildEmbedUrl(options: EmbedUrlOptions): string;
22
+ createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
23
+ sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
24
+ /**
25
+ * Materialize the generated Kibana plugin into `targetPath/org_dashboard_embed/`.
26
+ *
27
+ * Kibana plugins must be built within the Kibana repo against the exact
28
+ * Kibana version. When `build` is true, this attempts `yarn build` in the
29
+ * plugin directory (best-effort); real builds require the Kibana plugin
30
+ * helpers environment.
31
+ */
32
+ install(options: PluginInstallOptions): Promise<PluginInstallResult>;
33
+ /**
34
+ * Best-effort `yarn build` in the plugin directory. Real builds require the
35
+ * Kibana plugin helpers environment; failures are captured, not thrown.
36
+ */
37
+ protected runBuild(pluginDir: string): Promise<{
38
+ ok: boolean;
39
+ output: string;
40
+ }>;
41
+ }
42
+ /** Default singleton instance. */
43
+ export declare const kibanaDashboardEmbedPlugin: KibanaDashboardEmbedPlugin;
44
+ /** Factory accepting a target Kibana version. */
45
+ export declare function createKibanaDashboardEmbedPlugin(targetVersion: string): KibanaDashboardEmbedPlugin;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module integrations/plugins/kibana/manifest
3
+ * @summary Kibana embed plugin manifest builder.
4
+ * @description Builds the `kibana.json` manifest for the org-agnostic
5
+ * `orgDashboardEmbed` plugin against a target Kibana version.
6
+ */
7
+ import { EMBED_MESSAGE_TYPE } from "../contract.d.cts";
8
+ export declare const KIBANA_PLUGIN_ID = "orgDashboardEmbed";
9
+ export declare const KIBANA_APP_ID = "org_dashboard_embed";
10
+ export declare const KIBANA_PLUGIN_VERSION = "1.0.0";
11
+ export interface KibanaManifest {
12
+ id: string;
13
+ version: string;
14
+ kibanaVersion: string;
15
+ server: boolean;
16
+ ui: boolean;
17
+ requiredPlugins: string[];
18
+ optionalPlugins: string[];
19
+ requiredBundles?: string[];
20
+ }
21
+ /**
22
+ * Build the `kibana.json` manifest for a target Kibana version.
23
+ *
24
+ * @param targetVersion - Kibana version (defaults to "kibana").
25
+ */
26
+ export declare function buildKibanaManifest(targetVersion?: string): KibanaManifest;
27
+ /**
28
+ * Message type constants re-exported so the generated plugin templates can
29
+ * reference the same protocol identifiers as the host helpers.
30
+ */
31
+ export { EMBED_MESSAGE_TYPE };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @module integrations/plugins/kibana/manifest
3
+ * @summary Kibana embed plugin manifest builder.
4
+ * @description Builds the `kibana.json` manifest for the org-agnostic
5
+ * `orgDashboardEmbed` plugin against a target Kibana version.
6
+ */
7
+ import { EMBED_MESSAGE_TYPE } from "../contract.d.mts";
8
+ export declare const KIBANA_PLUGIN_ID = "orgDashboardEmbed";
9
+ export declare const KIBANA_APP_ID = "org_dashboard_embed";
10
+ export declare const KIBANA_PLUGIN_VERSION = "1.0.0";
11
+ export interface KibanaManifest {
12
+ id: string;
13
+ version: string;
14
+ kibanaVersion: string;
15
+ server: boolean;
16
+ ui: boolean;
17
+ requiredPlugins: string[];
18
+ optionalPlugins: string[];
19
+ requiredBundles?: string[];
20
+ }
21
+ /**
22
+ * Build the `kibana.json` manifest for a target Kibana version.
23
+ *
24
+ * @param targetVersion - Kibana version (defaults to "kibana").
25
+ */
26
+ export declare function buildKibanaManifest(targetVersion?: string): KibanaManifest;
27
+ /**
28
+ * Message type constants re-exported so the generated plugin templates can
29
+ * reference the same protocol identifiers as the host helpers.
30
+ */
31
+ export { EMBED_MESSAGE_TYPE };
@@ -0,0 +1,12 @@
1
+ export interface KibanaPluginFile {
2
+ /** Relative path within the plugin directory. */
3
+ path: string;
4
+ /** File contents. */
5
+ content: string;
6
+ }
7
+ /**
8
+ * Returns the full set of generated plugin files for a target Kibana version.
9
+ *
10
+ * @param targetVersion - Kibana version baked into `kibana.json`.
11
+ */
12
+ export declare function kibanaPluginFiles(targetVersion: string): KibanaPluginFile[];
@@ -0,0 +1,12 @@
1
+ export interface KibanaPluginFile {
2
+ /** Relative path within the plugin directory. */
3
+ path: string;
4
+ /** File contents. */
5
+ content: string;
6
+ }
7
+ /**
8
+ * Returns the full set of generated plugin files for a target Kibana version.
9
+ *
10
+ * @param targetVersion - Kibana version baked into `kibana.json`.
11
+ */
12
+ export declare function kibanaPluginFiles(targetVersion: string): KibanaPluginFile[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @module integrations/plugins/kibana/types
3
+ * @summary Kibana embed plugin types.
4
+ * @description Re-exports the shared contract types and exposes Kibana-specific
5
+ * constants/types for the org-agnostic dashboard embed plugin.
6
+ */
7
+ export * from "../contract.d.cts";
8
+ export { KIBANA_PLUGIN_ID, KIBANA_APP_ID, KIBANA_PLUGIN_VERSION, buildKibanaManifest, type KibanaManifest, } from "./manifest.d.cts";
9
+ export { kibanaPluginFiles, type KibanaPluginFile } from "./templates.d.cts";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @module integrations/plugins/kibana/types
3
+ * @summary Kibana embed plugin types.
4
+ * @description Re-exports the shared contract types and exposes Kibana-specific
5
+ * constants/types for the org-agnostic dashboard embed plugin.
6
+ */
7
+ export * from "../contract.d.mts";
8
+ export { KIBANA_PLUGIN_ID, KIBANA_APP_ID, KIBANA_PLUGIN_VERSION, buildKibanaManifest, type KibanaManifest, } from "./manifest.d.mts";
9
+ export { kibanaPluginFiles, type KibanaPluginFile } from "./templates.d.mts";