@supernova-studio/client 0.36.2 → 0.38.0
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 +2231 -997
- package/dist/index.d.ts +2231 -997
- package/dist/index.js +358 -175
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +531 -348
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/conversion/design-systems/elements/properties/property-value.ts +2 -2
- package/src/api/conversion/design-systems/index.ts +1 -1
- package/src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts +6 -5
- package/src/api/conversion/documentation/documentation-group-v1-to-dto.ts +85 -0
- package/src/api/conversion/documentation/{documentation-group-to-dto.ts → documentation-group-v2-to-dto.ts} +16 -12
- package/src/api/conversion/documentation/documentation-item-configuration-v1-to-dto.ts +46 -0
- package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +16 -5
- package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +12 -10
- package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +9 -7
- package/src/api/conversion/documentation/index.ts +3 -1
- package/src/api/conversion/index.ts +1 -1
- package/src/api/dto/design-systems/index.ts +2 -2
- package/src/api/dto/elements/documentation/group-action.ts +1 -1
- package/src/api/dto/elements/documentation/group-v1.ts +35 -0
- package/src/api/dto/elements/documentation/index.ts +3 -1
- package/src/api/dto/elements/documentation/item-configuration-v1.ts +22 -0
- package/src/api/dto/elements/documentation/page-v1.ts +8 -7
- package/src/api/dto/elements/documentation/page-v2.ts +2 -3
- package/src/yjs/design-system-content/documentation-hierarchy.ts +47 -2
- package/src/yjs/docs-editor/mock.ts +13 -13
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +1 -1
- /package/src/api/dto/elements/documentation/{group.ts → group-v2.ts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
// src/api/conversion/design-
|
|
2
|
-
function
|
|
1
|
+
// src/api/conversion/design-system/version-to-dto.ts
|
|
2
|
+
function designSystemVersionToDto(version) {
|
|
3
3
|
return {
|
|
4
|
-
id:
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
id: version.id,
|
|
5
|
+
designSystemId: version.designSystemId,
|
|
6
|
+
createdAt: version.createdAt,
|
|
7
7
|
meta: {
|
|
8
|
-
name:
|
|
9
|
-
description:
|
|
10
|
-
}
|
|
8
|
+
name: version.name,
|
|
9
|
+
description: version.comment
|
|
10
|
+
},
|
|
11
|
+
version: version.version,
|
|
12
|
+
changeLog: version.changeLog,
|
|
13
|
+
isReadonly: version.isReadonly
|
|
11
14
|
};
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -29,6 +32,61 @@ function elementPropertyDefinitionToDto(elementProperyDefinition) {
|
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
// src/api/conversion/design-systems/elements/properties/property-value.ts
|
|
36
|
+
function elementPropertyValueToDto(elementPropertyValue) {
|
|
37
|
+
let value;
|
|
38
|
+
let valuePreview;
|
|
39
|
+
if (elementPropertyValue.stringValue) {
|
|
40
|
+
value = elementPropertyValue.stringValue;
|
|
41
|
+
} else if (elementPropertyValue.numberValue) {
|
|
42
|
+
value = elementPropertyValue.numberValue;
|
|
43
|
+
} else if (typeof elementPropertyValue.booleanValue === "boolean") {
|
|
44
|
+
value = elementPropertyValue.booleanValue;
|
|
45
|
+
} else if (elementPropertyValue.referenceValue) {
|
|
46
|
+
value = elementPropertyValue.referenceValue;
|
|
47
|
+
valuePreview = elementPropertyValue.referenceValuePreview;
|
|
48
|
+
} else {
|
|
49
|
+
value = void 0;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
id: elementPropertyValue.id,
|
|
53
|
+
designSystemVersionId: elementPropertyValue.designSystemVersionId,
|
|
54
|
+
definitionId: elementPropertyValue.definitionPersistentId,
|
|
55
|
+
targetElementId: elementPropertyValue.targetElementPersistentId,
|
|
56
|
+
value,
|
|
57
|
+
valuePreview
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/api/conversion/design-systems/brand.ts
|
|
62
|
+
function designSystemBrandToDto(brand) {
|
|
63
|
+
return {
|
|
64
|
+
id: brand.id,
|
|
65
|
+
designSystemVersionId: brand.designSystemVersionId,
|
|
66
|
+
persistentId: brand.persistentId,
|
|
67
|
+
meta: {
|
|
68
|
+
name: brand.name,
|
|
69
|
+
description: brand.description
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/api/conversion/design-systems/view.ts
|
|
75
|
+
function elementViewToDto(elementView, columns) {
|
|
76
|
+
columns.sort((lhs, rhs) => lhs.sortPosition - rhs.sortPosition);
|
|
77
|
+
return {
|
|
78
|
+
id: elementView.id,
|
|
79
|
+
persistentId: elementView.persistentId,
|
|
80
|
+
targetElementType: elementView.targetElementType,
|
|
81
|
+
isDefault: elementView.isDefault,
|
|
82
|
+
meta: {
|
|
83
|
+
name: elementView.name,
|
|
84
|
+
description: elementView.description
|
|
85
|
+
},
|
|
86
|
+
columns
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
32
90
|
// ../model/dist/index.mjs
|
|
33
91
|
import { z } from "zod";
|
|
34
92
|
import { z as z2 } from "zod";
|
|
@@ -102,8 +160,8 @@ import { z as z66 } from "zod";
|
|
|
102
160
|
import { z as z67 } from "zod";
|
|
103
161
|
import { z as z68 } from "zod";
|
|
104
162
|
import { z as z69 } from "zod";
|
|
105
|
-
import { z as z70 } from "zod";
|
|
106
163
|
import { z as z71 } from "zod";
|
|
164
|
+
import { z as z70 } from "zod";
|
|
107
165
|
import { z as z72 } from "zod";
|
|
108
166
|
import { z as z73 } from "zod";
|
|
109
167
|
import { z as z74 } from "zod";
|
|
@@ -1014,10 +1072,10 @@ var PageBlockItemAssetValue = z35.object({
|
|
|
1014
1072
|
entityType: z35.enum(["Asset", "AssetGroup"]),
|
|
1015
1073
|
entityMeta: PageBlockAssetEntityMeta.optional()
|
|
1016
1074
|
})
|
|
1017
|
-
)
|
|
1075
|
+
).default([])
|
|
1018
1076
|
});
|
|
1019
1077
|
var PageBlockItemAssetPropertyValue = z35.object({
|
|
1020
|
-
value: z35.array(z35.string())
|
|
1078
|
+
value: z35.array(z35.string()).default([])
|
|
1021
1079
|
});
|
|
1022
1080
|
var PageBlockItemBooleanValue = z35.object({
|
|
1023
1081
|
value: z35.boolean()
|
|
@@ -1043,7 +1101,7 @@ var PageBlockItemComponentValue = z35.object({
|
|
|
1043
1101
|
entityId: z35.string(),
|
|
1044
1102
|
entityType: z35.enum(["Component", "ComponentGroup"])
|
|
1045
1103
|
})
|
|
1046
|
-
)
|
|
1104
|
+
).default([])
|
|
1047
1105
|
});
|
|
1048
1106
|
var PageBlockItemComponentPropertyValue = z35.object({
|
|
1049
1107
|
value: z35.string()
|
|
@@ -1069,7 +1127,7 @@ var PageBlockItemFigmaNodeValue = z35.object({
|
|
|
1069
1127
|
entityId: z35.string(),
|
|
1070
1128
|
entityMeta: PageBlockFigmaNodeEntityMeta.optional()
|
|
1071
1129
|
})
|
|
1072
|
-
)
|
|
1130
|
+
).default([])
|
|
1073
1131
|
});
|
|
1074
1132
|
var PageBlockItemImageValue = z35.object({
|
|
1075
1133
|
alt: z35.string().optional(),
|
|
@@ -1084,7 +1142,7 @@ var PageBlockItemMultiRichTextValue = z35.object({
|
|
|
1084
1142
|
value: PageBlockText.array()
|
|
1085
1143
|
});
|
|
1086
1144
|
var PageBlockItemMultiSelectValue = z35.object({
|
|
1087
|
-
value: z35.array(z35.string())
|
|
1145
|
+
value: z35.array(z35.string()).default([])
|
|
1088
1146
|
});
|
|
1089
1147
|
var PageBlockItemNumberValue = z35.object({
|
|
1090
1148
|
value: z35.number()
|
|
@@ -1117,15 +1175,15 @@ var PageBlockItemTokenValue = z35.object({
|
|
|
1117
1175
|
showNestedGroups: z35.boolean().optional()
|
|
1118
1176
|
}).optional()
|
|
1119
1177
|
})
|
|
1120
|
-
)
|
|
1178
|
+
).default([])
|
|
1121
1179
|
});
|
|
1122
1180
|
var PageBlockItemTokenPropertyValue = z35.object({
|
|
1123
1181
|
selectedPropertyIds: z35.array(z35.string()).optional(),
|
|
1124
1182
|
selectedThemeIds: z35.array(z35.string()).optional(),
|
|
1125
|
-
value: z35.array(z35.string())
|
|
1183
|
+
value: z35.array(z35.string()).default([])
|
|
1126
1184
|
});
|
|
1127
1185
|
var PageBlockItemTokenTypeValue = z35.object({
|
|
1128
|
-
value: z35.array(DesignTokenType)
|
|
1186
|
+
value: z35.array(DesignTokenType).default([])
|
|
1129
1187
|
});
|
|
1130
1188
|
var PageBlockItemUrlValue = z35.object({
|
|
1131
1189
|
value: z35.string()
|
|
@@ -1163,7 +1221,7 @@ var PageBlockItemTableValue = z35.object({
|
|
|
1163
1221
|
highlightHeaderColumn: z35.boolean().optional(),
|
|
1164
1222
|
highlightHeaderRow: z35.boolean().optional(),
|
|
1165
1223
|
showBorder: z35.boolean().optional(),
|
|
1166
|
-
value: z35.array(PageBlockItemTableRow)
|
|
1224
|
+
value: z35.array(PageBlockItemTableRow).default([])
|
|
1167
1225
|
});
|
|
1168
1226
|
var DocumentationItemHeaderAlignmentSchema = z36.enum(["Left", "Center"]);
|
|
1169
1227
|
var DocumentationItemHeaderImageScaleTypeSchema = z36.enum(["AspectFill", "AspectFit"]);
|
|
@@ -1361,6 +1419,10 @@ var GradientLayerData = tokenAliasOrValue(GradientLayerValue);
|
|
|
1361
1419
|
var GradientTokenValue = z52.array(GradientLayerData);
|
|
1362
1420
|
var GradientTokenData = tokenAliasOrValue(GradientTokenValue);
|
|
1363
1421
|
var DocumentationGroupBehavior = z53.enum(["Group", "Tabs"]);
|
|
1422
|
+
var ElementGroupDataV1 = z53.object({
|
|
1423
|
+
behavior: nullishToOptional(DocumentationGroupBehavior.optional()),
|
|
1424
|
+
configuration: nullishToOptional(DocumentationItemConfigurationV1)
|
|
1425
|
+
});
|
|
1364
1426
|
var ElementGroupDataV2 = z53.object({
|
|
1365
1427
|
behavior: nullishToOptional(DocumentationGroupBehavior.optional()),
|
|
1366
1428
|
configuration: nullishToOptional(DocumentationItemConfigurationV2)
|
|
@@ -1407,7 +1469,7 @@ var ShadowLayerValue = z60.object({
|
|
|
1407
1469
|
y: z60.number(),
|
|
1408
1470
|
radius: z60.number(),
|
|
1409
1471
|
spread: z60.number(),
|
|
1410
|
-
opacity: OpacityTokenData,
|
|
1472
|
+
opacity: OpacityTokenData.optional(),
|
|
1411
1473
|
type: ShadowType
|
|
1412
1474
|
});
|
|
1413
1475
|
var ShadowTokenDataBase = tokenAliasOrValue(ShadowLayerValue);
|
|
@@ -1469,21 +1531,32 @@ var Component = DesignElementBase.extend(DesignElementGroupableRequiredPart.shap
|
|
|
1469
1531
|
svg: ComponentAsset.optional(),
|
|
1470
1532
|
isAsset: z69.boolean()
|
|
1471
1533
|
});
|
|
1534
|
+
var ElementGroup = DesignElementBase.extend(DesignElementGroupablePart.shape).extend(DesignElementSlugPart.shape).extend(DesignElementBrandedPart.partial().shape).extend({
|
|
1535
|
+
shortPersistentId: z70.string().optional(),
|
|
1536
|
+
childType: DesignElementType,
|
|
1537
|
+
data: ElementGroupDataV2.optional()
|
|
1538
|
+
});
|
|
1539
|
+
var BrandedElementGroup = ElementGroup.extend(DesignElementBrandedPart.shape);
|
|
1472
1540
|
var DocumentationPageV1 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend(DesignElementSlugPart.shape).extend({
|
|
1473
|
-
shortPersistentId:
|
|
1541
|
+
shortPersistentId: z71.string(),
|
|
1474
1542
|
data: DocumentationPageDataV1
|
|
1475
1543
|
});
|
|
1544
|
+
var DocumentationGroupV1 = ElementGroup.omit({
|
|
1545
|
+
data: true
|
|
1546
|
+
}).extend({
|
|
1547
|
+
data: ElementGroupDataV1.optional()
|
|
1548
|
+
});
|
|
1476
1549
|
var DocumentationPageV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape).extend(DesignElementSlugPart.shape).extend({
|
|
1477
|
-
shortPersistentId:
|
|
1550
|
+
shortPersistentId: z72.string(),
|
|
1478
1551
|
data: DocumentationPageDataV2.extend({
|
|
1479
|
-
oldBlocks:
|
|
1552
|
+
oldBlocks: z72.array(PageBlockV1).optional()
|
|
1480
1553
|
})
|
|
1481
1554
|
});
|
|
1482
|
-
var FigmaFileStructureOrigin =
|
|
1483
|
-
sourceId:
|
|
1484
|
-
fileId:
|
|
1555
|
+
var FigmaFileStructureOrigin = z73.object({
|
|
1556
|
+
sourceId: z73.string(),
|
|
1557
|
+
fileId: z73.string().optional()
|
|
1485
1558
|
});
|
|
1486
|
-
var FigmaFileStructureData =
|
|
1559
|
+
var FigmaFileStructureData = z73.object({
|
|
1487
1560
|
rootNode: FigmaFileStructureNode,
|
|
1488
1561
|
assetsInFile: FigmaFileStructureStatistics
|
|
1489
1562
|
});
|
|
@@ -1491,19 +1564,13 @@ var FigmaFileStructure = DesignElementBase.extend({
|
|
|
1491
1564
|
origin: FigmaFileStructureOrigin,
|
|
1492
1565
|
data: FigmaFileStructureData
|
|
1493
1566
|
});
|
|
1494
|
-
var FigmaNodeReferenceOrigin =
|
|
1495
|
-
sourceId:
|
|
1567
|
+
var FigmaNodeReferenceOrigin = z74.object({
|
|
1568
|
+
sourceId: z74.string()
|
|
1496
1569
|
});
|
|
1497
1570
|
var FigmaNodeReference = DesignElementBase.extend({
|
|
1498
1571
|
data: FigmaNodeReferenceData,
|
|
1499
1572
|
origin: FigmaNodeReferenceOrigin
|
|
1500
1573
|
});
|
|
1501
|
-
var ElementGroup = DesignElementBase.extend(DesignElementGroupablePart.shape).extend(DesignElementSlugPart.shape).extend(DesignElementBrandedPart.partial().shape).extend({
|
|
1502
|
-
shortPersistentId: z74.string().optional(),
|
|
1503
|
-
childType: DesignElementType,
|
|
1504
|
-
data: ElementGroupDataV2.optional()
|
|
1505
|
-
});
|
|
1506
|
-
var BrandedElementGroup = ElementGroup.extend(DesignElementBrandedPart.shape);
|
|
1507
1574
|
var DesignTokenOriginPart = z75.object({
|
|
1508
1575
|
referenceOriginId: z75.string().optional(),
|
|
1509
1576
|
referencePersistentId: z75.string().optional()
|
|
@@ -1718,7 +1785,8 @@ var FigmaImportBaseContext = z78.object({
|
|
|
1718
1785
|
importedSourceDataBySourceId: z78.record(ImportedFigmaSourceData)
|
|
1719
1786
|
});
|
|
1720
1787
|
var FigmaImportContextWithSourcesState = FigmaImportBaseContext.extend({
|
|
1721
|
-
sourcesWithMissingAccess: z78.array(z78.string()).default([])
|
|
1788
|
+
sourcesWithMissingAccess: z78.array(z78.string()).default([]),
|
|
1789
|
+
shadowOpacityOptional: z78.boolean().default(false)
|
|
1722
1790
|
});
|
|
1723
1791
|
var ChangedImportedFigmaSourceData = ImportedFigmaSourceData.extend({
|
|
1724
1792
|
importMetadata: DataSourceFigmaImportMetadata
|
|
@@ -2215,11 +2283,17 @@ var DesignSystemVersionRoom = Entity.extend({
|
|
|
2215
2283
|
designSystemVersionId: z98.string(),
|
|
2216
2284
|
liveblocksId: z98.string()
|
|
2217
2285
|
});
|
|
2286
|
+
var DesignSystemVersionRoomInternalSettings = z98.object({
|
|
2287
|
+
routingVersion: z98.string()
|
|
2288
|
+
});
|
|
2218
2289
|
var DesignSystemVersionRoomInitialState = z98.object({
|
|
2219
2290
|
pages: z98.array(DocumentationPageV2),
|
|
2220
|
-
groups: z98.array(ElementGroup)
|
|
2291
|
+
groups: z98.array(ElementGroup),
|
|
2292
|
+
internalSettings: DesignSystemVersionRoomInternalSettings
|
|
2221
2293
|
});
|
|
2222
|
-
var DesignSystemVersionRoomUpdate =
|
|
2294
|
+
var DesignSystemVersionRoomUpdate = z98.object({
|
|
2295
|
+
pages: z98.array(DocumentationPageV2),
|
|
2296
|
+
groups: z98.array(ElementGroup),
|
|
2223
2297
|
deletedPageIds: z98.array(z98.string()),
|
|
2224
2298
|
deletedGroupIds: z98.array(z98.string())
|
|
2225
2299
|
});
|
|
@@ -2816,13 +2890,14 @@ var UserSession = z129.object({
|
|
|
2816
2890
|
session: Session,
|
|
2817
2891
|
user: User.nullable()
|
|
2818
2892
|
});
|
|
2819
|
-
var FlaggedFeature = z130.enum(["FigmaImporterV2"]);
|
|
2893
|
+
var FlaggedFeature = z130.enum(["FigmaImporterV2", "ShadowOpacityOptional"]);
|
|
2820
2894
|
var FeatureFlagMap = z130.record(FlaggedFeature, z130.boolean());
|
|
2821
2895
|
var FeatureFlag = z130.object({
|
|
2822
2896
|
id: z130.string(),
|
|
2823
2897
|
feature: FlaggedFeature,
|
|
2824
2898
|
createdAt: z130.coerce.date(),
|
|
2825
|
-
enabled: z130.boolean()
|
|
2899
|
+
enabled: z130.boolean(),
|
|
2900
|
+
designSystemId: z130.string().optional()
|
|
2826
2901
|
});
|
|
2827
2902
|
var OAuthProviderNames = /* @__PURE__ */ ((OAuthProviderNames2) => {
|
|
2828
2903
|
OAuthProviderNames2["Figma"] = "figma";
|
|
@@ -3616,50 +3691,61 @@ var RESERVED_SLUGS = [
|
|
|
3616
3691
|
];
|
|
3617
3692
|
var RESERVED_SLUGS_SET = new Set(RESERVED_SLUGS);
|
|
3618
3693
|
|
|
3619
|
-
// src/api/conversion/
|
|
3620
|
-
function
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3694
|
+
// src/api/conversion/documentation/documentation-group-v2-to-dto.ts
|
|
3695
|
+
function elementGroupsToDocumentationGroupStructureDTOV2(groups, pages) {
|
|
3696
|
+
const childrenIdsMap = calculateChildrenIdsMapV2(pages, groups);
|
|
3697
|
+
return groups.map((group) => elementGroupToDocumentationGroupStructureDTOV2(group, childrenIdsMap));
|
|
3698
|
+
}
|
|
3699
|
+
function elementGroupsToDocumentationGroupDTOV2(groups, pages) {
|
|
3700
|
+
const childrenIdsMap = calculateChildrenIdsMapV2(pages, groups);
|
|
3701
|
+
return groups.map((group) => {
|
|
3702
|
+
return {
|
|
3703
|
+
...elementGroupToDocumentationGroupStructureDTOV2(group, childrenIdsMap),
|
|
3704
|
+
configuration: group.data?.configuration ?? {
|
|
3705
|
+
showSidebar: true,
|
|
3706
|
+
header: defaultDocumentationItemHeaderV2
|
|
3707
|
+
}
|
|
3708
|
+
};
|
|
3709
|
+
});
|
|
3710
|
+
}
|
|
3711
|
+
function elementGroupToDocumentationGroupStructureDTOV2(group, childrenIdsMap) {
|
|
3712
|
+
const childrenIds = childrenIdsMap.get(group.persistentId) ?? [];
|
|
3713
|
+
if (!group.shortPersistentId) {
|
|
3714
|
+
throw new Error(`Short persistent id is required for docs groups, group id: ${group.id}`);
|
|
3634
3715
|
}
|
|
3635
3716
|
return {
|
|
3636
|
-
id:
|
|
3637
|
-
designSystemVersionId:
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3717
|
+
id: group.id,
|
|
3718
|
+
designSystemVersionId: group.designSystemVersionId,
|
|
3719
|
+
persistentId: group.persistentId,
|
|
3720
|
+
slug: group.slug,
|
|
3721
|
+
userSlug: group.userSlug,
|
|
3722
|
+
createdAt: group.createdAt,
|
|
3723
|
+
updatedAt: group.updatedAt,
|
|
3724
|
+
title: group.meta.name,
|
|
3725
|
+
childrenIds,
|
|
3726
|
+
isRoot: !group.parentPersistentId,
|
|
3727
|
+
groupBehavior: group.data?.behavior ?? "Group",
|
|
3728
|
+
shortPersistentId: group.shortPersistentId,
|
|
3729
|
+
type: "Group"
|
|
3642
3730
|
};
|
|
3643
3731
|
}
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
columns
|
|
3658
|
-
};
|
|
3732
|
+
function calculateChildrenIdsMapV2(elements, groups) {
|
|
3733
|
+
const byParentId = groupBy([...elements, ...groups], (e) => e.parentPersistentId);
|
|
3734
|
+
const childrenIdsMap = /* @__PURE__ */ new Map();
|
|
3735
|
+
for (const [parentPersistentId, children] of byParentId) {
|
|
3736
|
+
if (!parentPersistentId)
|
|
3737
|
+
continue;
|
|
3738
|
+
children.sort((lhs, rhs) => lhs.sortOrder - rhs.sortOrder);
|
|
3739
|
+
childrenIdsMap.set(
|
|
3740
|
+
parentPersistentId,
|
|
3741
|
+
children.map((c) => c.persistentId)
|
|
3742
|
+
);
|
|
3743
|
+
}
|
|
3744
|
+
return childrenIdsMap;
|
|
3659
3745
|
}
|
|
3660
3746
|
|
|
3661
3747
|
// src/api/conversion/documentation/documentation-page-to-dto-utils.ts
|
|
3662
|
-
function buildDocPagePublishPaths(groups, pages) {
|
|
3748
|
+
function buildDocPagePublishPaths(groups, pages, routingVersion) {
|
|
3663
3749
|
const groupPersistentIdToGroupMap = mapByUnique(groups, (group) => group.persistentId);
|
|
3664
3750
|
const result = /* @__PURE__ */ new Map();
|
|
3665
3751
|
for (const page of pages) {
|
|
@@ -3674,7 +3760,11 @@ function buildDocPagePublishPaths(groups, pages) {
|
|
|
3674
3760
|
}
|
|
3675
3761
|
pathV1 = `/${pathV1}`;
|
|
3676
3762
|
pathV2 = `/${pathV2}`;
|
|
3677
|
-
|
|
3763
|
+
if (routingVersion === "2") {
|
|
3764
|
+
result.set(page.persistentId, pathV2);
|
|
3765
|
+
} else {
|
|
3766
|
+
result.set(page.persistentId, pathV1);
|
|
3767
|
+
}
|
|
3678
3768
|
}
|
|
3679
3769
|
return result;
|
|
3680
3770
|
}
|
|
@@ -3691,12 +3781,12 @@ function calculateElementParentChain(elementParentPersistentId, groupPersistentI
|
|
|
3691
3781
|
}
|
|
3692
3782
|
|
|
3693
3783
|
// src/api/conversion/documentation/documentation-page-v2-to-dto.ts
|
|
3694
|
-
function documentationPagesToStructureDTOV2(pages, groups) {
|
|
3695
|
-
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
3784
|
+
function documentationPagesToStructureDTOV2(pages, groups, routingVersion) {
|
|
3785
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
|
|
3696
3786
|
return pages.map((page) => documentationPageToStructureDTOV2(page, pathsMap));
|
|
3697
3787
|
}
|
|
3698
|
-
function documentationPagesToDTOV2(pages, groups) {
|
|
3699
|
-
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
3788
|
+
function documentationPagesToDTOV2(pages, groups, routingVersion) {
|
|
3789
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
|
|
3700
3790
|
return pages.map((page) => {
|
|
3701
3791
|
return {
|
|
3702
3792
|
...documentationPageToStructureDTOV2(page, pathsMap),
|
|
@@ -3728,24 +3818,66 @@ function documentationPageToStructureDTOV2(page, pagePathMap) {
|
|
|
3728
3818
|
};
|
|
3729
3819
|
}
|
|
3730
3820
|
|
|
3731
|
-
// src/api/conversion/documentation/documentation-
|
|
3732
|
-
function
|
|
3733
|
-
|
|
3734
|
-
|
|
3821
|
+
// src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts
|
|
3822
|
+
function documentationElementsToHierarchyDto(docPages, docGroups, routingVersion) {
|
|
3823
|
+
return {
|
|
3824
|
+
pages: documentationPagesToStructureDTOV2(docPages, docGroups, routingVersion),
|
|
3825
|
+
groups: elementGroupsToDocumentationGroupStructureDTOV2(docGroups, docPages)
|
|
3826
|
+
};
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
// src/api/conversion/documentation/documentation-item-configuration-v1-to-dto.ts
|
|
3830
|
+
var dtoDefaultItemConfigurationV1 = {
|
|
3831
|
+
showSidebar: true,
|
|
3832
|
+
header: {
|
|
3833
|
+
alignment: DocumentationItemHeaderAlignment.Left,
|
|
3834
|
+
backgroundImageScaleType: DocumentationItemHeaderImageScaleType.AspectFill,
|
|
3835
|
+
description: "",
|
|
3836
|
+
showBackgroundOverlay: false,
|
|
3837
|
+
showCoverText: true
|
|
3838
|
+
}
|
|
3839
|
+
};
|
|
3840
|
+
function documentationItemConfigurationToDTOV1(config) {
|
|
3841
|
+
const { header, showSidebar } = config;
|
|
3842
|
+
const { backgroundColor, foregroundColor, ...headerRest } = header;
|
|
3843
|
+
return {
|
|
3844
|
+
showSidebar,
|
|
3845
|
+
header: {
|
|
3846
|
+
...headerRest,
|
|
3847
|
+
backgroundColor: colorToDTOV1(backgroundColor ?? void 0),
|
|
3848
|
+
foregroundColor: colorToDTOV1(foregroundColor ?? void 0)
|
|
3849
|
+
}
|
|
3850
|
+
};
|
|
3851
|
+
}
|
|
3852
|
+
function colorToDTOV1(color) {
|
|
3853
|
+
if (!color)
|
|
3854
|
+
return void 0;
|
|
3855
|
+
if (color.aliasTo)
|
|
3856
|
+
return { aliasTo: color.aliasTo };
|
|
3857
|
+
if (!color.value)
|
|
3858
|
+
return void 0;
|
|
3859
|
+
if (typeof color.value === "string")
|
|
3860
|
+
return { value: color.value };
|
|
3861
|
+
if (typeof color.value.color === "string")
|
|
3862
|
+
return { value: color.value.color };
|
|
3863
|
+
return void 0;
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3866
|
+
// src/api/conversion/documentation/documentation-group-v1-to-dto.ts
|
|
3867
|
+
function elementGroupsToDocumentationGroupStructureDTOV1(groups, pages) {
|
|
3868
|
+
const childrenIdsMap = calculateChildrenIdsMapV1(pages, groups);
|
|
3869
|
+
return groups.map((group) => elementGroupToDocumentationGroupStructureDTOV1(group, childrenIdsMap));
|
|
3735
3870
|
}
|
|
3736
|
-
function
|
|
3737
|
-
const childrenIdsMap =
|
|
3871
|
+
function elementGroupsToDocumentationGroupDTOV1(groups, pages) {
|
|
3872
|
+
const childrenIdsMap = calculateChildrenIdsMapV1(pages, groups);
|
|
3738
3873
|
return groups.map((group) => {
|
|
3739
3874
|
return {
|
|
3740
|
-
...
|
|
3741
|
-
configuration: group.data?.configuration
|
|
3742
|
-
showSidebar: true,
|
|
3743
|
-
header: defaultDocumentationItemHeaderV2
|
|
3744
|
-
}
|
|
3875
|
+
...elementGroupToDocumentationGroupStructureDTOV1(group, childrenIdsMap),
|
|
3876
|
+
configuration: group.data?.configuration ? documentationItemConfigurationToDTOV1(group.data.configuration) : dtoDefaultItemConfigurationV1
|
|
3745
3877
|
};
|
|
3746
3878
|
});
|
|
3747
3879
|
}
|
|
3748
|
-
function
|
|
3880
|
+
function elementGroupToDocumentationGroupStructureDTOV1(group, childrenIdsMap) {
|
|
3749
3881
|
const childrenIds = childrenIdsMap.get(group.persistentId) ?? [];
|
|
3750
3882
|
if (!group.shortPersistentId) {
|
|
3751
3883
|
throw new Error(`Short persistent id is required for docs groups, group id: ${group.id}`);
|
|
@@ -3766,7 +3898,7 @@ function elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap) {
|
|
|
3766
3898
|
type: "Group"
|
|
3767
3899
|
};
|
|
3768
3900
|
}
|
|
3769
|
-
function
|
|
3901
|
+
function calculateChildrenIdsMapV1(elements, groups) {
|
|
3770
3902
|
const byParentId = groupBy([...elements, ...groups], (e) => e.parentPersistentId);
|
|
3771
3903
|
const childrenIdsMap = /* @__PURE__ */ new Map();
|
|
3772
3904
|
for (const [parentPersistentId, children] of byParentId) {
|
|
@@ -3781,17 +3913,9 @@ function calculateChildrenIdsMap(elements, groups) {
|
|
|
3781
3913
|
return childrenIdsMap;
|
|
3782
3914
|
}
|
|
3783
3915
|
|
|
3784
|
-
// src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts
|
|
3785
|
-
function documentationElementsToHierarchyDto(docPages, docGroups) {
|
|
3786
|
-
return {
|
|
3787
|
-
pages: documentationPagesToStructureDTOV2(docPages, docGroups),
|
|
3788
|
-
groups: elementGroupsToDocumentationGroupStructureDTO(docGroups, docPages)
|
|
3789
|
-
};
|
|
3790
|
-
}
|
|
3791
|
-
|
|
3792
3916
|
// src/api/conversion/documentation/documentation-page-v1-to-dto.ts
|
|
3793
|
-
function documentationPagesToDTOV1(pages, groups) {
|
|
3794
|
-
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
3917
|
+
function documentationPagesToDTOV1(pages, groups, routingVersion) {
|
|
3918
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
|
|
3795
3919
|
return pages.map((page) => {
|
|
3796
3920
|
let path = pathsMap.get(page.persistentId);
|
|
3797
3921
|
if (!path)
|
|
@@ -3807,10 +3931,7 @@ function documentationPagesToDTOV1(pages, groups) {
|
|
|
3807
3931
|
blocks: page.data.blocks,
|
|
3808
3932
|
slug: page.slug,
|
|
3809
3933
|
userSlug: page.userSlug,
|
|
3810
|
-
configuration: page.data.configuration
|
|
3811
|
-
showSidebar: true,
|
|
3812
|
-
header: defaultDocumentationItemHeaderV1
|
|
3813
|
-
},
|
|
3934
|
+
configuration: page.data.configuration ? documentationItemConfigurationToDTOV1(page.data.configuration) : dtoDefaultItemConfigurationV1,
|
|
3814
3935
|
createdAt: page.createdAt,
|
|
3815
3936
|
updatedAt: page.updatedAt,
|
|
3816
3937
|
path
|
|
@@ -3818,30 +3939,6 @@ function documentationPagesToDTOV1(pages, groups) {
|
|
|
3818
3939
|
});
|
|
3819
3940
|
}
|
|
3820
3941
|
|
|
3821
|
-
// src/api/conversion/design-system/version-to-dto.ts
|
|
3822
|
-
function designSystemVersionToDto(version) {
|
|
3823
|
-
return {
|
|
3824
|
-
id: version.id,
|
|
3825
|
-
designSystemId: version.designSystemId,
|
|
3826
|
-
createdAt: version.createdAt,
|
|
3827
|
-
meta: {
|
|
3828
|
-
name: version.name,
|
|
3829
|
-
description: version.comment
|
|
3830
|
-
},
|
|
3831
|
-
version: version.version,
|
|
3832
|
-
changeLog: version.changeLog,
|
|
3833
|
-
isReadonly: version.isReadonly
|
|
3834
|
-
};
|
|
3835
|
-
}
|
|
3836
|
-
|
|
3837
|
-
// src/api/dto/design-systems/design-system.ts
|
|
3838
|
-
var DTODesignSystem = DesignSystem.omit({
|
|
3839
|
-
name: true,
|
|
3840
|
-
description: true
|
|
3841
|
-
}).extend({
|
|
3842
|
-
meta: ObjectMeta
|
|
3843
|
-
});
|
|
3844
|
-
|
|
3845
3942
|
// src/api/dto/design-systems/brand.ts
|
|
3846
3943
|
import { z as z138 } from "zod";
|
|
3847
3944
|
var DTOBrand = z138.object({
|
|
@@ -3853,58 +3950,66 @@ var DTOBrand = z138.object({
|
|
|
3853
3950
|
var DTOBrandGetResponse = z138.object({ brand: DTOBrand });
|
|
3854
3951
|
var DTOBrandsListResponse = z138.object({ brands: z138.array(DTOBrand) });
|
|
3855
3952
|
|
|
3856
|
-
// src/api/dto/design-systems/
|
|
3953
|
+
// src/api/dto/design-systems/design-system.ts
|
|
3954
|
+
var DTODesignSystem = DesignSystem.omit({
|
|
3955
|
+
name: true,
|
|
3956
|
+
description: true
|
|
3957
|
+
}).extend({
|
|
3958
|
+
meta: ObjectMeta
|
|
3959
|
+
});
|
|
3960
|
+
|
|
3961
|
+
// src/api/dto/design-systems/version.ts
|
|
3857
3962
|
import { z as z139 } from "zod";
|
|
3858
|
-
var
|
|
3963
|
+
var DTODesignSystemVersion = z139.object({
|
|
3859
3964
|
id: z139.string(),
|
|
3860
|
-
|
|
3861
|
-
|
|
3965
|
+
createdAt: z139.date(),
|
|
3966
|
+
meta: ObjectMeta,
|
|
3967
|
+
version: z139.string(),
|
|
3968
|
+
isReadonly: z139.boolean(),
|
|
3969
|
+
changeLog: z139.string(),
|
|
3970
|
+
designSystemId: z139.string()
|
|
3971
|
+
});
|
|
3972
|
+
var DTODesignSystemVersionsListResponse = z139.object({
|
|
3973
|
+
designSystemVersions: z139.array(DTODesignSystemVersion)
|
|
3974
|
+
});
|
|
3975
|
+
var DTODesignSystemVersionGetResponse = z139.object({
|
|
3976
|
+
designSystemVersion: DTODesignSystemVersion
|
|
3977
|
+
});
|
|
3978
|
+
|
|
3979
|
+
// src/api/dto/design-systems/view.ts
|
|
3980
|
+
import { z as z140 } from "zod";
|
|
3981
|
+
var DTOElementViewColumnSharedAttributes = z140.object({
|
|
3982
|
+
id: z140.string(),
|
|
3983
|
+
persistentId: z140.string(),
|
|
3984
|
+
width: z140.number()
|
|
3862
3985
|
});
|
|
3863
3986
|
var DTOElementViewBasePropertyColumn = DTOElementViewColumnSharedAttributes.extend({
|
|
3864
|
-
type:
|
|
3987
|
+
type: z140.literal("BaseProperty"),
|
|
3865
3988
|
basePropertyType: ElementViewBaseColumnType
|
|
3866
3989
|
});
|
|
3867
3990
|
var DTOElementViewPropertyDefinitionColumn = DTOElementViewColumnSharedAttributes.extend({
|
|
3868
|
-
type:
|
|
3869
|
-
propertyDefinitionId:
|
|
3991
|
+
type: z140.literal("PropertyDefinition"),
|
|
3992
|
+
propertyDefinitionId: z140.string()
|
|
3870
3993
|
});
|
|
3871
3994
|
var DTOElementViewThemeColumn = DTOElementViewColumnSharedAttributes.extend({
|
|
3872
|
-
type:
|
|
3873
|
-
themeId:
|
|
3995
|
+
type: z140.literal("Theme"),
|
|
3996
|
+
themeId: z140.string()
|
|
3874
3997
|
});
|
|
3875
|
-
var DTOElementViewColumn =
|
|
3998
|
+
var DTOElementViewColumn = z140.discriminatedUnion("type", [
|
|
3876
3999
|
DTOElementViewBasePropertyColumn,
|
|
3877
4000
|
DTOElementViewPropertyDefinitionColumn,
|
|
3878
4001
|
DTOElementViewThemeColumn
|
|
3879
4002
|
]);
|
|
3880
|
-
var DTOElementView =
|
|
4003
|
+
var DTOElementView = z140.object({
|
|
3881
4004
|
meta: ObjectMeta,
|
|
3882
|
-
persistentId:
|
|
4005
|
+
persistentId: z140.string(),
|
|
3883
4006
|
targetElementType: ElementPropertyTargetType,
|
|
3884
|
-
id: z139.string(),
|
|
3885
|
-
isDefault: z139.boolean(),
|
|
3886
|
-
columns: z139.array(DTOElementViewColumn)
|
|
3887
|
-
});
|
|
3888
|
-
var DTOElementViewsListResponse = z139.object({
|
|
3889
|
-
elementDataViews: z139.array(DTOElementView)
|
|
3890
|
-
});
|
|
3891
|
-
|
|
3892
|
-
// src/api/dto/design-systems/version.ts
|
|
3893
|
-
import { z as z140 } from "zod";
|
|
3894
|
-
var DTODesignSystemVersion = z140.object({
|
|
3895
4007
|
id: z140.string(),
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
version: z140.string(),
|
|
3899
|
-
isReadonly: z140.boolean(),
|
|
3900
|
-
changeLog: z140.string(),
|
|
3901
|
-
designSystemId: z140.string()
|
|
4008
|
+
isDefault: z140.boolean(),
|
|
4009
|
+
columns: z140.array(DTOElementViewColumn)
|
|
3902
4010
|
});
|
|
3903
|
-
var
|
|
3904
|
-
|
|
3905
|
-
});
|
|
3906
|
-
var DTODesignSystemVersionGetResponse = z140.object({
|
|
3907
|
-
designSystemVersion: DTODesignSystemVersion
|
|
4011
|
+
var DTOElementViewsListResponse = z140.object({
|
|
4012
|
+
elementDataViews: z140.array(DTOElementView)
|
|
3908
4013
|
});
|
|
3909
4014
|
|
|
3910
4015
|
// src/api/dto/documentation/link-preview.ts
|
|
@@ -3920,7 +4025,7 @@ var DTODocumentationLinkPreviewRequest = z141.object({
|
|
|
3920
4025
|
// src/api/dto/elements/documentation/group-action.ts
|
|
3921
4026
|
import { z as z143 } from "zod";
|
|
3922
4027
|
|
|
3923
|
-
// src/api/dto/elements/documentation/group.ts
|
|
4028
|
+
// src/api/dto/elements/documentation/group-v2.ts
|
|
3924
4029
|
import { z as z142 } from "zod";
|
|
3925
4030
|
var DTODocumentationGroupStructureV2 = ElementGroup.omit({
|
|
3926
4031
|
sortOrder: true,
|
|
@@ -4054,195 +4159,239 @@ var DTODocumentationTabGroupDeleteActionInputV2 = z143.object({
|
|
|
4054
4159
|
input: DTODeleteDocumentationTabGroupInput
|
|
4055
4160
|
});
|
|
4056
4161
|
|
|
4057
|
-
// src/api/dto/elements/documentation/
|
|
4162
|
+
// src/api/dto/elements/documentation/group-v1.ts
|
|
4058
4163
|
import { z as z145 } from "zod";
|
|
4059
4164
|
|
|
4060
|
-
// src/api/dto/elements/documentation/
|
|
4165
|
+
// src/api/dto/elements/documentation/item-configuration-v1.ts
|
|
4061
4166
|
import { z as z144 } from "zod";
|
|
4167
|
+
var DocumentationColorV1 = z144.object({
|
|
4168
|
+
aliasTo: z144.string().optional(),
|
|
4169
|
+
value: z144.string().optional()
|
|
4170
|
+
});
|
|
4171
|
+
var DTODocumentationItemHeaderV1 = DocumentationItemHeaderV1.omit({
|
|
4172
|
+
foregroundColor: true,
|
|
4173
|
+
backgroundColor: true
|
|
4174
|
+
}).extend({
|
|
4175
|
+
foregroundColor: DocumentationColorV1.optional(),
|
|
4176
|
+
backgroundColor: DocumentationColorV1.optional()
|
|
4177
|
+
});
|
|
4178
|
+
var DTODocumentationItemConfigurationV1 = z144.object({
|
|
4179
|
+
showSidebar: z144.boolean(),
|
|
4180
|
+
header: DTODocumentationItemHeaderV1
|
|
4181
|
+
});
|
|
4182
|
+
|
|
4183
|
+
// src/api/dto/elements/documentation/group-v1.ts
|
|
4184
|
+
var DTODocumentationGroupStructureV1 = ElementGroup.omit({
|
|
4185
|
+
sortOrder: true,
|
|
4186
|
+
parentPersistentId: true,
|
|
4187
|
+
brandPersistentId: true,
|
|
4188
|
+
meta: true,
|
|
4189
|
+
childType: true,
|
|
4190
|
+
data: true,
|
|
4191
|
+
shortPersistentId: true
|
|
4192
|
+
}).extend({
|
|
4193
|
+
title: z145.string(),
|
|
4194
|
+
isRoot: z145.boolean(),
|
|
4195
|
+
childrenIds: z145.array(z145.string()),
|
|
4196
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
4197
|
+
shortPersistentId: z145.string(),
|
|
4198
|
+
type: z145.literal("Group")
|
|
4199
|
+
});
|
|
4200
|
+
var DTODocumentationGroupV1 = DTODocumentationGroupStructureV1.extend({
|
|
4201
|
+
configuration: DTODocumentationItemConfigurationV1
|
|
4202
|
+
});
|
|
4203
|
+
|
|
4204
|
+
// src/api/dto/elements/documentation/page-actions-v2.ts
|
|
4205
|
+
import { z as z147 } from "zod";
|
|
4206
|
+
|
|
4207
|
+
// src/api/dto/elements/documentation/page-v2.ts
|
|
4208
|
+
import { z as z146 } from "zod";
|
|
4062
4209
|
var DTODocumentationPageStructureV2 = DocumentationPageV2.omit({
|
|
4063
4210
|
data: true,
|
|
4064
4211
|
meta: true,
|
|
4065
4212
|
parentPersistentId: true,
|
|
4066
4213
|
sortOrder: true
|
|
4067
4214
|
}).extend({
|
|
4068
|
-
title:
|
|
4069
|
-
path:
|
|
4070
|
-
type:
|
|
4215
|
+
title: z146.string(),
|
|
4216
|
+
path: z146.string(),
|
|
4217
|
+
type: z146.literal("Page")
|
|
4071
4218
|
});
|
|
4072
4219
|
var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend({
|
|
4073
4220
|
configuration: DocumentationItemConfigurationV2
|
|
4074
4221
|
});
|
|
4075
|
-
var DTODocumentationHierarchyV2 =
|
|
4076
|
-
pages:
|
|
4077
|
-
groups:
|
|
4222
|
+
var DTODocumentationHierarchyV2 = z146.object({
|
|
4223
|
+
pages: z146.array(DTODocumentationPageStructureV2),
|
|
4224
|
+
groups: z146.array(DTODocumentationGroupStructureV2)
|
|
4078
4225
|
});
|
|
4079
|
-
var DTOCreateDocumentationPageInputV2 =
|
|
4226
|
+
var DTOCreateDocumentationPageInputV2 = z146.object({
|
|
4080
4227
|
// Identifier
|
|
4081
|
-
persistentId:
|
|
4228
|
+
persistentId: z146.string().uuid(),
|
|
4082
4229
|
// Page properties
|
|
4083
|
-
title:
|
|
4230
|
+
title: z146.string(),
|
|
4084
4231
|
configuration: DocumentationItemConfigurationV2.optional(),
|
|
4085
4232
|
// Page placement properties
|
|
4086
|
-
parentPersistentId:
|
|
4087
|
-
afterPersistentId:
|
|
4233
|
+
parentPersistentId: z146.string().uuid(),
|
|
4234
|
+
afterPersistentId: z146.string().uuid().optional()
|
|
4088
4235
|
});
|
|
4089
|
-
var DTOUpdateDocumentationPageInputV2 =
|
|
4236
|
+
var DTOUpdateDocumentationPageInputV2 = z146.object({
|
|
4090
4237
|
// Identifier of the group to update
|
|
4091
|
-
id:
|
|
4238
|
+
id: z146.string(),
|
|
4092
4239
|
// Page properties
|
|
4093
|
-
title:
|
|
4240
|
+
title: z146.string().optional(),
|
|
4094
4241
|
configuration: DocumentationItemConfigurationV2.optional()
|
|
4095
4242
|
});
|
|
4096
|
-
var DTOMoveDocumentationPageInputV2 =
|
|
4243
|
+
var DTOMoveDocumentationPageInputV2 = z146.object({
|
|
4097
4244
|
// Identifier of the group to update
|
|
4098
|
-
id:
|
|
4245
|
+
id: z146.string(),
|
|
4099
4246
|
// Page placement properties
|
|
4100
|
-
parentPersistentId:
|
|
4101
|
-
afterPersistentId:
|
|
4247
|
+
parentPersistentId: z146.string().uuid(),
|
|
4248
|
+
afterPersistentId: z146.string().uuid().optional()
|
|
4102
4249
|
});
|
|
4103
|
-
var DTODuplicateDocumentationPageInputV2 =
|
|
4250
|
+
var DTODuplicateDocumentationPageInputV2 = z146.object({
|
|
4104
4251
|
// Identifier of the page to duplicate from
|
|
4105
|
-
id:
|
|
4252
|
+
id: z146.string(),
|
|
4106
4253
|
// New page persistent id
|
|
4107
|
-
persistentId:
|
|
4254
|
+
persistentId: z146.string().uuid(),
|
|
4108
4255
|
// Page placement properties
|
|
4109
|
-
parentPersistentId:
|
|
4110
|
-
afterPersistentId:
|
|
4256
|
+
parentPersistentId: z146.string().uuid(),
|
|
4257
|
+
afterPersistentId: z146.string().uuid().optional()
|
|
4111
4258
|
});
|
|
4112
|
-
var DTODeleteDocumentationPageInputV2 =
|
|
4259
|
+
var DTODeleteDocumentationPageInputV2 = z146.object({
|
|
4113
4260
|
// Identifier
|
|
4114
|
-
id:
|
|
4261
|
+
id: z146.string()
|
|
4115
4262
|
});
|
|
4116
4263
|
|
|
4117
4264
|
// src/api/dto/elements/documentation/page-actions-v2.ts
|
|
4118
|
-
var SuccessPayload2 =
|
|
4119
|
-
success:
|
|
4265
|
+
var SuccessPayload2 = z147.object({
|
|
4266
|
+
success: z147.literal(true)
|
|
4120
4267
|
});
|
|
4121
|
-
var DTODocumentationPageCreateActionOutputV2 =
|
|
4122
|
-
type:
|
|
4268
|
+
var DTODocumentationPageCreateActionOutputV2 = z147.object({
|
|
4269
|
+
type: z147.literal("DocumentationPageCreate"),
|
|
4123
4270
|
output: SuccessPayload2
|
|
4124
4271
|
});
|
|
4125
|
-
var DTODocumentationPageUpdateActionOutputV2 =
|
|
4126
|
-
type:
|
|
4272
|
+
var DTODocumentationPageUpdateActionOutputV2 = z147.object({
|
|
4273
|
+
type: z147.literal("DocumentationPageUpdate"),
|
|
4127
4274
|
output: SuccessPayload2
|
|
4128
4275
|
});
|
|
4129
|
-
var DTODocumentationPageMoveActionOutputV2 =
|
|
4130
|
-
type:
|
|
4276
|
+
var DTODocumentationPageMoveActionOutputV2 = z147.object({
|
|
4277
|
+
type: z147.literal("DocumentationPageMove"),
|
|
4131
4278
|
output: SuccessPayload2
|
|
4132
4279
|
});
|
|
4133
|
-
var DTODocumentationPageDuplicateActionOutputV2 =
|
|
4134
|
-
type:
|
|
4280
|
+
var DTODocumentationPageDuplicateActionOutputV2 = z147.object({
|
|
4281
|
+
type: z147.literal("DocumentationPageDuplicate"),
|
|
4135
4282
|
output: SuccessPayload2
|
|
4136
4283
|
});
|
|
4137
|
-
var DTODocumentationPageDeleteActionOutputV2 =
|
|
4138
|
-
type:
|
|
4284
|
+
var DTODocumentationPageDeleteActionOutputV2 = z147.object({
|
|
4285
|
+
type: z147.literal("DocumentationPageDelete"),
|
|
4139
4286
|
output: SuccessPayload2
|
|
4140
4287
|
});
|
|
4141
|
-
var DTODocumentationPageCreateActionInputV2 =
|
|
4142
|
-
type:
|
|
4288
|
+
var DTODocumentationPageCreateActionInputV2 = z147.object({
|
|
4289
|
+
type: z147.literal("DocumentationPageCreate"),
|
|
4143
4290
|
input: DTOCreateDocumentationPageInputV2
|
|
4144
4291
|
});
|
|
4145
|
-
var DTODocumentationPageUpdateActionInputV2 =
|
|
4146
|
-
type:
|
|
4292
|
+
var DTODocumentationPageUpdateActionInputV2 = z147.object({
|
|
4293
|
+
type: z147.literal("DocumentationPageUpdate"),
|
|
4147
4294
|
input: DTOUpdateDocumentationPageInputV2
|
|
4148
4295
|
});
|
|
4149
|
-
var DTODocumentationPageMoveActionInputV2 =
|
|
4150
|
-
type:
|
|
4296
|
+
var DTODocumentationPageMoveActionInputV2 = z147.object({
|
|
4297
|
+
type: z147.literal("DocumentationPageMove"),
|
|
4151
4298
|
input: DTOMoveDocumentationPageInputV2
|
|
4152
4299
|
});
|
|
4153
|
-
var DTODocumentationPageDuplicateActionInputV2 =
|
|
4154
|
-
type:
|
|
4300
|
+
var DTODocumentationPageDuplicateActionInputV2 = z147.object({
|
|
4301
|
+
type: z147.literal("DocumentationPageDuplicate"),
|
|
4155
4302
|
input: DTODuplicateDocumentationPageInputV2
|
|
4156
4303
|
});
|
|
4157
|
-
var DTODocumentationPageDeleteActionInputV2 =
|
|
4158
|
-
type:
|
|
4304
|
+
var DTODocumentationPageDeleteActionInputV2 = z147.object({
|
|
4305
|
+
type: z147.literal("DocumentationPageDelete"),
|
|
4159
4306
|
input: DTODeleteDocumentationPageInputV2
|
|
4160
4307
|
});
|
|
4161
4308
|
|
|
4162
4309
|
// src/api/dto/elements/documentation/page-v1.ts
|
|
4163
|
-
import { z as
|
|
4310
|
+
import { z as z148 } from "zod";
|
|
4164
4311
|
var DocumentationPageV1DTO = DocumentationPageV1.omit({
|
|
4165
4312
|
data: true,
|
|
4166
4313
|
meta: true,
|
|
4167
4314
|
parentPersistentId: true,
|
|
4168
4315
|
sortOrder: true
|
|
4169
|
-
}).extend(
|
|
4170
|
-
|
|
4171
|
-
|
|
4316
|
+
}).extend({
|
|
4317
|
+
configuration: DTODocumentationItemConfigurationV1,
|
|
4318
|
+
blocks: z148.array(PageBlockV1),
|
|
4319
|
+
title: z148.string(),
|
|
4320
|
+
path: z148.string()
|
|
4172
4321
|
});
|
|
4173
4322
|
|
|
4174
4323
|
// src/api/dto/elements/figma-nodes/figma-node.ts
|
|
4175
|
-
import { z as
|
|
4176
|
-
var DTOFigmaNodeData =
|
|
4324
|
+
import { z as z149 } from "zod";
|
|
4325
|
+
var DTOFigmaNodeData = z149.object({
|
|
4177
4326
|
// Id of the node in the Figma file
|
|
4178
|
-
figmaNodeId:
|
|
4327
|
+
figmaNodeId: z149.string(),
|
|
4179
4328
|
// Validity
|
|
4180
|
-
isValid:
|
|
4329
|
+
isValid: z149.boolean(),
|
|
4181
4330
|
// Asset data
|
|
4182
|
-
assetId:
|
|
4183
|
-
assetUrl:
|
|
4331
|
+
assetId: z149.string(),
|
|
4332
|
+
assetUrl: z149.string(),
|
|
4184
4333
|
// Asset metadata
|
|
4185
|
-
assetScale:
|
|
4186
|
-
assetWidth:
|
|
4187
|
-
assetHeight:
|
|
4334
|
+
assetScale: z149.number(),
|
|
4335
|
+
assetWidth: z149.number().optional(),
|
|
4336
|
+
assetHeight: z149.number().optional()
|
|
4188
4337
|
});
|
|
4189
4338
|
var DTOFigmaNode = FigmaFileStructure.omit({
|
|
4190
4339
|
data: true
|
|
4191
4340
|
}).extend({
|
|
4192
4341
|
data: DTOFigmaNodeData
|
|
4193
4342
|
});
|
|
4194
|
-
var DTOFigmaNodeRenderInput =
|
|
4343
|
+
var DTOFigmaNodeRenderInput = z149.object({
|
|
4195
4344
|
// Id of a design system's data source representing a linked Figma file
|
|
4196
|
-
sourceId:
|
|
4345
|
+
sourceId: z149.string(),
|
|
4197
4346
|
// Id of a node within the Figma file
|
|
4198
|
-
figmaFileNodeId:
|
|
4347
|
+
figmaFileNodeId: z149.string()
|
|
4199
4348
|
});
|
|
4200
4349
|
|
|
4201
4350
|
// src/api/dto/elements/figma-nodes/node-actions-v2.ts
|
|
4202
|
-
import { z as
|
|
4203
|
-
var DTOFigmaNodeRenderActionOutput =
|
|
4204
|
-
type:
|
|
4205
|
-
figmaNodes:
|
|
4351
|
+
import { z as z150 } from "zod";
|
|
4352
|
+
var DTOFigmaNodeRenderActionOutput = z150.object({
|
|
4353
|
+
type: z150.literal("FigmaNodeRender"),
|
|
4354
|
+
figmaNodes: z150.array(DTOFigmaNode)
|
|
4206
4355
|
});
|
|
4207
|
-
var DTOFigmaNodeRenderActionInput =
|
|
4208
|
-
type:
|
|
4356
|
+
var DTOFigmaNodeRenderActionInput = z150.object({
|
|
4357
|
+
type: z150.literal("FigmaNodeRender"),
|
|
4209
4358
|
input: DTOFigmaNodeRenderInput.array()
|
|
4210
4359
|
});
|
|
4211
4360
|
|
|
4212
4361
|
// src/api/dto/elements/properties/property-definitions.ts
|
|
4213
|
-
import { z as
|
|
4214
|
-
var DTOElementPropertyDefinition =
|
|
4215
|
-
id:
|
|
4216
|
-
designSystemVersionId:
|
|
4362
|
+
import { z as z151 } from "zod";
|
|
4363
|
+
var DTOElementPropertyDefinition = z151.object({
|
|
4364
|
+
id: z151.string(),
|
|
4365
|
+
designSystemVersionId: z151.string(),
|
|
4217
4366
|
meta: ObjectMeta,
|
|
4218
|
-
persistentId:
|
|
4367
|
+
persistentId: z151.string(),
|
|
4219
4368
|
type: ElementPropertyTypeSchema,
|
|
4220
4369
|
targetElementType: ElementPropertyTargetType,
|
|
4221
|
-
codeName:
|
|
4222
|
-
options:
|
|
4370
|
+
codeName: z151.string(),
|
|
4371
|
+
options: z151.array(ElementPropertyDefinitionOption).optional(),
|
|
4223
4372
|
linkElementType: ElementPropertyLinkType.optional()
|
|
4224
4373
|
});
|
|
4225
|
-
var DTOElementPropertyDefinitionsGetResponse =
|
|
4226
|
-
definitions:
|
|
4374
|
+
var DTOElementPropertyDefinitionsGetResponse = z151.object({
|
|
4375
|
+
definitions: z151.array(DTOElementPropertyDefinition)
|
|
4227
4376
|
});
|
|
4228
4377
|
|
|
4229
4378
|
// src/api/dto/elements/properties/property-values.ts
|
|
4230
|
-
import { z as
|
|
4231
|
-
var DTOElementPropertyValue =
|
|
4232
|
-
id:
|
|
4233
|
-
designSystemVersionId:
|
|
4234
|
-
definitionId:
|
|
4235
|
-
targetElementId:
|
|
4236
|
-
value:
|
|
4237
|
-
valuePreview:
|
|
4379
|
+
import { z as z152 } from "zod";
|
|
4380
|
+
var DTOElementPropertyValue = z152.object({
|
|
4381
|
+
id: z152.string(),
|
|
4382
|
+
designSystemVersionId: z152.string(),
|
|
4383
|
+
definitionId: z152.string(),
|
|
4384
|
+
targetElementId: z152.string(),
|
|
4385
|
+
value: z152.union([z152.string(), z152.number(), z152.boolean()]).optional(),
|
|
4386
|
+
valuePreview: z152.string().optional()
|
|
4238
4387
|
});
|
|
4239
|
-
var DTOElementPropertyValuesGetResponse =
|
|
4240
|
-
values:
|
|
4388
|
+
var DTOElementPropertyValuesGetResponse = z152.object({
|
|
4389
|
+
values: z152.array(DTOElementPropertyValue)
|
|
4241
4390
|
});
|
|
4242
4391
|
|
|
4243
4392
|
// src/api/dto/elements/elements-action-v2.ts
|
|
4244
|
-
import { z as
|
|
4245
|
-
var DTOElementActionOutput =
|
|
4393
|
+
import { z as z153 } from "zod";
|
|
4394
|
+
var DTOElementActionOutput = z153.discriminatedUnion("type", [
|
|
4246
4395
|
// Documentation pages
|
|
4247
4396
|
DTODocumentationPageCreateActionOutputV2,
|
|
4248
4397
|
DTODocumentationPageUpdateActionOutputV2,
|
|
@@ -4260,7 +4409,7 @@ var DTOElementActionOutput = z151.discriminatedUnion("type", [
|
|
|
4260
4409
|
// Figma frames
|
|
4261
4410
|
DTOFigmaNodeRenderActionOutput
|
|
4262
4411
|
]);
|
|
4263
|
-
var DTOElementActionInput =
|
|
4412
|
+
var DTOElementActionInput = z153.discriminatedUnion("type", [
|
|
4264
4413
|
// Documentation pages
|
|
4265
4414
|
DTODocumentationPageCreateActionInputV2,
|
|
4266
4415
|
DTODocumentationPageUpdateActionInputV2,
|
|
@@ -4280,53 +4429,53 @@ var DTOElementActionInput = z151.discriminatedUnion("type", [
|
|
|
4280
4429
|
]);
|
|
4281
4430
|
|
|
4282
4431
|
// src/api/dto/elements/get-elements-v2.ts
|
|
4283
|
-
import { z as
|
|
4284
|
-
var DTOElementsGetTypeFilter =
|
|
4285
|
-
var DTOElementsGetQuerySchema =
|
|
4286
|
-
types:
|
|
4432
|
+
import { z as z154 } from "zod";
|
|
4433
|
+
var DTOElementsGetTypeFilter = z154.enum(["FigmaNode"]);
|
|
4434
|
+
var DTOElementsGetQuerySchema = z154.object({
|
|
4435
|
+
types: z154.string().transform((val) => val.split(",").map((v) => DTOElementsGetTypeFilter.parse(v)))
|
|
4287
4436
|
});
|
|
4288
|
-
var DTOElementsGetOutput =
|
|
4289
|
-
figmaNodes:
|
|
4437
|
+
var DTOElementsGetOutput = z154.object({
|
|
4438
|
+
figmaNodes: z154.array(DTOFigmaNode).optional()
|
|
4290
4439
|
});
|
|
4291
4440
|
|
|
4292
4441
|
// src/api/dto/workspaces/membership.ts
|
|
4293
|
-
import { z as
|
|
4442
|
+
import { z as z157 } from "zod";
|
|
4294
4443
|
|
|
4295
4444
|
// src/api/dto/workspaces/workspace.ts
|
|
4296
|
-
import { z as
|
|
4445
|
+
import { z as z156 } from "zod";
|
|
4297
4446
|
|
|
4298
4447
|
// src/api/dto/workspaces/npm-registry.ts
|
|
4299
|
-
import { z as
|
|
4300
|
-
var DTONpmRegistryConfig =
|
|
4448
|
+
import { z as z155 } from "zod";
|
|
4449
|
+
var DTONpmRegistryConfig = z155.object({
|
|
4301
4450
|
// Registry basic configuration
|
|
4302
4451
|
registryType: NpmRegistryType,
|
|
4303
|
-
registryUrl:
|
|
4304
|
-
customRegistryUrl:
|
|
4452
|
+
registryUrl: z155.string(),
|
|
4453
|
+
customRegistryUrl: z155.string().optional(),
|
|
4305
4454
|
// URL of Supernova NPM packages proxy
|
|
4306
|
-
proxyUrl:
|
|
4455
|
+
proxyUrl: z155.string(),
|
|
4307
4456
|
// Auth configuration
|
|
4308
4457
|
authType: NpmRegistryAuthType,
|
|
4309
|
-
accessToken:
|
|
4310
|
-
username:
|
|
4311
|
-
password:
|
|
4458
|
+
accessToken: z155.literal("redacted").optional(),
|
|
4459
|
+
username: z155.string().optional(),
|
|
4460
|
+
password: z155.literal("redacted").optional(),
|
|
4312
4461
|
// NPM package scopes for whih the proxy should be enabled
|
|
4313
|
-
enabledScopes:
|
|
4462
|
+
enabledScopes: z155.array(z155.string()),
|
|
4314
4463
|
// True if client should bypass Supernova proxy and connect directly to the registry
|
|
4315
4464
|
// (e.g. when the NPM registry is behind a VPN or firewall which prevents Supernova from accessing it)
|
|
4316
|
-
bypassProxy:
|
|
4465
|
+
bypassProxy: z155.boolean()
|
|
4317
4466
|
});
|
|
4318
4467
|
|
|
4319
4468
|
// src/api/dto/workspaces/workspace.ts
|
|
4320
|
-
var DTOWorkspace =
|
|
4321
|
-
id:
|
|
4469
|
+
var DTOWorkspace = z156.object({
|
|
4470
|
+
id: z156.string(),
|
|
4322
4471
|
profile: WorkspaceProfile,
|
|
4323
4472
|
subscription: Subscription,
|
|
4324
4473
|
npmRegistry: DTONpmRegistryConfig.optional()
|
|
4325
4474
|
});
|
|
4326
4475
|
|
|
4327
4476
|
// src/api/dto/workspaces/membership.ts
|
|
4328
|
-
var DTOWorkspaceRole =
|
|
4329
|
-
var DTOUserWorkspaceMembership =
|
|
4477
|
+
var DTOWorkspaceRole = z157.enum(["Owner", "Admin", "Creator", "Viewer", "Billing"]);
|
|
4478
|
+
var DTOUserWorkspaceMembership = z157.object({
|
|
4330
4479
|
// Workspace the user is a member of
|
|
4331
4480
|
workspace: DTOWorkspace,
|
|
4332
4481
|
// Assigned role the user has in the workspace
|
|
@@ -4336,24 +4485,24 @@ var DTOUserWorkspaceMembership = z155.object({
|
|
|
4336
4485
|
// when a workspace's subscription is downgraded to free tier
|
|
4337
4486
|
effectiveRole: DTOWorkspaceRole
|
|
4338
4487
|
});
|
|
4339
|
-
var DTOUserWorkspaceMembershipsResponse =
|
|
4340
|
-
membership:
|
|
4488
|
+
var DTOUserWorkspaceMembershipsResponse = z157.object({
|
|
4489
|
+
membership: z157.array(DTOUserWorkspaceMembership)
|
|
4341
4490
|
});
|
|
4342
4491
|
|
|
4343
4492
|
// src/api/payloads/documentation/block-definitions.ts
|
|
4344
|
-
import { z as
|
|
4345
|
-
var DTOGetBlockDefinitionsOutput =
|
|
4346
|
-
definitions:
|
|
4493
|
+
import { z as z158 } from "zod";
|
|
4494
|
+
var DTOGetBlockDefinitionsOutput = z158.object({
|
|
4495
|
+
definitions: z158.array(PageBlockDefinition)
|
|
4347
4496
|
});
|
|
4348
4497
|
|
|
4349
4498
|
// src/api/payloads/liveblocks/auth.ts
|
|
4350
|
-
import { z as
|
|
4351
|
-
var DTOLiveblocksAuthRequest =
|
|
4352
|
-
room:
|
|
4499
|
+
import { z as z159 } from "zod";
|
|
4500
|
+
var DTOLiveblocksAuthRequest = z159.object({
|
|
4501
|
+
room: z159.string()
|
|
4353
4502
|
});
|
|
4354
4503
|
|
|
4355
4504
|
// src/api/payloads/workspaces/workspace-configuration.ts
|
|
4356
|
-
import { z as
|
|
4505
|
+
import { z as z160 } from "zod";
|
|
4357
4506
|
var prohibitedSsoKeys = ["providerId", "metadataXml", "emailDomains"];
|
|
4358
4507
|
function validateSsoPayload(ssoPayload) {
|
|
4359
4508
|
const keys = [];
|
|
@@ -4376,21 +4525,21 @@ function validateSsoPayload(ssoPayload) {
|
|
|
4376
4525
|
keys
|
|
4377
4526
|
};
|
|
4378
4527
|
}
|
|
4379
|
-
var NpmRegistryInput =
|
|
4380
|
-
enabledScopes:
|
|
4381
|
-
customRegistryUrl:
|
|
4382
|
-
bypassProxy:
|
|
4383
|
-
npmProxyRegistryConfigId:
|
|
4384
|
-
npmProxyVersion:
|
|
4385
|
-
registryType:
|
|
4386
|
-
authType:
|
|
4387
|
-
authHeaderName:
|
|
4388
|
-
authHeaderValue:
|
|
4389
|
-
accessToken:
|
|
4390
|
-
username:
|
|
4391
|
-
password:
|
|
4392
|
-
});
|
|
4393
|
-
var WorkspaceConfigurationPayload =
|
|
4528
|
+
var NpmRegistryInput = z160.object({
|
|
4529
|
+
enabledScopes: z160.array(z160.string()),
|
|
4530
|
+
customRegistryUrl: z160.string().optional(),
|
|
4531
|
+
bypassProxy: z160.boolean().optional(),
|
|
4532
|
+
npmProxyRegistryConfigId: z160.string().optional(),
|
|
4533
|
+
npmProxyVersion: z160.number().optional(),
|
|
4534
|
+
registryType: z160.string(),
|
|
4535
|
+
authType: z160.string(),
|
|
4536
|
+
authHeaderName: z160.string(),
|
|
4537
|
+
authHeaderValue: z160.string(),
|
|
4538
|
+
accessToken: z160.string(),
|
|
4539
|
+
username: z160.string(),
|
|
4540
|
+
password: z160.string()
|
|
4541
|
+
});
|
|
4542
|
+
var WorkspaceConfigurationPayload = z160.object({
|
|
4394
4543
|
ipWhitelist: WorkspaceIpSettings.partial().optional(),
|
|
4395
4544
|
sso: SsoProvider.partial().optional(),
|
|
4396
4545
|
npmRegistrySettings: NpmRegistryInput.partial().optional(),
|
|
@@ -4398,6 +4547,10 @@ var WorkspaceConfigurationPayload = z158.object({
|
|
|
4398
4547
|
});
|
|
4399
4548
|
|
|
4400
4549
|
// src/yjs/design-system-content/documentation-hierarchy.ts
|
|
4550
|
+
import { z as z161 } from "zod";
|
|
4551
|
+
var DocumentationHierarchySettings = z161.object({
|
|
4552
|
+
routingVersion: z161.string()
|
|
4553
|
+
});
|
|
4401
4554
|
function documentationHierarchyToYjs(doc, transaction) {
|
|
4402
4555
|
doc.transact((trx) => {
|
|
4403
4556
|
const pagesMap = getPagesYMap(trx.doc);
|
|
@@ -4424,9 +4577,16 @@ function documentationHierarchyToYjs(doc, transaction) {
|
|
|
4424
4577
|
};
|
|
4425
4578
|
groupsMap.set(group.id, JSON.parse(JSON.stringify(sanitizedGroup)));
|
|
4426
4579
|
});
|
|
4580
|
+
if (transaction.internalSettings) {
|
|
4581
|
+
serializeDocumentationInternalSettings(trx.doc, transaction.internalSettings);
|
|
4582
|
+
}
|
|
4427
4583
|
});
|
|
4428
4584
|
return doc;
|
|
4429
4585
|
}
|
|
4586
|
+
function serializeDocumentationInternalSettings(doc, settings) {
|
|
4587
|
+
const map = getInternalSettingsYMap(doc);
|
|
4588
|
+
map.set("routingVersion", settings.routingVersion);
|
|
4589
|
+
}
|
|
4430
4590
|
function yjsToDocumentationHierarchy(doc) {
|
|
4431
4591
|
const pagesMap = getPagesYMap(doc);
|
|
4432
4592
|
const groupsMap = getGroupsYMap(doc);
|
|
@@ -4438,24 +4598,39 @@ function yjsToDocumentationHierarchy(doc) {
|
|
|
4438
4598
|
groupsMap.forEach((group) => {
|
|
4439
4599
|
groups.push(ElementGroup.parse(group));
|
|
4440
4600
|
});
|
|
4441
|
-
const
|
|
4601
|
+
const internalSettings = parseDocumentationInternalSettings(doc);
|
|
4602
|
+
const hierarchy = documentationElementsToHierarchyDto(pages, groups, internalSettings.routingVersion ?? "2");
|
|
4442
4603
|
return hierarchy;
|
|
4443
4604
|
}
|
|
4605
|
+
function parseDocumentationInternalSettings(doc) {
|
|
4606
|
+
const map = getInternalSettingsYMap(doc);
|
|
4607
|
+
const rawSettings = {
|
|
4608
|
+
routingVersion: map.get("routingVersion")
|
|
4609
|
+
};
|
|
4610
|
+
const settingsParseResult = DocumentationHierarchySettings.safeParse(rawSettings);
|
|
4611
|
+
if (!settingsParseResult.success) {
|
|
4612
|
+
return { routingVersion: "2" };
|
|
4613
|
+
}
|
|
4614
|
+
return settingsParseResult.data;
|
|
4615
|
+
}
|
|
4444
4616
|
function getPagesYMap(doc) {
|
|
4445
4617
|
return doc.getMap("documentationPages");
|
|
4446
4618
|
}
|
|
4447
4619
|
function getGroupsYMap(doc) {
|
|
4448
4620
|
return doc.getMap("documentationGroups");
|
|
4449
4621
|
}
|
|
4622
|
+
function getInternalSettingsYMap(doc) {
|
|
4623
|
+
return doc.getMap("documentationInternalSettings");
|
|
4624
|
+
}
|
|
4450
4625
|
|
|
4451
4626
|
// src/yjs/design-system-content/item-configuration.ts
|
|
4452
|
-
import { z as
|
|
4453
|
-
var DTODocumentationPageRoomHeaderData =
|
|
4454
|
-
title:
|
|
4627
|
+
import { z as z162 } from "zod";
|
|
4628
|
+
var DTODocumentationPageRoomHeaderData = z162.object({
|
|
4629
|
+
title: z162.string(),
|
|
4455
4630
|
configuration: DocumentationItemConfigurationV2
|
|
4456
4631
|
});
|
|
4457
|
-
var DTODocumentationPageRoomHeaderDataUpdate =
|
|
4458
|
-
title:
|
|
4632
|
+
var DTODocumentationPageRoomHeaderDataUpdate = z162.object({
|
|
4633
|
+
title: z162.string().optional(),
|
|
4459
4634
|
configuration: DocumentationItemConfigurationV2.omit({ header: true }).extend({ header: DocumentationItemHeaderV2.partial() }).optional()
|
|
4460
4635
|
});
|
|
4461
4636
|
function itemConfigurationToYjs(yDoc, item) {
|
|
@@ -4504,7 +4679,7 @@ function yjsToItemConfiguration(yDoc) {
|
|
|
4504
4679
|
header: rawHeader
|
|
4505
4680
|
};
|
|
4506
4681
|
return {
|
|
4507
|
-
title:
|
|
4682
|
+
title: z162.string().parse(title),
|
|
4508
4683
|
configuration: DocumentationItemConfigurationV2.parse(rawConfig)
|
|
4509
4684
|
};
|
|
4510
4685
|
}
|
|
@@ -4514,9 +4689,9 @@ var PageBlockEditorModel = PageBlockEditorModelV2;
|
|
|
4514
4689
|
var PageSectionEditorModel = PageSectionEditorModelV2;
|
|
4515
4690
|
|
|
4516
4691
|
// src/yjs/docs-editor/model/page.ts
|
|
4517
|
-
import { z as
|
|
4518
|
-
var DocumentationPageEditorModel =
|
|
4519
|
-
blocks:
|
|
4692
|
+
import { z as z163 } from "zod";
|
|
4693
|
+
var DocumentationPageEditorModel = z163.object({
|
|
4694
|
+
blocks: z163.array(PageBlockEditorModel.or(PageSectionEditorModel))
|
|
4520
4695
|
});
|
|
4521
4696
|
|
|
4522
4697
|
// src/yjs/docs-editor/prosemirror/schema.ts
|
|
@@ -5839,7 +6014,7 @@ var blocks = [
|
|
|
5839
6014
|
name: "Text",
|
|
5840
6015
|
description: "Plain text",
|
|
5841
6016
|
category: "Text",
|
|
5842
|
-
icon: "https://cdn-assets.supernova.io/blocks/icons/
|
|
6017
|
+
icon: "https://cdn-assets.supernova.io/blocks/icons/v3/text.svg",
|
|
5843
6018
|
searchKeywords: ["paragraph", "rich text"],
|
|
5844
6019
|
item: {
|
|
5845
6020
|
properties: [
|
|
@@ -6309,7 +6484,7 @@ var blocks = [
|
|
|
6309
6484
|
{
|
|
6310
6485
|
id: "io.supernova.block.image",
|
|
6311
6486
|
name: "Image",
|
|
6312
|
-
description: "Display an image or Figma
|
|
6487
|
+
description: "Display an image or Figma image",
|
|
6313
6488
|
category: "Media",
|
|
6314
6489
|
icon: "https://cdn-assets.supernova.io/blocks/icons/v2/image.svg",
|
|
6315
6490
|
searchKeywords: ["image", "figma", "frame", "picture", "photo"],
|
|
@@ -6338,7 +6513,7 @@ var blocks = [
|
|
|
6338
6513
|
behavior: { dataType: "Item", items: { numberOfItems: 1, allowLinks: false } },
|
|
6339
6514
|
editorOptions: {
|
|
6340
6515
|
onboarding: {
|
|
6341
|
-
helpText: "Use to display an image or Figma
|
|
6516
|
+
helpText: "Use to display an image or Figma image.",
|
|
6342
6517
|
documentationLink: "https://learn.supernova.io/latest/documentation/types-of-blocks/media-and-assets/image-Ue8VdT8B"
|
|
6343
6518
|
}
|
|
6344
6519
|
},
|
|
@@ -7057,7 +7232,7 @@ var blocks = [
|
|
|
7057
7232
|
behavior: { dataType: "Item", items: { numberOfItems: 1, allowLinks: false } },
|
|
7058
7233
|
editorOptions: { onboarding: { helpText: "Code descriptor." } },
|
|
7059
7234
|
appearance: {
|
|
7060
|
-
isBordered:
|
|
7235
|
+
isBordered: false,
|
|
7061
7236
|
hasBackground: false,
|
|
7062
7237
|
isEditorPresentationDifferent: false,
|
|
7063
7238
|
showBlockHeaderInEditor: false
|
|
@@ -7162,7 +7337,7 @@ var blocks = [
|
|
|
7162
7337
|
layout: { type: "Column", children: ["assets"], columnAlign: "Start", columnResizing: "Fill", gap: "Medium" },
|
|
7163
7338
|
maxColumns: 8,
|
|
7164
7339
|
defaultColumns: 1,
|
|
7165
|
-
appearance: {
|
|
7340
|
+
appearance: {}
|
|
7166
7341
|
},
|
|
7167
7342
|
{
|
|
7168
7343
|
id: "square-grid",
|
|
@@ -7172,7 +7347,7 @@ var blocks = [
|
|
|
7172
7347
|
layout: { type: "Column", children: ["assets"], columnAlign: "Start", columnResizing: "Fill", gap: "Medium" },
|
|
7173
7348
|
maxColumns: 8,
|
|
7174
7349
|
defaultColumns: 1,
|
|
7175
|
-
appearance: { isEditorPresentationDifferent:
|
|
7350
|
+
appearance: { isEditorPresentationDifferent: true }
|
|
7176
7351
|
},
|
|
7177
7352
|
{
|
|
7178
7353
|
id: "borderless-grid",
|
|
@@ -7182,7 +7357,7 @@ var blocks = [
|
|
|
7182
7357
|
layout: { type: "Column", children: ["assets"], columnAlign: "Start", columnResizing: "Fill", gap: "Medium" },
|
|
7183
7358
|
maxColumns: 8,
|
|
7184
7359
|
defaultColumns: 1,
|
|
7185
|
-
appearance: { isEditorPresentationDifferent:
|
|
7360
|
+
appearance: { isEditorPresentationDifferent: true }
|
|
7186
7361
|
}
|
|
7187
7362
|
],
|
|
7188
7363
|
defaultVariantKey: "default"
|
|
@@ -7203,11 +7378,11 @@ var blocks = [
|
|
|
7203
7378
|
},
|
|
7204
7379
|
{
|
|
7205
7380
|
id: "io.supernova.block.figma-frames",
|
|
7206
|
-
name: "Figma
|
|
7207
|
-
description: "
|
|
7381
|
+
name: "Figma images",
|
|
7382
|
+
description: "Generate images from Figma layers",
|
|
7208
7383
|
category: "Figma",
|
|
7209
7384
|
icon: "https://cdn-assets.supernova.io/blocks/icons/v2/figma-frames.svg",
|
|
7210
|
-
searchKeywords: ["figma", "frames", "image"],
|
|
7385
|
+
searchKeywords: ["figma", "frames", "image", "layer"],
|
|
7211
7386
|
item: {
|
|
7212
7387
|
properties: [
|
|
7213
7388
|
{
|
|
@@ -7231,7 +7406,7 @@ var blocks = [
|
|
|
7231
7406
|
columnResizing: "Fill",
|
|
7232
7407
|
gap: "Medium"
|
|
7233
7408
|
},
|
|
7234
|
-
maxColumns:
|
|
7409
|
+
maxColumns: 8,
|
|
7235
7410
|
defaultColumns: 1,
|
|
7236
7411
|
appearance: {}
|
|
7237
7412
|
},
|
|
@@ -7247,7 +7422,7 @@ var blocks = [
|
|
|
7247
7422
|
columnResizing: "Fill",
|
|
7248
7423
|
gap: "Medium"
|
|
7249
7424
|
},
|
|
7250
|
-
maxColumns:
|
|
7425
|
+
maxColumns: 8,
|
|
7251
7426
|
defaultColumns: 1,
|
|
7252
7427
|
appearance: {}
|
|
7253
7428
|
}
|
|
@@ -7257,7 +7432,7 @@ var blocks = [
|
|
|
7257
7432
|
behavior: { dataType: "FigmaNode", entities: { selectionType: "Entity", maxSelected: 0 } },
|
|
7258
7433
|
editorOptions: {
|
|
7259
7434
|
onboarding: {
|
|
7260
|
-
helpText: "
|
|
7435
|
+
helpText: "Generate images from Figma layers",
|
|
7261
7436
|
documentationLink: "https://learn.supernova.io/latest/documentation/types-of-blocks/figma/figma-frames/general-f3IYC5dg"
|
|
7262
7437
|
}
|
|
7263
7438
|
},
|
|
@@ -7477,7 +7652,7 @@ var blocks = [
|
|
|
7477
7652
|
|
|
7478
7653
|
// src/yjs/docs-editor/prosemirror-to-blocks.ts
|
|
7479
7654
|
import { yXmlFragmentToProsemirrorJSON } from "y-prosemirror";
|
|
7480
|
-
import { z as
|
|
7655
|
+
import { z as z164 } from "zod";
|
|
7481
7656
|
function yDocToPage(yDoc, definitions) {
|
|
7482
7657
|
return yXmlFragmentToPage(yDoc.getXmlFragment("default"), definitions);
|
|
7483
7658
|
}
|
|
@@ -7492,7 +7667,7 @@ function prosemirrorDocToPage(prosemirrorDoc, definitions) {
|
|
|
7492
7667
|
};
|
|
7493
7668
|
}
|
|
7494
7669
|
function shallowProsemirrorNodeToBlock(prosemirrorNode, definition) {
|
|
7495
|
-
return
|
|
7670
|
+
return prosemirrorNodeAndDefinitionToBlock(prosemirrorNode, definition, /* @__PURE__ */ new Map([[definition.id, definition]]), 0);
|
|
7496
7671
|
}
|
|
7497
7672
|
function prosemirrorNodeToSection(prosemirrorNode, definitions) {
|
|
7498
7673
|
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
@@ -7520,7 +7695,7 @@ function prosemirrorNodeToSectionItem(prosemirrorNode, definitionsMap) {
|
|
|
7520
7695
|
return null;
|
|
7521
7696
|
return {
|
|
7522
7697
|
id,
|
|
7523
|
-
title: getProsemirrorAttribute(prosemirrorNode, "title",
|
|
7698
|
+
title: getProsemirrorAttribute(prosemirrorNode, "title", z164.string()) ?? "",
|
|
7524
7699
|
columns: (prosemirrorNode.content ?? []).filter((c) => c.type === "sectionItemColumn").map((c) => prosemirrorNodeToSectionColumns(c, definitionsMap)).filter(nonNullFilter)
|
|
7525
7700
|
};
|
|
7526
7701
|
}
|
|
@@ -7555,7 +7730,7 @@ function internalProsemirrorNodesToBlocks(prosemirrorNodes, definitionsMap, dept
|
|
|
7555
7730
|
});
|
|
7556
7731
|
}
|
|
7557
7732
|
function internalProsemirrorNodeToBlock(prosemirrorNode, definitionsMap, depth) {
|
|
7558
|
-
const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId",
|
|
7733
|
+
const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", z164.string());
|
|
7559
7734
|
if (!definitionId) {
|
|
7560
7735
|
console.warn(`definitionId on ${prosemirrorNode.type} is required to be interpreted as a block, skipping node`);
|
|
7561
7736
|
return [];
|
|
@@ -7597,7 +7772,7 @@ function parseAsRichText(prosemirrorNode, definition, property) {
|
|
|
7597
7772
|
if (!id)
|
|
7598
7773
|
return null;
|
|
7599
7774
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
7600
|
-
const calloutType = parseCalloutType(getProsemirrorAttribute(prosemirrorNode, "type",
|
|
7775
|
+
const calloutType = parseCalloutType(getProsemirrorAttribute(prosemirrorNode, "type", z164.string().optional()));
|
|
7601
7776
|
return {
|
|
7602
7777
|
// TODO Artem: indent
|
|
7603
7778
|
id,
|
|
@@ -7721,10 +7896,10 @@ function parseRichTextAttribute(mark) {
|
|
|
7721
7896
|
return null;
|
|
7722
7897
|
}
|
|
7723
7898
|
function parseProsemirrorLink(mark) {
|
|
7724
|
-
const href = getProsemirrorAttribute(mark, "href",
|
|
7899
|
+
const href = getProsemirrorAttribute(mark, "href", z164.string().optional());
|
|
7725
7900
|
if (!href)
|
|
7726
7901
|
return null;
|
|
7727
|
-
const target = getProsemirrorAttribute(mark, "target",
|
|
7902
|
+
const target = getProsemirrorAttribute(mark, "target", z164.string().optional());
|
|
7728
7903
|
const openInNewWindow = target === "_blank";
|
|
7729
7904
|
if (href.startsWith("@")) {
|
|
7730
7905
|
return {
|
|
@@ -7745,7 +7920,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
|
|
|
7745
7920
|
if (!id)
|
|
7746
7921
|
return null;
|
|
7747
7922
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
7748
|
-
const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder",
|
|
7923
|
+
const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", z164.boolean().optional()) !== false;
|
|
7749
7924
|
const tableChild = prosemirrorNode.content?.find((c) => c.type === "table");
|
|
7750
7925
|
if (!tableChild) {
|
|
7751
7926
|
return emptyTable(id, variantId, 0);
|
|
@@ -7792,9 +7967,9 @@ function parseAsTableCell(prosemirrorNode) {
|
|
|
7792
7967
|
const id = getProsemirrorBlockId(prosemirrorNode);
|
|
7793
7968
|
if (!id)
|
|
7794
7969
|
return null;
|
|
7795
|
-
const textAlign = getProsemirrorAttribute(prosemirrorNode, "textAlign",
|
|
7970
|
+
const textAlign = getProsemirrorAttribute(prosemirrorNode, "textAlign", z164.string().optional());
|
|
7796
7971
|
let columnWidth;
|
|
7797
|
-
const columnWidthArray = getProsemirrorAttribute(prosemirrorNode, "colwidth",
|
|
7972
|
+
const columnWidthArray = getProsemirrorAttribute(prosemirrorNode, "colwidth", z164.array(z164.number()).optional());
|
|
7798
7973
|
if (columnWidthArray) {
|
|
7799
7974
|
columnWidth = columnWidthArray[0];
|
|
7800
7975
|
}
|
|
@@ -7832,7 +8007,7 @@ function parseAsTableNode(prosemirrorNode) {
|
|
|
7832
8007
|
value: parseRichText(prosemirrorNode.content ?? [])
|
|
7833
8008
|
};
|
|
7834
8009
|
case "image":
|
|
7835
|
-
const items = getProsemirrorAttribute(prosemirrorNode, "items",
|
|
8010
|
+
const items = getProsemirrorAttribute(prosemirrorNode, "items", z164.string());
|
|
7836
8011
|
if (!items)
|
|
7837
8012
|
return null;
|
|
7838
8013
|
const parsedItems = PageBlockItemV2.array().safeParse(JSON.parse(items));
|
|
@@ -7937,7 +8112,7 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
|
|
|
7937
8112
|
};
|
|
7938
8113
|
}
|
|
7939
8114
|
function parseBlockItems(prosemirrorNode, definition) {
|
|
7940
|
-
const itemsString = getProsemirrorAttribute(prosemirrorNode, "items",
|
|
8115
|
+
const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", z164.string());
|
|
7941
8116
|
if (!itemsString)
|
|
7942
8117
|
return null;
|
|
7943
8118
|
const itemsJson = JSON.parse(itemsString);
|
|
@@ -7949,18 +8124,18 @@ function parseBlockItems(prosemirrorNode, definition) {
|
|
|
7949
8124
|
}
|
|
7950
8125
|
function parseAppearance(prosemirrorNode) {
|
|
7951
8126
|
let appearance = {};
|
|
7952
|
-
const rawAppearanceString = getProsemirrorAttribute(prosemirrorNode, "appearance",
|
|
8127
|
+
const rawAppearanceString = getProsemirrorAttribute(prosemirrorNode, "appearance", z164.string().optional());
|
|
7953
8128
|
if (rawAppearanceString) {
|
|
7954
8129
|
const parsedAppearance = PageBlockAppearanceV2.safeParse(JSON.parse(rawAppearanceString));
|
|
7955
8130
|
if (parsedAppearance.success) {
|
|
7956
8131
|
appearance = parsedAppearance.data;
|
|
7957
8132
|
}
|
|
7958
8133
|
}
|
|
7959
|
-
const columns = getProsemirrorAttribute(prosemirrorNode, "columns",
|
|
8134
|
+
const columns = getProsemirrorAttribute(prosemirrorNode, "columns", z164.number().optional());
|
|
7960
8135
|
if (columns) {
|
|
7961
8136
|
appearance.numberOfColumns = columns;
|
|
7962
8137
|
}
|
|
7963
|
-
const backgroundColor = getProsemirrorAttribute(prosemirrorNode, "backgroundColor",
|
|
8138
|
+
const backgroundColor = getProsemirrorAttribute(prosemirrorNode, "backgroundColor", z164.string().optional());
|
|
7964
8139
|
if (backgroundColor) {
|
|
7965
8140
|
const parsedColor = PageBlockColorV2.safeParse(JSON.parse(backgroundColor));
|
|
7966
8141
|
if (parsedColor.success) {
|
|
@@ -8051,13 +8226,13 @@ function valueSchemaForPropertyType(type) {
|
|
|
8051
8226
|
}
|
|
8052
8227
|
}
|
|
8053
8228
|
function getProsemirrorBlockId(prosemirrorNode) {
|
|
8054
|
-
const id = getProsemirrorAttribute(prosemirrorNode, "id",
|
|
8229
|
+
const id = getProsemirrorAttribute(prosemirrorNode, "id", z164.string());
|
|
8055
8230
|
if (!id)
|
|
8056
8231
|
console.warn(`Prosemirror attribute "id" on ${prosemirrorNode.type} is required`);
|
|
8057
8232
|
return id;
|
|
8058
8233
|
}
|
|
8059
8234
|
function getProsemirrorBlockVariantId(prosemirrorNode) {
|
|
8060
|
-
return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(
|
|
8235
|
+
return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(z164.string()));
|
|
8061
8236
|
}
|
|
8062
8237
|
function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchema) {
|
|
8063
8238
|
const parsedAttr = validationSchema.safeParse(prosemirrorNode.attrs?.[attributeName]);
|
|
@@ -8103,11 +8278,14 @@ export {
|
|
|
8103
8278
|
DTODocumentationGroupDuplicateActionOutputV2,
|
|
8104
8279
|
DTODocumentationGroupMoveActionInputV2,
|
|
8105
8280
|
DTODocumentationGroupMoveActionOutputV2,
|
|
8281
|
+
DTODocumentationGroupStructureV1,
|
|
8106
8282
|
DTODocumentationGroupStructureV2,
|
|
8107
8283
|
DTODocumentationGroupUpdateActionInputV2,
|
|
8108
8284
|
DTODocumentationGroupUpdateActionOutputV2,
|
|
8285
|
+
DTODocumentationGroupV1,
|
|
8109
8286
|
DTODocumentationGroupV2,
|
|
8110
8287
|
DTODocumentationHierarchyV2,
|
|
8288
|
+
DTODocumentationItemConfigurationV1,
|
|
8111
8289
|
DTODocumentationLinkPreviewRequest,
|
|
8112
8290
|
DTODocumentationLinkPreviewResponse,
|
|
8113
8291
|
DTODocumentationPageCreateActionInputV2,
|
|
@@ -8162,6 +8340,7 @@ export {
|
|
|
8162
8340
|
DTOUserWorkspaceMembershipsResponse,
|
|
8163
8341
|
DTOWorkspace,
|
|
8164
8342
|
DTOWorkspaceRole,
|
|
8343
|
+
DocumentationHierarchySettings,
|
|
8165
8344
|
DocumentationPageEditorModel,
|
|
8166
8345
|
DocumentationPageV1DTO,
|
|
8167
8346
|
ListTreeBuilder,
|
|
@@ -8176,11 +8355,15 @@ export {
|
|
|
8176
8355
|
designSystemVersionToDto,
|
|
8177
8356
|
documentationElementsToHierarchyDto,
|
|
8178
8357
|
documentationHierarchyToYjs,
|
|
8358
|
+
documentationItemConfigurationToDTOV1,
|
|
8179
8359
|
documentationPagesToDTOV1,
|
|
8180
8360
|
documentationPagesToDTOV2,
|
|
8181
8361
|
documentationPagesToStructureDTOV2,
|
|
8182
|
-
|
|
8183
|
-
|
|
8362
|
+
dtoDefaultItemConfigurationV1,
|
|
8363
|
+
elementGroupsToDocumentationGroupDTOV1,
|
|
8364
|
+
elementGroupsToDocumentationGroupDTOV2,
|
|
8365
|
+
elementGroupsToDocumentationGroupStructureDTOV1,
|
|
8366
|
+
elementGroupsToDocumentationGroupStructureDTOV2,
|
|
8184
8367
|
elementPropertyDefinitionToDto,
|
|
8185
8368
|
elementPropertyValueToDto,
|
|
8186
8369
|
elementViewToDto,
|