@uniformdev/transformer 1.1.10 → 1.1.11
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/cli/index.js +66 -48
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +65 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3634,6 +3634,8 @@ var CompositionConverterService = class {
|
|
|
3634
3634
|
contentTypeMap.set(rootType, contentType);
|
|
3635
3635
|
}
|
|
3636
3636
|
const flattenContentTypeMap = /* @__PURE__ */ new Map();
|
|
3637
|
+
const missingFlattenTypes = [];
|
|
3638
|
+
const foundMissingFlattenTypes = /* @__PURE__ */ new Set();
|
|
3637
3639
|
for (const flattenType of flattenComponentIds) {
|
|
3638
3640
|
const isRootType = [...rootComponentTypes].some(
|
|
3639
3641
|
(rt) => this.compareTypes(rt, flattenType, strict)
|
|
@@ -3651,57 +3653,13 @@ var CompositionConverterService = class {
|
|
|
3651
3653
|
flattenContentTypeMap.set(flattenType, contentType);
|
|
3652
3654
|
} catch (error) {
|
|
3653
3655
|
if (error instanceof ComponentNotFoundError) {
|
|
3654
|
-
|
|
3656
|
+
this.logger.info(`Flatten component type not found: ${flattenType}`);
|
|
3657
|
+
missingFlattenTypes.push(flattenType);
|
|
3658
|
+
continue;
|
|
3655
3659
|
}
|
|
3656
3660
|
throw error;
|
|
3657
3661
|
}
|
|
3658
3662
|
}
|
|
3659
|
-
if (flattenComponentIds.length > 0) {
|
|
3660
|
-
for (const contentType of contentTypeMap.values()) {
|
|
3661
|
-
for (const flattenType of flattenComponentIds) {
|
|
3662
|
-
if (this.compareTypes(flattenType, contentType.id, strict)) {
|
|
3663
|
-
continue;
|
|
3664
|
-
}
|
|
3665
|
-
contentType.fields.push({
|
|
3666
|
-
id: flattenType,
|
|
3667
|
-
name: flattenType,
|
|
3668
|
-
type: "contentReference",
|
|
3669
|
-
typeConfig: {
|
|
3670
|
-
isMulti: true,
|
|
3671
|
-
allowedContentTypes: [flattenType]
|
|
3672
|
-
},
|
|
3673
|
-
localizable: false
|
|
3674
|
-
});
|
|
3675
|
-
}
|
|
3676
|
-
}
|
|
3677
|
-
}
|
|
3678
|
-
for (const [typeName, contentType] of contentTypeMap) {
|
|
3679
|
-
const filePath = this.fileSystem.joinPath(contentTypesDirFull, `${typeName}.json`);
|
|
3680
|
-
const fieldCount = contentType.fields.filter((f) => f.type !== "contentReference").length;
|
|
3681
|
-
const refCount = contentType.fields.filter((f) => f.type === "contentReference").length;
|
|
3682
|
-
const refInfo = refCount > 0 ? ` + ${refCount} reference(s)` : "";
|
|
3683
|
-
this.logger.action(
|
|
3684
|
-
whatIf,
|
|
3685
|
-
"WRITE",
|
|
3686
|
-
`${contentTypesDir}/${typeName}.json (${fieldCount} fields${refInfo})`
|
|
3687
|
-
);
|
|
3688
|
-
if (!whatIf) {
|
|
3689
|
-
await this.fileSystem.writeFile(filePath, contentType);
|
|
3690
|
-
}
|
|
3691
|
-
contentTypesWritten++;
|
|
3692
|
-
}
|
|
3693
|
-
for (const [typeName, contentType] of flattenContentTypeMap) {
|
|
3694
|
-
const filePath = this.fileSystem.joinPath(contentTypesDirFull, `${typeName}.json`);
|
|
3695
|
-
this.logger.action(
|
|
3696
|
-
whatIf,
|
|
3697
|
-
"WRITE",
|
|
3698
|
-
`${contentTypesDir}/${typeName}.json (${contentType.fields.length} fields)`
|
|
3699
|
-
);
|
|
3700
|
-
if (!whatIf) {
|
|
3701
|
-
await this.fileSystem.writeFile(filePath, contentType);
|
|
3702
|
-
}
|
|
3703
|
-
contentTypesWritten++;
|
|
3704
|
-
}
|
|
3705
3663
|
for (const { composition } of compositionResults) {
|
|
3706
3664
|
const comp = composition.composition;
|
|
3707
3665
|
const compositionId = comp._id;
|
|
@@ -3726,6 +3684,9 @@ var CompositionConverterService = class {
|
|
|
3726
3684
|
);
|
|
3727
3685
|
if (instances.length > 0) {
|
|
3728
3686
|
flattenedByType.set(flattenType, instances);
|
|
3687
|
+
if (missingFlattenTypes.includes(flattenType)) {
|
|
3688
|
+
foundMissingFlattenTypes.add(flattenType);
|
|
3689
|
+
}
|
|
3729
3690
|
}
|
|
3730
3691
|
}
|
|
3731
3692
|
}
|
|
@@ -3764,6 +3725,63 @@ var CompositionConverterService = class {
|
|
|
3764
3725
|
}
|
|
3765
3726
|
}
|
|
3766
3727
|
}
|
|
3728
|
+
if (flattenComponentIds.length > 0) {
|
|
3729
|
+
for (const contentType of contentTypeMap.values()) {
|
|
3730
|
+
for (const flattenType of flattenComponentIds) {
|
|
3731
|
+
if (this.compareTypes(flattenType, contentType.id, strict)) {
|
|
3732
|
+
continue;
|
|
3733
|
+
}
|
|
3734
|
+
if (missingFlattenTypes.includes(flattenType) && !foundMissingFlattenTypes.has(flattenType)) {
|
|
3735
|
+
continue;
|
|
3736
|
+
}
|
|
3737
|
+
contentType.fields.push({
|
|
3738
|
+
id: flattenType,
|
|
3739
|
+
name: flattenType,
|
|
3740
|
+
type: "contentReference",
|
|
3741
|
+
typeConfig: {
|
|
3742
|
+
isMulti: true,
|
|
3743
|
+
allowedContentTypes: [flattenType]
|
|
3744
|
+
},
|
|
3745
|
+
localizable: false
|
|
3746
|
+
});
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
for (const [typeName, contentType] of contentTypeMap) {
|
|
3751
|
+
const filePath = this.fileSystem.joinPath(contentTypesDirFull, `${typeName}.json`);
|
|
3752
|
+
const fieldCount = contentType.fields.filter((f) => f.type !== "contentReference").length;
|
|
3753
|
+
const refCount = contentType.fields.filter((f) => f.type === "contentReference").length;
|
|
3754
|
+
const refInfo = refCount > 0 ? ` + ${refCount} reference(s)` : "";
|
|
3755
|
+
this.logger.action(
|
|
3756
|
+
whatIf,
|
|
3757
|
+
"WRITE",
|
|
3758
|
+
`${contentTypesDir}/${typeName}.json (${fieldCount} fields${refInfo})`
|
|
3759
|
+
);
|
|
3760
|
+
if (!whatIf) {
|
|
3761
|
+
await this.fileSystem.writeFile(filePath, contentType);
|
|
3762
|
+
}
|
|
3763
|
+
contentTypesWritten++;
|
|
3764
|
+
}
|
|
3765
|
+
for (const [typeName, contentType] of flattenContentTypeMap) {
|
|
3766
|
+
const filePath = this.fileSystem.joinPath(contentTypesDirFull, `${typeName}.json`);
|
|
3767
|
+
this.logger.action(
|
|
3768
|
+
whatIf,
|
|
3769
|
+
"WRITE",
|
|
3770
|
+
`${contentTypesDir}/${typeName}.json (${contentType.fields.length} fields)`
|
|
3771
|
+
);
|
|
3772
|
+
if (!whatIf) {
|
|
3773
|
+
await this.fileSystem.writeFile(filePath, contentType);
|
|
3774
|
+
}
|
|
3775
|
+
contentTypesWritten++;
|
|
3776
|
+
}
|
|
3777
|
+
const neverFoundMissingTypes = missingFlattenTypes.filter(
|
|
3778
|
+
(type) => !foundMissingFlattenTypes.has(type)
|
|
3779
|
+
);
|
|
3780
|
+
if (neverFoundMissingTypes.length > 0) {
|
|
3781
|
+
this.logger.warn(
|
|
3782
|
+
`Flatten component type(s) not found in any composition: ${neverFoundMissingTypes.join(", ")}`
|
|
3783
|
+
);
|
|
3784
|
+
}
|
|
3767
3785
|
return { contentTypesWritten, entriesFromCompositions, entriesFromFlattened };
|
|
3768
3786
|
}
|
|
3769
3787
|
// --- Content Type Generation ---
|
|
@@ -3992,7 +4010,7 @@ function createConvertCompositionsToEntriesCommand() {
|
|
|
3992
4010
|
// package.json
|
|
3993
4011
|
var package_default = {
|
|
3994
4012
|
name: "@uniformdev/transformer",
|
|
3995
|
-
version: "1.1.
|
|
4013
|
+
version: "1.1.11",
|
|
3996
4014
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
3997
4015
|
type: "module",
|
|
3998
4016
|
bin: {
|