@eventcatalog/sdk 1.3.0 → 1.3.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/channels.js +8 -2
- package/dist/channels.js.map +1 -1
- package/dist/channels.mjs +8 -2
- package/dist/channels.mjs.map +1 -1
- package/dist/commands.js +1 -1
- package/dist/commands.js.map +1 -1
- package/dist/commands.mjs +1 -1
- package/dist/commands.mjs.map +1 -1
- package/dist/domains.js +1 -1
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +1 -1
- package/dist/domains.mjs.map +1 -1
- package/dist/events.js +1 -1
- package/dist/events.js.map +1 -1
- package/dist/events.mjs +1 -1
- package/dist/events.mjs.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/queries.js +1 -1
- package/dist/queries.js.map +1 -1
- package/dist/queries.mjs +1 -1
- package/dist/queries.mjs.map +1 -1
- package/dist/services.js +8 -2
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +8 -2
- package/dist/services.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -132,7 +132,7 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
132
132
|
throw new Error(`Failed to write ${resource.id} (${options.type}) as the version ${resource.version} already exists`);
|
|
133
133
|
}
|
|
134
134
|
const { markdown, ...frontmatter } = resource;
|
|
135
|
-
if (options.versionExistingContent) {
|
|
135
|
+
if (options.versionExistingContent && !exists) {
|
|
136
136
|
const currentResource = await getResource(catalogDir, resource.id);
|
|
137
137
|
if (currentResource) {
|
|
138
138
|
if (satisfies2(resource.version, `>${currentResource.version}`)) {
|
|
@@ -344,8 +344,14 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
344
344
|
} else {
|
|
345
345
|
throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
|
|
346
346
|
}
|
|
347
|
+
const existingResource = await findFileById(directory, id, version);
|
|
348
|
+
if (!existingResource) {
|
|
349
|
+
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
350
|
+
}
|
|
351
|
+
const path = existingResource.split("/services")[0];
|
|
352
|
+
const pathToResource = join6(path, "services");
|
|
347
353
|
await rmServiceById(directory)(id, version);
|
|
348
|
-
await writeService(
|
|
354
|
+
await writeService(pathToResource)(service);
|
|
349
355
|
};
|
|
350
356
|
var serviceHasVersion = (directory) => async (id, version) => {
|
|
351
357
|
const file = await findFileById(directory, id, version);
|
|
@@ -430,8 +436,14 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
430
436
|
}
|
|
431
437
|
const channelInfo = { id, version: channel.version, ..._message.parameters && { parameters: _message.parameters } };
|
|
432
438
|
message.channels.push(channelInfo);
|
|
439
|
+
const existingResource = await findFileById(directory, _message.id, _message.version);
|
|
440
|
+
if (!existingResource) {
|
|
441
|
+
throw new Error(`Cannot find message ${id} in the catalog`);
|
|
442
|
+
}
|
|
443
|
+
const path = existingResource.split(`/${collection}`)[0];
|
|
444
|
+
const pathToResource = join8(path, collection);
|
|
433
445
|
await rmMessageById(directory)(_message.id, _message.version);
|
|
434
|
-
await writeMessage(
|
|
446
|
+
await writeMessage(pathToResource)(message);
|
|
435
447
|
};
|
|
436
448
|
|
|
437
449
|
// src/index.ts
|