@eventcatalog/sdk 2.3.3 → 2.3.5

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.
@@ -250,7 +250,14 @@ var rmResourceById = async (catalogDir, id, version, options) => {
250
250
  var addFileToResource = async (catalogDir, id, file, version) => {
251
251
  const pathToResource = await findFileById(catalogDir, id, version);
252
252
  if (!pathToResource) throw new Error("Cannot find directory to write file to");
253
- fsSync2.writeFileSync(join2(dirname2(pathToResource), file.fileName), file.content);
253
+ let fileContent = file.content.trim();
254
+ try {
255
+ const json = JSON.parse(fileContent);
256
+ fileContent = JSON.stringify(json, null, 2);
257
+ } catch (error) {
258
+ console.error(error);
259
+ }
260
+ fsSync2.writeFileSync(join2(dirname2(pathToResource), file.fileName), fileContent);
254
261
  };
255
262
  var getFileFromResource = async (catalogDir, id, file, version) => {
256
263
  const pathToResource = await findFileById(catalogDir, id, version);
@@ -394,7 +401,7 @@ var writeVersionedService = (directory) => async (service) => {
394
401
  const path4 = getVersionedDirectory(service.id, service.version);
395
402
  return await writeService(directory)(resource, { path: path4 });
396
403
  };
397
- var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx" }) => {
404
+ var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
398
405
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
399
406
  pathForService = join6(pathForService, service.id);
400
407
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });