@uniformdev/transformer 1.1.13 → 1.1.15

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.ts CHANGED
@@ -469,6 +469,7 @@ declare class CompositionConverterService {
469
469
  private transformContentReferences;
470
470
  private compareTypes;
471
471
  private truncate;
472
+ private truncateName;
472
473
  }
473
474
  /**
474
475
  * Computes a deterministic UUID v4 from a string seed.
package/dist/index.js CHANGED
@@ -1770,11 +1770,12 @@ var CompositionConverterService = class {
1770
1770
  if (flattenComponentIds.length > 0) {
1771
1771
  this.transformContentReferences(entry);
1772
1772
  }
1773
- const entryFilePath = this.fileSystem.joinPath(entriesDirFull, `${compositionId}.json`);
1773
+ const entryId = entry.entry._id;
1774
+ const entryFilePath = this.fileSystem.joinPath(entriesDirFull, `${entryId}.json`);
1774
1775
  this.logger.action(
1775
1776
  whatIf,
1776
1777
  "WRITE",
1777
- `${entriesDir}/${compositionId}.json (${compositionType}, "${this.truncate(compositionName, 50)}")`
1778
+ `${entriesDir}/${entryId}.json (${compositionType}, "${this.truncate(compositionName, 50)}")`
1778
1779
  );
1779
1780
  if (!whatIf) {
1780
1781
  await this.fileSystem.writeFile(entryFilePath, entry);
@@ -1906,10 +1907,12 @@ var CompositionConverterService = class {
1906
1907
  extraWrapperProps[key] = value;
1907
1908
  }
1908
1909
  }
1910
+ const entryId = computeGuidHash(`entry${comp._id}`);
1911
+ const entryName = this.truncateName(comp._name ?? comp._id, 60);
1909
1912
  return {
1910
1913
  entry: {
1911
- _id: comp._id,
1912
- _name: comp._name ?? comp._id,
1914
+ _id: entryId,
1915
+ _name: entryName,
1913
1916
  type: comp.type,
1914
1917
  fields: { ...comp.parameters ?? {} },
1915
1918
  ...extraRootProps
@@ -1918,10 +1921,14 @@ var CompositionConverterService = class {
1918
1921
  };
1919
1922
  }
1920
1923
  generateEntryFromFlattenedInstance(inst) {
1924
+ const entryName = this.truncateName(
1925
+ `${inst.componentType} (from ${inst.compositionName})`,
1926
+ 60
1927
+ );
1921
1928
  return {
1922
1929
  entry: {
1923
1930
  _id: inst.determinisiticId,
1924
- _name: `${inst.componentType} (from ${inst.compositionName})`,
1931
+ _name: entryName,
1925
1932
  type: inst.componentType,
1926
1933
  fields: { ...inst.instance.parameters ?? {} }
1927
1934
  }
@@ -2003,6 +2010,10 @@ var CompositionConverterService = class {
2003
2010
  if (str.length <= maxLength) return str;
2004
2011
  return str.substring(0, maxLength - 3) + "...";
2005
2012
  }
2013
+ truncateName(name, maxLength) {
2014
+ if (name.length <= maxLength) return name;
2015
+ return name.substring(0, maxLength);
2016
+ }
2006
2017
  };
2007
2018
  function computeGuidHash(guidOrSeed) {
2008
2019
  let uuidStr;