@eventcatalog/sdk 2.29.2 → 2.30.0-beta.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
@@ -2298,6 +2298,7 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
2298
2298
  // src/eventcatalog.ts
2299
2299
  import fs13 from "fs";
2300
2300
  import path6, { join as join15 } from "path";
2301
+ import { pathToFileURL } from "url";
2301
2302
  var DUMP_VERSION = "0.0.1";
2302
2303
  var getEventCatalogVersion = async (catalogDir) => {
2303
2304
  try {
@@ -2336,7 +2337,10 @@ var filterCollection = (collection, options) => {
2336
2337
  var getEventCatalogConfigurationFile = (directory) => async () => {
2337
2338
  try {
2338
2339
  const path11 = join15(directory, "eventcatalog.config.js");
2339
- const configModule = await import(path11);
2340
+ const configModule = await import(
2341
+ /* @vite-ignore */
2342
+ pathToFileURL(path11).href
2343
+ );
2340
2344
  return configModule.default;
2341
2345
  } catch (error) {
2342
2346
  console.error("Error getting event catalog configuration file", error);
@@ -2580,6 +2584,7 @@ var cloneStep = (step) => ({
2580
2584
  ...step.service ? { service: { ...step.service } } : {},
2581
2585
  ...step.systems ? { systems: { ...step.systems } } : {},
2582
2586
  ...step.system ? { system: { ...step.system } } : {},
2587
+ ...step.channel ? { channel: { ...step.channel } } : {},
2583
2588
  ...step.flow ? { flow: { ...step.flow } } : {},
2584
2589
  ...step.container ? { container: { ...step.container } } : {},
2585
2590
  ...step.dataProduct ? { dataProduct: { ...step.dataProduct } } : {},
@@ -2727,6 +2732,41 @@ var FlowBuilder = class _FlowBuilder {
2727
2732
  step.nextSteps
2728
2733
  );
2729
2734
  }
2735
+ /**
2736
+ * Add a channel step.
2737
+ *
2738
+ * @param step - The channel step payload.
2739
+ *
2740
+ * @example
2741
+ * ```ts
2742
+ * FlowBuilder.create({
2743
+ * id: 'OrderFlow',
2744
+ * name: 'Order Flow',
2745
+ * version: '1.0.0',
2746
+ * markdown: '',
2747
+ * })
2748
+ * .addChannelStep({
2749
+ * id: 'orders-topic',
2750
+ * channel: { id: 'orders-topic', version: '1.0.0' },
2751
+ * });
2752
+ * ```
2753
+ */
2754
+ addChannelStep(step) {
2755
+ const channel = step.channel || {
2756
+ id: String(step.id),
2757
+ ...step.version ? { version: step.version } : {}
2758
+ };
2759
+ return this.addStepWithNext(
2760
+ {
2761
+ id: step.id,
2762
+ // Left out, EventCatalog names the step after its channel
2763
+ ...step.title ? { title: step.title } : {},
2764
+ ...step.summary ? { summary: step.summary } : {},
2765
+ channel: { ...channel, ...step.version && !channel.version ? { version: step.version } : {} }
2766
+ },
2767
+ step.nextSteps
2768
+ );
2769
+ }
2730
2770
  /**
2731
2771
  * Add an agent step.
2732
2772
  *
@@ -3334,6 +3374,7 @@ var getGraph = (directory) => {
3334
3374
  if (step.service) await addPointers([step.service], ["service"]);
3335
3375
  if (step.systems) await addPointers([step.systems], ["system"]);
3336
3376
  if (step.system) await addPointers([step.system], ["system"]);
3377
+ if (step.channel) await addPointers([step.channel], ["channel"]);
3337
3378
  if (step.flow) await addPointers([step.flow], ["flow"]);
3338
3379
  if (step.container) await addPointers([step.container], ["container"]);
3339
3380
  if (step.dataProduct) await addPointers([step.dataProduct], ["data-product"]);
@@ -3810,6 +3851,7 @@ var getFlowReferences = (steps) => steps.flatMap((step) => [
3810
3851
  ...step.service ? [{ kind: "service", ...step.service }] : [],
3811
3852
  ...step.systems ? [{ kind: "system", ...step.systems }] : [],
3812
3853
  ...step.system ? [{ kind: "system", ...step.system }] : [],
3854
+ ...step.channel ? [{ kind: "channel", ...step.channel }] : [],
3813
3855
  ...step.message ? [{ kind: "message", ...step.message }] : [],
3814
3856
  ...step.agent ? [{ kind: "agent", ...step.agent }] : [],
3815
3857
  ...step.container ? [{ kind: "container", ...step.container }] : [],
@@ -4638,7 +4680,7 @@ var IndexAssetSchema = z.object({
4638
4680
  hash: contentHash.optional()
4639
4681
  }).strict();
4640
4682
  var IndexReferenceSchema = ResourcePointerSchema.extend({
4641
- kind: z.enum(["agent", "container", "data-product", "flow", "message", "service"])
4683
+ kind: z.enum(["agent", "channel", "container", "data-product", "flow", "message", "service", "system"])
4642
4684
  });
4643
4685
  var AdrPointerSchema = z.object({
4644
4686
  id: nonEmptyString,