@eventcatalog/generator-openapi 7.4.2 → 7.4.4

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.js CHANGED
@@ -572,7 +572,7 @@ var getSummary2 = (message2) => {
572
572
  }
573
573
  return escapeSpecialCharactersThatBreakMarkdown(eventCatalogMessageSummary);
574
574
  };
575
- var buildMessage = async (pathToFile, document, operation, generateMarkdown, messageIdConfig) => {
575
+ var buildMessage = async (pathToFile, document, operation, generateMarkdown, messageIdConfig, serviceId) => {
576
576
  const requestBodiesAndResponses = await getSchemasByOperationId(pathToFile, operation.operationId);
577
577
  const extensions = operation.extensions || {};
578
578
  const operationTags = operation.tags.map((badge) => ({
@@ -595,7 +595,7 @@ var buildMessage = async (pathToFile, document, operation, generateMarkdown, mes
595
595
  }
596
596
  if (messageIdConfig?.prefixWithServiceId) {
597
597
  const separator = messageIdConfig.separator || "-";
598
- uniqueIdentifier = [apiName, uniqueIdentifier].join(separator);
598
+ uniqueIdentifier = [serviceId, uniqueIdentifier].join(separator);
599
599
  }
600
600
  return {
601
601
  id: extensions["x-eventcatalog-message-id"] || uniqueIdentifier,
@@ -2833,7 +2833,7 @@ var import_node_path = require("path");
2833
2833
  // package.json
2834
2834
  var package_default = {
2835
2835
  name: "@eventcatalog/generator-openapi",
2836
- version: "7.4.2",
2836
+ version: "7.4.4",
2837
2837
  description: "OpenAPI generator for EventCatalog",
2838
2838
  scripts: {
2839
2839
  build: "tsup",
@@ -2897,31 +2897,34 @@ var getInstalledVersionOfPackage = (packageName) => {
2897
2897
  async function checkForPackageUpdate(packageName) {
2898
2898
  const installedVersion = getInstalledVersionOfPackage(packageName);
2899
2899
  if (!installedVersion || installedVersion === "latest") return;
2900
- const pkg = { name: packageName, version: installedVersion };
2901
- const updateNotifierModule = await import("update-notifier");
2902
- const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
2903
- const info = await notifier.fetchInfo();
2904
- if (info?.type !== "latest") {
2905
- const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
2900
+ try {
2901
+ const pkg = { name: packageName, version: installedVersion };
2902
+ const updateNotifierModule = await import("update-notifier");
2903
+ const notifier = updateNotifierModule.default({ pkg, updateCheckInterval: 0, shouldNotifyInNpmScript: true });
2904
+ const info = await notifier.fetchInfo();
2905
+ if (info?.type !== "latest") {
2906
+ const message2 = `Package ${packageName} update available ${info.current} \u2192 ${info.latest}
2906
2907
  Run npm i ${packageName} to update`;
2907
- console.log(
2908
- boxen(message2, {
2909
- padding: 1,
2910
- margin: 1,
2911
- align: "center",
2912
- borderColor: "yellow",
2913
- borderStyle: {
2914
- topLeft: " ",
2915
- topRight: " ",
2916
- bottomLeft: " ",
2917
- bottomRight: " ",
2918
- right: " ",
2919
- top: "-",
2920
- bottom: "-",
2921
- left: " "
2922
- }
2923
- })
2924
- );
2908
+ console.log(
2909
+ boxen(message2, {
2910
+ padding: 1,
2911
+ margin: 1,
2912
+ align: "center",
2913
+ borderColor: "yellow",
2914
+ borderStyle: {
2915
+ topLeft: " ",
2916
+ topRight: " ",
2917
+ bottomLeft: " ",
2918
+ bottomRight: " ",
2919
+ right: " ",
2920
+ top: "-",
2921
+ bottom: "-",
2922
+ left: " "
2923
+ }
2924
+ })
2925
+ );
2926
+ }
2927
+ } catch (error) {
2925
2928
  }
2926
2929
  }
2927
2930
 
@@ -3040,7 +3043,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
3040
3043
  ...options,
3041
3044
  owners: service.setMessageOwnersToServiceOwners ? service.owners : [],
3042
3045
  serviceHasMultipleSpecFiles: Array.isArray(serviceSpec.path),
3043
- isDraft: isServiceMarkedAsDraft
3046
+ isDraft: isServiceMarkedAsDraft,
3047
+ serviceId: service.id
3044
3048
  });
3045
3049
  let owners = service.owners || [];
3046
3050
  let repository = null;
@@ -3066,6 +3070,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
3066
3070
  await writeService(
3067
3071
  {
3068
3072
  ...service,
3073
+ name: serviceSpec.name || service.name,
3074
+ summary: serviceSpec.summary || service.summary,
3069
3075
  badges: serviceBadges || service.badges,
3070
3076
  markdown: serviceMarkdown,
3071
3077
  specifications: serviceSpecifications,
@@ -3114,7 +3120,8 @@ var processMessagesForOpenAPISpec = async (pathToSpec, document, servicePath, op
3114
3120
  document,
3115
3121
  operation,
3116
3122
  options.messages?.generateMarkdown,
3117
- options.messages?.id
3123
+ options.messages?.id,
3124
+ options.serviceId
3118
3125
  );
3119
3126
  let messageMarkdown = message2.markdown;
3120
3127
  const messageType = operation.type;