@questpie/next 0.0.1 → 1.0.1
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/README.md +8 -8
- package/dist/server.d.mts +2 -2
- package/package.json +9 -2
- package/.turbo/turbo-build.log +0 -14
- package/.turbo/turbo-check-types.log +0 -1
- package/CHANGELOG.md +0 -9
- package/src/server.ts +0 -48
- package/tsconfig.json +0 -5
- package/tsconfig.tsbuildinfo +0 -1
- package/tsdown.config.ts +0 -10
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @questpie/next
|
|
2
2
|
|
|
3
|
-
Next.js App Router adapter for QUESTPIE
|
|
3
|
+
Next.js App Router adapter for QUESTPIE.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **App Router Support** - Catch-all route handlers for Next.js 13+
|
|
8
|
-
- **Type-Safe Client** - Full TypeScript support with
|
|
8
|
+
- **Type-Safe Client** - Full TypeScript support with `questpie/client`
|
|
9
9
|
- **Server Components** - Works with React Server Components
|
|
10
10
|
- **Edge Runtime** - Compatible with Edge Runtime (with limitations)
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
bun add @questpie/next
|
|
15
|
+
bun add @questpie/next questpie
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
@@ -21,9 +21,9 @@ bun add @questpie/next @questpie/cms
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// src/cms/index.ts
|
|
24
|
-
import {
|
|
24
|
+
import { questpie } from "questpie";
|
|
25
25
|
|
|
26
|
-
export const cms =
|
|
26
|
+
export const cms = questpie()
|
|
27
27
|
.db({ connectionString: process.env.DATABASE_URL! })
|
|
28
28
|
.collections({
|
|
29
29
|
/* your collections */
|
|
@@ -59,10 +59,10 @@ export const dynamic = "force-dynamic";
|
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
61
|
// src/lib/cms-client.ts
|
|
62
|
-
import {
|
|
62
|
+
import { createClient } from "questpie/client";
|
|
63
63
|
import type { AppCMS } from "@/cms";
|
|
64
64
|
|
|
65
|
-
export const cmsClient =
|
|
65
|
+
export const cmsClient = createClient<AppCMS>({
|
|
66
66
|
baseURL: process.env.NEXT_PUBLIC_URL!,
|
|
67
67
|
basePath: "/api/cms",
|
|
68
68
|
});
|
|
@@ -278,7 +278,7 @@ S3_SECRET_KEY=...
|
|
|
278
278
|
|
|
279
279
|
## Related Packages
|
|
280
280
|
|
|
281
|
-
- [
|
|
281
|
+
- [`questpie`](../questpie) - Core CMS engine
|
|
282
282
|
- [`@questpie/admin`](../admin) - Admin UI
|
|
283
283
|
- [`@questpie/tanstack-query`](../tanstack-query) - TanStack Query integration
|
|
284
284
|
|
package/dist/server.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdapterConfig, Questpie } from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server.d.ts
|
|
4
|
-
type NextAdapterConfig =
|
|
4
|
+
type NextAdapterConfig = AdapterConfig;
|
|
5
5
|
type NextHandler = (request: Request) => Promise<Response>;
|
|
6
6
|
/**
|
|
7
7
|
* Create a Next.js-compatible handler for QUESTPIE CMS routes.
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@questpie/next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/questpie/questpie-cms.git",
|
|
8
|
+
"directory": "packages/next"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
5
13
|
"scripts": {
|
|
6
14
|
"build": "tsdown",
|
|
7
15
|
"check-types": "tsc --noEmit"
|
|
@@ -10,7 +18,6 @@
|
|
|
10
18
|
"questpie": "workspace:*"
|
|
11
19
|
},
|
|
12
20
|
"devDependencies": {
|
|
13
|
-
"@questpie/typescript-config": "workspace:*",
|
|
14
21
|
"bun-types": "latest",
|
|
15
22
|
"tsdown": "^0.18.3"
|
|
16
23
|
},
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
[0m[2m[35m$[0m [2m[1mtsdown[0m
|
|
3
|
-
[34mℹ[39m tsdown [2mv0.18.4[22m powered by rolldown [2mv1.0.0-beta.57[22m
|
|
4
|
-
[34mℹ[39m config file: [4m/Users/drepkovsky/questpie/repos/questpie-cms/packages/next/tsdown.config.ts[24m
|
|
5
|
-
(node:61187) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
|
|
6
|
-
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
7
|
-
[34mℹ[39m entry: [34msrc/server.ts[39m
|
|
8
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
-
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m Cleaning 2 files
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mserver.mjs[22m [2m0.84 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[22m[32m[1mserver.d.mts[22m[39m [2m0.61 kB[22m [2m│ gzip: 0.31 kB[22m
|
|
13
|
-
[34mℹ[39m 2 files, total: 1.46 kB
|
|
14
|
-
[32m✔[39m Build complete in [32m5270ms[39m
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ tsc --noEmit
|
package/CHANGELOG.md
DELETED
package/src/server.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createFetchHandler, type CMSAdapterConfig, type Questpie } from "questpie";
|
|
2
|
-
|
|
3
|
-
export type NextAdapterConfig = CMSAdapterConfig;
|
|
4
|
-
|
|
5
|
-
type NextHandler = (request: Request) => Promise<Response>;
|
|
6
|
-
|
|
7
|
-
const notFoundResponse = () =>
|
|
8
|
-
new Response(JSON.stringify({ error: "Not found" }), {
|
|
9
|
-
status: 404,
|
|
10
|
-
headers: {
|
|
11
|
-
"Content-Type": "application/json",
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Create a Next.js-compatible handler for QUESTPIE CMS routes.
|
|
17
|
-
*/
|
|
18
|
-
export const questpieNext = (
|
|
19
|
-
cms: Questpie<any>,
|
|
20
|
-
config: NextAdapterConfig = {},
|
|
21
|
-
): NextHandler => {
|
|
22
|
-
const handler = createFetchHandler(cms, config);
|
|
23
|
-
|
|
24
|
-
return async (request) => {
|
|
25
|
-
const response = await handler(request);
|
|
26
|
-
return response ?? notFoundResponse();
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Convenience helpers for Next.js route handlers.
|
|
32
|
-
*/
|
|
33
|
-
export const questpieNextRouteHandlers = (
|
|
34
|
-
cms: Questpie<any>,
|
|
35
|
-
config: NextAdapterConfig = {},
|
|
36
|
-
): Record<string, NextHandler> => {
|
|
37
|
-
const handler = questpieNext(cms, config);
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
GET: handler,
|
|
41
|
-
POST: handler,
|
|
42
|
-
PATCH: handler,
|
|
43
|
-
DELETE: handler,
|
|
44
|
-
PUT: handler,
|
|
45
|
-
OPTIONS: handler,
|
|
46
|
-
HEAD: handler,
|
|
47
|
-
};
|
|
48
|
-
};
|