@nextsparkjs/core 0.1.0-beta.12 → 0.1.0-beta.14
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/dist/lib/entities/queries.d.ts +6 -0
- package/dist/lib/entities/queries.d.ts.map +1 -1
- package/dist/lib/entities/queries.js +10 -27
- package/dist/styles/classes.json +1 -1
- package/dist/templates/app/dashboard/(main)/layout.tsx +9 -29
- package/package.json +1 -1
- package/templates/app/dashboard/(main)/layout.tsx +9 -29
|
@@ -45,6 +45,12 @@ export interface EntityOwner {
|
|
|
45
45
|
type: 'plugin' | 'theme';
|
|
46
46
|
name: string;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Register the entity registry from the project
|
|
50
|
+
* This should be called by the dashboard layout which imports the registry directly
|
|
51
|
+
* (webpack resolves the @nextsparkjs/registries alias at compile time)
|
|
52
|
+
*/
|
|
53
|
+
export declare function setEntityRegistry(registry: Record<string, EntityRegistryEntry>, metadata?: EntityRegistryMetadata): void;
|
|
48
54
|
/**
|
|
49
55
|
* Get all registered entity configs
|
|
50
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAElE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,YAAY,GAAG,qBAAqB,CAAA;IAC5C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE;QACd,UAAU,EAAE,MAAM,CAA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AAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAEvF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAI3E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAIzE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAWrE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAItE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,sBAAsB,GAAG,IAAI,CAIzE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAEvE"}
|
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
let _cachedRegistry = null;
|
|
2
2
|
let _cachedMetadata = null;
|
|
3
|
+
function setEntityRegistry(registry, metadata) {
|
|
4
|
+
_cachedRegistry = registry;
|
|
5
|
+
_cachedMetadata = metadata || null;
|
|
6
|
+
const entityCount = Object.keys(registry || {}).length;
|
|
7
|
+
console.log(`[EntityQueries] Registry set with ${entityCount} entities`);
|
|
8
|
+
}
|
|
3
9
|
function getRegistry() {
|
|
4
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5
10
|
if (_cachedRegistry) return _cachedRegistry;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const registryPath = path.join(process.cwd(), ".nextspark/registries/entity-registry");
|
|
9
|
-
const registry = require(registryPath);
|
|
10
|
-
_cachedRegistry = registry.ENTITY_REGISTRY;
|
|
11
|
-
_cachedMetadata = registry.ENTITY_METADATA;
|
|
12
|
-
const entityCount = Object.keys(_cachedRegistry || {}).length;
|
|
13
|
-
console.log(`[EntityQueries] Registry loaded successfully with ${entityCount} entities`);
|
|
14
|
-
if (entityCount > 0) {
|
|
15
|
-
const firstKey = Object.keys(_cachedRegistry)[0];
|
|
16
|
-
const firstEntry = _cachedRegistry[firstKey];
|
|
17
|
-
console.log(`[EntityQueries] First entity sample:`, {
|
|
18
|
-
name: firstEntry.name,
|
|
19
|
-
hasConfig: !!firstEntry.config,
|
|
20
|
-
configSlug: (_a = firstEntry.config) == null ? void 0 : _a.slug,
|
|
21
|
-
configEnabled: (_b = firstEntry.config) == null ? void 0 : _b.enabled,
|
|
22
|
-
hasUi: !!((_c = firstEntry.config) == null ? void 0 : _c.ui),
|
|
23
|
-
showInMenu: (_f = (_e = (_d = firstEntry.config) == null ? void 0 : _d.ui) == null ? void 0 : _e.dashboard) == null ? void 0 : _f.showInMenu
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return _cachedRegistry;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.error("[EntityQueries] Registry not available:", error);
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
11
|
+
console.log("[EntityQueries] Registry not yet initialized (will be set by layout)");
|
|
12
|
+
return {};
|
|
31
13
|
}
|
|
32
14
|
function getRegisteredEntities() {
|
|
33
15
|
return Object.values(getRegistry()).map((entry) => entry.config);
|
|
@@ -122,5 +104,6 @@ export {
|
|
|
122
104
|
getPluginEntities,
|
|
123
105
|
getRegisteredEntities,
|
|
124
106
|
getRootEntities,
|
|
125
|
-
getThemeEntities
|
|
107
|
+
getThemeEntities,
|
|
108
|
+
setEntityRegistry
|
|
126
109
|
};
|
package/dist/styles/classes.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { DashboardShell } from '@nextsparkjs/core/components/dashboard/layouts/DashboardShell'
|
|
2
|
-
import { getRegisteredEntities } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
2
|
import { serializeEntityConfig, type SerializableEntityConfig } from '@nextsparkjs/core/lib/entities/serialization'
|
|
3
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
4
4
|
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
5
|
-
import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
|
|
6
5
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
6
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
7
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
7
8
|
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
console.log('[MainLayout] Checking template override for:', LAYOUT_PATH)
|
|
11
|
-
console.log('[MainLayout] hasTemplateOverride:', TemplateService.hasOverride(LAYOUT_PATH))
|
|
12
|
-
console.log('[MainLayout] templateEntry:', TemplateService.getEntry(LAYOUT_PATH)?.template?.themeName)
|
|
9
|
+
// Register entities globally so other parts of the app can access them via getRegisteredEntities()
|
|
10
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
13
11
|
|
|
14
12
|
// Type guard to check if entity is a full EntityConfig
|
|
15
13
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
@@ -23,32 +21,14 @@ function DefaultMainDashboardLayout({
|
|
|
23
21
|
}: {
|
|
24
22
|
children: React.ReactNode
|
|
25
23
|
}) {
|
|
26
|
-
|
|
24
|
+
// Get entities directly from the imported registry
|
|
25
|
+
const allEntities = Object.values(ENTITY_REGISTRY).map(entry => entry.config)
|
|
27
26
|
// Filter to only include full EntityConfig (not child entities)
|
|
28
27
|
const entities = allEntities.filter(isEntityConfig)
|
|
29
28
|
const serializedEntities: SerializableEntityConfig[] = entities.map(serializeEntityConfig)
|
|
30
29
|
|
|
31
|
-
// DEBUG: Log entity data
|
|
32
|
-
console.log('[MainLayout]
|
|
33
|
-
console.log('[MainLayout] Filtered entities count:', entities.length)
|
|
34
|
-
if (entities.length > 0) {
|
|
35
|
-
const first = entities[0]
|
|
36
|
-
console.log('[MainLayout] First entity sample:', {
|
|
37
|
-
slug: first.slug,
|
|
38
|
-
enabled: first.enabled,
|
|
39
|
-
hasUi: !!first.ui,
|
|
40
|
-
showInMenu: first.ui?.dashboard?.showInMenu
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
if (serializedEntities.length > 0) {
|
|
44
|
-
const firstSer = serializedEntities[0]
|
|
45
|
-
console.log('[MainLayout] First serialized entity sample:', {
|
|
46
|
-
slug: firstSer.slug,
|
|
47
|
-
enabled: firstSer.enabled,
|
|
48
|
-
hasUi: !!(firstSer as any).ui,
|
|
49
|
-
showInMenu: (firstSer as any).ui?.dashboard?.showInMenu
|
|
50
|
-
})
|
|
51
|
-
}
|
|
30
|
+
// DEBUG: Log entity data
|
|
31
|
+
console.log('[MainLayout] Entities count:', entities.length)
|
|
52
32
|
|
|
53
33
|
return (
|
|
54
34
|
<DashboardShell entities={serializedEntities}>
|
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { DashboardShell } from '@nextsparkjs/core/components/dashboard/layouts/DashboardShell'
|
|
2
|
-
import { getRegisteredEntities } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
2
|
import { serializeEntityConfig, type SerializableEntityConfig } from '@nextsparkjs/core/lib/entities/serialization'
|
|
3
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
4
4
|
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
5
|
-
import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
|
|
6
5
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
6
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
7
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
7
8
|
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
console.log('[MainLayout] Checking template override for:', LAYOUT_PATH)
|
|
11
|
-
console.log('[MainLayout] hasTemplateOverride:', TemplateService.hasOverride(LAYOUT_PATH))
|
|
12
|
-
console.log('[MainLayout] templateEntry:', TemplateService.getEntry(LAYOUT_PATH)?.template?.themeName)
|
|
9
|
+
// Register entities globally so other parts of the app can access them via getRegisteredEntities()
|
|
10
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
13
11
|
|
|
14
12
|
// Type guard to check if entity is a full EntityConfig
|
|
15
13
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
@@ -23,32 +21,14 @@ function DefaultMainDashboardLayout({
|
|
|
23
21
|
}: {
|
|
24
22
|
children: React.ReactNode
|
|
25
23
|
}) {
|
|
26
|
-
|
|
24
|
+
// Get entities directly from the imported registry
|
|
25
|
+
const allEntities = Object.values(ENTITY_REGISTRY).map(entry => entry.config)
|
|
27
26
|
// Filter to only include full EntityConfig (not child entities)
|
|
28
27
|
const entities = allEntities.filter(isEntityConfig)
|
|
29
28
|
const serializedEntities: SerializableEntityConfig[] = entities.map(serializeEntityConfig)
|
|
30
29
|
|
|
31
|
-
// DEBUG: Log entity data
|
|
32
|
-
console.log('[MainLayout]
|
|
33
|
-
console.log('[MainLayout] Filtered entities count:', entities.length)
|
|
34
|
-
if (entities.length > 0) {
|
|
35
|
-
const first = entities[0]
|
|
36
|
-
console.log('[MainLayout] First entity sample:', {
|
|
37
|
-
slug: first.slug,
|
|
38
|
-
enabled: first.enabled,
|
|
39
|
-
hasUi: !!first.ui,
|
|
40
|
-
showInMenu: first.ui?.dashboard?.showInMenu
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
if (serializedEntities.length > 0) {
|
|
44
|
-
const firstSer = serializedEntities[0]
|
|
45
|
-
console.log('[MainLayout] First serialized entity sample:', {
|
|
46
|
-
slug: firstSer.slug,
|
|
47
|
-
enabled: firstSer.enabled,
|
|
48
|
-
hasUi: !!(firstSer as any).ui,
|
|
49
|
-
showInMenu: (firstSer as any).ui?.dashboard?.showInMenu
|
|
50
|
-
})
|
|
51
|
-
}
|
|
30
|
+
// DEBUG: Log entity data
|
|
31
|
+
console.log('[MainLayout] Entities count:', entities.length)
|
|
52
32
|
|
|
53
33
|
return (
|
|
54
34
|
<DashboardShell entities={serializedEntities}>
|