@eventcatalog/generator-asyncapi 4.3.0 → 4.4.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.mjs CHANGED
@@ -1536,7 +1536,7 @@ import path2 from "path";
1536
1536
  // package.json
1537
1537
  var package_default = {
1538
1538
  name: "@eventcatalog/generator-asyncapi",
1539
- version: "4.3.0",
1539
+ version: "4.4.0",
1540
1540
  description: "AsyncAPI generator for EventCatalog",
1541
1541
  scripts: {
1542
1542
  build: "tsup",
@@ -1574,7 +1574,7 @@ var package_default = {
1574
1574
  dependencies: {
1575
1575
  "@asyncapi/avro-schema-parser": "^3.0.24",
1576
1576
  "@asyncapi/parser": "^3.3.0",
1577
- "@eventcatalog/sdk": "^2.5.5",
1577
+ "@eventcatalog/sdk": "^2.6.9",
1578
1578
  chalk: "^4",
1579
1579
  "fs-extra": "^11.2.0",
1580
1580
  glob: "^11.0.0",
@@ -2656,6 +2656,7 @@ var optionsSchema = z.object({
2656
2656
  z.object({
2657
2657
  id: z.string({ required_error: "The service id is required. please provide the service id" }),
2658
2658
  path: z.string({ required_error: "The service path is required. please provide the path to specification file" }),
2659
+ draft: z.boolean().optional(),
2659
2660
  name: z.string().optional(),
2660
2661
  owners: z.array(z.string()).optional(),
2661
2662
  generateMarkdown: z.function().args(
@@ -2687,6 +2688,7 @@ var optionsSchema = z.object({
2687
2688
  name: z.string({ required_error: "The domain name is required. please provide a domain name" }),
2688
2689
  owners: z.array(z.string()).optional(),
2689
2690
  version: z.string({ required_error: "The domain version is required. please provide a domain version" }),
2691
+ draft: z.boolean().optional(),
2690
2692
  // function that takes options (including domain) and returns a string
2691
2693
  generateMarkdown: z.function().args(
2692
2694
  z.object({
@@ -2792,6 +2794,8 @@ var index_default = async (config, options) => {
2792
2794
  const operations = document2.allOperations();
2793
2795
  const channels = document2.allChannels();
2794
2796
  const documentTags = document2.info().tags().all() || [];
2797
+ const isDomainMarkedAsDraft = options.domain?.draft || false;
2798
+ const isServiceMarkedAsDraft = isDomainMarkedAsDraft || document2.info().extensions().get("x-eventcatalog-draft")?.value() || service.draft || false;
2795
2799
  const serviceId = service.id;
2796
2800
  const serviceName = service.name || document2.info().title();
2797
2801
  const version = document2.info().version();
@@ -2816,6 +2820,7 @@ var index_default = async (config, options) => {
2816
2820
  const { id: domainId, name: domainName, version: domainVersion, owners: domainOwners } = options.domain;
2817
2821
  const domain = await getDomain(options.domain.id, domainVersion || "latest");
2818
2822
  const currentDomain = await getDomain(options.domain.id, "latest");
2823
+ const domainIsDraft = isDomainMarkedAsDraft || currentDomain?.draft || false;
2819
2824
  console.log(chalk3.blue(`
2820
2825
  Processing domain: ${domainName} (v${domainVersion})`));
2821
2826
  if (currentDomain && currentDomain.version !== domainVersion) {
@@ -2829,7 +2834,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
2829
2834
  name: domainName,
2830
2835
  version: domainVersion,
2831
2836
  markdown: options.domain?.generateMarkdown ? options.domain.generateMarkdown({ domain: options.domain, markdown: generatedMarkdownForDomain }) : generatedMarkdownForDomain,
2832
- ...domainOwners && { owners: domainOwners }
2837
+ ...domainOwners && { owners: domainOwners },
2838
+ ...domainIsDraft && { draft: true }
2833
2839
  // services: [{ id: serviceId, version: version }],
2834
2840
  });
2835
2841
  console.log(chalk3.cyan(` - Domain (v${domainVersion}) created`));
@@ -2877,7 +2883,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
2877
2883
  ...Object.keys(paramsForCatalog).length > 0 && { parameters: paramsForCatalog },
2878
2884
  ...channel.address() && { address: channel.address() },
2879
2885
  ...channelAsJSON?.summary && { summary: channelAsJSON.summary },
2880
- ...protocols.length > 0 && { protocols }
2886
+ ...protocols.length > 0 && { protocols },
2887
+ ...(isDomainMarkedAsDraft || isServiceMarkedAsDraft) && { draft: true }
2881
2888
  },
2882
2889
  { override: true }
2883
2890
  );
@@ -2890,6 +2897,7 @@ Processing domain: ${domainName} (v${domainVersion})`));
2890
2897
  const messageVersion = message.extensions().get("x-eventcatalog-message-version")?.value() || version;
2891
2898
  const deprecatedDate = message.extensions().get("x-eventcatalog-deprecated-date")?.value() || null;
2892
2899
  const deprecatedMessage = message.extensions().get("x-eventcatalog-deprecated-message")?.value() || null;
2900
+ const isMessageMarkedAsDraft = isDomainMarkedAsDraft || isServiceMarkedAsDraft || message.extensions().get("x-eventcatalog-draft")?.value() || null;
2893
2901
  const serviceOwnsMessageContract = isServiceMessageOwner(message);
2894
2902
  const isReceived = operation.action() === "receive" || operation.action() === "subscribe";
2895
2903
  const isSent = operation.action() === "send" || operation.action() === "publish";
@@ -2935,7 +2943,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
2935
2943
  ...channelsForMessage.length > 0 && { channels: channelsForMessage },
2936
2944
  ...deprecatedDate && {
2937
2945
  deprecated: { date: deprecatedDate, ...deprecatedMessage && { message: deprecatedMessage } }
2938
- }
2946
+ },
2947
+ ...isMessageMarkedAsDraft && { draft: true }
2939
2948
  },
2940
2949
  {
2941
2950
  override: true,
@@ -3002,7 +3011,8 @@ Processing domain: ${domainName} (v${domainVersion})`));
3002
3011
  },
3003
3012
  ...owners && { owners },
3004
3013
  ...repository && { repository },
3005
- ...styles2 && { styles: styles2 }
3014
+ ...styles2 && { styles: styles2 },
3015
+ ...isServiceMarkedAsDraft && { draft: true }
3006
3016
  },
3007
3017
  {
3008
3018
  path: servicePath,