@aventara/next 0.0.0-stage → 1.0.0-rc.11

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.
@@ -0,0 +1,61 @@
1
+ export const NO_BYTES = new Uint8Array();
2
+ export function pathnameOf(request) {
3
+ return new URL(request.url).pathname;
4
+ }
5
+ export function protocolRequest(request, path, content) {
6
+ return {
7
+ method: request.method,
8
+ path,
9
+ query: new URL(request.url).search.slice(1),
10
+ headers: Object.fromEntries(request.headers),
11
+ body: { kind: "raw", content },
12
+ };
13
+ }
14
+ export function mcpRequest(request, content) {
15
+ return {
16
+ method: request.method,
17
+ url: calledUrl(request),
18
+ headers: Object.fromEntries(request.headers),
19
+ body: content,
20
+ remoteAddress: undefined,
21
+ };
22
+ }
23
+ function firstOf(request, name) {
24
+ const value = request.headers.get(name)?.split(",")[0]?.trim();
25
+ return value === undefined || value === "" ? undefined : value;
26
+ }
27
+ function calledUrl(request) {
28
+ const url = new URL(request.url);
29
+ const host = firstOf(request, "x-forwarded-host") ?? firstOf(request, "host");
30
+ const scheme = firstOf(request, "x-forwarded-proto");
31
+ return `${scheme ?? url.protocol.slice(0, -1)}://${host ?? url.host}${url.pathname}${url.search}`;
32
+ }
33
+ export function webResponse(answer) {
34
+ if (typeof answer.body !== "string") {
35
+ return new Response(streamOf(answer.body), {
36
+ status: answer.status,
37
+ headers: answer.headers,
38
+ });
39
+ }
40
+ return new Response(answer.body === "" ? null : answer.body, {
41
+ status: answer.status,
42
+ headers: answer.headers,
43
+ });
44
+ }
45
+ function streamOf(lines) {
46
+ const iterator = lines[Symbol.asyncIterator]();
47
+ const encoder = new TextEncoder();
48
+ return new ReadableStream({
49
+ async pull(controller) {
50
+ const next = await iterator.next();
51
+ if (next.done === true) {
52
+ controller.close();
53
+ return;
54
+ }
55
+ controller.enqueue(encoder.encode(next.value));
56
+ },
57
+ async cancel() {
58
+ await iterator.return?.();
59
+ },
60
+ });
61
+ }
package/package.json CHANGED
@@ -1,6 +1,76 @@
1
1
  {
2
2
  "name": "@aventara/next",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-rc.11",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "description": "Next.js App Router host integration for Aventara.",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": "^22.23.4 || >=24.22.1"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "LICENSE-ADDITIONAL-PERMISSION.md",
22
+ "CHANGELOG.md"
23
+ ],
24
+ "dependencies": {
25
+ "@aventara/core": "1.0.0-rc.11",
26
+ "server-only": "0.0.1"
27
+ },
28
+ "peerDependencies": {
29
+ "@aventara/mcp": "1.0.0-rc.11",
30
+ "next": ">=16.4 <17",
31
+ "react": "^19.0.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "@aventara/mcp": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "aventara": {
39
+ "host": {
40
+ "alias": "next",
41
+ "label": "Next.js",
42
+ "framework": "next",
43
+ "layout": {
44
+ "config": "src/aventara/config",
45
+ "adapter": "src/aventara/adapter",
46
+ "generated": "src/aventara/generated",
47
+ "client": "src/aventara/client.ts",
48
+ "universal": "src/aventara/universal.ts"
49
+ }
50
+ }
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "devDependencies": {
56
+ "@aventara/build": "1.0.0-rc.11",
57
+ "@aventara/client": "1.0.0-rc.11",
58
+ "@aventara/mcp": "1.0.0-rc.11",
59
+ "@aventara/testing": "1.0.0-rc.11",
60
+ "@modelcontextprotocol/sdk": "1.32.2",
61
+ "@tanstack/react-query": "5.104.2",
62
+ "@types/react": "19.3.0",
63
+ "jsdom": "30.1.2",
64
+ "next": "16.4.2",
65
+ "react": "19.3.0",
66
+ "react-dom": "19.3.0",
67
+ "swr": "2.5.1",
68
+ "typescript-6": "npm:typescript@6.0.3"
69
+ },
70
+ "scripts": {
71
+ "build": "node ../../scripts/build/build-output.cleaner.ts dist && tsc -p tsconfig.json --removeComments --declaration false && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/build/declaration-comments.sanitizer.ts dist",
72
+ "typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
73
+ "test": "vitest run --typecheck --config ./vitest.config.mts --root .",
74
+ "lint": "biome lint src"
75
+ }
6
76
  }