@fleetbase/ember-core 0.3.10 → 0.3.12
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.
- package/addon/exports/host-services.js +1 -0
- package/addon/exports/services.js +1 -0
- package/addon/services/app-cache.js +2 -1
- package/addon/services/crud.js +19 -0
- package/addon/services/current-user.js +50 -36
- package/addon/services/events.js +322 -0
- package/addon/services/resource-action.js +18 -0
- package/addon/services/universe.js +0 -1
- package/addon/utils/lookup-user-ip.js +221 -0
- package/app/services/events.js +1 -0
- package/package.json +1 -1
- package/BOOT_SEQUENCE_REFACTOR_GUIDE.md +0 -294
- package/UNIVERSE_REFACTOR_MIGRATION_GUIDE.md +0 -318
- package/UNIVERSE_REFACTOR_README.md +0 -220
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
# UniverseService Refactor Migration Guide
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The UniverseService has been completely refactored to improve performance, maintainability, and developer experience. This guide will help you migrate your extensions to the new architecture.
|
|
6
|
-
|
|
7
|
-
## What Changed?
|
|
8
|
-
|
|
9
|
-
### 1. Service Decomposition
|
|
10
|
-
|
|
11
|
-
The monolithic `UniverseService` has been split into specialized services:
|
|
12
|
-
|
|
13
|
-
- **ExtensionManager**: Manages lazy loading of engines
|
|
14
|
-
- **RegistryService**: Manages all registries using Ember's container
|
|
15
|
-
- **MenuService**: Manages menu items and panels
|
|
16
|
-
- **WidgetService**: Manages dashboard widgets
|
|
17
|
-
- **HookService**: Manages application hooks
|
|
18
|
-
|
|
19
|
-
The original `UniverseService` now acts as a facade, delegating to these services while maintaining backward compatibility.
|
|
20
|
-
|
|
21
|
-
### 2. Contract System
|
|
22
|
-
|
|
23
|
-
New contract classes provide a fluent, type-safe API:
|
|
24
|
-
|
|
25
|
-
- `ExtensionComponent`: Lazy-loadable component definitions
|
|
26
|
-
- `MenuItem`: Menu item definitions
|
|
27
|
-
- `MenuPanel`: Menu panel definitions
|
|
28
|
-
- `Hook`: Hook definitions
|
|
29
|
-
- `Widget`: Widget definitions
|
|
30
|
-
- `Registry`: Registry namespace definitions
|
|
31
|
-
|
|
32
|
-
### 3. Lazy Loading Architecture
|
|
33
|
-
|
|
34
|
-
The old `bootEngines` mechanism has been replaced with on-demand lazy loading:
|
|
35
|
-
|
|
36
|
-
- Engines are no longer loaded at boot time
|
|
37
|
-
- Components are loaded only when needed
|
|
38
|
-
- The `<LazyEngineComponent>` wrapper handles lazy loading automatically
|
|
39
|
-
|
|
40
|
-
## Migration Steps
|
|
41
|
-
|
|
42
|
-
### Step 1: Create `extension.js` File
|
|
43
|
-
|
|
44
|
-
Each engine should create a new `addon/extension.js` file to replace the `setupExtension` method in `engine.js`.
|
|
45
|
-
|
|
46
|
-
**Before (`addon/engine.js`):**
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
import NavigatorAppComponent from './components/admin/navigator-app';
|
|
50
|
-
|
|
51
|
-
export default class FleetOpsEngine extends Engine {
|
|
52
|
-
setupExtension = function (app, engine, universe) {
|
|
53
|
-
universe.registerHeaderMenuItem('Fleet-Ops', 'console.fleet-ops', {
|
|
54
|
-
icon: 'route',
|
|
55
|
-
priority: 0
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
universe.registerAdminMenuPanel('Fleet-Ops Config', [
|
|
59
|
-
{
|
|
60
|
-
title: 'Navigator App',
|
|
61
|
-
component: NavigatorAppComponent
|
|
62
|
-
}
|
|
63
|
-
]);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**After (`addon/extension.js`):**
|
|
69
|
-
|
|
70
|
-
```javascript
|
|
71
|
-
import { MenuItem, MenuPanel, ExtensionComponent } from '@fleetbase/ember-core/contracts';
|
|
72
|
-
|
|
73
|
-
export default function (app, universe) {
|
|
74
|
-
// Register header menu item
|
|
75
|
-
universe.registerHeaderMenuItem(
|
|
76
|
-
new MenuItem('Fleet-Ops', 'console.fleet-ops')
|
|
77
|
-
.withIcon('route')
|
|
78
|
-
.withPriority(0)
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// Register admin panel with lazy component
|
|
82
|
-
universe.registerAdminMenuPanel(
|
|
83
|
-
new MenuPanel('Fleet-Ops Config')
|
|
84
|
-
.addItem(
|
|
85
|
-
new MenuItem('Navigator App')
|
|
86
|
-
.withIcon('location-arrow')
|
|
87
|
-
.withComponent(
|
|
88
|
-
new ExtensionComponent('@fleetbase/fleetops-engine', 'components/admin/navigator-app')
|
|
89
|
-
)
|
|
90
|
-
)
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**After (`addon/engine.js`):**
|
|
96
|
-
|
|
97
|
-
```javascript
|
|
98
|
-
// Remove the setupExtension method entirely
|
|
99
|
-
export default class FleetOpsEngine extends Engine {
|
|
100
|
-
// ... other engine configuration
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Step 2: Use Contract Classes
|
|
105
|
-
|
|
106
|
-
Instead of plain objects, use the new contract classes for better type safety and developer experience.
|
|
107
|
-
|
|
108
|
-
**Before:**
|
|
109
|
-
|
|
110
|
-
```javascript
|
|
111
|
-
universe.registerWidget({
|
|
112
|
-
widgetId: 'fleet-ops-metrics',
|
|
113
|
-
name: 'Fleet-Ops Metrics',
|
|
114
|
-
icon: 'truck',
|
|
115
|
-
component: WidgetComponent,
|
|
116
|
-
grid_options: { w: 12, h: 12 }
|
|
117
|
-
});
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**After:**
|
|
121
|
-
|
|
122
|
-
```javascript
|
|
123
|
-
import { Widget, ExtensionComponent } from '@fleetbase/ember-core/contracts';
|
|
124
|
-
|
|
125
|
-
universe.registerDashboardWidgets([
|
|
126
|
-
new Widget('fleet-ops-metrics')
|
|
127
|
-
.withName('Fleet-Ops Metrics')
|
|
128
|
-
.withIcon('truck')
|
|
129
|
-
.withComponent(
|
|
130
|
-
new ExtensionComponent('@fleetbase/fleetops-engine', 'components/widget/fleet-ops-key-metrics')
|
|
131
|
-
)
|
|
132
|
-
.withGridOptions({ w: 12, h: 12 })
|
|
133
|
-
]);
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Step 3: Update Component References
|
|
137
|
-
|
|
138
|
-
Replace direct component imports with lazy component definitions.
|
|
139
|
-
|
|
140
|
-
**Before:**
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
import MyComponent from './components/my-component';
|
|
144
|
-
|
|
145
|
-
universe.registerMenuItem('my-registry', 'My Item', {
|
|
146
|
-
component: MyComponent
|
|
147
|
-
});
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**After:**
|
|
151
|
-
|
|
152
|
-
```javascript
|
|
153
|
-
import { MenuItem, ExtensionComponent } from '@fleetbase/ember-core/contracts';
|
|
154
|
-
|
|
155
|
-
universe.registerMenuItem(
|
|
156
|
-
'my-registry',
|
|
157
|
-
new MenuItem('My Item')
|
|
158
|
-
.withComponent(
|
|
159
|
-
new ExtensionComponent('@fleetbase/my-engine', 'components/my-component')
|
|
160
|
-
)
|
|
161
|
-
);
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Step 4: Update Templates Using Registry Components
|
|
165
|
-
|
|
166
|
-
Templates that render components from registries need to use the `<LazyEngineComponent>` wrapper.
|
|
167
|
-
|
|
168
|
-
**Before:**
|
|
169
|
-
|
|
170
|
-
```handlebars
|
|
171
|
-
{{#each this.menuItems as |item|}}
|
|
172
|
-
{{component item.component model=@model}}
|
|
173
|
-
{{/each}}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**After:**
|
|
177
|
-
|
|
178
|
-
```handlebars
|
|
179
|
-
{{#each this.menuItems as |item|}}
|
|
180
|
-
<LazyEngineComponent @componentDef={{item.component}} @model={{@model}} />
|
|
181
|
-
{{/each}}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Step 5: Update Hook Registrations
|
|
185
|
-
|
|
186
|
-
Use the new `Hook` contract for better hook management.
|
|
187
|
-
|
|
188
|
-
**Before:**
|
|
189
|
-
|
|
190
|
-
```javascript
|
|
191
|
-
universe.registerHook('application:before-model', (session, router) => {
|
|
192
|
-
if (session.isCustomer) {
|
|
193
|
-
router.transitionTo('customer-portal');
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
**After:**
|
|
199
|
-
|
|
200
|
-
```javascript
|
|
201
|
-
import { Hook } from '@fleetbase/ember-core/contracts';
|
|
202
|
-
|
|
203
|
-
universe.registerHook(
|
|
204
|
-
new Hook('application:before-model', (session, router) => {
|
|
205
|
-
if (session.isCustomer) {
|
|
206
|
-
router.transitionTo('customer-portal');
|
|
207
|
-
}
|
|
208
|
-
})
|
|
209
|
-
.withPriority(10)
|
|
210
|
-
.withId('customer-redirect')
|
|
211
|
-
);
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Backward Compatibility
|
|
215
|
-
|
|
216
|
-
The refactored `UniverseService` maintains backward compatibility with the old API. You can continue using the old syntax while migrating:
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
// Old syntax still works
|
|
220
|
-
universe.registerHeaderMenuItem('My Item', 'my.route', { icon: 'star' });
|
|
221
|
-
|
|
222
|
-
// New syntax is preferred
|
|
223
|
-
universe.registerHeaderMenuItem(
|
|
224
|
-
new MenuItem('My Item', 'my.route').withIcon('star')
|
|
225
|
-
);
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Benefits of Migration
|
|
229
|
-
|
|
230
|
-
1. **Performance**: Sub-second boot times with lazy loading
|
|
231
|
-
2. **Type Safety**: Contract classes provide validation and IDE support
|
|
232
|
-
3. **Maintainability**: Specialized services are easier to understand and modify
|
|
233
|
-
4. **Developer Experience**: Fluent API with method chaining
|
|
234
|
-
5. **Extensibility**: Easy to add new features without breaking changes
|
|
235
|
-
|
|
236
|
-
## Common Patterns
|
|
237
|
-
|
|
238
|
-
### Menu Item with Click Handler
|
|
239
|
-
|
|
240
|
-
```javascript
|
|
241
|
-
new MenuItem('Track Order')
|
|
242
|
-
.withIcon('barcode')
|
|
243
|
-
.withType('link')
|
|
244
|
-
.withWrapperClass('btn-block py-1 border')
|
|
245
|
-
.withComponent(
|
|
246
|
-
new ExtensionComponent('@fleetbase/fleetops-engine', 'components/order-tracking-lookup')
|
|
247
|
-
)
|
|
248
|
-
.onClick((menuItem) => {
|
|
249
|
-
universe.transitionMenuItem('virtual', menuItem);
|
|
250
|
-
})
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Widget with Refresh Interval
|
|
254
|
-
|
|
255
|
-
```javascript
|
|
256
|
-
new Widget('live-metrics')
|
|
257
|
-
.withName('Live Metrics')
|
|
258
|
-
.withComponent(
|
|
259
|
-
new ExtensionComponent('@fleetbase/my-engine', 'components/widget/live-metrics')
|
|
260
|
-
.withLoadingComponent('skeletons/widget')
|
|
261
|
-
)
|
|
262
|
-
.withRefreshInterval(5000)
|
|
263
|
-
.asDefault()
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### Hook with Priority and Once
|
|
267
|
-
|
|
268
|
-
```javascript
|
|
269
|
-
new Hook('order:before-save')
|
|
270
|
-
.withPriority(10)
|
|
271
|
-
.once()
|
|
272
|
-
.execute(async (order) => {
|
|
273
|
-
await validateOrder(order);
|
|
274
|
-
})
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
## Troubleshooting
|
|
278
|
-
|
|
279
|
-
### Component Not Found Error
|
|
280
|
-
|
|
281
|
-
If you see "Component not found in engine" errors:
|
|
282
|
-
|
|
283
|
-
1. Check that the component path is correct
|
|
284
|
-
2. Ensure the engine name matches exactly
|
|
285
|
-
3. Verify the component exists in the engine
|
|
286
|
-
|
|
287
|
-
### Loading Spinner Not Showing
|
|
288
|
-
|
|
289
|
-
If the loading spinner doesn't appear:
|
|
290
|
-
|
|
291
|
-
1. Check that you're using `<LazyEngineComponent>` in templates
|
|
292
|
-
2. Verify the `componentDef` is a lazy definition object
|
|
293
|
-
3. Ensure the loading component exists
|
|
294
|
-
|
|
295
|
-
### Hooks Not Executing
|
|
296
|
-
|
|
297
|
-
If hooks aren't running:
|
|
298
|
-
|
|
299
|
-
1. Check the hook name matches exactly
|
|
300
|
-
2. Verify the hook is registered before it's needed
|
|
301
|
-
3. Use `universe.hookService.getHooks(hookName)` to debug
|
|
302
|
-
|
|
303
|
-
## Support
|
|
304
|
-
|
|
305
|
-
For questions or issues with the migration, please:
|
|
306
|
-
|
|
307
|
-
1. Check the contract class documentation in `addon/contracts/`
|
|
308
|
-
2. Review the service documentation in `addon/services/universe/`
|
|
309
|
-
3. Open an issue on GitHub with details about your migration challenge
|
|
310
|
-
|
|
311
|
-
## Timeline
|
|
312
|
-
|
|
313
|
-
- **Phase 1**: Refactored services are available, old API still works
|
|
314
|
-
- **Phase 2**: Extensions migrate to new `extension.js` pattern
|
|
315
|
-
- **Phase 3**: Deprecation warnings for old patterns
|
|
316
|
-
- **Phase 4**: Old `setupExtension` pattern removed (future release)
|
|
317
|
-
|
|
318
|
-
You can migrate at your own pace. The new architecture is fully backward compatible.
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
# UniverseService Refactor
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This refactor addresses critical performance and architectural issues in the UniverseService by decomposing it into specialized services, introducing a contract system, and implementing true lazy loading for engines.
|
|
6
|
-
|
|
7
|
-
## Problems Solved
|
|
8
|
-
|
|
9
|
-
### 1. Performance Bottleneck
|
|
10
|
-
|
|
11
|
-
**Before**: 10-40 second initial load time due to sequential `bootEngines` process loading all extensions upfront.
|
|
12
|
-
|
|
13
|
-
**After**: <1 second initial load time with on-demand lazy loading.
|
|
14
|
-
|
|
15
|
-
### 2. Monolithic Design
|
|
16
|
-
|
|
17
|
-
**Before**: 1,978 lines handling 7+ distinct responsibilities in a single service.
|
|
18
|
-
|
|
19
|
-
**After**: Specialized services with clear separation of concerns:
|
|
20
|
-
- `ExtensionManager`: Engine lifecycle and lazy loading
|
|
21
|
-
- `RegistryService`: Registry management using Ember's container
|
|
22
|
-
- `MenuService`: Menu items and panels
|
|
23
|
-
- `WidgetService`: Dashboard widgets
|
|
24
|
-
- `HookService`: Application hooks
|
|
25
|
-
|
|
26
|
-
### 3. Inefficient Registry
|
|
27
|
-
|
|
28
|
-
**Before**: Custom object-based registry with O(n) lookups.
|
|
29
|
-
|
|
30
|
-
**After**: Ember container-based registry with O(1) lookups.
|
|
31
|
-
|
|
32
|
-
### 4. Broken Lazy Loading
|
|
33
|
-
|
|
34
|
-
**Before**: `bootEngines` manually boots and initializes every engine, breaking lazy loading.
|
|
35
|
-
|
|
36
|
-
**After**: Engines load on-demand when their components are actually needed.
|
|
37
|
-
|
|
38
|
-
## Architecture
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
42
|
-
│ UniverseService (Facade) │
|
|
43
|
-
│ Maintains backward compatibility while delegating to: │
|
|
44
|
-
└─────────────────────────────────────────────────────────────┘
|
|
45
|
-
│
|
|
46
|
-
┌───────────────────┼───────────────────┐
|
|
47
|
-
│ │ │
|
|
48
|
-
▼ ▼ ▼
|
|
49
|
-
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
50
|
-
│ Extension │ │ Registry │ │ Menu │
|
|
51
|
-
│ Manager │ │ Service │ │ Service │
|
|
52
|
-
└──────────────┘ └──────────────┘ └──────────────┘
|
|
53
|
-
│ │ │
|
|
54
|
-
▼ ▼ ▼
|
|
55
|
-
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
56
|
-
│ Widget │ │ Hook │ │ Contract │
|
|
57
|
-
│ Service │ │ Service │ │ System │
|
|
58
|
-
└──────────────┘ └──────────────┘ └──────────────┘
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Contract System
|
|
62
|
-
|
|
63
|
-
New classes provide a fluent, type-safe API for extension definitions:
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
66
|
-
import { MenuItem, ExtensionComponent, Widget, Hook } from '@fleetbase/ember-core/contracts';
|
|
67
|
-
|
|
68
|
-
// Menu item with lazy component
|
|
69
|
-
new MenuItem('Fleet-Ops', 'console.fleet-ops')
|
|
70
|
-
.withIcon('route')
|
|
71
|
-
.withPriority(0)
|
|
72
|
-
.withComponent(
|
|
73
|
-
new ExtensionComponent('@fleetbase/fleetops-engine', 'components/admin/navigator-app')
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
// Widget with grid options
|
|
77
|
-
new Widget('fleet-ops-metrics')
|
|
78
|
-
.withName('Fleet-Ops Metrics')
|
|
79
|
-
.withIcon('truck')
|
|
80
|
-
.withComponent(
|
|
81
|
-
new ExtensionComponent('@fleetbase/fleetops-engine', 'components/widget/metrics')
|
|
82
|
-
)
|
|
83
|
-
.withGridOptions({ w: 12, h: 12 })
|
|
84
|
-
.asDefault();
|
|
85
|
-
|
|
86
|
-
// Hook with priority
|
|
87
|
-
new Hook('application:before-model', (session, router) => {
|
|
88
|
-
if (session.isCustomer) {
|
|
89
|
-
router.transitionTo('customer-portal');
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
.withPriority(10)
|
|
93
|
-
.once();
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Lazy Loading Flow
|
|
97
|
-
|
|
98
|
-
1. **Boot Time**: Only `extension.js` files are loaded (no engine code)
|
|
99
|
-
2. **Registration**: Metadata is registered (menus, widgets, hooks)
|
|
100
|
-
3. **Runtime**: When a component needs to render:
|
|
101
|
-
- `<LazyEngineComponent>` triggers `extensionManager.ensureEngineLoaded()`
|
|
102
|
-
- Engine bundle is fetched and loaded
|
|
103
|
-
- Component is looked up from the engine
|
|
104
|
-
- Component is rendered
|
|
105
|
-
|
|
106
|
-
## Extension Pattern
|
|
107
|
-
|
|
108
|
-
### Old Pattern (engine.js)
|
|
109
|
-
|
|
110
|
-
```javascript
|
|
111
|
-
import MyComponent from './components/my-component';
|
|
112
|
-
|
|
113
|
-
export default class MyEngine extends Engine {
|
|
114
|
-
setupExtension = function (app, engine, universe) {
|
|
115
|
-
universe.registerMenuItem('my-registry', 'My Item', {
|
|
116
|
-
component: MyComponent // Loads entire engine!
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### New Pattern (extension.js)
|
|
123
|
-
|
|
124
|
-
```javascript
|
|
125
|
-
import { MenuItem, ExtensionComponent } from '@fleetbase/ember-core/contracts';
|
|
126
|
-
|
|
127
|
-
export default function (app, universe) {
|
|
128
|
-
universe.registerMenuItem(
|
|
129
|
-
'my-registry',
|
|
130
|
-
new MenuItem('My Item')
|
|
131
|
-
.withComponent(
|
|
132
|
-
new ExtensionComponent('@fleetbase/my-engine', 'components/my-component')
|
|
133
|
-
)
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**Key Difference**: No component imports = no engine loading at boot time.
|
|
139
|
-
|
|
140
|
-
## Performance Improvements
|
|
141
|
-
|
|
142
|
-
| Metric | Before | After | Improvement |
|
|
143
|
-
|--------|--------|-------|-------------|
|
|
144
|
-
| Initial Load Time | 10-40s | <1s | ~90% faster |
|
|
145
|
-
| Bundle Size (initial) | Full app + all engines | Core app only | ~60% reduction |
|
|
146
|
-
| Lookup Performance | O(n) | O(1) | 100x faster |
|
|
147
|
-
| Timeout Errors | Frequent | None | 100% reduction |
|
|
148
|
-
|
|
149
|
-
## Backward Compatibility
|
|
150
|
-
|
|
151
|
-
The refactor is **100% backward compatible**. The old API still works:
|
|
152
|
-
|
|
153
|
-
```javascript
|
|
154
|
-
// Old syntax (still works)
|
|
155
|
-
universe.registerHeaderMenuItem('My Item', 'my.route', { icon: 'star' });
|
|
156
|
-
|
|
157
|
-
// New syntax (preferred)
|
|
158
|
-
universe.registerHeaderMenuItem(
|
|
159
|
-
new MenuItem('My Item', 'my.route').withIcon('star')
|
|
160
|
-
);
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Migration
|
|
164
|
-
|
|
165
|
-
See [UNIVERSE_REFACTOR_MIGRATION_GUIDE.md](./UNIVERSE_REFACTOR_MIGRATION_GUIDE.md) for detailed migration instructions.
|
|
166
|
-
|
|
167
|
-
## Files Changed
|
|
168
|
-
|
|
169
|
-
### New Files
|
|
170
|
-
|
|
171
|
-
- `addon/contracts/` - Contract system classes
|
|
172
|
-
- `base-contract.js`
|
|
173
|
-
- `extension-component.js`
|
|
174
|
-
- `menu-item.js`
|
|
175
|
-
- `menu-panel.js`
|
|
176
|
-
- `hook.js`
|
|
177
|
-
- `widget.js`
|
|
178
|
-
- `registry.js`
|
|
179
|
-
- `index.js`
|
|
180
|
-
|
|
181
|
-
- `addon/services/universe/` - Specialized services
|
|
182
|
-
- `extension-manager.js`
|
|
183
|
-
- `registry-service.js`
|
|
184
|
-
- `menu-service.js`
|
|
185
|
-
- `widget-service.js`
|
|
186
|
-
- `hook-service.js`
|
|
187
|
-
|
|
188
|
-
- `addon/components/` - Lazy loading component
|
|
189
|
-
- `lazy-engine-component.js`
|
|
190
|
-
- `lazy-engine-component.hbs`
|
|
191
|
-
|
|
192
|
-
### Modified Files
|
|
193
|
-
|
|
194
|
-
- `addon/services/universe.js` - Refactored as facade
|
|
195
|
-
- `addon/services/legacy-universe.js` - Original service (for reference)
|
|
196
|
-
|
|
197
|
-
## Testing
|
|
198
|
-
|
|
199
|
-
The refactor includes:
|
|
200
|
-
|
|
201
|
-
1. **Unit tests** for each contract class
|
|
202
|
-
2. **Integration tests** for each service
|
|
203
|
-
3. **Acceptance tests** for lazy loading behavior
|
|
204
|
-
4. **Performance benchmarks** comparing old vs new
|
|
205
|
-
|
|
206
|
-
## Future Enhancements
|
|
207
|
-
|
|
208
|
-
1. **TypeScript definitions** for contract classes
|
|
209
|
-
2. **Extension manifest validation** at build time
|
|
210
|
-
3. **Preloading strategies** for critical engines
|
|
211
|
-
4. **Memory management** for long-running applications
|
|
212
|
-
5. **Developer tools** for debugging extension loading
|
|
213
|
-
|
|
214
|
-
## Credits
|
|
215
|
-
|
|
216
|
-
Designed and implemented based on collaborative analysis with Ronald A Richardson, CTO of Fleetbase.
|
|
217
|
-
|
|
218
|
-
## License
|
|
219
|
-
|
|
220
|
-
MIT License - Copyright (c) 2025 Fleetbase
|