@nextsparkjs/core 0.1.0-beta.18 → 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/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/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
|
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
|