@eventcatalog/sdk 2.18.1 → 2.18.2

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 CHANGED
@@ -1320,25 +1320,7 @@ declare const _default: (path: string) => {
1320
1320
  addEventToDomain: (id: string, direction: string, message: {
1321
1321
  id: string;
1322
1322
  version: string;
1323
- fields? /**
1324
- * Add an event to a service by it's id.
1325
- *
1326
- * Optionally specify a version to add the event to a specific version of the service.
1327
- *
1328
- * @example
1329
- * ```ts
1330
- * import utils from '@eventcatalog/utils';
1331
- *
1332
- * const { addEventToService } = utils('/path/to/eventcatalog');
1333
- *
1334
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
1335
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
1336
- *
1337
- * // adds a new event (OrderComplete) that the InventoryService will receive
1338
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
1339
- *
1340
- * ```
1341
- */: string[];
1323
+ fields?: string[];
1342
1324
  }, version?: string) => Promise<void>;
1343
1325
  /**
1344
1326
  * Add a command to a domain by its id.
@@ -1360,25 +1342,7 @@ declare const _default: (path: string) => {
1360
1342
  addCommandToDomain: (id: string, direction: string, message: {
1361
1343
  id: string;
1362
1344
  version: string;
1363
- fields? /**
1364
- * Add an event to a service by it's id.
1365
- *
1366
- * Optionally specify a version to add the event to a specific version of the service.
1367
- *
1368
- * @example
1369
- * ```ts
1370
- * import utils from '@eventcatalog/utils';
1371
- *
1372
- * const { addEventToService } = utils('/path/to/eventcatalog');
1373
- *
1374
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
1375
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
1376
- *
1377
- * // adds a new event (OrderComplete) that the InventoryService will receive
1378
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
1379
- *
1380
- * ```
1381
- */: string[];
1345
+ fields?: string[];
1382
1346
  }, version?: string) => Promise<void>;
1383
1347
  /**
1384
1348
  * Add a query to a domain by its id.
@@ -1400,25 +1364,7 @@ declare const _default: (path: string) => {
1400
1364
  addQueryToDomain: (id: string, direction: string, message: {
1401
1365
  id: string;
1402
1366
  version: string;
1403
- fields? /**
1404
- * Add an event to a service by it's id.
1405
- *
1406
- * Optionally specify a version to add the event to a specific version of the service.
1407
- *
1408
- * @example
1409
- * ```ts
1410
- * import utils from '@eventcatalog/utils';
1411
- *
1412
- * const { addEventToService } = utils('/path/to/eventcatalog');
1413
- *
1414
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
1415
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
1416
- *
1417
- * // adds a new event (OrderComplete) that the InventoryService will receive
1418
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
1419
- *
1420
- * ```
1421
- */: string[];
1367
+ fields?: string[];
1422
1368
  }, version?: string) => Promise<void>;
1423
1369
  /**
1424
1370
  * ================================
package/dist/index.d.ts CHANGED
@@ -1320,25 +1320,7 @@ declare const _default: (path: string) => {
1320
1320
  addEventToDomain: (id: string, direction: string, message: {
1321
1321
  id: string;
1322
1322
  version: string;
1323
- fields? /**
1324
- * Add an event to a service by it's id.
1325
- *
1326
- * Optionally specify a version to add the event to a specific version of the service.
1327
- *
1328
- * @example
1329
- * ```ts
1330
- * import utils from '@eventcatalog/utils';
1331
- *
1332
- * const { addEventToService } = utils('/path/to/eventcatalog');
1333
- *
1334
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
1335
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
1336
- *
1337
- * // adds a new event (OrderComplete) that the InventoryService will receive
1338
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
1339
- *
1340
- * ```
1341
- */: string[];
1323
+ fields?: string[];
1342
1324
  }, version?: string) => Promise<void>;
1343
1325
  /**
1344
1326
  * Add a command to a domain by its id.
@@ -1360,25 +1342,7 @@ declare const _default: (path: string) => {
1360
1342
  addCommandToDomain: (id: string, direction: string, message: {
1361
1343
  id: string;
1362
1344
  version: string;
1363
- fields? /**
1364
- * Add an event to a service by it's id.
1365
- *
1366
- * Optionally specify a version to add the event to a specific version of the service.
1367
- *
1368
- * @example
1369
- * ```ts
1370
- * import utils from '@eventcatalog/utils';
1371
- *
1372
- * const { addEventToService } = utils('/path/to/eventcatalog');
1373
- *
1374
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
1375
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
1376
- *
1377
- * // adds a new event (OrderComplete) that the InventoryService will receive
1378
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
1379
- *
1380
- * ```
1381
- */: string[];
1345
+ fields?: string[];
1382
1346
  }, version?: string) => Promise<void>;
1383
1347
  /**
1384
1348
  * Add a query to a domain by its id.
@@ -1400,25 +1364,7 @@ declare const _default: (path: string) => {
1400
1364
  addQueryToDomain: (id: string, direction: string, message: {
1401
1365
  id: string;
1402
1366
  version: string;
1403
- fields? /**
1404
- * Add an event to a service by it's id.
1405
- *
1406
- * Optionally specify a version to add the event to a specific version of the service.
1407
- *
1408
- * @example
1409
- * ```ts
1410
- * import utils from '@eventcatalog/utils';
1411
- *
1412
- * const { addEventToService } = utils('/path/to/eventcatalog');
1413
- *
1414
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
1415
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
1416
- *
1417
- * // adds a new event (OrderComplete) that the InventoryService will receive
1418
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
1419
- *
1420
- * ```
1421
- */: string[];
1367
+ fields?: string[];
1422
1368
  }, version?: string) => Promise<void>;
1423
1369
  /**
1424
1370
  * ================================
package/dist/index.js CHANGED
@@ -1472,8 +1472,11 @@ var resolveDomainWriteDirectory = async (directory, id, version) => {
1472
1472
  if (!existingResource) return directory;
1473
1473
  const normalizedPath = existingResource.replace(/\\/g, "/");
1474
1474
  const lastDomainsIndex = normalizedPath.lastIndexOf("/domains/");
1475
- if (lastDomainsIndex === -1) return directory;
1476
- return existingResource.substring(0, lastDomainsIndex + "/domains".length);
1475
+ const lastSubdomainsIndex = normalizedPath.lastIndexOf("/subdomains/");
1476
+ const lastIndex = Math.max(lastDomainsIndex, lastSubdomainsIndex);
1477
+ if (lastIndex === -1) return directory;
1478
+ const segment = lastSubdomainsIndex > lastDomainsIndex ? "/subdomains" : "/domains";
1479
+ return existingResource.substring(0, lastIndex + segment.length);
1477
1480
  };
1478
1481
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
1479
1482
  var getDomains = (directory) => async (options) => getResources(directory, {