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.
@@ -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
  */
@@ -115,9 +115,12 @@ export class FilterQuery {
115
115
  /**
116
116
  * Set the SignalBus for cache invalidation
117
117
  *
118
- * For entity sources, subscribes to CRUD signals ({entity}:created, {entity}:updated,
119
- * {entity}:deleted) to automatically invalidate cached options when the source
120
- * entity changes.
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 && signals) {
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}`