@ontahi/runtime-nextjs 1.0.0-alpha.16 → 1.0.0-alpha.17
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
CHANGED
|
@@ -174,4 +174,6 @@ export const POST = createNextEventIngressRouteHandler({
|
|
|
174
174
|
The provider owns authentication and normalization. Ontahi matches the accepted provider identity
|
|
175
175
|
and channel against the explicit route, validates the payload against the registered declaration,
|
|
176
176
|
and only then creates the Event occurrence. Rejected or ignored deliveries never materialize an
|
|
177
|
-
occurrence.
|
|
177
|
+
occurrence. The App Router adapter delegates this semantic routing to
|
|
178
|
+
`@ontahi/runtime-http/ingress`; Next.js owns the route lifecycle and safe framework-facing failure
|
|
179
|
+
projection rather than a second ingress implementation.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyEventDeclaration, EventApplication } from '@ontahi/core/runtime/server';
|
|
2
|
-
import {
|
|
2
|
+
import type { GraphHttpEventIngressRoute, GraphHttpIngressProviderRegistry } from '@ontahi/core/runtime/server/ingress';
|
|
3
3
|
export type CreateNextEventIngressRouteHandlerOptions = {
|
|
4
4
|
events: EventApplication<readonly AnyEventDeclaration[]>;
|
|
5
5
|
route: GraphHttpEventIngressRoute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/event-ingress/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/event-ingress/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,KAAK,EACV,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,qCAAqC,CAAC;AAG7C,MAAM,MAAM,yCAAyC,GAAG;IACtD,MAAM,EAAE,gBAAgB,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC;IACzD,KAAK,EAAE,0BAA0B,CAAC;IAClC,SAAS,EAAE,gCAAgC,CAAC;IAC5C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1D,CAAC;AAUF,eAAO,MAAM,kCAAkC,GAC7C,SAAS,yCAAyC,MAYpC,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAYlD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createHttpIngressHandler } from '@ontahi/runtime-http/ingress';
|
|
2
2
|
const unavailableResponse = () => Response.json({ ok: false, error: 'Event ingress is temporarily unavailable.' }, { status: 500 });
|
|
3
3
|
const responseError = async (response) => {
|
|
4
4
|
const body = (await response.clone().json());
|
|
@@ -9,14 +9,13 @@ export const createNextEventIngressRouteHandler = (options) => {
|
|
|
9
9
|
((error) => {
|
|
10
10
|
globalThis.console.error('Ontahi Next.js Event ingress failed.', error);
|
|
11
11
|
});
|
|
12
|
-
const
|
|
13
|
-
routes: [options.route],
|
|
12
|
+
const handler = createHttpIngressHandler({
|
|
14
13
|
providers: options.providers,
|
|
15
|
-
|
|
14
|
+
events: { routes: [options.route], events: options.events },
|
|
16
15
|
});
|
|
17
16
|
return async (request) => {
|
|
18
17
|
try {
|
|
19
|
-
const response = await
|
|
18
|
+
const response = await handler.handle(request);
|
|
20
19
|
if (response.status !== 500)
|
|
21
20
|
return response;
|
|
22
21
|
reportError(await responseError(response), request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/event-ingress/route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/event-ingress/route.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CA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E,OAAO,CAAC,CAAC;YAC5B,OAAO,mBAAmB,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { AnyEventDeclaration, EventApplication } from '@ontahi/core/runtime/server';\nimport type {\n GraphHttpEventIngressRoute,\n GraphHttpIngressProviderRegistry,\n} from '@ontahi/core/runtime/server/ingress';\nimport { createHttpIngressHandler } from '@ontahi/runtime-http/ingress';\n\nexport type CreateNextEventIngressRouteHandlerOptions = {\n events: EventApplication<readonly AnyEventDeclaration[]>;\n route: GraphHttpEventIngressRoute;\n providers: GraphHttpIngressProviderRegistry;\n reportError?: (error: unknown, request: Request) => void;\n};\n\nconst unavailableResponse = () =>\n Response.json({ ok: false, error: 'Event ingress is temporarily unavailable.' }, { status: 500 });\n\nconst responseError = async (response: Response) => {\n const body = (await response.clone().json()) as { error: string };\n return new Error(body.error);\n};\n\nexport const createNextEventIngressRouteHandler = (\n options: CreateNextEventIngressRouteHandlerOptions,\n) => {\n const reportError =\n options.reportError ??\n ((error: unknown) => {\n globalThis.console.error('Ontahi Next.js Event ingress failed.', error);\n });\n const handler = createHttpIngressHandler({\n providers: options.providers,\n events: { routes: [options.route], events: options.events },\n });\n\n return async (request: Request): Promise<Response> => {\n try {\n const response = await handler.handle(request);\n if (response.status !== 500) return response;\n\n reportError(await responseError(response), request);\n return unavailableResponse();\n } catch (error) {\n reportError(error, request);\n return unavailableResponse();\n }\n };\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontahi/runtime-nextjs",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"description": "Next.js runtime and transport adapters for Ontahi applications",
|
|
5
5
|
"homepage": "https://github.com/javifernandes/ontahi/tree/main/packages/runtime-nextjs",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -60,15 +60,16 @@
|
|
|
60
60
|
"provenance": true
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@ontahi/core": "1.0.0-alpha.
|
|
63
|
+
"@ontahi/core": "1.0.0-alpha.17",
|
|
64
|
+
"@ontahi/runtime-http": "1.0.0-alpha.17",
|
|
64
65
|
"effect": "^3.21.0",
|
|
65
66
|
"next-safe-action": "^8.3.0",
|
|
66
67
|
"server-only": "^0.0.1",
|
|
67
68
|
"zod": "^4.3.6"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
|
-
"@ontahi/react": "1.0.0-alpha.
|
|
71
|
-
"@ontahi/runtime-express": "1.0.0-alpha.
|
|
71
|
+
"@ontahi/react": "1.0.0-alpha.17",
|
|
72
|
+
"@ontahi/runtime-express": "1.0.0-alpha.17",
|
|
72
73
|
"@types/node": "^20.0.0",
|
|
73
74
|
"@types/react": "^18.3.0",
|
|
74
75
|
"@types/react-dom": "^18.3.0",
|