qdadm 0.38.1 → 0.40.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.
@@ -366,6 +366,11 @@ export class KernelContext {
366
366
  // Derive route prefix: 'books' → 'book', 'countries' → 'country'
367
367
  const routePrefix = options.routePrefix || this._singularize(entity)
368
368
 
369
+ // Check if entity is actually registered in orchestrator (for permission binding)
370
+ // If not registered, don't bind entity to routes/nav (allows pure route registration)
371
+ const hasEntity = this._kernel.orchestrator?.isRegistered(entity) ?? false
372
+ const entityBinding = hasEntity ? entity : undefined
373
+
369
374
  // Build routes array
370
375
  const routes = []
371
376
 
@@ -410,8 +415,9 @@ export class KernelContext {
410
415
  }
411
416
  }
412
417
 
413
- // Register routes with entity binding
414
- this.routes(entity, routes, { entity })
418
+ // Register routes (with entity binding only if entity exists)
419
+ const routeOpts = entityBinding ? { entity: entityBinding } : {}
420
+ this.routes(entity, routes, routeOpts)
415
421
 
416
422
  // Register route family for active state detection
417
423
  this.routeFamily(routePrefix, [`${routePrefix}-`])
@@ -419,13 +425,16 @@ export class KernelContext {
419
425
  // Register nav item if provided
420
426
  if (options.nav) {
421
427
  const label = options.nav.label || this._capitalize(entity)
422
- this.navItem({
428
+ const navItem = {
423
429
  section: options.nav.section,
424
430
  route: routePrefix,
425
431
  icon: options.nav.icon,
426
- label,
427
- entity
428
- })
432
+ label
433
+ }
434
+ if (entityBinding) {
435
+ navItem.entity = entityBinding
436
+ }
437
+ this.navItem(navItem)
429
438
  }
430
439
 
431
440
  return this
@@ -161,7 +161,7 @@ export class Orchestrator {
161
161
  }
162
162
 
163
163
  /**
164
- * Check if a manager exists (registered or can be created)
164
+ * Check if a manager exists (registered or can be created via factory)
165
165
  * @param {string} name - Entity name
166
166
  * @returns {boolean}
167
167
  */
@@ -169,6 +169,16 @@ export class Orchestrator {
169
169
  return this._managers.has(name) || !!this._entityFactory
170
170
  }
171
171
 
172
+ /**
173
+ * Check if a manager is actually registered (not just creatable)
174
+ * Use this to check if ctx.entity() was called for this entity
175
+ * @param {string} name - Entity name
176
+ * @returns {boolean}
177
+ */
178
+ isRegistered(name) {
179
+ return this._managers.has(name)
180
+ }
181
+
172
182
  /**
173
183
  * Get an EntityManager by name
174
184
  * Creates it via factory if not already registered