@nextsparkjs/core 0.1.0-beta.17 → 0.1.0-beta.19
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/styles/classes.json +1 -1
- package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +6 -1
- package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +6 -1
- package/dist/templates/app/api/v1/[entity]/[id]/route.ts +13 -7
- package/dist/templates/app/api/v1/[entity]/route.ts +12 -6
- package/dist/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +6 -1
- package/dist/templates/app/dashboard/(main)/[entity]/page.tsx +7 -1
- package/package.json +1 -1
- package/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +6 -1
- package/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +6 -1
- package/templates/app/api/v1/[entity]/[id]/route.ts +13 -7
- package/templates/app/api/v1/[entity]/route.ts +12 -6
- package/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +6 -1
- package/templates/app/dashboard/(main)/[entity]/page.tsx +7 -1
package/dist/styles/classes.json
CHANGED
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
import { NextRequest, NextResponse } from 'next/server'
|
|
8
8
|
import { queryWithRLS } from '@nextsparkjs/core/lib/db'
|
|
9
9
|
import { resolveEntityFromUrl } from '@nextsparkjs/core/lib/api/entity/resolver'
|
|
10
|
-
import { getChildEntities, getEntity } from '@nextsparkjs/core/lib/entities/queries'
|
|
10
|
+
import { getChildEntities, getEntity, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
11
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
12
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
13
|
+
|
|
14
|
+
// Initialize registry at module load time (before any handler runs)
|
|
15
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
11
16
|
|
|
12
17
|
interface RouteParams {
|
|
13
18
|
entity: string
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
import { NextRequest, NextResponse } from 'next/server'
|
|
8
8
|
import { queryWithRLS } from '@nextsparkjs/core/lib/db'
|
|
9
9
|
import { resolveEntityFromUrl } from '@nextsparkjs/core/lib/api/entity/resolver'
|
|
10
|
-
import { getChildEntities, getEntity } from '@nextsparkjs/core/lib/entities/queries'
|
|
10
|
+
import { getChildEntities, getEntity, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
11
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
12
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
13
|
+
|
|
14
|
+
// Initialize registry at module load time (before any handler runs)
|
|
15
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
11
16
|
|
|
12
17
|
|
|
13
18
|
interface RouteParams {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic Entity Detail Route
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Catch-all route that handles GET, PATCH, and DELETE requests for any registered entity.
|
|
5
5
|
* Supports dual authentication (API Keys + Sessions).
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Examples:
|
|
8
8
|
* GET /api/v1/products/123 -> Get product by ID
|
|
9
9
|
* PATCH /api/v1/products/123 -> Update product
|
|
@@ -13,12 +13,18 @@
|
|
|
13
13
|
* DELETE /api/v1/orders/456 -> Delete order
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
handleGenericRead,
|
|
18
|
-
handleGenericUpdate,
|
|
19
|
-
handleGenericDelete,
|
|
20
|
-
handleGenericOptions
|
|
16
|
+
import {
|
|
17
|
+
handleGenericRead,
|
|
18
|
+
handleGenericUpdate,
|
|
19
|
+
handleGenericDelete,
|
|
20
|
+
handleGenericOptions
|
|
21
21
|
} from '@nextsparkjs/core/lib/api/entity/generic-handler'
|
|
22
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
23
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
24
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
25
|
+
|
|
26
|
+
// Initialize registry at module load time (before any handler runs)
|
|
27
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
22
28
|
|
|
23
29
|
export const GET = handleGenericRead
|
|
24
30
|
export const PATCH = handleGenericUpdate
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic Entity List Route
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Catch-all route that handles GET and POST requests for any registered entity.
|
|
5
5
|
* Supports dual authentication (API Keys + Sessions).
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Examples:
|
|
8
8
|
* GET /api/v1/products -> List products
|
|
9
9
|
* POST /api/v1/products -> Create product
|
|
@@ -11,11 +11,17 @@
|
|
|
11
11
|
* POST /api/v1/orders -> Create order
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
handleGenericList,
|
|
16
|
-
handleGenericCreate,
|
|
17
|
-
handleGenericOptions
|
|
14
|
+
import {
|
|
15
|
+
handleGenericList,
|
|
16
|
+
handleGenericCreate,
|
|
17
|
+
handleGenericOptions
|
|
18
18
|
} from '@nextsparkjs/core/lib/api/entity/generic-handler'
|
|
19
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
20
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
21
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
22
|
+
|
|
23
|
+
// Initialize registry at module load time (before any handler runs)
|
|
24
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
19
25
|
|
|
20
26
|
export const GET = handleGenericList
|
|
21
27
|
export const POST = handleGenericCreate
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { notFound, redirect } from 'next/navigation'
|
|
2
|
-
import { getEntity, getEntityRegistry, getChildEntities } from '@nextsparkjs/core/lib/entities/queries'
|
|
2
|
+
import { getEntity, getEntityRegistry, getChildEntities, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
3
|
import { EntityDetailWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityDetailWrapper'
|
|
4
4
|
import type { Metadata } from 'next'
|
|
5
5
|
import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
|
|
6
6
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
7
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
8
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
9
|
+
|
|
10
|
+
// Initialize registry at module load time (before any component renders)
|
|
11
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
7
12
|
|
|
8
13
|
// Type guard to check if entity is a full EntityConfig
|
|
9
14
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { notFound } from 'next/navigation'
|
|
2
|
-
import { getEntity, getEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
2
|
+
import { getEntity, getEntityRegistry, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
3
|
import { EntityListWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityListWrapper'
|
|
4
4
|
import type { Metadata } from 'next'
|
|
5
5
|
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
6
6
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
7
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
8
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
9
|
+
|
|
10
|
+
// Initialize registry at module load time (before any component renders)
|
|
11
|
+
// This ensures the registry is available even if this page loads before the layout
|
|
12
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
7
13
|
|
|
8
14
|
// Type guard to check if entity is a full EntityConfig
|
|
9
15
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
package/package.json
CHANGED
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
import { NextRequest, NextResponse } from 'next/server'
|
|
8
8
|
import { queryWithRLS } from '@nextsparkjs/core/lib/db'
|
|
9
9
|
import { resolveEntityFromUrl } from '@nextsparkjs/core/lib/api/entity/resolver'
|
|
10
|
-
import { getChildEntities, getEntity } from '@nextsparkjs/core/lib/entities/queries'
|
|
10
|
+
import { getChildEntities, getEntity, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
11
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
12
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
13
|
+
|
|
14
|
+
// Initialize registry at module load time (before any handler runs)
|
|
15
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
11
16
|
|
|
12
17
|
interface RouteParams {
|
|
13
18
|
entity: string
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
import { NextRequest, NextResponse } from 'next/server'
|
|
8
8
|
import { queryWithRLS } from '@nextsparkjs/core/lib/db'
|
|
9
9
|
import { resolveEntityFromUrl } from '@nextsparkjs/core/lib/api/entity/resolver'
|
|
10
|
-
import { getChildEntities, getEntity } from '@nextsparkjs/core/lib/entities/queries'
|
|
10
|
+
import { getChildEntities, getEntity, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
11
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
12
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
13
|
+
|
|
14
|
+
// Initialize registry at module load time (before any handler runs)
|
|
15
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
11
16
|
|
|
12
17
|
|
|
13
18
|
interface RouteParams {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic Entity Detail Route
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Catch-all route that handles GET, PATCH, and DELETE requests for any registered entity.
|
|
5
5
|
* Supports dual authentication (API Keys + Sessions).
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Examples:
|
|
8
8
|
* GET /api/v1/products/123 -> Get product by ID
|
|
9
9
|
* PATCH /api/v1/products/123 -> Update product
|
|
@@ -13,12 +13,18 @@
|
|
|
13
13
|
* DELETE /api/v1/orders/456 -> Delete order
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
handleGenericRead,
|
|
18
|
-
handleGenericUpdate,
|
|
19
|
-
handleGenericDelete,
|
|
20
|
-
handleGenericOptions
|
|
16
|
+
import {
|
|
17
|
+
handleGenericRead,
|
|
18
|
+
handleGenericUpdate,
|
|
19
|
+
handleGenericDelete,
|
|
20
|
+
handleGenericOptions
|
|
21
21
|
} from '@nextsparkjs/core/lib/api/entity/generic-handler'
|
|
22
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
23
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
24
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
25
|
+
|
|
26
|
+
// Initialize registry at module load time (before any handler runs)
|
|
27
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
22
28
|
|
|
23
29
|
export const GET = handleGenericRead
|
|
24
30
|
export const PATCH = handleGenericUpdate
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic Entity List Route
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Catch-all route that handles GET and POST requests for any registered entity.
|
|
5
5
|
* Supports dual authentication (API Keys + Sessions).
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Examples:
|
|
8
8
|
* GET /api/v1/products -> List products
|
|
9
9
|
* POST /api/v1/products -> Create product
|
|
@@ -11,11 +11,17 @@
|
|
|
11
11
|
* POST /api/v1/orders -> Create order
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
handleGenericList,
|
|
16
|
-
handleGenericCreate,
|
|
17
|
-
handleGenericOptions
|
|
14
|
+
import {
|
|
15
|
+
handleGenericList,
|
|
16
|
+
handleGenericCreate,
|
|
17
|
+
handleGenericOptions
|
|
18
18
|
} from '@nextsparkjs/core/lib/api/entity/generic-handler'
|
|
19
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
20
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
21
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
22
|
+
|
|
23
|
+
// Initialize registry at module load time (before any handler runs)
|
|
24
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
19
25
|
|
|
20
26
|
export const GET = handleGenericList
|
|
21
27
|
export const POST = handleGenericCreate
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { notFound, redirect } from 'next/navigation'
|
|
2
|
-
import { getEntity, getEntityRegistry, getChildEntities } from '@nextsparkjs/core/lib/entities/queries'
|
|
2
|
+
import { getEntity, getEntityRegistry, getChildEntities, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
3
|
import { EntityDetailWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityDetailWrapper'
|
|
4
4
|
import type { Metadata } from 'next'
|
|
5
5
|
import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
|
|
6
6
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
7
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
8
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
9
|
+
|
|
10
|
+
// Initialize registry at module load time (before any component renders)
|
|
11
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
7
12
|
|
|
8
13
|
// Type guard to check if entity is a full EntityConfig
|
|
9
14
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { notFound } from 'next/navigation'
|
|
2
|
-
import { getEntity, getEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
2
|
+
import { getEntity, getEntityRegistry, setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
3
|
import { EntityListWrapper } from '@nextsparkjs/core/components/entities/wrappers/EntityListWrapper'
|
|
4
4
|
import type { Metadata } from 'next'
|
|
5
5
|
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
6
6
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
7
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
8
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
9
|
+
|
|
10
|
+
// Initialize registry at module load time (before any component renders)
|
|
11
|
+
// This ensures the registry is available even if this page loads before the layout
|
|
12
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
7
13
|
|
|
8
14
|
// Type guard to check if entity is a full EntityConfig
|
|
9
15
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|