brix-runtime-sdk-api-web 1.0.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 (135) hide show
  1. package/dist/index.js +190 -0
  2. package/dist/types/api-exports.test.d.ts +33 -0
  3. package/dist/types/api-exports.test.d.ts.map +1 -0
  4. package/dist/types/context/RuntimeContext.d.ts +69 -0
  5. package/dist/types/context/RuntimeContext.d.ts.map +1 -0
  6. package/dist/types/context/index.d.ts +23 -0
  7. package/dist/types/context/index.d.ts.map +1 -0
  8. package/dist/types/index.d.ts +52 -0
  9. package/dist/types/index.d.ts.map +1 -0
  10. package/dist/types/types/auth.d.ts +405 -0
  11. package/dist/types/types/auth.d.ts.map +1 -0
  12. package/dist/types/types/capability.d.ts +218 -0
  13. package/dist/types/types/capability.d.ts.map +1 -0
  14. package/dist/types/types/common.d.ts +99 -0
  15. package/dist/types/types/common.d.ts.map +1 -0
  16. package/dist/types/types/config.d.ts +85 -0
  17. package/dist/types/types/config.d.ts.map +1 -0
  18. package/dist/types/types/event.d.ts +658 -0
  19. package/dist/types/types/event.d.ts.map +1 -0
  20. package/dist/types/types/http.d.ts +132 -0
  21. package/dist/types/types/http.d.ts.map +1 -0
  22. package/dist/types/types/i18n.d.ts +327 -0
  23. package/dist/types/types/i18n.d.ts.map +1 -0
  24. package/dist/types/types/index.d.ts +61 -0
  25. package/dist/types/types/index.d.ts.map +1 -0
  26. package/dist/types/types/layout.d.ts +301 -0
  27. package/dist/types/types/layout.d.ts.map +1 -0
  28. package/dist/types/types/module.d.ts +78 -0
  29. package/dist/types/types/module.d.ts.map +1 -0
  30. package/dist/types/types/navigation.d.ts +295 -0
  31. package/dist/types/types/navigation.d.ts.map +1 -0
  32. package/dist/types/types/plugin-loader-capability.d.ts +142 -0
  33. package/dist/types/types/plugin-loader-capability.d.ts.map +1 -0
  34. package/dist/types/types/plugin.d.ts +250 -0
  35. package/dist/types/types/plugin.d.ts.map +1 -0
  36. package/dist/types/types/state.d.ts +306 -0
  37. package/dist/types/types/state.d.ts.map +1 -0
  38. package/dist/types/types/theme.d.ts +279 -0
  39. package/dist/types/types/theme.d.ts.map +1 -0
  40. package/dist/types/types/ui/adapter.d.ts +181 -0
  41. package/dist/types/types/ui/adapter.d.ts.map +1 -0
  42. package/dist/types/types/ui/avatar.d.ts +102 -0
  43. package/dist/types/types/ui/avatar.d.ts.map +1 -0
  44. package/dist/types/types/ui/badge.d.ts +101 -0
  45. package/dist/types/types/ui/badge.d.ts.map +1 -0
  46. package/dist/types/types/ui/button.d.ts +135 -0
  47. package/dist/types/types/ui/button.d.ts.map +1 -0
  48. package/dist/types/types/ui/card.d.ts +105 -0
  49. package/dist/types/types/ui/card.d.ts.map +1 -0
  50. package/dist/types/types/ui/common.d.ts +29 -0
  51. package/dist/types/types/ui/common.d.ts.map +1 -0
  52. package/dist/types/types/ui/icon.d.ts +78 -0
  53. package/dist/types/types/ui/icon.d.ts.map +1 -0
  54. package/dist/types/types/ui/index.d.ts +59 -0
  55. package/dist/types/types/ui/index.d.ts.map +1 -0
  56. package/dist/types/types/ui/input.d.ts +200 -0
  57. package/dist/types/types/ui/input.d.ts.map +1 -0
  58. package/dist/types/types/ui/menu.d.ts +211 -0
  59. package/dist/types/types/ui/menu.d.ts.map +1 -0
  60. package/dist/types/types/ui/message.d.ts +121 -0
  61. package/dist/types/types/ui/message.d.ts.map +1 -0
  62. package/dist/types/types/ui/modal.d.ts +167 -0
  63. package/dist/types/types/ui/modal.d.ts.map +1 -0
  64. package/dist/types/types/ui/select.d.ts +213 -0
  65. package/dist/types/types/ui/select.d.ts.map +1 -0
  66. package/dist/types/types/ui/theme-tokens.d.ts +226 -0
  67. package/dist/types/types/ui/theme-tokens.d.ts.map +1 -0
  68. package/dist/types/types/ui/tooltip.d.ts +98 -0
  69. package/dist/types/types/ui/tooltip.d.ts.map +1 -0
  70. package/dist/types/types/ui.d.ts +49 -0
  71. package/dist/types/types/ui.d.ts.map +1 -0
  72. package/package.json +34 -0
  73. package/src/api-exports.test.ts +199 -0
  74. package/src/context/RuntimeContext.d.ts +69 -0
  75. package/src/context/RuntimeContext.d.ts.map +1 -0
  76. package/src/context/RuntimeContext.ts +75 -0
  77. package/src/context/index.d.ts +23 -0
  78. package/src/context/index.d.ts.map +1 -0
  79. package/src/context/index.ts +23 -0
  80. package/src/index.d.ts +52 -0
  81. package/src/index.d.ts.map +1 -0
  82. package/src/index.ts +59 -0
  83. package/src/types/auth.d.ts +146 -0
  84. package/src/types/auth.d.ts.map +1 -0
  85. package/src/types/auth.ts +479 -0
  86. package/src/types/capability.d.ts +218 -0
  87. package/src/types/capability.d.ts.map +1 -0
  88. package/src/types/capability.ts +302 -0
  89. package/src/types/common.d.ts +99 -0
  90. package/src/types/common.d.ts.map +1 -0
  91. package/src/types/common.ts +115 -0
  92. package/src/types/config.d.ts +64 -0
  93. package/src/types/config.d.ts.map +1 -0
  94. package/src/types/config.ts +96 -0
  95. package/src/types/event.d.ts +206 -0
  96. package/src/types/event.d.ts.map +1 -0
  97. package/src/types/event.ts +776 -0
  98. package/src/types/http.d.ts +132 -0
  99. package/src/types/http.d.ts.map +1 -0
  100. package/src/types/http.ts +156 -0
  101. package/src/types/i18n.ts +420 -0
  102. package/src/types/index.d.ts +50 -0
  103. package/src/types/index.d.ts.map +1 -0
  104. package/src/types/index.ts +120 -0
  105. package/src/types/layout.ts +394 -0
  106. package/src/types/module.d.ts +78 -0
  107. package/src/types/module.d.ts.map +1 -0
  108. package/src/types/module.ts +92 -0
  109. package/src/types/navigation.d.ts +101 -0
  110. package/src/types/navigation.d.ts.map +1 -0
  111. package/src/types/navigation.ts +361 -0
  112. package/src/types/plugin-loader-capability.ts +159 -0
  113. package/src/types/plugin.d.ts +250 -0
  114. package/src/types/plugin.d.ts.map +1 -0
  115. package/src/types/plugin.ts +344 -0
  116. package/src/types/state.d.ts +119 -0
  117. package/src/types/state.d.ts.map +1 -0
  118. package/src/types/state.ts +366 -0
  119. package/src/types/theme.ts +378 -0
  120. package/src/types/ui/adapter.ts +222 -0
  121. package/src/types/ui/avatar.ts +113 -0
  122. package/src/types/ui/badge.ts +112 -0
  123. package/src/types/ui/button.ts +148 -0
  124. package/src/types/ui/card.ts +116 -0
  125. package/src/types/ui/common.ts +29 -0
  126. package/src/types/ui/icon.ts +85 -0
  127. package/src/types/ui/index.ts +78 -0
  128. package/src/types/ui/input.ts +225 -0
  129. package/src/types/ui/menu.ts +237 -0
  130. package/src/types/ui/message.ts +135 -0
  131. package/src/types/ui/modal.ts +188 -0
  132. package/src/types/ui/select.ts +239 -0
  133. package/src/types/ui/theme-tokens.ts +357 -0
  134. package/src/types/ui/tooltip.ts +120 -0
  135. package/src/types/ui.ts +49 -0
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright 2026 Brix Platform Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * @file Common Type Definitions
18
+ * @description Defines utility types and API response types
19
+ * @module @brix/runtime-sdk-api-web/types/common
20
+ * @version 3.2.0
21
+ *
22
+ * [v3.2 Changes]
23
+ * Extracted from index.ts into a standalone type file.
24
+ */
25
+
26
+ // =========================================
27
+ // Utility Types
28
+ // =========================================
29
+
30
+ /**
31
+ * Optional Fields
32
+ *
33
+ * <p>Makes specified fields optional.</p>
34
+ */
35
+ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
36
+
37
+ /**
38
+ * Required Fields
39
+ *
40
+ * <p>Makes specified fields required. Named to avoid conflict with built-in Required.</p>
41
+ */
42
+ export type RequiredFields<T, K extends keyof T> = T & { [P in K]-?: T[P] };
43
+
44
+ /**
45
+ * Deep Readonly
46
+ *
47
+ * <p>Recursively makes all properties readonly.</p>
48
+ */
49
+ export type DeepReadonly<T> = {
50
+ readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
51
+ };
52
+
53
+ // =========================================
54
+ // API Response Types
55
+ // =========================================
56
+
57
+ /**
58
+ * Standard API Response
59
+ */
60
+ export interface ApiResponse<T = unknown> {
61
+ /** Whether Successful */
62
+ readonly success: boolean;
63
+ /** Response Data */
64
+ readonly data?: T;
65
+ /** Error Information */
66
+ readonly error?: ApiError;
67
+ /** Timestamp */
68
+ readonly timestamp: number;
69
+ }
70
+
71
+ /**
72
+ * API Error
73
+ */
74
+ export interface ApiError {
75
+ /** Error Code */
76
+ readonly code: string;
77
+ /** Error Message */
78
+ readonly message: string;
79
+ /** Details */
80
+ readonly details?: Record<string, unknown>;
81
+ }
82
+
83
+ // =========================================
84
+ // Pagination Types
85
+ // =========================================
86
+
87
+ /**
88
+ * Paged Response
89
+ */
90
+ export interface PagedResponse<T> {
91
+ /** Data List */
92
+ readonly items: T[];
93
+ /** Total Count */
94
+ readonly total: number;
95
+ /** Current Page */
96
+ readonly page: number;
97
+ /** Page Size */
98
+ readonly pageSize: number;
99
+ /** Total Pages */
100
+ readonly totalPages: number;
101
+ }
102
+
103
+ /**
104
+ * Paged Request
105
+ */
106
+ export interface PagedRequest {
107
+ /** Current Page */
108
+ readonly page: number;
109
+ /** Page Size */
110
+ readonly pageSize: number;
111
+ /** Sort Field */
112
+ readonly sort?: string;
113
+ /** Sort Direction */
114
+ readonly order?: 'asc' | 'desc';
115
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Copyright 2026 Brix Platform Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * @file Configuration Capability Type Definitions
18
+ * @description Defines core types for the configuration management system
19
+ * @module @brix/runtime-sdk-api-web/types/config
20
+ * @version 3.2.0
21
+ *
22
+ * [v3.2 Changes]
23
+ * Extracted from index.ts into a standalone type file.
24
+ */
25
+ /**
26
+ * Configuration Capability Type Identifier
27
+ */
28
+ export declare const ConfigCapabilityType: unique symbol;
29
+ /**
30
+ * Configuration Capability Contract
31
+ *
32
+ * <p>Provides runtime configuration reading capability for plugins.</p>
33
+ *
34
+ * <h3>Usage Example</h3>
35
+ * ```typescript
36
+ * const config = context.getCapability<ConfigCapability>(ConfigCapabilityType);
37
+ * const apiBase = config.get<string>('api.baseUrl', '/api/v1');
38
+ * const timeout = config.get<number>('http.timeout', 30000);
39
+ * ```
40
+ *
41
+ * <h3>Configuration Sources</h3>
42
+ * <ul>
43
+ * <li>Environment Variables</li>
44
+ * <li>Configuration Center</li>
45
+ * <li>Manifest Files</li>
46
+ * </ul>
47
+ */
48
+ export interface ConfigCapability {
49
+ /**
50
+ * Get configuration item
51
+ *
52
+ * @param key Configuration key
53
+ * @param defaultValue Default value
54
+ * @returns Configuration value
55
+ */
56
+ get<T>(key: string, defaultValue?: T): T;
57
+ /**
58
+ * Get all configurations
59
+ *
60
+ * @returns Configuration object (supports sync/async)
61
+ */
62
+ getAll<T = Record<string, unknown>>(): T | Promise<T>;
63
+ }
64
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AAMnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEzC;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACvD"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copyright 2026 Brix Platform Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * @file Configuration Capability Type Definitions
18
+ * @description Defines core types for the configuration management system
19
+ * @module @brix/runtime-sdk-api-web/types/config
20
+ * @version 3.2.0
21
+ *
22
+ * [v3.2 Changes]
23
+ * Extracted from index.ts into a standalone type file.
24
+ *
25
+ * [v3.1 Changes]
26
+ * Added ConfigStoreCapability alias for Java/TS naming alignment.
27
+ * ConfigCapability is now deprecated, use ConfigStoreCapability instead.
28
+ */
29
+
30
+ // =========================================
31
+ // Configuration Capability Type Identifier
32
+ // =========================================
33
+
34
+ /**
35
+ * Configuration Capability Type Identifier
36
+ */
37
+ export const ConfigCapabilityType = Symbol.for('ConfigCapability');
38
+
39
+ /**
40
+ * Configuration Store Capability Type Identifier (Aligned with Java naming)
41
+ * @since 3.1.0
42
+ */
43
+ export const ConfigStoreCapabilityType = Symbol.for('ConfigStoreCapability');
44
+
45
+ // =========================================
46
+ // Configuration Capability Contract
47
+ // =========================================
48
+
49
+ /**
50
+ * Configuration Store Capability Contract
51
+ *
52
+ * <p>Provides runtime configuration reading capability for plugins.</p>
53
+ *
54
+ * <p>This is the canonical name aligned with Java SDK (ConfigStoreCapability).</p>
55
+ *
56
+ * <h3>Usage Example</h3>
57
+ * ```typescript
58
+ * const config = context.getCapability<ConfigStoreCapability>(ConfigStoreCapabilityType);
59
+ * const apiBase = config.get<string>('api.baseUrl', '/api/v1');
60
+ * const timeout = config.get<number>('http.timeout', 30000);
61
+ * ```
62
+ *
63
+ * <h3>Configuration Sources</h3>
64
+ * <ul>
65
+ * <li>Environment Variables</li>
66
+ * <li>Configuration Center</li>
67
+ * <li>Manifest Files</li>
68
+ * </ul>
69
+ *
70
+ * @since 3.1.0
71
+ */
72
+ export interface ConfigStoreCapability {
73
+ /**
74
+ * Get configuration item
75
+ *
76
+ * @param key Configuration key
77
+ * @param defaultValue Default value
78
+ * @returns Configuration value
79
+ */
80
+ get<T>(key: string, defaultValue?: T): T;
81
+
82
+ /**
83
+ * Get all configurations
84
+ *
85
+ * @returns Configuration object (supports sync/async)
86
+ */
87
+ getAll<T = Record<string, unknown>>(): T | Promise<T>;
88
+ }
89
+
90
+ /**
91
+ * Configuration Capability Contract
92
+ *
93
+ * @deprecated Use ConfigStoreCapability instead for Java/TS naming alignment.
94
+ * Will be removed in v4.0.0.
95
+ */
96
+ export interface ConfigCapability extends ConfigStoreCapability {}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Copyright 2026 Brix Platform Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * @file Event-Related Type Definitions
18
+ * @description Defines core types for the event system, including event messages, handlers, subscription options, etc.
19
+ * @module @brix/runtime-sdk-api-web/types/event
20
+ * @version 3.2.0
21
+ *
22
+ * [v3.2 Changes]
23
+ * Extracted from index.ts into a standalone type file.
24
+ *
25
+ * [Design Principles]
26
+ * - Supports both simple Event Bus and Governed Event Bus modes
27
+ * - Governed Event Bus provides complete event metadata and audit information
28
+ */
29
+ /**
30
+ * Event Message
31
+ *
32
+ * <p>Encapsulates complete event information including type, payload, timestamp, and source.</p>
33
+ */
34
+ export interface EventMessage<T = unknown> {
35
+ /** Event Type */
36
+ readonly eventType: string;
37
+ /** Event Payload */
38
+ readonly payload: T;
39
+ /** Timestamp */
40
+ readonly timestamp: number;
41
+ /** Event Source (Plugin ID) */
42
+ readonly source?: string;
43
+ }
44
+ /**
45
+ * Event Subscription Options
46
+ */
47
+ export interface SubscriptionOptions {
48
+ /** Whether to trigger only once */
49
+ readonly once?: boolean;
50
+ /** Filter function */
51
+ readonly filter?: (payload: unknown) => boolean;
52
+ }
53
+ /**
54
+ * Event Handler
55
+ *
56
+ * @typeParam T - Event payload type
57
+ */
58
+ export type EventHandler<T = unknown> = (payload: T) => void;
59
+ /**
60
+ * Unsubscribe Function
61
+ */
62
+ export type Unsubscribe = () => void;
63
+ /**
64
+ * Event Bus Capability Type Identifier
65
+ */
66
+ export declare const EventBusCapabilityType: unique symbol;
67
+ /**
68
+ * Event Bus Capability Contract
69
+ *
70
+ * <p>Provides cross-plugin communication capability for plugins.</p>
71
+ *
72
+ * <h3>Usage Example</h3>
73
+ * ```typescript
74
+ * const eventBus = context.getCapability<EventBusCapability>(EventBusCapabilityType);
75
+ *
76
+ * // Emit event
77
+ * eventBus.emit('booking:selected', { bookingId: '123' });
78
+ *
79
+ * // Subscribe to event
80
+ * const unsubscribe = eventBus.on('booking:selected', (payload) => {
81
+ * console.log('Booking selected:', payload);
82
+ * });
83
+ * ```
84
+ */
85
+ export interface EventBusCapability {
86
+ /**
87
+ * Emit event
88
+ *
89
+ * @param eventType Event type
90
+ * @param payload Event payload
91
+ */
92
+ emit(eventType: string, payload: unknown): void;
93
+ /**
94
+ * Subscribe to event
95
+ *
96
+ * @param eventType Event type
97
+ * @param handler Event handler
98
+ * @returns Unsubscribe function
99
+ */
100
+ on(eventType: string, handler: EventHandler): () => void;
101
+ /**
102
+ * Unsubscribe from event
103
+ *
104
+ * @param eventType Event type
105
+ * @param handler Event handler
106
+ */
107
+ off(eventType: string, handler: EventHandler): void;
108
+ }
109
+ /**
110
+ * Governed Event Bus Capability Type Identifier
111
+ */
112
+ export declare const GovernedEventBusCapabilityType: unique symbol;
113
+ /**
114
+ * Governed Event
115
+ *
116
+ * <p>Event containing complete metadata for observability and auditing.</p>
117
+ */
118
+ export interface GovernedEvent<T = unknown> {
119
+ /** Event Type */
120
+ readonly type: string;
121
+ /** Event Payload */
122
+ readonly payload: T;
123
+ /** Event Metadata */
124
+ readonly metadata: GovernedEventMetadata;
125
+ }
126
+ /**
127
+ * Governed Event Metadata
128
+ */
129
+ export interface GovernedEventMetadata {
130
+ /** Event ID (Unique Identifier) */
131
+ readonly eventId: string;
132
+ /** Emit Timestamp */
133
+ readonly timestamp: number;
134
+ /** Sender (Plugin ID) */
135
+ readonly source: string;
136
+ /** Tenant ID */
137
+ readonly tenantId?: string;
138
+ /**
139
+ * Event Scope
140
+ * - 'plugin': Visible only within the plugin
141
+ * - 'host': Globally visible
142
+ */
143
+ readonly scope: 'plugin' | 'host';
144
+ }
145
+ /**
146
+ * Governed Event Handler Function
147
+ */
148
+ export type GovernedEventHandler<T = unknown> = (event: GovernedEvent<T>) => void;
149
+ /**
150
+ * Governed Event Bus Capability Contract
151
+ *
152
+ * <p>Unlike the simple EventBusCapability, GovernedEventBusCapability provides:</p>
153
+ * <ul>
154
+ * <li>Automatic injection of event metadata (eventId, timestamp, source)</li>
155
+ * <li>Event scope control (plugin/host)</li>
156
+ * <li>Complete event audit information</li>
157
+ * </ul>
158
+ *
159
+ * <h3>Usage Example</h3>
160
+ * ```typescript
161
+ * const eventBus = context.getCapability<GovernedEventBusCapability>(GovernedEventBusCapabilityType);
162
+ *
163
+ * // Emit global event
164
+ * eventBus.emit('booking:created', { bookingId: '123' }, 'host');
165
+ *
166
+ * // Subscribe to event (receive complete metadata)
167
+ * eventBus.on('booking:created', (event) => {
168
+ * console.log(`Event ${event.metadata.eventId} from ${event.metadata.source}`);
169
+ * console.log('Payload:', event.payload);
170
+ * });
171
+ * ```
172
+ */
173
+ export interface GovernedEventBusCapability {
174
+ /**
175
+ * Emit Event
176
+ *
177
+ * @param eventType Event type
178
+ * @param payload Event payload
179
+ * @param scope Event scope (default 'host')
180
+ */
181
+ emit<T = unknown>(eventType: string, payload: T, scope?: 'plugin' | 'host'): void;
182
+ /**
183
+ * Subscribe to Event
184
+ *
185
+ * @param eventType Event type
186
+ * @param handler Event handler function, receives complete GovernedEvent
187
+ * @returns Unsubscribe function
188
+ */
189
+ on<T = unknown>(eventType: string, handler: GovernedEventHandler<T>): Unsubscribe;
190
+ /**
191
+ * Subscribe to Event Once
192
+ *
193
+ * @param eventType Event type
194
+ * @param handler Event handler function
195
+ * @returns Unsubscribe function
196
+ */
197
+ once<T = unknown>(eventType: string, handler: GovernedEventHandler<T>): Unsubscribe;
198
+ /**
199
+ * Unsubscribe from Event
200
+ *
201
+ * @param eventType Event type
202
+ * @param handler Event handler function
203
+ */
204
+ off<T = unknown>(eventType: string, handler: GovernedEventHandler<T>): void;
205
+ }
206
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,WAAW;IACX,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,WAAW;IACX,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,UAAU;IACV,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