@voyant-travel/event-catalog 0.1.0
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/routes.d.ts +4 -0
- package/dist/routes.js +47 -0
- package/dist/runtime.d.ts +3 -0
- package/dist/runtime.js +12 -0
- package/dist/voyant.d.ts +3 -0
- package/dist/voyant.js +75 -0
- package/openapi/admin/event-catalog.json +79 -0
- package/package.json +83 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import { type VoyantGraphEventCatalog } from "@voyant-travel/core/project";
|
|
3
|
+
/** Build the read-only admin API over one generated selected-graph catalog. */
|
|
4
|
+
export declare function createEventCatalogHonoApp(eventCatalog: VoyantGraphEventCatalog): OpenAPIHono;
|
package/dist/routes.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
|
2
|
+
import { VOYANT_EVENT_CATALOG_SCHEMA_VERSION, } from "@voyant-travel/core/project";
|
|
3
|
+
const EVENT_CATALOG_API_ID = "@voyant-travel/event-catalog#api.admin";
|
|
4
|
+
const eventCatalogEntrySchema = z.object({
|
|
5
|
+
key: z.string(),
|
|
6
|
+
id: z.string(),
|
|
7
|
+
unitId: z.string(),
|
|
8
|
+
packageName: z.string(),
|
|
9
|
+
eventType: z.string(),
|
|
10
|
+
version: z.string(),
|
|
11
|
+
payloadSchema: z.record(z.string(), z.unknown()),
|
|
12
|
+
visibility: z.enum(["internal", "external"]),
|
|
13
|
+
audit: z.object({
|
|
14
|
+
sourceModule: z.string(),
|
|
15
|
+
category: z.enum(["domain", "internal"]),
|
|
16
|
+
}),
|
|
17
|
+
redactedFields: z.array(z.string()).readonly(),
|
|
18
|
+
});
|
|
19
|
+
const eventCatalogSchema = z.object({
|
|
20
|
+
schemaVersion: z.literal(VOYANT_EVENT_CATALOG_SCHEMA_VERSION),
|
|
21
|
+
events: z.array(eventCatalogEntrySchema).readonly(),
|
|
22
|
+
});
|
|
23
|
+
const getEventCatalogRoute = createRoute({
|
|
24
|
+
method: "get",
|
|
25
|
+
path: "/",
|
|
26
|
+
operationId: "getSelectedEventCatalog",
|
|
27
|
+
summary: "Get selected event contracts",
|
|
28
|
+
tags: ["Event catalog"],
|
|
29
|
+
"x-voyant-api-id": EVENT_CATALOG_API_ID,
|
|
30
|
+
responses: {
|
|
31
|
+
200: {
|
|
32
|
+
description: "Versioned event contracts selected for this deployment.",
|
|
33
|
+
content: {
|
|
34
|
+
"application/json": {
|
|
35
|
+
schema: z.object({ data: eventCatalogSchema }),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
/** Build the read-only admin API over one generated selected-graph catalog. */
|
|
42
|
+
export function createEventCatalogHonoApp(eventCatalog) {
|
|
43
|
+
const app = new OpenAPIHono();
|
|
44
|
+
const responseBody = { data: eventCatalog };
|
|
45
|
+
app.openapi(getEventCatalogRoute, (context) => context.json(responseBody, 200));
|
|
46
|
+
return app;
|
|
47
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { HonoModule } from "@voyant-travel/hono/module";
|
|
2
|
+
/** Compose the package API from the canonical catalog lowered into this graph runtime. */
|
|
3
|
+
export declare const createEventCatalogVoyantRuntime: import("@voyant-travel/core/project").VoyantGraphRuntimeFactory<HonoModule>;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineGraphRuntimeFactory } from "@voyant-travel/core/project";
|
|
2
|
+
import { createEventCatalogHonoApp } from "./routes.js";
|
|
3
|
+
/** Compose the package API from the canonical catalog lowered into this graph runtime. */
|
|
4
|
+
export const createEventCatalogVoyantRuntime = defineGraphRuntimeFactory(({ graph }) => {
|
|
5
|
+
if (!graph.eventCatalog) {
|
|
6
|
+
throw new Error("The generated graph runtime did not provide an event catalog.");
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
module: { name: "event-catalog" },
|
|
10
|
+
adminRoutes: createEventCatalogHonoApp(graph.eventCatalog),
|
|
11
|
+
};
|
|
12
|
+
});
|
package/dist/voyant.d.ts
ADDED
package/dist/voyant.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineModule } from "@voyant-travel/core/project";
|
|
2
|
+
const eventCatalogAdminRuntime = {
|
|
3
|
+
entry: "@voyant-travel/event-catalog-react/admin",
|
|
4
|
+
export: "createSelectedEventCatalogAdminExtension",
|
|
5
|
+
};
|
|
6
|
+
/** Infrastructure module exposing selected package event contracts without owning them. */
|
|
7
|
+
export const eventCatalogVoyantModule = defineModule({
|
|
8
|
+
id: "@voyant-travel/event-catalog",
|
|
9
|
+
packageName: "@voyant-travel/event-catalog",
|
|
10
|
+
localId: "event-catalog",
|
|
11
|
+
api: [
|
|
12
|
+
{
|
|
13
|
+
id: "@voyant-travel/event-catalog#api.admin",
|
|
14
|
+
surface: "admin",
|
|
15
|
+
mount: "event-catalog",
|
|
16
|
+
methods: ["GET"],
|
|
17
|
+
resource: "event-catalog",
|
|
18
|
+
openapi: { document: "event-catalog" },
|
|
19
|
+
runtime: {
|
|
20
|
+
entry: "@voyant-travel/event-catalog/runtime",
|
|
21
|
+
export: "createEventCatalogVoyantRuntime",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
access: {
|
|
26
|
+
resources: [
|
|
27
|
+
{
|
|
28
|
+
id: "@voyant-travel/event-catalog#access.event-catalog",
|
|
29
|
+
resource: "event-catalog",
|
|
30
|
+
label: "Event catalog",
|
|
31
|
+
description: "Discover event contracts selected for this deployment.",
|
|
32
|
+
actions: [
|
|
33
|
+
{
|
|
34
|
+
action: "read",
|
|
35
|
+
label: "View event contracts",
|
|
36
|
+
description: "View selected event types, versions, schemas, and redacted fields.",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
admin: {
|
|
43
|
+
compositionOrder: 180,
|
|
44
|
+
runtime: eventCatalogAdminRuntime,
|
|
45
|
+
copy: [
|
|
46
|
+
{
|
|
47
|
+
id: "@voyant-travel/event-catalog#admin.copy",
|
|
48
|
+
namespace: "event-catalog.admin",
|
|
49
|
+
fallbackLocale: "en",
|
|
50
|
+
runtime: {
|
|
51
|
+
entry: "@voyant-travel/event-catalog-react/i18n",
|
|
52
|
+
export: "eventCatalogMessageDefinitions",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
routes: [
|
|
57
|
+
{
|
|
58
|
+
id: "@voyant-travel/event-catalog#admin.route.docs",
|
|
59
|
+
path: "/docs/events",
|
|
60
|
+
requiredScopes: ["event-catalog:read"],
|
|
61
|
+
runtime: eventCatalogAdminRuntime,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
nav: [
|
|
65
|
+
{
|
|
66
|
+
id: "@voyant-travel/event-catalog#admin.nav.docs",
|
|
67
|
+
routeId: "@voyant-travel/event-catalog#admin.route.docs",
|
|
68
|
+
label: { namespace: "event-catalog.admin", key: "navigation.title" },
|
|
69
|
+
order: 180,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
meta: { ownership: "package" },
|
|
74
|
+
});
|
|
75
|
+
export default eventCatalogVoyantModule;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "Voyant Event Catalog Admin API",
|
|
5
|
+
"version": "1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"paths": {
|
|
8
|
+
"/v1/admin/event-catalog": {
|
|
9
|
+
"get": {
|
|
10
|
+
"operationId": "getSelectedEventCatalog",
|
|
11
|
+
"summary": "Get selected event contracts",
|
|
12
|
+
"tags": ["Event catalog"],
|
|
13
|
+
"x-voyant-api-id": "@voyant-travel/event-catalog#api.admin",
|
|
14
|
+
"responses": {
|
|
15
|
+
"200": {
|
|
16
|
+
"description": "Versioned event contracts selected for this deployment.",
|
|
17
|
+
"content": {
|
|
18
|
+
"application/json": {
|
|
19
|
+
"schema": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": ["data"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"data": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"required": ["schemaVersion", "events"],
|
|
26
|
+
"properties": {
|
|
27
|
+
"schemaVersion": { "const": "voyant.event-catalog.v1" },
|
|
28
|
+
"events": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": [
|
|
33
|
+
"key",
|
|
34
|
+
"id",
|
|
35
|
+
"unitId",
|
|
36
|
+
"packageName",
|
|
37
|
+
"eventType",
|
|
38
|
+
"version",
|
|
39
|
+
"payloadSchema",
|
|
40
|
+
"visibility",
|
|
41
|
+
"audit",
|
|
42
|
+
"redactedFields"
|
|
43
|
+
],
|
|
44
|
+
"properties": {
|
|
45
|
+
"key": { "type": "string" },
|
|
46
|
+
"id": { "type": "string" },
|
|
47
|
+
"unitId": { "type": "string" },
|
|
48
|
+
"packageName": { "type": "string" },
|
|
49
|
+
"eventType": { "type": "string" },
|
|
50
|
+
"version": { "type": "string" },
|
|
51
|
+
"payloadSchema": { "type": "object", "additionalProperties": true },
|
|
52
|
+
"visibility": { "enum": ["internal", "external"] },
|
|
53
|
+
"audit": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["sourceModule", "category"],
|
|
56
|
+
"properties": {
|
|
57
|
+
"sourceModule": { "type": "string" },
|
|
58
|
+
"category": { "enum": ["domain", "internal"] }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"redactedFields": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": { "type": "string" }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@voyant-travel/event-catalog",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Selected-graph event contract discovery for Voyant deployments.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts",
|
|
10
|
+
"./runtime": "./src/runtime.ts",
|
|
11
|
+
"./voyant": "./src/voyant.ts",
|
|
12
|
+
"./openapi/admin": "./openapi/admin/event-catalog.json"
|
|
13
|
+
},
|
|
14
|
+
"voyant": {
|
|
15
|
+
"schemaVersion": "voyant.package.v1",
|
|
16
|
+
"kind": "module",
|
|
17
|
+
"manifest": "./voyant",
|
|
18
|
+
"compatibleWith": {
|
|
19
|
+
"framework": ">=0.44.0",
|
|
20
|
+
"targets": [
|
|
21
|
+
"node"
|
|
22
|
+
],
|
|
23
|
+
"modes": [
|
|
24
|
+
"local",
|
|
25
|
+
"managed-cloud",
|
|
26
|
+
"self-hosted"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"openapi"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -p tsconfig.build.json",
|
|
36
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
37
|
+
"prepack": "pnpm run build",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
39
|
+
"lint": "biome check src/ tests/",
|
|
40
|
+
"test": "vitest run"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@hono/zod-openapi": "catalog:",
|
|
44
|
+
"@voyant-travel/core": "workspace:^",
|
|
45
|
+
"@voyant-travel/hono": "workspace:^",
|
|
46
|
+
"hono": "catalog:",
|
|
47
|
+
"zod": "catalog:"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "catalog:",
|
|
51
|
+
"@voyant-travel/voyant-typescript-config": "workspace:^",
|
|
52
|
+
"typescript": "catalog:",
|
|
53
|
+
"vitest": "catalog:"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"main": "./dist/index.js",
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
59
|
+
"exports": {
|
|
60
|
+
".": {
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
|
+
"import": "./dist/index.js",
|
|
63
|
+
"default": "./dist/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./runtime": {
|
|
66
|
+
"types": "./dist/runtime.d.ts",
|
|
67
|
+
"import": "./dist/runtime.js",
|
|
68
|
+
"default": "./dist/runtime.js"
|
|
69
|
+
},
|
|
70
|
+
"./voyant": {
|
|
71
|
+
"types": "./dist/voyant.d.ts",
|
|
72
|
+
"import": "./dist/voyant.js",
|
|
73
|
+
"default": "./dist/voyant.js"
|
|
74
|
+
},
|
|
75
|
+
"./openapi/admin": "./openapi/admin/event-catalog.json"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"repository": {
|
|
79
|
+
"type": "git",
|
|
80
|
+
"url": "https://github.com/voyant-travel/voyant.git",
|
|
81
|
+
"directory": "packages/event-catalog"
|
|
82
|
+
}
|
|
83
|
+
}
|