@cosmneo/onion-lasagna 0.2.1 → 0.3.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/dist/chunk-36IO4BM7.js +113 -0
- package/dist/chunk-36IO4BM7.js.map +1 -0
- package/dist/chunk-4BVOLXDJ.js +54 -0
- package/dist/chunk-4BVOLXDJ.js.map +1 -0
- package/dist/chunk-CBTICRSM.js +34 -0
- package/dist/chunk-CBTICRSM.js.map +1 -0
- package/dist/chunk-KJ4JGZOE.js +96 -0
- package/dist/chunk-KJ4JGZOE.js.map +1 -0
- package/dist/chunk-RVSBIYY4.js +1 -0
- package/dist/chunk-RVSBIYY4.js.map +1 -0
- package/dist/{chunk-MF2JDREK.js → chunk-UNVB4INM.js} +1 -1
- package/dist/{chunk-MF2JDREK.js.map → chunk-UNVB4INM.js.map} +1 -1
- package/dist/chunk-XWKHOLIP.js +191 -0
- package/dist/chunk-XWKHOLIP.js.map +1 -0
- package/dist/event-router-definition.type-CP9uTlux.d.cts +150 -0
- package/dist/event-router-definition.type-D8CG-kjZ.d.ts +150 -0
- package/dist/events/asyncapi/index.cjs +143 -0
- package/dist/events/asyncapi/index.cjs.map +1 -0
- package/dist/events/asyncapi/index.d.cts +184 -0
- package/dist/events/asyncapi/index.d.ts +184 -0
- package/dist/events/asyncapi/index.js +8 -0
- package/dist/events/asyncapi/index.js.map +1 -0
- package/dist/events/handler/index.cjs +171 -0
- package/dist/events/handler/index.cjs.map +1 -0
- package/dist/events/handler/index.d.cts +153 -0
- package/dist/events/handler/index.d.ts +153 -0
- package/dist/events/handler/index.js +21 -0
- package/dist/events/handler/index.js.map +1 -0
- package/dist/events/index.cjs +497 -0
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/index.d.cts +9 -0
- package/dist/events/index.d.ts +9 -0
- package/dist/events/index.js +41 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/server/index.cjs +291 -0
- package/dist/events/server/index.cjs.map +1 -0
- package/dist/events/server/index.d.cts +281 -0
- package/dist/events/server/index.d.ts +281 -0
- package/dist/events/server/index.js +16 -0
- package/dist/events/server/index.js.map +1 -0
- package/dist/events/shared/index.cjs +85 -0
- package/dist/events/shared/index.cjs.map +1 -0
- package/dist/events/shared/index.d.cts +35 -0
- package/dist/events/shared/index.d.ts +35 -0
- package/dist/events/shared/index.js +13 -0
- package/dist/events/shared/index.js.map +1 -0
- package/dist/http/index.cjs.map +1 -1
- package/dist/http/index.d.cts +2 -1
- package/dist/http/index.d.ts +2 -1
- package/dist/http/index.js +4 -4
- package/dist/http/route/index.cjs.map +1 -1
- package/dist/http/route/index.d.cts +4 -0
- package/dist/http/route/index.d.ts +4 -0
- package/dist/http/route/index.js +1 -1
- package/dist/http/server/index.d.cts +4 -261
- package/dist/http/server/index.d.ts +4 -261
- package/dist/types-B6Q1iCgf.d.ts +262 -0
- package/dist/types-afYpL7Ap.d.cts +262 -0
- package/dist/types-cke61juH.d.cts +42 -0
- package/dist/types-cke61juH.d.ts +42 -0
- package/package.json +35 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/presentation/events/asyncapi/index.ts
|
|
21
|
+
var asyncapi_exports = {};
|
|
22
|
+
__export(asyncapi_exports, {
|
|
23
|
+
generateAsyncAPI: () => generateAsyncAPI
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(asyncapi_exports);
|
|
26
|
+
|
|
27
|
+
// src/presentation/events/handler/types/event-router-definition.type.ts
|
|
28
|
+
function isEventHandlerDefinition(value) {
|
|
29
|
+
return typeof value === "object" && value !== null && "eventType" in value && "_types" in value;
|
|
30
|
+
}
|
|
31
|
+
function isEventRouterDefinition(value) {
|
|
32
|
+
return typeof value === "object" && value !== null && "_isEventRouter" in value && value._isEventRouter === true;
|
|
33
|
+
}
|
|
34
|
+
function collectEventHandlers(config, basePath = "") {
|
|
35
|
+
const handlers = [];
|
|
36
|
+
for (const [key, value] of Object.entries(config)) {
|
|
37
|
+
const fullKey = basePath ? `${basePath}.${key}` : key;
|
|
38
|
+
if (isEventHandlerDefinition(value)) {
|
|
39
|
+
handlers.push({ key: fullKey, handler: value });
|
|
40
|
+
} else if (isEventRouterDefinition(value)) {
|
|
41
|
+
handlers.push(...collectEventHandlers(value.handlers, fullKey));
|
|
42
|
+
} else if (typeof value === "object" && value !== null) {
|
|
43
|
+
handlers.push(...collectEventHandlers(value, fullKey));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return handlers;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/presentation/events/handler/utils.ts
|
|
50
|
+
function generateHandlerId(key) {
|
|
51
|
+
return key.replace(/\.(\w)/g, (_, char) => char.toUpperCase());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/presentation/events/asyncapi/generate.ts
|
|
55
|
+
function generateAsyncAPI(router, config) {
|
|
56
|
+
const routerConfig = isEventRouterDefinition(router) ? router.handlers : router;
|
|
57
|
+
const handlers = collectEventHandlers(routerConfig);
|
|
58
|
+
const channels = {};
|
|
59
|
+
const operations = {};
|
|
60
|
+
const allTags = /* @__PURE__ */ new Set();
|
|
61
|
+
for (const { key, handler } of handlers) {
|
|
62
|
+
const handlerId = generateHandlerId(key);
|
|
63
|
+
const channelId = handler.eventType;
|
|
64
|
+
const message = buildMessage(handler.eventType, handler.payload, handler.docs);
|
|
65
|
+
if (!channels[channelId]) {
|
|
66
|
+
channels[channelId] = {
|
|
67
|
+
address: handler.eventType,
|
|
68
|
+
messages: {}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const channelMessages = { ...channels[channelId].messages ?? {} };
|
|
72
|
+
channelMessages[handlerId] = message;
|
|
73
|
+
channels[channelId] = { ...channels[channelId], messages: channelMessages };
|
|
74
|
+
const operation = {
|
|
75
|
+
action: "receive",
|
|
76
|
+
channel: { $ref: `#/channels/${channelId}` },
|
|
77
|
+
messages: [{ $ref: `#/channels/${channelId}/messages/${handlerId}` }]
|
|
78
|
+
};
|
|
79
|
+
if (handler.docs.summary) {
|
|
80
|
+
operation.summary = handler.docs.summary;
|
|
81
|
+
}
|
|
82
|
+
if (handler.docs.description) {
|
|
83
|
+
operation.description = handler.docs.description;
|
|
84
|
+
}
|
|
85
|
+
if (handler.docs.deprecated) {
|
|
86
|
+
operation.deprecated = true;
|
|
87
|
+
}
|
|
88
|
+
if (handler.docs.tags && handler.docs.tags.length > 0) {
|
|
89
|
+
operation.tags = handler.docs.tags.map((t) => ({
|
|
90
|
+
name: t
|
|
91
|
+
}));
|
|
92
|
+
for (const tag of handler.docs.tags) {
|
|
93
|
+
allTags.add(tag);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
operations[handlerId] = operation;
|
|
97
|
+
}
|
|
98
|
+
const tags = config.tags ? [...config.tags] : [];
|
|
99
|
+
for (const tagName of allTags) {
|
|
100
|
+
if (!tags.some((t) => t.name === tagName)) {
|
|
101
|
+
tags.push({ name: tagName });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const info = tags.length > 0 ? { ...config.info, tags } : config.info;
|
|
105
|
+
const spec = {
|
|
106
|
+
asyncapi: config.asyncapi ?? "3.0.0",
|
|
107
|
+
info,
|
|
108
|
+
defaultContentType: config.defaultContentType ?? "application/json",
|
|
109
|
+
channels,
|
|
110
|
+
operations
|
|
111
|
+
};
|
|
112
|
+
if (config.servers && Object.keys(config.servers).length > 0) {
|
|
113
|
+
spec.servers = config.servers;
|
|
114
|
+
}
|
|
115
|
+
if (config.externalDocs) {
|
|
116
|
+
spec.externalDocs = config.externalDocs;
|
|
117
|
+
}
|
|
118
|
+
return spec;
|
|
119
|
+
}
|
|
120
|
+
function buildMessage(eventType, payload, docs) {
|
|
121
|
+
const message = {
|
|
122
|
+
name: eventType
|
|
123
|
+
};
|
|
124
|
+
if (docs.summary) {
|
|
125
|
+
message.summary = docs.summary;
|
|
126
|
+
}
|
|
127
|
+
if (docs.description) {
|
|
128
|
+
message.description = docs.description;
|
|
129
|
+
}
|
|
130
|
+
if (docs.deprecated) {
|
|
131
|
+
message.deprecated = true;
|
|
132
|
+
}
|
|
133
|
+
if (payload) {
|
|
134
|
+
const schema = payload.toJsonSchema();
|
|
135
|
+
message.payload = schema;
|
|
136
|
+
}
|
|
137
|
+
return message;
|
|
138
|
+
}
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
generateAsyncAPI
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/presentation/events/asyncapi/index.ts","../../../src/presentation/events/handler/types/event-router-definition.type.ts","../../../src/presentation/events/handler/utils.ts","../../../src/presentation/events/asyncapi/generate.ts"],"sourcesContent":["export { generateAsyncAPI } from './generate';\nexport type {\n AsyncAPIConfig,\n AsyncAPIInfo,\n AsyncAPIServer,\n AsyncAPITag,\n AsyncAPIExternalDocs,\n AsyncAPISpec,\n AsyncAPIChannel,\n AsyncAPIMessage,\n AsyncAPIOperation,\n AsyncAPIComponents,\n} from './types';\n","/**\n * @fileoverview Event router definition types for grouping event handlers.\n *\n * Mirrors the HTTP router definition pattern with hierarchical grouping,\n * dotted-key access, and deep merge support.\n *\n * @module events/handler/types/event-router-definition\n */\n\nimport type { EventHandlerDefinition } from './event-handler-definition.type';\nimport type { SchemaAdapter } from '../../../http/schema/types';\n\n// ============================================================================\n// Router Types\n// ============================================================================\n\n/**\n * A router entry can be an event handler definition, a nested config, or a router definition.\n */\nexport type EventRouterEntry =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n EventHandlerDefinition<string, any, any> | EventRouterConfig | EventRouterDefinition;\n\n/**\n * Configuration for an event router (group of event handlers).\n */\nexport interface EventRouterConfig {\n readonly [key: string]: EventRouterEntry;\n}\n\n/**\n * Router-level defaults applied to all child event handlers.\n */\nexport interface EventRouterDefaults {\n /** Default tags for all handlers. Merged with handler-specific tags. */\n readonly tags?: readonly string[];\n\n /** Default context schema. Applied to handlers that don't define their own. */\n readonly context?: SchemaAdapter;\n}\n\n/**\n * A fully defined event router.\n */\nexport interface EventRouterDefinition<T extends EventRouterConfig = EventRouterConfig> {\n /** The handlers and nested routers in this router. */\n readonly handlers: T;\n\n /** Default values applied to all child handlers. */\n readonly defaults?: EventRouterDefaults;\n\n /**\n * Marker to identify this as an event router.\n * @internal\n */\n readonly _isEventRouter: true;\n}\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Checks if a value is an EventHandlerDefinition.\n */\nexport function isEventHandlerDefinition(value: unknown): value is EventHandlerDefinition {\n return typeof value === 'object' && value !== null && 'eventType' in value && '_types' in value;\n}\n\n/**\n * Checks if a value is an EventRouterDefinition.\n */\nexport function isEventRouterDefinition(value: unknown): value is EventRouterDefinition {\n return (\n typeof value === 'object' &&\n value !== null &&\n '_isEventRouter' in value &&\n (value as EventRouterDefinition)._isEventRouter === true\n );\n}\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\n/**\n * Flattens an event router into a map of dotted keys to handler definitions.\n */\nexport type FlattenEventRouter<\n T extends EventRouterConfig,\n Prefix extends string = '',\n> = T extends EventRouterConfig\n ? {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends EventHandlerDefinition<any, any, any>\n ? { [P in `${Prefix}${K & string}`]: T[K] }\n : T[K] extends EventRouterConfig\n ? FlattenEventRouter<T[K], `${Prefix}${K & string}.`>\n : never;\n }[keyof T] extends infer U\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\n U extends Record<string, EventHandlerDefinition<any, any, any>>\n ? U\n : never\n : never\n : never;\n\n/**\n * Gets all handler keys from an event router.\n */\nexport type EventRouterKeys<\n T extends EventRouterConfig,\n Prefix extends string = '',\n> = T extends EventRouterConfig\n ? {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends EventHandlerDefinition<any, any, any>\n ? `${Prefix}${K & string}`\n : T[K] extends EventRouterConfig\n ? EventRouterKeys<T[K], `${Prefix}${K & string}.`>\n : never;\n }[keyof T]\n : never;\n\n/**\n * Gets an event handler by its dotted key path.\n */\nexport type GetEventHandler<\n T extends EventRouterConfig,\n K extends string,\n> = K extends `${infer Head}.${infer Tail}`\n ? Head extends keyof T\n ? T[Head] extends EventRouterConfig\n ? GetEventHandler<T[Head], Tail>\n : never\n : never\n : K extends keyof T\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T[K] extends EventHandlerDefinition<any, any, any>\n ? T[K]\n : never\n : never;\n\n// ============================================================================\n// Deep Merge Types\n// ============================================================================\n\n/**\n * Deep-merges two event router configs at the type level.\n */\nexport type DeepMergeTwo<A extends EventRouterConfig, B extends EventRouterConfig> = {\n readonly [K in keyof A | keyof B]: K extends keyof A\n ? K extends keyof B\n ? A[K] extends EventRouterConfig\n ? B[K] extends EventRouterConfig\n ? DeepMergeTwo<A[K], B[K]>\n : B[K]\n : B[K]\n : A[K]\n : K extends keyof B\n ? B[K]\n : never;\n};\n\n/**\n * Recursively deep-merges N event router configs left-to-right.\n */\nexport type DeepMergeAll<T extends readonly EventRouterConfig[]> = T extends readonly [\n infer Only extends EventRouterConfig,\n]\n ? Only\n : T extends readonly [\n infer First extends EventRouterConfig,\n infer Second extends EventRouterConfig,\n ...infer Rest extends readonly EventRouterConfig[],\n ]\n ? DeepMergeAll<[DeepMergeTwo<First, Second>, ...Rest]>\n : EventRouterConfig;\n\n// ============================================================================\n// Runtime Utilities\n// ============================================================================\n\n/**\n * Collects all event handlers from a router into a flat array.\n */\nexport function collectEventHandlers(\n config: EventRouterConfig,\n basePath = '',\n): { key: string; handler: EventHandlerDefinition }[] {\n const handlers: { key: string; handler: EventHandlerDefinition }[] = [];\n\n for (const [key, value] of Object.entries(config)) {\n const fullKey = basePath ? `${basePath}.${key}` : key;\n\n if (isEventHandlerDefinition(value)) {\n handlers.push({ key: fullKey, handler: value });\n } else if (isEventRouterDefinition(value)) {\n handlers.push(...collectEventHandlers(value.handlers, fullKey));\n } else if (typeof value === 'object' && value !== null) {\n handlers.push(...collectEventHandlers(value as EventRouterConfig, fullKey));\n }\n }\n\n return handlers;\n}\n","/**\n * @fileoverview Utility functions for event handler routing.\n *\n * @module events/handler/utils\n */\n\n/**\n * Generates a handler ID from a dotted key path.\n *\n * Converts dot-separated keys to camelCase:\n * - `\"ticket.created\"` → `\"ticketCreated\"`\n * - `\"ecosystem.member.added\"` → `\"ecosystemMemberAdded\"`\n *\n * @param key - The dotted key path\n * @returns A camelCase handler ID\n */\nexport function generateHandlerId(key: string): string {\n return key.replace(/\\.(\\w)/g, (_, char: string) => char.toUpperCase());\n}\n","/**\n * @fileoverview AsyncAPI specification generation from event router definitions.\n *\n * The `generateAsyncAPI` function creates a complete AsyncAPI 3.0 specification\n * from an event router definition. All handler payload schemas are converted to\n * JSON Schema and included in the specification.\n *\n * @module events/asyncapi/generate\n */\n\nimport type { SchemaAdapter } from '../../http/schema/types';\nimport type { EventRouterConfig, EventRouterDefinition } from '../handler/types';\nimport { isEventRouterDefinition, collectEventHandlers } from '../handler/types';\nimport { generateHandlerId } from '../handler/utils';\nimport type {\n AsyncAPIConfig,\n AsyncAPISpec,\n AsyncAPIChannel,\n AsyncAPIOperation,\n AsyncAPIMessage,\n AsyncAPITag,\n} from './types';\n\n/**\n * Generates an AsyncAPI 3.0 specification from an event router definition.\n *\n * This function walks the event router structure, extracts JSON schemas from\n * all handler payload definitions, and builds a complete AsyncAPI 3.0 specification.\n *\n * @param router - Event router definition or raw config\n * @param config - AsyncAPI configuration (info, servers, tags, etc.)\n * @returns Complete AsyncAPI specification\n *\n * @example\n * ```typescript\n * import { generateAsyncAPI } from '@cosmneo/onion-lasagna/events/asyncapi';\n * import { notificationEventRouter } from './events/router';\n *\n * const spec = generateAsyncAPI(notificationEventRouter, {\n * info: {\n * title: 'My Event API',\n * version: '1.0.0',\n * description: 'Domain events for the application',\n * },\n * });\n *\n * app.get('/asyncapi.json', (c) => c.json(spec));\n * ```\n */\nexport function generateAsyncAPI<T extends EventRouterConfig>(\n router: T | EventRouterDefinition<T>,\n config: AsyncAPIConfig,\n): AsyncAPISpec {\n const routerConfig = isEventRouterDefinition(router) ? router.handlers : router;\n const handlers = collectEventHandlers(routerConfig);\n\n const channels: Record<string, AsyncAPIChannel> = {};\n const operations: Record<string, AsyncAPIOperation> = {};\n const allTags = new Set<string>();\n\n for (const { key, handler } of handlers) {\n const handlerId = generateHandlerId(key);\n const channelId = handler.eventType;\n\n // Build message\n const message = buildMessage(handler.eventType, handler.payload, handler.docs);\n\n // Build channel (group by eventType — multiple handlers may share a channel)\n if (!channels[channelId]) {\n channels[channelId] = {\n address: handler.eventType,\n messages: {},\n };\n }\n const channelMessages = { ...(channels[channelId]!.messages ?? {}) };\n channelMessages[handlerId] = message;\n channels[channelId] = { ...channels[channelId]!, messages: channelMessages };\n\n // Build operation (one per handler)\n const operation: AsyncAPIOperation = {\n action: 'receive',\n channel: { $ref: `#/channels/${channelId}` },\n messages: [{ $ref: `#/channels/${channelId}/messages/${handlerId}` }],\n };\n\n if (handler.docs.summary) {\n (operation as { summary: string }).summary = handler.docs.summary;\n }\n if (handler.docs.description) {\n (operation as { description: string }).description = handler.docs.description;\n }\n if (handler.docs.deprecated) {\n (operation as { deprecated: boolean }).deprecated = true;\n }\n if (handler.docs.tags && handler.docs.tags.length > 0) {\n (operation as { tags: readonly AsyncAPITag[] }).tags = handler.docs.tags.map((t) => ({\n name: t,\n }));\n for (const tag of handler.docs.tags) {\n allTags.add(tag);\n }\n }\n\n operations[handlerId] = operation;\n }\n\n // Merge custom tags with collected tags (AsyncAPI 3.0: tags live inside info)\n const tags: AsyncAPITag[] = config.tags ? [...config.tags] : [];\n for (const tagName of allTags) {\n if (!tags.some((t) => t.name === tagName)) {\n tags.push({ name: tagName });\n }\n }\n\n const info = tags.length > 0 ? { ...config.info, tags } : config.info;\n\n // Build the specification\n const spec: AsyncAPISpec = {\n asyncapi: config.asyncapi ?? '3.0.0',\n info,\n defaultContentType: config.defaultContentType ?? 'application/json',\n channels,\n operations,\n };\n\n if (config.servers && Object.keys(config.servers).length > 0) {\n (spec as { servers: typeof config.servers }).servers = config.servers;\n }\n\n if (config.externalDocs) {\n (spec as { externalDocs: typeof config.externalDocs }).externalDocs = config.externalDocs;\n }\n\n return spec;\n}\n\n/**\n * Builds an AsyncAPI message from a handler definition.\n */\nfunction buildMessage(\n eventType: string,\n payload: unknown,\n docs: {\n readonly summary?: string;\n readonly description?: string;\n readonly tags?: readonly string[];\n readonly deprecated?: boolean;\n },\n): AsyncAPIMessage {\n const message: AsyncAPIMessage = {\n name: eventType,\n };\n\n if (docs.summary) {\n (message as { summary: string }).summary = docs.summary;\n }\n if (docs.description) {\n (message as { description: string }).description = docs.description;\n }\n if (docs.deprecated) {\n (message as { deprecated: boolean }).deprecated = true;\n }\n\n if (payload) {\n const schema = (payload as SchemaAdapter).toJsonSchema();\n (message as { payload: typeof schema }).payload = schema;\n }\n\n return message;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { c as EventRouterConfig, e as EventRouterDefinition } from '../../event-router-definition.type-CP9uTlux.cjs';
|
|
2
|
+
import { JsonSchema } from '../../http/schema/types.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview AsyncAPI types for specification generation.
|
|
6
|
+
*
|
|
7
|
+
* @module events/asyncapi/types
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* AsyncAPI specification configuration.
|
|
12
|
+
*/
|
|
13
|
+
interface AsyncAPIConfig {
|
|
14
|
+
/**
|
|
15
|
+
* AsyncAPI specification version.
|
|
16
|
+
* @default '3.0.0'
|
|
17
|
+
*/
|
|
18
|
+
readonly asyncapi?: '3.0.0';
|
|
19
|
+
/**
|
|
20
|
+
* API information.
|
|
21
|
+
*/
|
|
22
|
+
readonly info: AsyncAPIInfo;
|
|
23
|
+
/**
|
|
24
|
+
* Server configurations (e.g., message broker details).
|
|
25
|
+
*/
|
|
26
|
+
readonly servers?: Record<string, AsyncAPIServer>;
|
|
27
|
+
/**
|
|
28
|
+
* Default content type for messages.
|
|
29
|
+
* @default 'application/json'
|
|
30
|
+
*/
|
|
31
|
+
readonly defaultContentType?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom tags with descriptions.
|
|
34
|
+
*/
|
|
35
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
36
|
+
/**
|
|
37
|
+
* External documentation.
|
|
38
|
+
*/
|
|
39
|
+
readonly externalDocs?: AsyncAPIExternalDocs;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* API information.
|
|
43
|
+
*/
|
|
44
|
+
interface AsyncAPIInfo {
|
|
45
|
+
readonly title: string;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
readonly description?: string;
|
|
48
|
+
readonly termsOfService?: string;
|
|
49
|
+
readonly contact?: {
|
|
50
|
+
readonly name?: string;
|
|
51
|
+
readonly url?: string;
|
|
52
|
+
readonly email?: string;
|
|
53
|
+
};
|
|
54
|
+
readonly license?: {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly url?: string;
|
|
57
|
+
};
|
|
58
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Server configuration (message broker).
|
|
62
|
+
*/
|
|
63
|
+
interface AsyncAPIServer {
|
|
64
|
+
readonly host: string;
|
|
65
|
+
readonly protocol: string;
|
|
66
|
+
readonly protocolVersion?: string;
|
|
67
|
+
readonly pathname?: string;
|
|
68
|
+
readonly description?: string;
|
|
69
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Tag definition.
|
|
73
|
+
*/
|
|
74
|
+
interface AsyncAPITag {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly description?: string;
|
|
77
|
+
readonly externalDocs?: AsyncAPIExternalDocs;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* External documentation.
|
|
81
|
+
*/
|
|
82
|
+
interface AsyncAPIExternalDocs {
|
|
83
|
+
readonly url: string;
|
|
84
|
+
readonly description?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Complete AsyncAPI 3.0 specification.
|
|
88
|
+
*/
|
|
89
|
+
interface AsyncAPISpec {
|
|
90
|
+
readonly asyncapi: string;
|
|
91
|
+
readonly info: AsyncAPIInfo;
|
|
92
|
+
readonly servers?: Record<string, AsyncAPIServer>;
|
|
93
|
+
readonly defaultContentType?: string;
|
|
94
|
+
readonly channels?: Record<string, AsyncAPIChannel>;
|
|
95
|
+
readonly operations?: Record<string, AsyncAPIOperation>;
|
|
96
|
+
readonly components?: AsyncAPIComponents;
|
|
97
|
+
readonly externalDocs?: AsyncAPIExternalDocs;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Channel definition (represents an event type).
|
|
101
|
+
*/
|
|
102
|
+
interface AsyncAPIChannel {
|
|
103
|
+
readonly address?: string;
|
|
104
|
+
readonly messages?: Record<string, AsyncAPIMessage>;
|
|
105
|
+
readonly description?: string;
|
|
106
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Message definition (event payload).
|
|
110
|
+
*/
|
|
111
|
+
interface AsyncAPIMessage {
|
|
112
|
+
readonly name?: string;
|
|
113
|
+
readonly title?: string;
|
|
114
|
+
readonly summary?: string;
|
|
115
|
+
readonly description?: string;
|
|
116
|
+
readonly contentType?: string;
|
|
117
|
+
readonly payload?: JsonSchema;
|
|
118
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
119
|
+
readonly deprecated?: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Operation definition (subscribe action).
|
|
123
|
+
*/
|
|
124
|
+
interface AsyncAPIOperation {
|
|
125
|
+
readonly action: 'send' | 'receive';
|
|
126
|
+
readonly channel: {
|
|
127
|
+
readonly $ref: string;
|
|
128
|
+
};
|
|
129
|
+
readonly summary?: string;
|
|
130
|
+
readonly description?: string;
|
|
131
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
132
|
+
readonly deprecated?: boolean;
|
|
133
|
+
readonly messages?: readonly {
|
|
134
|
+
readonly $ref: string;
|
|
135
|
+
}[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Components object for reusable definitions.
|
|
139
|
+
*/
|
|
140
|
+
interface AsyncAPIComponents {
|
|
141
|
+
readonly schemas?: Record<string, JsonSchema>;
|
|
142
|
+
readonly messages?: Record<string, AsyncAPIMessage>;
|
|
143
|
+
readonly channels?: Record<string, AsyncAPIChannel>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @fileoverview AsyncAPI specification generation from event router definitions.
|
|
148
|
+
*
|
|
149
|
+
* The `generateAsyncAPI` function creates a complete AsyncAPI 3.0 specification
|
|
150
|
+
* from an event router definition. All handler payload schemas are converted to
|
|
151
|
+
* JSON Schema and included in the specification.
|
|
152
|
+
*
|
|
153
|
+
* @module events/asyncapi/generate
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Generates an AsyncAPI 3.0 specification from an event router definition.
|
|
158
|
+
*
|
|
159
|
+
* This function walks the event router structure, extracts JSON schemas from
|
|
160
|
+
* all handler payload definitions, and builds a complete AsyncAPI 3.0 specification.
|
|
161
|
+
*
|
|
162
|
+
* @param router - Event router definition or raw config
|
|
163
|
+
* @param config - AsyncAPI configuration (info, servers, tags, etc.)
|
|
164
|
+
* @returns Complete AsyncAPI specification
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* import { generateAsyncAPI } from '@cosmneo/onion-lasagna/events/asyncapi';
|
|
169
|
+
* import { notificationEventRouter } from './events/router';
|
|
170
|
+
*
|
|
171
|
+
* const spec = generateAsyncAPI(notificationEventRouter, {
|
|
172
|
+
* info: {
|
|
173
|
+
* title: 'My Event API',
|
|
174
|
+
* version: '1.0.0',
|
|
175
|
+
* description: 'Domain events for the application',
|
|
176
|
+
* },
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* app.get('/asyncapi.json', (c) => c.json(spec));
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
declare function generateAsyncAPI<T extends EventRouterConfig>(router: T | EventRouterDefinition<T>, config: AsyncAPIConfig): AsyncAPISpec;
|
|
183
|
+
|
|
184
|
+
export { type AsyncAPIChannel, type AsyncAPIComponents, type AsyncAPIConfig, type AsyncAPIExternalDocs, type AsyncAPIInfo, type AsyncAPIMessage, type AsyncAPIOperation, type AsyncAPIServer, type AsyncAPISpec, type AsyncAPITag, generateAsyncAPI };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { c as EventRouterConfig, e as EventRouterDefinition } from '../../event-router-definition.type-D8CG-kjZ.js';
|
|
2
|
+
import { JsonSchema } from '../../http/schema/types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview AsyncAPI types for specification generation.
|
|
6
|
+
*
|
|
7
|
+
* @module events/asyncapi/types
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* AsyncAPI specification configuration.
|
|
12
|
+
*/
|
|
13
|
+
interface AsyncAPIConfig {
|
|
14
|
+
/**
|
|
15
|
+
* AsyncAPI specification version.
|
|
16
|
+
* @default '3.0.0'
|
|
17
|
+
*/
|
|
18
|
+
readonly asyncapi?: '3.0.0';
|
|
19
|
+
/**
|
|
20
|
+
* API information.
|
|
21
|
+
*/
|
|
22
|
+
readonly info: AsyncAPIInfo;
|
|
23
|
+
/**
|
|
24
|
+
* Server configurations (e.g., message broker details).
|
|
25
|
+
*/
|
|
26
|
+
readonly servers?: Record<string, AsyncAPIServer>;
|
|
27
|
+
/**
|
|
28
|
+
* Default content type for messages.
|
|
29
|
+
* @default 'application/json'
|
|
30
|
+
*/
|
|
31
|
+
readonly defaultContentType?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom tags with descriptions.
|
|
34
|
+
*/
|
|
35
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
36
|
+
/**
|
|
37
|
+
* External documentation.
|
|
38
|
+
*/
|
|
39
|
+
readonly externalDocs?: AsyncAPIExternalDocs;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* API information.
|
|
43
|
+
*/
|
|
44
|
+
interface AsyncAPIInfo {
|
|
45
|
+
readonly title: string;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
readonly description?: string;
|
|
48
|
+
readonly termsOfService?: string;
|
|
49
|
+
readonly contact?: {
|
|
50
|
+
readonly name?: string;
|
|
51
|
+
readonly url?: string;
|
|
52
|
+
readonly email?: string;
|
|
53
|
+
};
|
|
54
|
+
readonly license?: {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly url?: string;
|
|
57
|
+
};
|
|
58
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Server configuration (message broker).
|
|
62
|
+
*/
|
|
63
|
+
interface AsyncAPIServer {
|
|
64
|
+
readonly host: string;
|
|
65
|
+
readonly protocol: string;
|
|
66
|
+
readonly protocolVersion?: string;
|
|
67
|
+
readonly pathname?: string;
|
|
68
|
+
readonly description?: string;
|
|
69
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Tag definition.
|
|
73
|
+
*/
|
|
74
|
+
interface AsyncAPITag {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly description?: string;
|
|
77
|
+
readonly externalDocs?: AsyncAPIExternalDocs;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* External documentation.
|
|
81
|
+
*/
|
|
82
|
+
interface AsyncAPIExternalDocs {
|
|
83
|
+
readonly url: string;
|
|
84
|
+
readonly description?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Complete AsyncAPI 3.0 specification.
|
|
88
|
+
*/
|
|
89
|
+
interface AsyncAPISpec {
|
|
90
|
+
readonly asyncapi: string;
|
|
91
|
+
readonly info: AsyncAPIInfo;
|
|
92
|
+
readonly servers?: Record<string, AsyncAPIServer>;
|
|
93
|
+
readonly defaultContentType?: string;
|
|
94
|
+
readonly channels?: Record<string, AsyncAPIChannel>;
|
|
95
|
+
readonly operations?: Record<string, AsyncAPIOperation>;
|
|
96
|
+
readonly components?: AsyncAPIComponents;
|
|
97
|
+
readonly externalDocs?: AsyncAPIExternalDocs;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Channel definition (represents an event type).
|
|
101
|
+
*/
|
|
102
|
+
interface AsyncAPIChannel {
|
|
103
|
+
readonly address?: string;
|
|
104
|
+
readonly messages?: Record<string, AsyncAPIMessage>;
|
|
105
|
+
readonly description?: string;
|
|
106
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Message definition (event payload).
|
|
110
|
+
*/
|
|
111
|
+
interface AsyncAPIMessage {
|
|
112
|
+
readonly name?: string;
|
|
113
|
+
readonly title?: string;
|
|
114
|
+
readonly summary?: string;
|
|
115
|
+
readonly description?: string;
|
|
116
|
+
readonly contentType?: string;
|
|
117
|
+
readonly payload?: JsonSchema;
|
|
118
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
119
|
+
readonly deprecated?: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Operation definition (subscribe action).
|
|
123
|
+
*/
|
|
124
|
+
interface AsyncAPIOperation {
|
|
125
|
+
readonly action: 'send' | 'receive';
|
|
126
|
+
readonly channel: {
|
|
127
|
+
readonly $ref: string;
|
|
128
|
+
};
|
|
129
|
+
readonly summary?: string;
|
|
130
|
+
readonly description?: string;
|
|
131
|
+
readonly tags?: readonly AsyncAPITag[];
|
|
132
|
+
readonly deprecated?: boolean;
|
|
133
|
+
readonly messages?: readonly {
|
|
134
|
+
readonly $ref: string;
|
|
135
|
+
}[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Components object for reusable definitions.
|
|
139
|
+
*/
|
|
140
|
+
interface AsyncAPIComponents {
|
|
141
|
+
readonly schemas?: Record<string, JsonSchema>;
|
|
142
|
+
readonly messages?: Record<string, AsyncAPIMessage>;
|
|
143
|
+
readonly channels?: Record<string, AsyncAPIChannel>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @fileoverview AsyncAPI specification generation from event router definitions.
|
|
148
|
+
*
|
|
149
|
+
* The `generateAsyncAPI` function creates a complete AsyncAPI 3.0 specification
|
|
150
|
+
* from an event router definition. All handler payload schemas are converted to
|
|
151
|
+
* JSON Schema and included in the specification.
|
|
152
|
+
*
|
|
153
|
+
* @module events/asyncapi/generate
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Generates an AsyncAPI 3.0 specification from an event router definition.
|
|
158
|
+
*
|
|
159
|
+
* This function walks the event router structure, extracts JSON schemas from
|
|
160
|
+
* all handler payload definitions, and builds a complete AsyncAPI 3.0 specification.
|
|
161
|
+
*
|
|
162
|
+
* @param router - Event router definition or raw config
|
|
163
|
+
* @param config - AsyncAPI configuration (info, servers, tags, etc.)
|
|
164
|
+
* @returns Complete AsyncAPI specification
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* import { generateAsyncAPI } from '@cosmneo/onion-lasagna/events/asyncapi';
|
|
169
|
+
* import { notificationEventRouter } from './events/router';
|
|
170
|
+
*
|
|
171
|
+
* const spec = generateAsyncAPI(notificationEventRouter, {
|
|
172
|
+
* info: {
|
|
173
|
+
* title: 'My Event API',
|
|
174
|
+
* version: '1.0.0',
|
|
175
|
+
* description: 'Domain events for the application',
|
|
176
|
+
* },
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* app.get('/asyncapi.json', (c) => c.json(spec));
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
declare function generateAsyncAPI<T extends EventRouterConfig>(router: T | EventRouterDefinition<T>, config: AsyncAPIConfig): AsyncAPISpec;
|
|
183
|
+
|
|
184
|
+
export { type AsyncAPIChannel, type AsyncAPIComponents, type AsyncAPIConfig, type AsyncAPIExternalDocs, type AsyncAPIInfo, type AsyncAPIMessage, type AsyncAPIOperation, type AsyncAPIServer, type AsyncAPISpec, type AsyncAPITag, generateAsyncAPI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|