@eventcatalog/generator-openapi 7.1.1 → 7.2.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/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -13
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +17 -2
- package/dist/types.d.ts +17 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Service, Domain } from './types.mjs';
|
|
1
|
+
import { Service, Message, Domain } from './types.mjs';
|
|
2
2
|
import 'openapi-types';
|
|
3
3
|
|
|
4
4
|
type MESSAGE_TYPE = 'command' | 'query' | 'event';
|
|
@@ -6,6 +6,7 @@ type HTTP_METHOD = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIO
|
|
|
6
6
|
type HTTP_METHOD_TO_MESSAGE_TYPE = Partial<Record<HTTP_METHOD, MESSAGE_TYPE>>;
|
|
7
7
|
type Props = {
|
|
8
8
|
services: Service[];
|
|
9
|
+
messages?: Message;
|
|
9
10
|
domain?: Domain;
|
|
10
11
|
debug?: boolean;
|
|
11
12
|
saveParsedSpecFile?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Service, Domain } from './types.js';
|
|
1
|
+
import { Service, Message, Domain } from './types.js';
|
|
2
2
|
import 'openapi-types';
|
|
3
3
|
|
|
4
4
|
type MESSAGE_TYPE = 'command' | 'query' | 'event';
|
|
@@ -6,6 +6,7 @@ type HTTP_METHOD = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIO
|
|
|
6
6
|
type HTTP_METHOD_TO_MESSAGE_TYPE = Partial<Record<HTTP_METHOD, MESSAGE_TYPE>>;
|
|
7
7
|
type Props = {
|
|
8
8
|
services: Service[];
|
|
9
|
+
messages?: Message;
|
|
9
10
|
domain?: Domain;
|
|
10
11
|
debug?: boolean;
|
|
11
12
|
saveParsedSpecFile?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -5872,9 +5872,9 @@ var require_src = __commonJS({
|
|
|
5872
5872
|
}
|
|
5873
5873
|
});
|
|
5874
5874
|
|
|
5875
|
-
// ../../node_modules/.pnpm/agent-base@7.1.
|
|
5875
|
+
// ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
|
|
5876
5876
|
var require_helpers = __commonJS({
|
|
5877
|
-
"../../node_modules/.pnpm/agent-base@7.1.
|
|
5877
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(exports2) {
|
|
5878
5878
|
"use strict";
|
|
5879
5879
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
5880
5880
|
if (k2 === void 0) k2 = k;
|
|
@@ -5942,9 +5942,9 @@ var require_helpers = __commonJS({
|
|
|
5942
5942
|
}
|
|
5943
5943
|
});
|
|
5944
5944
|
|
|
5945
|
-
// ../../node_modules/.pnpm/agent-base@7.1.
|
|
5945
|
+
// ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
|
|
5946
5946
|
var require_dist = __commonJS({
|
|
5947
|
-
"../../node_modules/.pnpm/agent-base@7.1.
|
|
5947
|
+
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(exports2) {
|
|
5948
5948
|
"use strict";
|
|
5949
5949
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
5950
5950
|
if (k2 === void 0) k2 = k;
|
|
@@ -6040,7 +6040,7 @@ var require_dist = __commonJS({
|
|
|
6040
6040
|
// In order to properly update the socket pool, we need to call `getName()` on
|
|
6041
6041
|
// the core `https.Agent` if it is a secureEndpoint.
|
|
6042
6042
|
getName(options) {
|
|
6043
|
-
const secureEndpoint =
|
|
6043
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
6044
6044
|
if (secureEndpoint) {
|
|
6045
6045
|
return https_1.Agent.prototype.getName.call(this, options);
|
|
6046
6046
|
}
|
|
@@ -6640,10 +6640,11 @@ var getSummary = (document2) => {
|
|
|
6640
6640
|
const summary = document2.info.description ? document2.info.description : "";
|
|
6641
6641
|
return summary && summary.length < 150 ? summary : "";
|
|
6642
6642
|
};
|
|
6643
|
-
var buildService = (serviceOptions, document2) => {
|
|
6643
|
+
var buildService = (serviceOptions, document2, generateMarkdown) => {
|
|
6644
6644
|
const schemaPath = import_path.default.basename(serviceOptions.path) || "openapi.yml";
|
|
6645
6645
|
const documentTags = document2.tags || [];
|
|
6646
6646
|
const serviceId = serviceOptions.id || (0, import_slugify.default)(document2.info.title, { lower: true, strict: true });
|
|
6647
|
+
const generatedMarkdownForService = defaultMarkdown2(document2, schemaPath);
|
|
6647
6648
|
return {
|
|
6648
6649
|
id: serviceId,
|
|
6649
6650
|
version: document2.info.version,
|
|
@@ -6653,7 +6654,7 @@ var buildService = (serviceOptions, document2) => {
|
|
|
6653
6654
|
specifications: {
|
|
6654
6655
|
openapiPath: schemaPath
|
|
6655
6656
|
},
|
|
6656
|
-
markdown:
|
|
6657
|
+
markdown: generateMarkdown ? generateMarkdown({ service: serviceOptions, document: document2, markdown: generatedMarkdownForService }) : generatedMarkdownForService,
|
|
6657
6658
|
badges: documentTags.map((tag) => ({ content: tag.name, textColor: "blue", backgroundColor: "blue" })),
|
|
6658
6659
|
owners: serviceOptions.owners || [],
|
|
6659
6660
|
setMessageOwnersToServiceOwners: serviceOptions.setMessageOwnersToServiceOwners || true
|
|
@@ -6867,7 +6868,7 @@ var getSummary2 = (message) => {
|
|
|
6867
6868
|
}
|
|
6868
6869
|
return eventCatalogMessageSummary;
|
|
6869
6870
|
};
|
|
6870
|
-
var buildMessage = async (pathToFile, document2, operation) => {
|
|
6871
|
+
var buildMessage = async (pathToFile, document2, operation, generateMarkdown) => {
|
|
6871
6872
|
const requestBodiesAndResponses = await getSchemasByOperationId(pathToFile, operation.operationId);
|
|
6872
6873
|
const extensions = operation.extensions || {};
|
|
6873
6874
|
const operationTags = operation.tags.map((badge) => ({
|
|
@@ -6883,12 +6884,13 @@ var buildMessage = async (pathToFile, document2, operation) => {
|
|
|
6883
6884
|
uniqueIdentifier = uniqueIdentifier.concat(`_${path3}`);
|
|
6884
6885
|
}
|
|
6885
6886
|
const httpVerb = operation.method.toUpperCase() || "";
|
|
6887
|
+
const generatedMarkdownForMessage = defaultMarkdown3(operation, requestBodiesAndResponses);
|
|
6886
6888
|
return {
|
|
6887
6889
|
id: extensions["x-eventcatalog-message-id"] || uniqueIdentifier,
|
|
6888
6890
|
version: extensions["x-eventcatalog-message-version"] || document2.info.version,
|
|
6889
6891
|
name: extensions["x-eventcatalog-message-name"] || uniqueIdentifier,
|
|
6890
6892
|
summary: getSummary2(operation),
|
|
6891
|
-
markdown:
|
|
6893
|
+
markdown: generateMarkdown ? generateMarkdown({ operation, markdown: generatedMarkdownForMessage }) : generatedMarkdownForMessage,
|
|
6892
6894
|
schemaPath: requestBodiesAndResponses?.requestBody ? "request-body.json" : "",
|
|
6893
6895
|
badges,
|
|
6894
6896
|
requestBodiesAndResponses,
|
|
@@ -8293,7 +8295,7 @@ var import_node_path2 = require("path");
|
|
|
8293
8295
|
// package.json
|
|
8294
8296
|
var package_default = {
|
|
8295
8297
|
name: "@eventcatalog/generator-openapi",
|
|
8296
|
-
version: "7.
|
|
8298
|
+
version: "7.2.1",
|
|
8297
8299
|
description: "OpenAPI generator for EventCatalog",
|
|
8298
8300
|
scripts: {
|
|
8299
8301
|
build: "tsup",
|
|
@@ -9256,7 +9258,7 @@ var index_default = async (_, options) => {
|
|
|
9256
9258
|
const document2 = specification.document;
|
|
9257
9259
|
const version = document2.info.version;
|
|
9258
9260
|
const specPath = specification.path;
|
|
9259
|
-
const service = buildService({ ...serviceSpec, path: specPath }, document2);
|
|
9261
|
+
const service = buildService({ ...serviceSpec, path: specPath }, document2, serviceSpec.generateMarkdown);
|
|
9260
9262
|
let serviceMarkdown = service.markdown;
|
|
9261
9263
|
let serviceSpecificationsFiles = [];
|
|
9262
9264
|
let serviceSpecifications = service.specifications;
|
|
@@ -9275,11 +9277,12 @@ Processing domain: ${domainName} (v${domainVersion})`));
|
|
|
9275
9277
|
console.log(import_chalk3.default.cyan(` - Versioned previous domain (v${currentDomain.version})`));
|
|
9276
9278
|
}
|
|
9277
9279
|
if (!domain || domain && domain.version !== domainVersion) {
|
|
9280
|
+
const generatedMarkdownForDomain = defaultMarkdown();
|
|
9278
9281
|
await writeDomain({
|
|
9279
9282
|
id: domainId,
|
|
9280
9283
|
name: domainName,
|
|
9281
9284
|
version: domainVersion,
|
|
9282
|
-
markdown:
|
|
9285
|
+
markdown: options.domain?.generateMarkdown ? options.domain.generateMarkdown({ domain: options.domain, markdown: generatedMarkdownForDomain }) : generatedMarkdownForDomain,
|
|
9283
9286
|
...options.domain?.owners ? { owners: options.domain.owners } : {}
|
|
9284
9287
|
});
|
|
9285
9288
|
console.log(import_chalk3.default.cyan(` - Domain (v${domainVersion}) created`));
|
|
@@ -9365,7 +9368,12 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document2, servicePath, o
|
|
|
9365
9368
|
const preserveExistingMessages = options.preserveExistingMessages ?? true;
|
|
9366
9369
|
let receives = [], sends = [];
|
|
9367
9370
|
for (const operation of operations) {
|
|
9368
|
-
const { requestBodiesAndResponses, sidebar, ...message } = await buildMessage(
|
|
9371
|
+
const { requestBodiesAndResponses, sidebar, ...message } = await buildMessage(
|
|
9372
|
+
pathToSpec,
|
|
9373
|
+
document2,
|
|
9374
|
+
operation,
|
|
9375
|
+
options.messages?.generateMarkdown
|
|
9376
|
+
);
|
|
9369
9377
|
let messageMarkdown = message.markdown;
|
|
9370
9378
|
const messageType = operation.type;
|
|
9371
9379
|
const messageAction = operation.action;
|