qdadm 0.26.3 → 0.28.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.
- package/package.json +1 -1
- package/src/components/index.js +3 -0
- package/src/components/pages/LoginPage.vue +267 -0
- package/src/composables/index.js +2 -0
- package/src/composables/useDeferred.js +85 -0
- package/src/composables/useListPageBuilder.js +3 -0
- package/src/composables/useSSE.js +212 -0
- package/src/deferred/DeferredRegistry.js +323 -0
- package/src/deferred/index.js +7 -0
- package/src/entity/EntityManager.js +82 -14
- package/src/entity/factory.js +155 -0
- package/src/entity/factory.test.js +189 -0
- package/src/entity/index.js +8 -0
- package/src/entity/storage/ApiStorage.js +4 -1
- package/src/entity/storage/IStorage.js +76 -0
- package/src/entity/storage/LocalStorage.js +4 -1
- package/src/entity/storage/MemoryStorage.js +4 -1
- package/src/entity/storage/MockApiStorage.js +4 -1
- package/src/entity/storage/SdkStorage.js +4 -1
- package/src/entity/storage/factory.js +193 -0
- package/src/entity/storage/factory.test.js +159 -0
- package/src/entity/storage/index.js +13 -0
- package/src/index.js +3 -0
- package/src/kernel/EventRouter.js +264 -0
- package/src/kernel/Kernel.js +123 -8
- package/src/kernel/index.js +4 -0
- package/src/orchestrator/Orchestrator.js +60 -0
- package/src/query/FilterQuery.js +9 -4
|
@@ -40,6 +40,8 @@ export class Orchestrator {
|
|
|
40
40
|
signals = null,
|
|
41
41
|
// HookRegistry instance for lifecycle hooks
|
|
42
42
|
hooks = null,
|
|
43
|
+
// DeferredRegistry instance for async warmup
|
|
44
|
+
deferred = null,
|
|
43
45
|
// Optional: AuthAdapter for entity permission checks (scope/silo)
|
|
44
46
|
entityAuthAdapter = null
|
|
45
47
|
} = options
|
|
@@ -48,6 +50,7 @@ export class Orchestrator {
|
|
|
48
50
|
this._managers = new Map()
|
|
49
51
|
this._signals = signals
|
|
50
52
|
this._hooks = hooks
|
|
53
|
+
this._deferred = deferred
|
|
51
54
|
this._entityAuthAdapter = entityAuthAdapter
|
|
52
55
|
|
|
53
56
|
// Register pre-provided managers
|
|
@@ -106,6 +109,22 @@ export class Orchestrator {
|
|
|
106
109
|
return this._hooks
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Set the DeferredRegistry instance
|
|
114
|
+
* @param {DeferredRegistry} deferred
|
|
115
|
+
*/
|
|
116
|
+
setDeferred(deferred) {
|
|
117
|
+
this._deferred = deferred
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get the DeferredRegistry instance
|
|
122
|
+
* @returns {DeferredRegistry|null}
|
|
123
|
+
*/
|
|
124
|
+
get deferred() {
|
|
125
|
+
return this._deferred
|
|
126
|
+
}
|
|
127
|
+
|
|
109
128
|
/**
|
|
110
129
|
* Set the entity factory
|
|
111
130
|
* @param {function} factory - (entityName, entityConfig) => EntityManager
|
|
@@ -192,6 +211,47 @@ export class Orchestrator {
|
|
|
192
211
|
return Array.from(this._managers.keys())
|
|
193
212
|
}
|
|
194
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Fire warmup for all managers (fire-and-forget)
|
|
216
|
+
*
|
|
217
|
+
* Triggers cache preloading for all managers with warmupEnabled.
|
|
218
|
+
* Each manager registers its warmup in the DeferredRegistry, allowing
|
|
219
|
+
* pages to await specific entities before rendering.
|
|
220
|
+
*
|
|
221
|
+
* IMPORTANT: This is fire-and-forget by design. Don't await this method.
|
|
222
|
+
* Components await what they need via DeferredRegistry:
|
|
223
|
+
* `await deferred.await('entity:books:cache')`
|
|
224
|
+
*
|
|
225
|
+
* @returns {Promise<Map<string, any>>} For debugging/logging only
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```js
|
|
229
|
+
* // At boot (fire-and-forget)
|
|
230
|
+
* orchestrator.fireWarmups()
|
|
231
|
+
*
|
|
232
|
+
* // In component - await specific entity cache
|
|
233
|
+
* await deferred.await('entity:books:cache')
|
|
234
|
+
* const { items } = await booksManager.list() // Uses local cache
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
fireWarmups() {
|
|
238
|
+
const results = new Map()
|
|
239
|
+
|
|
240
|
+
for (const [name, manager] of this._managers) {
|
|
241
|
+
if (manager.warmup && manager.warmupEnabled) {
|
|
242
|
+
// Fire each warmup - they register themselves in DeferredRegistry
|
|
243
|
+
manager.warmup().then(result => {
|
|
244
|
+
results.set(name, result)
|
|
245
|
+
}).catch(error => {
|
|
246
|
+
console.warn(`[Orchestrator] Warmup failed for ${name}:`, error.message)
|
|
247
|
+
results.set(name, error)
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return results
|
|
253
|
+
}
|
|
254
|
+
|
|
195
255
|
/**
|
|
196
256
|
* Dispose all managers
|
|
197
257
|
*/
|
package/src/query/FilterQuery.js
CHANGED
|
@@ -115,9 +115,12 @@ export class FilterQuery {
|
|
|
115
115
|
/**
|
|
116
116
|
* Set the SignalBus for cache invalidation
|
|
117
117
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
118
|
+
* Subscribes to entity CRUD signals ({entity}:created, {entity}:updated, {entity}:deleted)
|
|
119
|
+
* to invalidate cached options when the source entity changes.
|
|
120
|
+
*
|
|
121
|
+
* Note: Auth changes are handled by Vue component lifecycle - when user logs out,
|
|
122
|
+
* router guard redirects to login, component unmounts, FilterQuery is disposed.
|
|
123
|
+
* On re-login, new FilterQuery is created with empty cache.
|
|
121
124
|
*
|
|
122
125
|
* @param {SignalBus} signals
|
|
123
126
|
* @returns {FilterQuery} this for chaining
|
|
@@ -128,8 +131,10 @@ export class FilterQuery {
|
|
|
128
131
|
|
|
129
132
|
this._signals = signals
|
|
130
133
|
|
|
134
|
+
if (!signals) return this
|
|
135
|
+
|
|
131
136
|
// Subscribe to entity CRUD signals for cache invalidation
|
|
132
|
-
if (this.source === 'entity' && this.entity
|
|
137
|
+
if (this.source === 'entity' && this.entity) {
|
|
133
138
|
const actions = ['created', 'updated', 'deleted']
|
|
134
139
|
for (const action of actions) {
|
|
135
140
|
const signalName = `${this.entity}:${action}`
|