@supernova-studio/client 0.16.0 → 0.19.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 +14007 -6383
- package/dist/index.d.ts +14007 -6383
- package/dist/index.js +1188 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1219 -123
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts +20 -0
- package/src/api/conversion/documentation/documentation-group-to-dto.ts +83 -0
- package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +54 -0
- package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +43 -0
- package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +57 -0
- package/src/api/conversion/documentation/index.ts +5 -0
- package/src/api/conversion/index.ts +1 -0
- package/src/api/dto/{design-system.ts → design-systems/design-system.ts} +6 -2
- package/src/api/dto/design-systems/index.ts +1 -0
- package/src/api/dto/documentation/index.ts +0 -0
- package/src/api/dto/elements/documentation/group-action.ts +70 -0
- package/src/api/dto/elements/documentation/group.ts +105 -0
- package/src/api/dto/elements/documentation/index.ts +5 -0
- package/src/api/dto/elements/documentation/page-actions-v2.ts +70 -0
- package/src/api/dto/{documentation-v1.ts → elements/documentation/page-v1.ts} +4 -0
- package/src/api/dto/elements/documentation/page-v2.ts +87 -0
- package/src/api/dto/elements/elements-action-v2.ts +61 -0
- package/src/api/dto/elements/index.ts +2 -0
- package/src/api/dto/index.ts +2 -3
- package/src/api/index.ts +2 -2
- package/src/api/payloads/documentation/block-definitions.ts +12 -0
- package/src/api/payloads/documentation/index.ts +1 -0
- package/src/api/payloads/index.ts +2 -0
- package/src/api/payloads/liveblocks/auth.ts +7 -0
- package/src/api/payloads/liveblocks/index.ts +1 -0
- package/src/index.ts +1 -2
- package/src/yjs/design-system-content/documentation-hierarchy.ts +100 -0
- package/src/{design-system-content → yjs/design-system-content}/item-configuration.ts +41 -10
- package/src/yjs/design-system-content/item-title.ts +0 -0
- package/src/yjs/docs-editor/model/block.ts +5 -0
- package/src/yjs/index.ts +2 -0
- package/src/api/dto/documentation-v2.ts +0 -28
- package/src/api/dto/documentation.ts +0 -29
- package/src/api/requests/elements/elements-transaction-v2.ts +0 -53
- package/src/api/requests/elements/index.ts +0 -1
- package/src/api/requests/index.ts +0 -2
- package/src/api/requests/post-liveblocks-auth.ts +0 -4
- package/src/api/responses/elements/elements-transaction-v2.ts +0 -11
- package/src/api/responses/elements/index.ts +0 -1
- package/src/api/responses/get-block-definitions.ts +0 -8
- package/src/api/responses/index.ts +0 -2
- package/src/design-system-content/documentation-hierarchy.ts +0 -74
- package/src/docs-editor/model/block.ts +0 -9
- /package/src/{design-system-content → yjs/design-system-content}/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/blocks-to-prosemirror.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/mock.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/model/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/model/page.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror/index.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror/schema.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror/types.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/prosemirror-to-blocks.ts +0 -0
- /package/src/{docs-editor → yjs/docs-editor}/utils.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../model/dist/index.mjs
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../model/dist/index.mjs
|
|
2
2
|
var _zod = require('zod');
|
|
3
3
|
|
|
4
4
|
|
|
@@ -126,6 +126,7 @@ var _zod = require('zod');
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
var _slugify = require('@sindresorhus/slugify'); var _slugify2 = _interopRequireDefault(_slugify);
|
|
129
130
|
var PluginOAuthRequestSchema = _zod.z.object({
|
|
130
131
|
id: _zod.z.string(),
|
|
131
132
|
codeChallenge: _zod.z.string(),
|
|
@@ -981,7 +982,12 @@ var PageBlockItemDividerValue = _zod.z.object({});
|
|
|
981
982
|
var PageBlockItemEmbedValue = _zod.z.object({
|
|
982
983
|
value: _zod.z.string().optional(),
|
|
983
984
|
caption: _zod.z.string().optional(),
|
|
984
|
-
height: _zod.z.number().optional()
|
|
985
|
+
height: _zod.z.number().optional(),
|
|
986
|
+
openGraph: _zod.z.object({
|
|
987
|
+
title: _zod.z.string().optional(),
|
|
988
|
+
description: _zod.z.string().optional(),
|
|
989
|
+
imageUrl: _zod.z.string().optional()
|
|
990
|
+
}).optional()
|
|
985
991
|
});
|
|
986
992
|
var PageBlockItemFigmaNodeValue = _zod.z.object({
|
|
987
993
|
selectedPropertyIds: _zod.z.array(_zod.z.string()).optional(),
|
|
@@ -2605,11 +2611,31 @@ var DesignSystemVersionRoom = Entity.extend({
|
|
|
2605
2611
|
designSystemVersionId: _zod.z.string(),
|
|
2606
2612
|
liveblocksId: _zod.z.string()
|
|
2607
2613
|
});
|
|
2614
|
+
var DesignSystemVersionRoomInitialState = _zod.z.object({
|
|
2615
|
+
pages: _zod.z.array(DocumentationPageV2),
|
|
2616
|
+
groups: _zod.z.array(ElementGroup)
|
|
2617
|
+
});
|
|
2618
|
+
var DesignSystemVersionRoomUpdate = DesignSystemVersionRoomInitialState.extend({
|
|
2619
|
+
deletedPageIds: _zod.z.array(_zod.z.string()),
|
|
2620
|
+
deletedGroupIds: _zod.z.array(_zod.z.string())
|
|
2621
|
+
});
|
|
2608
2622
|
var DocumentationPageRoom = Entity.extend({
|
|
2609
2623
|
designSystemVersionId: _zod.z.string(),
|
|
2610
2624
|
documentationPageId: _zod.z.string(),
|
|
2611
2625
|
liveblocksId: _zod.z.string()
|
|
2612
2626
|
});
|
|
2627
|
+
var PageBlockEditorModel = _zod.z.object({
|
|
2628
|
+
id: _zod.z.string(),
|
|
2629
|
+
data: PageBlockDataV2
|
|
2630
|
+
});
|
|
2631
|
+
var DocumentationPageRoomRoomUpdate = _zod.z.object({
|
|
2632
|
+
page: DocumentationPageV2,
|
|
2633
|
+
pageParent: ElementGroup
|
|
2634
|
+
});
|
|
2635
|
+
var DocumentationPageRoomInitialState = DocumentationPageRoomRoomUpdate.extend({
|
|
2636
|
+
pageBlocks: _zod.z.array(PageBlockEditorModel),
|
|
2637
|
+
blockDefinitions: _zod.z.array(PageBlockDefinition)
|
|
2638
|
+
});
|
|
2613
2639
|
var RoomTypeEnum = /* @__PURE__ */ ((RoomTypeEnum2) => {
|
|
2614
2640
|
RoomTypeEnum2["DocumentationPage"] = "documentation-page";
|
|
2615
2641
|
RoomTypeEnum2["DesignSystemVersion"] = "design-system-version";
|
|
@@ -2653,6 +2679,86 @@ var PersonalAccessToken = _zod.z.object({
|
|
|
2653
2679
|
expireAt: _zod.z.date().optional(),
|
|
2654
2680
|
scope: _zod.z.string().optional()
|
|
2655
2681
|
});
|
|
2682
|
+
var SupernovaException = class _SupernovaException extends Error {
|
|
2683
|
+
//
|
|
2684
|
+
// Properties
|
|
2685
|
+
//
|
|
2686
|
+
constructor(type, message) {
|
|
2687
|
+
super(`${type}: ${message}`);
|
|
2688
|
+
this.type = type;
|
|
2689
|
+
}
|
|
2690
|
+
static wrongFormat(message) {
|
|
2691
|
+
return new _SupernovaException("WrongFormat", message);
|
|
2692
|
+
}
|
|
2693
|
+
static accessDenied(message) {
|
|
2694
|
+
return new _SupernovaException("AccessDenied", message);
|
|
2695
|
+
}
|
|
2696
|
+
static notFound(message) {
|
|
2697
|
+
return new _SupernovaException("ResourceNotFound", message);
|
|
2698
|
+
}
|
|
2699
|
+
static timeout(message) {
|
|
2700
|
+
return new _SupernovaException("Timeout", message);
|
|
2701
|
+
}
|
|
2702
|
+
static conflict(message) {
|
|
2703
|
+
return new _SupernovaException("Conflict", message);
|
|
2704
|
+
}
|
|
2705
|
+
static notImplemented(message) {
|
|
2706
|
+
return new _SupernovaException("NotImplemented", message);
|
|
2707
|
+
}
|
|
2708
|
+
static wrongActionOrder(message) {
|
|
2709
|
+
return new _SupernovaException("WrongActionOrder", message);
|
|
2710
|
+
}
|
|
2711
|
+
static invalidOperation(message) {
|
|
2712
|
+
return new _SupernovaException("InvalidOperation", message);
|
|
2713
|
+
}
|
|
2714
|
+
static shouldNotHappen(message) {
|
|
2715
|
+
return new _SupernovaException("UnexpectedError", message);
|
|
2716
|
+
}
|
|
2717
|
+
static ipRestricted(message) {
|
|
2718
|
+
return new _SupernovaException("IPRestricted", message);
|
|
2719
|
+
}
|
|
2720
|
+
static planRestricted(message) {
|
|
2721
|
+
return new _SupernovaException("PlanRestricted", message);
|
|
2722
|
+
}
|
|
2723
|
+
static missingWorkspacePermission(message) {
|
|
2724
|
+
return new _SupernovaException("MissingWorkspacePermission", message);
|
|
2725
|
+
}
|
|
2726
|
+
static missingExporterPermission(message) {
|
|
2727
|
+
return new _SupernovaException("MissingExporterPermission", message);
|
|
2728
|
+
}
|
|
2729
|
+
static missingIntegration(message) {
|
|
2730
|
+
return new _SupernovaException("AccessDenied", message);
|
|
2731
|
+
}
|
|
2732
|
+
static noAccess(message) {
|
|
2733
|
+
return new _SupernovaException("NoAccess", message);
|
|
2734
|
+
}
|
|
2735
|
+
//
|
|
2736
|
+
// To refactor
|
|
2737
|
+
//
|
|
2738
|
+
static badRequest(message) {
|
|
2739
|
+
return new _SupernovaException("BadRequest", message);
|
|
2740
|
+
}
|
|
2741
|
+
};
|
|
2742
|
+
function mapByUnique(items, keyFn) {
|
|
2743
|
+
const result = /* @__PURE__ */ new Map();
|
|
2744
|
+
for (const item of items) {
|
|
2745
|
+
result.set(keyFn(item), item);
|
|
2746
|
+
}
|
|
2747
|
+
return result;
|
|
2748
|
+
}
|
|
2749
|
+
function groupBy(items, keyFn) {
|
|
2750
|
+
const result = /* @__PURE__ */ new Map();
|
|
2751
|
+
for (const item of items) {
|
|
2752
|
+
const key = keyFn(item);
|
|
2753
|
+
const array = result.get(key);
|
|
2754
|
+
if (array) {
|
|
2755
|
+
array.push(item);
|
|
2756
|
+
} else {
|
|
2757
|
+
result.set(key, [item]);
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
return result;
|
|
2761
|
+
}
|
|
2656
2762
|
var ContentLoadInstruction = _zod.z.object({
|
|
2657
2763
|
from: _zod.z.string(),
|
|
2658
2764
|
to: _zod.z.string(),
|
|
@@ -2674,33 +2780,803 @@ var ContentLoaderPayload = _zod.z.object({
|
|
|
2674
2780
|
location: _zod.z.string()
|
|
2675
2781
|
})
|
|
2676
2782
|
);
|
|
2783
|
+
function slugify(str, options) {
|
|
2784
|
+
const slug = _slugify2.default.call(void 0, _nullishCoalesce(str, () => ( "")), options);
|
|
2785
|
+
return _optionalChain([slug, 'optionalAccess', _2 => _2.length]) > 0 ? slug : "item";
|
|
2786
|
+
}
|
|
2787
|
+
var RESERVED_SLUGS = [
|
|
2788
|
+
"workspaces",
|
|
2789
|
+
"workspace",
|
|
2790
|
+
"api0",
|
|
2791
|
+
"api1",
|
|
2792
|
+
"api2",
|
|
2793
|
+
"custom",
|
|
2794
|
+
"x-sn-reserved",
|
|
2795
|
+
// further elements copied from https://github.com/shouldbee/reserved-usernames/blob/master/reserved-usernames.json
|
|
2796
|
+
"0",
|
|
2797
|
+
"about",
|
|
2798
|
+
"access",
|
|
2799
|
+
"account",
|
|
2800
|
+
"accounts",
|
|
2801
|
+
"activate",
|
|
2802
|
+
"activities",
|
|
2803
|
+
"activity",
|
|
2804
|
+
"ad",
|
|
2805
|
+
"add",
|
|
2806
|
+
"address",
|
|
2807
|
+
"adm",
|
|
2808
|
+
"admin",
|
|
2809
|
+
"administration",
|
|
2810
|
+
"administrator",
|
|
2811
|
+
"ads",
|
|
2812
|
+
"adult",
|
|
2813
|
+
"advertising",
|
|
2814
|
+
"affiliate",
|
|
2815
|
+
"affiliates",
|
|
2816
|
+
"ajax",
|
|
2817
|
+
"all",
|
|
2818
|
+
"alpha",
|
|
2819
|
+
"analysis",
|
|
2820
|
+
"analytics",
|
|
2821
|
+
"android",
|
|
2822
|
+
"anon",
|
|
2823
|
+
"anonymous",
|
|
2824
|
+
"api",
|
|
2825
|
+
"app",
|
|
2826
|
+
"apps",
|
|
2827
|
+
"archive",
|
|
2828
|
+
"archives",
|
|
2829
|
+
"article",
|
|
2830
|
+
"asct",
|
|
2831
|
+
"asset",
|
|
2832
|
+
"assets",
|
|
2833
|
+
"atom",
|
|
2834
|
+
"auth",
|
|
2835
|
+
"authentication",
|
|
2836
|
+
"avatar",
|
|
2837
|
+
"backup",
|
|
2838
|
+
"balancer-manager",
|
|
2839
|
+
"banner",
|
|
2840
|
+
"banners",
|
|
2841
|
+
"beta",
|
|
2842
|
+
"billing",
|
|
2843
|
+
"bin",
|
|
2844
|
+
"blog",
|
|
2845
|
+
"blogs",
|
|
2846
|
+
"board",
|
|
2847
|
+
"book",
|
|
2848
|
+
"bookmark",
|
|
2849
|
+
"bot",
|
|
2850
|
+
"bots",
|
|
2851
|
+
"bug",
|
|
2852
|
+
"business",
|
|
2853
|
+
"cache",
|
|
2854
|
+
"cadastro",
|
|
2855
|
+
"calendar",
|
|
2856
|
+
"call",
|
|
2857
|
+
"campaign",
|
|
2858
|
+
"cancel",
|
|
2859
|
+
"captcha",
|
|
2860
|
+
"career",
|
|
2861
|
+
"careers",
|
|
2862
|
+
"cart",
|
|
2863
|
+
"categories",
|
|
2864
|
+
"category",
|
|
2865
|
+
"cgi",
|
|
2866
|
+
"cgi-bin",
|
|
2867
|
+
"changelog",
|
|
2868
|
+
"chat",
|
|
2869
|
+
"check",
|
|
2870
|
+
"checking",
|
|
2871
|
+
"checkout",
|
|
2872
|
+
"client",
|
|
2873
|
+
"cliente",
|
|
2874
|
+
"clients",
|
|
2875
|
+
"code",
|
|
2876
|
+
"codereview",
|
|
2877
|
+
"comercial",
|
|
2878
|
+
"comment",
|
|
2879
|
+
"comments",
|
|
2880
|
+
"communities",
|
|
2881
|
+
"community",
|
|
2882
|
+
"company",
|
|
2883
|
+
"compare",
|
|
2884
|
+
"compras",
|
|
2885
|
+
"config",
|
|
2886
|
+
"configuration",
|
|
2887
|
+
"connect",
|
|
2888
|
+
"contact",
|
|
2889
|
+
"contact-us",
|
|
2890
|
+
"contact_us",
|
|
2891
|
+
"contactus",
|
|
2892
|
+
"contest",
|
|
2893
|
+
"contribute",
|
|
2894
|
+
"corp",
|
|
2895
|
+
"create",
|
|
2896
|
+
"css",
|
|
2897
|
+
"dashboard",
|
|
2898
|
+
"data",
|
|
2899
|
+
"db",
|
|
2900
|
+
"default",
|
|
2901
|
+
"delete",
|
|
2902
|
+
"demo",
|
|
2903
|
+
"design",
|
|
2904
|
+
"designer",
|
|
2905
|
+
"destroy",
|
|
2906
|
+
"dev",
|
|
2907
|
+
"devel",
|
|
2908
|
+
"developer",
|
|
2909
|
+
"developers",
|
|
2910
|
+
"diagram",
|
|
2911
|
+
"diary",
|
|
2912
|
+
"dict",
|
|
2913
|
+
"dictionary",
|
|
2914
|
+
"die",
|
|
2915
|
+
"dir",
|
|
2916
|
+
"direct_messages",
|
|
2917
|
+
"directory",
|
|
2918
|
+
"dist",
|
|
2919
|
+
"doc",
|
|
2920
|
+
"docs",
|
|
2921
|
+
"documentation",
|
|
2922
|
+
"domain",
|
|
2923
|
+
"download",
|
|
2924
|
+
"downloads",
|
|
2925
|
+
"ecommerce",
|
|
2926
|
+
"edit",
|
|
2927
|
+
"editor",
|
|
2928
|
+
"edu",
|
|
2929
|
+
"education",
|
|
2930
|
+
"email",
|
|
2931
|
+
"employment",
|
|
2932
|
+
"empty",
|
|
2933
|
+
"end",
|
|
2934
|
+
"enterprise",
|
|
2935
|
+
"entries",
|
|
2936
|
+
"entry",
|
|
2937
|
+
"error",
|
|
2938
|
+
"errors",
|
|
2939
|
+
"eval",
|
|
2940
|
+
"event",
|
|
2941
|
+
"exit",
|
|
2942
|
+
"explore",
|
|
2943
|
+
"facebook",
|
|
2944
|
+
"faq",
|
|
2945
|
+
"favorite",
|
|
2946
|
+
"favorites",
|
|
2947
|
+
"feature",
|
|
2948
|
+
"features",
|
|
2949
|
+
"feed",
|
|
2950
|
+
"feedback",
|
|
2951
|
+
"feeds",
|
|
2952
|
+
"file",
|
|
2953
|
+
"files",
|
|
2954
|
+
"first",
|
|
2955
|
+
"flash",
|
|
2956
|
+
"fleet",
|
|
2957
|
+
"fleets",
|
|
2958
|
+
"flog",
|
|
2959
|
+
"follow",
|
|
2960
|
+
"followers",
|
|
2961
|
+
"following",
|
|
2962
|
+
"forgot",
|
|
2963
|
+
"form",
|
|
2964
|
+
"forum",
|
|
2965
|
+
"forums",
|
|
2966
|
+
"founder",
|
|
2967
|
+
"free",
|
|
2968
|
+
"friend",
|
|
2969
|
+
"friends",
|
|
2970
|
+
"ftp",
|
|
2971
|
+
"gadget",
|
|
2972
|
+
"gadgets",
|
|
2973
|
+
"game",
|
|
2974
|
+
"games",
|
|
2975
|
+
"get",
|
|
2976
|
+
"ghost",
|
|
2977
|
+
"gift",
|
|
2978
|
+
"gifts",
|
|
2979
|
+
"gist",
|
|
2980
|
+
"github",
|
|
2981
|
+
"graph",
|
|
2982
|
+
"group",
|
|
2983
|
+
"groups",
|
|
2984
|
+
"guest",
|
|
2985
|
+
"guests",
|
|
2986
|
+
"help",
|
|
2987
|
+
"home",
|
|
2988
|
+
"homepage",
|
|
2989
|
+
"host",
|
|
2990
|
+
"hosting",
|
|
2991
|
+
"hostmaster",
|
|
2992
|
+
"hostname",
|
|
2993
|
+
"howto",
|
|
2994
|
+
"hpg",
|
|
2995
|
+
"html",
|
|
2996
|
+
"http",
|
|
2997
|
+
"httpd",
|
|
2998
|
+
"https",
|
|
2999
|
+
"i",
|
|
3000
|
+
"iamges",
|
|
3001
|
+
"icon",
|
|
3002
|
+
"icons",
|
|
3003
|
+
"id",
|
|
3004
|
+
"idea",
|
|
3005
|
+
"ideas",
|
|
3006
|
+
"image",
|
|
3007
|
+
"images",
|
|
3008
|
+
"imap",
|
|
3009
|
+
"img",
|
|
3010
|
+
"index",
|
|
3011
|
+
"indice",
|
|
3012
|
+
"info",
|
|
3013
|
+
"information",
|
|
3014
|
+
"inquiry",
|
|
3015
|
+
"instagram",
|
|
3016
|
+
"intranet",
|
|
3017
|
+
"invitations",
|
|
3018
|
+
"invite",
|
|
3019
|
+
"ipad",
|
|
3020
|
+
"iphone",
|
|
3021
|
+
"irc",
|
|
3022
|
+
"is",
|
|
3023
|
+
"issue",
|
|
3024
|
+
"issues",
|
|
3025
|
+
"it",
|
|
3026
|
+
"item",
|
|
3027
|
+
"items",
|
|
3028
|
+
"java",
|
|
3029
|
+
"javascript",
|
|
3030
|
+
"job",
|
|
3031
|
+
"jobs",
|
|
3032
|
+
"join",
|
|
3033
|
+
"js",
|
|
3034
|
+
"json",
|
|
3035
|
+
"jump",
|
|
3036
|
+
"knowledgebase",
|
|
3037
|
+
"language",
|
|
3038
|
+
"languages",
|
|
3039
|
+
"last",
|
|
3040
|
+
"ldap-status",
|
|
3041
|
+
"legal",
|
|
3042
|
+
"license",
|
|
3043
|
+
"link",
|
|
3044
|
+
"links",
|
|
3045
|
+
"linux",
|
|
3046
|
+
"list",
|
|
3047
|
+
"lists",
|
|
3048
|
+
"log",
|
|
3049
|
+
"log-in",
|
|
3050
|
+
"log-out",
|
|
3051
|
+
"log_in",
|
|
3052
|
+
"log_out",
|
|
3053
|
+
"login",
|
|
3054
|
+
"logout",
|
|
3055
|
+
"logs",
|
|
3056
|
+
"m",
|
|
3057
|
+
"mac",
|
|
3058
|
+
"mail",
|
|
3059
|
+
"mail1",
|
|
3060
|
+
"mail2",
|
|
3061
|
+
"mail3",
|
|
3062
|
+
"mail4",
|
|
3063
|
+
"mail5",
|
|
3064
|
+
"mailer",
|
|
3065
|
+
"mailing",
|
|
3066
|
+
"maintenance",
|
|
3067
|
+
"manager",
|
|
3068
|
+
"manual",
|
|
3069
|
+
"map",
|
|
3070
|
+
"maps",
|
|
3071
|
+
"marketing",
|
|
3072
|
+
"master",
|
|
3073
|
+
"me",
|
|
3074
|
+
"media",
|
|
3075
|
+
"member",
|
|
3076
|
+
"members",
|
|
3077
|
+
"message",
|
|
3078
|
+
"messages",
|
|
3079
|
+
"messenger",
|
|
3080
|
+
"microblog",
|
|
3081
|
+
"microblogs",
|
|
3082
|
+
"mine",
|
|
3083
|
+
"mis",
|
|
3084
|
+
"mob",
|
|
3085
|
+
"mobile",
|
|
3086
|
+
"movie",
|
|
3087
|
+
"movies",
|
|
3088
|
+
"mp3",
|
|
3089
|
+
"msg",
|
|
3090
|
+
"msn",
|
|
3091
|
+
"music",
|
|
3092
|
+
"musicas",
|
|
3093
|
+
"mx",
|
|
3094
|
+
"my",
|
|
3095
|
+
"mysql",
|
|
3096
|
+
"name",
|
|
3097
|
+
"named",
|
|
3098
|
+
"nan",
|
|
3099
|
+
"navi",
|
|
3100
|
+
"navigation",
|
|
3101
|
+
"net",
|
|
3102
|
+
"network",
|
|
3103
|
+
"new",
|
|
3104
|
+
"news",
|
|
3105
|
+
"newsletter",
|
|
3106
|
+
"nick",
|
|
3107
|
+
"nickname",
|
|
3108
|
+
"notes",
|
|
3109
|
+
"noticias",
|
|
3110
|
+
"notification",
|
|
3111
|
+
"notifications",
|
|
3112
|
+
"notify",
|
|
3113
|
+
"ns",
|
|
3114
|
+
"ns1",
|
|
3115
|
+
"ns10",
|
|
3116
|
+
"ns2",
|
|
3117
|
+
"ns3",
|
|
3118
|
+
"ns4",
|
|
3119
|
+
"ns5",
|
|
3120
|
+
"ns6",
|
|
3121
|
+
"ns7",
|
|
3122
|
+
"ns8",
|
|
3123
|
+
"ns9",
|
|
3124
|
+
"null",
|
|
3125
|
+
"oauth",
|
|
3126
|
+
"oauth_clients",
|
|
3127
|
+
"offer",
|
|
3128
|
+
"offers",
|
|
3129
|
+
"official",
|
|
3130
|
+
"old",
|
|
3131
|
+
"online",
|
|
3132
|
+
"openid",
|
|
3133
|
+
"operator",
|
|
3134
|
+
"order",
|
|
3135
|
+
"orders",
|
|
3136
|
+
"organization",
|
|
3137
|
+
"organizations",
|
|
3138
|
+
"overview",
|
|
3139
|
+
"owner",
|
|
3140
|
+
"owners",
|
|
3141
|
+
"page",
|
|
3142
|
+
"pager",
|
|
3143
|
+
"pages",
|
|
3144
|
+
"panel",
|
|
3145
|
+
"password",
|
|
3146
|
+
"payment",
|
|
3147
|
+
"perl",
|
|
3148
|
+
"phone",
|
|
3149
|
+
"photo",
|
|
3150
|
+
"photoalbum",
|
|
3151
|
+
"photos",
|
|
3152
|
+
"php",
|
|
3153
|
+
"phpmyadmin",
|
|
3154
|
+
"phppgadmin",
|
|
3155
|
+
"phpredisadmin",
|
|
3156
|
+
"pic",
|
|
3157
|
+
"pics",
|
|
3158
|
+
"ping",
|
|
3159
|
+
"plan",
|
|
3160
|
+
"plans",
|
|
3161
|
+
"plugin",
|
|
3162
|
+
"plugins",
|
|
3163
|
+
"policy",
|
|
3164
|
+
"pop",
|
|
3165
|
+
"pop3",
|
|
3166
|
+
"popular",
|
|
3167
|
+
"portal",
|
|
3168
|
+
"post",
|
|
3169
|
+
"postfix",
|
|
3170
|
+
"postmaster",
|
|
3171
|
+
"posts",
|
|
3172
|
+
"pr",
|
|
3173
|
+
"premium",
|
|
3174
|
+
"press",
|
|
3175
|
+
"price",
|
|
3176
|
+
"pricing",
|
|
3177
|
+
"privacy",
|
|
3178
|
+
"privacy-policy",
|
|
3179
|
+
"privacy_policy",
|
|
3180
|
+
"privacypolicy",
|
|
3181
|
+
"private",
|
|
3182
|
+
"product",
|
|
3183
|
+
"products",
|
|
3184
|
+
"profile",
|
|
3185
|
+
"project",
|
|
3186
|
+
"projects",
|
|
3187
|
+
"promo",
|
|
3188
|
+
"pub",
|
|
3189
|
+
"public",
|
|
3190
|
+
"purpose",
|
|
3191
|
+
"put",
|
|
3192
|
+
"python",
|
|
3193
|
+
"query",
|
|
3194
|
+
"random",
|
|
3195
|
+
"ranking",
|
|
3196
|
+
"read",
|
|
3197
|
+
"readme",
|
|
3198
|
+
"recent",
|
|
3199
|
+
"recruit",
|
|
3200
|
+
"recruitment",
|
|
3201
|
+
"register",
|
|
3202
|
+
"registration",
|
|
3203
|
+
"release",
|
|
3204
|
+
"remove",
|
|
3205
|
+
"replies",
|
|
3206
|
+
"report",
|
|
3207
|
+
"reports",
|
|
3208
|
+
"repositories",
|
|
3209
|
+
"repository",
|
|
3210
|
+
"req",
|
|
3211
|
+
"request",
|
|
3212
|
+
"requests",
|
|
3213
|
+
"reset",
|
|
3214
|
+
"roc",
|
|
3215
|
+
"root",
|
|
3216
|
+
"rss",
|
|
3217
|
+
"ruby",
|
|
3218
|
+
"rule",
|
|
3219
|
+
"sag",
|
|
3220
|
+
"sale",
|
|
3221
|
+
"sales",
|
|
3222
|
+
"sample",
|
|
3223
|
+
"samples",
|
|
3224
|
+
"save",
|
|
3225
|
+
"school",
|
|
3226
|
+
"script",
|
|
3227
|
+
"scripts",
|
|
3228
|
+
"search",
|
|
3229
|
+
"secure",
|
|
3230
|
+
"security",
|
|
3231
|
+
"self",
|
|
3232
|
+
"send",
|
|
3233
|
+
"server",
|
|
3234
|
+
"server-info",
|
|
3235
|
+
"server-status",
|
|
3236
|
+
"service",
|
|
3237
|
+
"services",
|
|
3238
|
+
"session",
|
|
3239
|
+
"sessions",
|
|
3240
|
+
"setting",
|
|
3241
|
+
"settings",
|
|
3242
|
+
"setup",
|
|
3243
|
+
"share",
|
|
3244
|
+
"shop",
|
|
3245
|
+
"show",
|
|
3246
|
+
"sign-in",
|
|
3247
|
+
"sign-up",
|
|
3248
|
+
"sign_in",
|
|
3249
|
+
"sign_up",
|
|
3250
|
+
"signin",
|
|
3251
|
+
"signout",
|
|
3252
|
+
"signup",
|
|
3253
|
+
"site",
|
|
3254
|
+
"sitemap",
|
|
3255
|
+
"sites",
|
|
3256
|
+
"smartphone",
|
|
3257
|
+
"smtp",
|
|
3258
|
+
"soporte",
|
|
3259
|
+
"source",
|
|
3260
|
+
"spec",
|
|
3261
|
+
"special",
|
|
3262
|
+
"sql",
|
|
3263
|
+
"src",
|
|
3264
|
+
"ssh",
|
|
3265
|
+
"ssl",
|
|
3266
|
+
"ssladmin",
|
|
3267
|
+
"ssladministrator",
|
|
3268
|
+
"sslwebmaster",
|
|
3269
|
+
"staff",
|
|
3270
|
+
"stage",
|
|
3271
|
+
"staging",
|
|
3272
|
+
"start",
|
|
3273
|
+
"stat",
|
|
3274
|
+
"state",
|
|
3275
|
+
"static",
|
|
3276
|
+
"stats",
|
|
3277
|
+
"status",
|
|
3278
|
+
"store",
|
|
3279
|
+
"stores",
|
|
3280
|
+
"stories",
|
|
3281
|
+
"style",
|
|
3282
|
+
"styleguide",
|
|
3283
|
+
"stylesheet",
|
|
3284
|
+
"stylesheets",
|
|
3285
|
+
"subdomain",
|
|
3286
|
+
"subscribe",
|
|
3287
|
+
"subscriptions",
|
|
3288
|
+
"suporte",
|
|
3289
|
+
"support",
|
|
3290
|
+
"svn",
|
|
3291
|
+
"swf",
|
|
3292
|
+
"sys",
|
|
3293
|
+
"sysadmin",
|
|
3294
|
+
"sysadministrator",
|
|
3295
|
+
"system",
|
|
3296
|
+
"tablet",
|
|
3297
|
+
"tablets",
|
|
3298
|
+
"tag",
|
|
3299
|
+
"talk",
|
|
3300
|
+
"task",
|
|
3301
|
+
"tasks",
|
|
3302
|
+
"team",
|
|
3303
|
+
"teams",
|
|
3304
|
+
"tech",
|
|
3305
|
+
"telnet",
|
|
3306
|
+
"term",
|
|
3307
|
+
"terms",
|
|
3308
|
+
"terms-of-service",
|
|
3309
|
+
"terms_of_service",
|
|
3310
|
+
"termsofservice",
|
|
3311
|
+
"test",
|
|
3312
|
+
"test1",
|
|
3313
|
+
"test2",
|
|
3314
|
+
"test3",
|
|
3315
|
+
"teste",
|
|
3316
|
+
"testing",
|
|
3317
|
+
"tests",
|
|
3318
|
+
"theme",
|
|
3319
|
+
"themes",
|
|
3320
|
+
"thread",
|
|
3321
|
+
"threads",
|
|
3322
|
+
"tmp",
|
|
3323
|
+
"todo",
|
|
3324
|
+
"tool",
|
|
3325
|
+
"tools",
|
|
3326
|
+
"top",
|
|
3327
|
+
"topic",
|
|
3328
|
+
"topics",
|
|
3329
|
+
"tos",
|
|
3330
|
+
"tour",
|
|
3331
|
+
"translations",
|
|
3332
|
+
"trends",
|
|
3333
|
+
"tutorial",
|
|
3334
|
+
"tux",
|
|
3335
|
+
"tv",
|
|
3336
|
+
"twitter",
|
|
3337
|
+
"undef",
|
|
3338
|
+
"unfollow",
|
|
3339
|
+
"unsubscribe",
|
|
3340
|
+
"update",
|
|
3341
|
+
"upload",
|
|
3342
|
+
"uploads",
|
|
3343
|
+
"url",
|
|
3344
|
+
"usage",
|
|
3345
|
+
"user",
|
|
3346
|
+
"username",
|
|
3347
|
+
"users",
|
|
3348
|
+
"usuario",
|
|
3349
|
+
"vendas",
|
|
3350
|
+
"ver",
|
|
3351
|
+
"version",
|
|
3352
|
+
"video",
|
|
3353
|
+
"videos",
|
|
3354
|
+
"visitor",
|
|
3355
|
+
"watch",
|
|
3356
|
+
"weather",
|
|
3357
|
+
"web",
|
|
3358
|
+
"webhook",
|
|
3359
|
+
"webhooks",
|
|
3360
|
+
"webmail",
|
|
3361
|
+
"webmaster",
|
|
3362
|
+
"website",
|
|
3363
|
+
"websites",
|
|
3364
|
+
"welcome",
|
|
3365
|
+
"widget",
|
|
3366
|
+
"widgets",
|
|
3367
|
+
"wiki",
|
|
3368
|
+
"win",
|
|
3369
|
+
"windows",
|
|
3370
|
+
"word",
|
|
3371
|
+
"work",
|
|
3372
|
+
"works",
|
|
3373
|
+
"workshop",
|
|
3374
|
+
"ww",
|
|
3375
|
+
"wws",
|
|
3376
|
+
"www",
|
|
3377
|
+
"www1",
|
|
3378
|
+
"www2",
|
|
3379
|
+
"www3",
|
|
3380
|
+
"www4",
|
|
3381
|
+
"www5",
|
|
3382
|
+
"www6",
|
|
3383
|
+
"www7",
|
|
3384
|
+
"wwws",
|
|
3385
|
+
"wwww",
|
|
3386
|
+
"xfn",
|
|
3387
|
+
"xml",
|
|
3388
|
+
"xmpp",
|
|
3389
|
+
"xpg",
|
|
3390
|
+
"xxx",
|
|
3391
|
+
"yaml",
|
|
3392
|
+
"year",
|
|
3393
|
+
"yml",
|
|
3394
|
+
"you",
|
|
3395
|
+
"yourdomain",
|
|
3396
|
+
"yourname",
|
|
3397
|
+
"yoursite",
|
|
3398
|
+
"yourusername",
|
|
3399
|
+
"latest",
|
|
3400
|
+
"live",
|
|
3401
|
+
"preview",
|
|
3402
|
+
"learn",
|
|
3403
|
+
"supernova",
|
|
3404
|
+
"super-nova"
|
|
3405
|
+
];
|
|
3406
|
+
var RESERVED_SLUGS_SET = new Set(RESERVED_SLUGS);
|
|
3407
|
+
|
|
3408
|
+
// src/api/conversion/documentation/documentation-page-to-dto-utils.ts
|
|
3409
|
+
function buildDocPagePublishPaths(groups, pages) {
|
|
3410
|
+
const groupPersistentIdToGroupMap = mapByUnique(groups, (group) => group.persistentId);
|
|
3411
|
+
const result = /* @__PURE__ */ new Map();
|
|
3412
|
+
for (const page of pages) {
|
|
3413
|
+
const parentChain = calculateElementParentChain(page.parentPersistentId, groupPersistentIdToGroupMap);
|
|
3414
|
+
let pathV1 = `${page.userSlug || page.slug}.html`;
|
|
3415
|
+
let pathV2 = `${slugify(page.meta.name)}-${page.shortPersistentId}`;
|
|
3416
|
+
for (const parent of parentChain) {
|
|
3417
|
+
if (!parent.parentPersistentId)
|
|
3418
|
+
continue;
|
|
3419
|
+
pathV1 = `${parent.userSlug || parent.slug}/${pathV1}`;
|
|
3420
|
+
pathV2 = `${slugify(parent.meta.name)}/${pathV2}`;
|
|
3421
|
+
}
|
|
3422
|
+
pathV1 = `/${pathV1}`;
|
|
3423
|
+
pathV2 = `/${pathV2}`;
|
|
3424
|
+
result.set(page.persistentId, pathV2);
|
|
3425
|
+
}
|
|
3426
|
+
return result;
|
|
3427
|
+
}
|
|
3428
|
+
function calculateElementParentChain(elementParentPersistentId, groupPersistentIdToGroupMap) {
|
|
3429
|
+
const result = [];
|
|
3430
|
+
let parentId = elementParentPersistentId;
|
|
3431
|
+
while (parentId) {
|
|
3432
|
+
const parent = groupPersistentIdToGroupMap.get(parentId);
|
|
3433
|
+
if (parent)
|
|
3434
|
+
result.push(parent);
|
|
3435
|
+
parentId = _optionalChain([parent, 'optionalAccess', _3 => _3.parentPersistentId]);
|
|
3436
|
+
}
|
|
3437
|
+
return result;
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3440
|
+
// src/api/conversion/documentation/documentation-page-v2-to-dto.ts
|
|
3441
|
+
function documentationPagesToStructureDTOV2(pages, groups) {
|
|
3442
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
3443
|
+
return pages.map((page) => documentationPageToStructureDTOV2(page, pathsMap));
|
|
3444
|
+
}
|
|
3445
|
+
function documentationPagesToDTOV2(pages, groups) {
|
|
3446
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
3447
|
+
return pages.map((page) => {
|
|
3448
|
+
return {
|
|
3449
|
+
...documentationPageToStructureDTOV2(page, pathsMap),
|
|
3450
|
+
configuration: _nullishCoalesce(page.data.configuration, () => ( {
|
|
3451
|
+
showSidebar: true,
|
|
3452
|
+
header: defaultDocumentationItemHeader
|
|
3453
|
+
}))
|
|
3454
|
+
};
|
|
3455
|
+
});
|
|
3456
|
+
}
|
|
3457
|
+
function documentationPageToStructureDTOV2(page, pagePathMap) {
|
|
3458
|
+
let path = pagePathMap.get(page.persistentId);
|
|
3459
|
+
if (!path)
|
|
3460
|
+
throw new Error(`Path for page ${page.id} was not calculated`);
|
|
3461
|
+
if (path.startsWith("/"))
|
|
3462
|
+
path = path.substring(1);
|
|
3463
|
+
return {
|
|
3464
|
+
id: page.id,
|
|
3465
|
+
designSystemVersionId: page.designSystemVersionId,
|
|
3466
|
+
persistentId: page.persistentId,
|
|
3467
|
+
shortPersistentId: page.shortPersistentId,
|
|
3468
|
+
title: page.meta.name,
|
|
3469
|
+
slug: page.slug,
|
|
3470
|
+
userSlug: page.userSlug,
|
|
3471
|
+
createdAt: page.createdAt,
|
|
3472
|
+
updatedAt: page.updatedAt,
|
|
3473
|
+
path
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
2677
3476
|
|
|
2678
|
-
// src/api/
|
|
2679
|
-
|
|
3477
|
+
// src/api/conversion/documentation/documentation-group-to-dto.ts
|
|
3478
|
+
function elementGroupsToDocumentationGroupStructureDTO(groups, pages) {
|
|
3479
|
+
const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
|
|
3480
|
+
return groups.map((group) => elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap));
|
|
3481
|
+
}
|
|
3482
|
+
function elementGroupsToDocumentationGroupDTO(groups, pages) {
|
|
3483
|
+
const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
|
|
3484
|
+
return groups.map((group) => {
|
|
3485
|
+
return {
|
|
3486
|
+
...elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap),
|
|
3487
|
+
configuration: _nullishCoalesce(_optionalChain([group, 'access', _4 => _4.data, 'optionalAccess', _5 => _5.configuration]), () => ( {
|
|
3488
|
+
showSidebar: true,
|
|
3489
|
+
header: defaultDocumentationItemHeader
|
|
3490
|
+
}))
|
|
3491
|
+
};
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
function elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap) {
|
|
3495
|
+
const childrenIds = _nullishCoalesce(childrenIdsMap.get(group.persistentId), () => ( []));
|
|
3496
|
+
if (!group.shortPersistentId) {
|
|
3497
|
+
throw new Error(`Short persistent id is required for docs groups, group id: ${group.id}`);
|
|
3498
|
+
}
|
|
3499
|
+
return {
|
|
3500
|
+
id: group.id,
|
|
3501
|
+
designSystemVersionId: group.designSystemVersionId,
|
|
3502
|
+
persistentId: group.persistentId,
|
|
3503
|
+
slug: group.slug,
|
|
3504
|
+
userSlug: group.userSlug,
|
|
3505
|
+
createdAt: group.createdAt,
|
|
3506
|
+
updatedAt: group.updatedAt,
|
|
3507
|
+
title: group.meta.name,
|
|
3508
|
+
childrenIds,
|
|
3509
|
+
isRoot: !group.parentPersistentId,
|
|
3510
|
+
groupBehavior: _nullishCoalesce(_optionalChain([group, 'access', _6 => _6.data, 'optionalAccess', _7 => _7.behavior]), () => ( "Group")),
|
|
3511
|
+
shortPersistentId: group.shortPersistentId
|
|
3512
|
+
};
|
|
3513
|
+
}
|
|
3514
|
+
function calculateChildrenIdsMap(elements, groups) {
|
|
3515
|
+
const byParentId = groupBy([...elements, ...groups], (e) => e.parentPersistentId);
|
|
3516
|
+
const childrenIdsMap = /* @__PURE__ */ new Map();
|
|
3517
|
+
for (const [parentPersistentId, children] of byParentId) {
|
|
3518
|
+
if (!parentPersistentId)
|
|
3519
|
+
continue;
|
|
3520
|
+
children.sort((lhs, rhs) => lhs.sortOrder - rhs.sortOrder);
|
|
3521
|
+
childrenIdsMap.set(
|
|
3522
|
+
parentPersistentId,
|
|
3523
|
+
children.map((c) => c.persistentId)
|
|
3524
|
+
);
|
|
3525
|
+
}
|
|
3526
|
+
return childrenIdsMap;
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
// src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts
|
|
3530
|
+
function documentationElementsToHierarchyDto(docPages, docGroups) {
|
|
3531
|
+
return {
|
|
3532
|
+
pages: documentationPagesToStructureDTOV2(docPages, docGroups),
|
|
3533
|
+
groups: elementGroupsToDocumentationGroupStructureDTO(docGroups, docPages)
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
// src/api/conversion/documentation/documentation-page-v1-to-dto.ts
|
|
3538
|
+
function documentationPagesToDTOV1(pages, groups) {
|
|
3539
|
+
const pathsMap = buildDocPagePublishPaths(groups, pages);
|
|
3540
|
+
return pages.map((page) => {
|
|
3541
|
+
let path = pathsMap.get(page.persistentId);
|
|
3542
|
+
if (!path)
|
|
3543
|
+
throw SupernovaException.conflict(`Path for page ${page.id} was not calculated`);
|
|
3544
|
+
if (path.startsWith("/"))
|
|
3545
|
+
path = path.substring(1);
|
|
3546
|
+
return {
|
|
3547
|
+
id: page.id,
|
|
3548
|
+
designSystemVersionId: page.designSystemVersionId,
|
|
3549
|
+
persistentId: page.persistentId,
|
|
3550
|
+
shortPersistentId: page.shortPersistentId,
|
|
3551
|
+
title: page.meta.name,
|
|
3552
|
+
blocks: page.data.blocks,
|
|
3553
|
+
slug: page.slug,
|
|
3554
|
+
userSlug: page.userSlug,
|
|
3555
|
+
configuration: _nullishCoalesce(page.data.configuration, () => ( {
|
|
3556
|
+
showSidebar: true,
|
|
3557
|
+
header: defaultDocumentationItemHeader
|
|
3558
|
+
})),
|
|
3559
|
+
createdAt: page.createdAt,
|
|
3560
|
+
updatedAt: page.updatedAt,
|
|
3561
|
+
path
|
|
3562
|
+
};
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
// src/api/dto/design-systems/design-system.ts
|
|
3567
|
+
var DTODesignSystem = DesignSystem.omit({
|
|
2680
3568
|
name: true,
|
|
2681
3569
|
description: true
|
|
2682
3570
|
}).extend({
|
|
2683
3571
|
meta: ObjectMeta
|
|
2684
3572
|
});
|
|
2685
3573
|
|
|
2686
|
-
// src/api/dto/documentation-
|
|
2687
|
-
|
|
2688
|
-
var DocumentationPageV1DTO = DocumentationPageV1.omit({
|
|
2689
|
-
data: true,
|
|
2690
|
-
meta: true,
|
|
2691
|
-
parentPersistentId: true,
|
|
2692
|
-
sortOrder: true
|
|
2693
|
-
}).extend(DocumentationPageV1.shape.data.shape).extend({
|
|
2694
|
-
title: _zod.z.string(),
|
|
2695
|
-
path: _zod.z.string()
|
|
2696
|
-
});
|
|
2697
|
-
|
|
2698
|
-
// src/api/dto/documentation-v2.ts
|
|
3574
|
+
// src/api/dto/elements/documentation/group-action.ts
|
|
2699
3575
|
|
|
2700
3576
|
|
|
2701
|
-
// src/api/dto/documentation.ts
|
|
3577
|
+
// src/api/dto/elements/documentation/group.ts
|
|
2702
3578
|
|
|
2703
|
-
var
|
|
3579
|
+
var DTODocumentationGroupStructure = ElementGroup.omit({
|
|
2704
3580
|
sortOrder: true,
|
|
2705
3581
|
parentPersistentId: true,
|
|
2706
3582
|
brandPersistentId: true,
|
|
@@ -2715,11 +3591,99 @@ var DocumentationGroupStructureDTO = ElementGroup.omit({
|
|
|
2715
3591
|
groupBehavior: DocumentationGroupBehavior,
|
|
2716
3592
|
shortPersistentId: _zod.z.string()
|
|
2717
3593
|
});
|
|
2718
|
-
var
|
|
3594
|
+
var DTODocumentationGroup = DTODocumentationGroupStructure.extend({
|
|
2719
3595
|
configuration: DocumentationItemConfiguration
|
|
2720
3596
|
});
|
|
3597
|
+
var DTOCreateDocumentationGroupInput = _zod.z.object({
|
|
3598
|
+
// Identifier
|
|
3599
|
+
persistentId: _zod.z.string().uuid(),
|
|
3600
|
+
// Group properties
|
|
3601
|
+
title: _zod.z.string(),
|
|
3602
|
+
configuration: DocumentationItemConfiguration.optional(),
|
|
3603
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
3604
|
+
// Group placement properties
|
|
3605
|
+
afterPersistentId: _zod.z.string().uuid().optional(),
|
|
3606
|
+
parentPersistentId: _zod.z.string().uuid()
|
|
3607
|
+
});
|
|
3608
|
+
var DTOUpdateDocumentationGroupInput = _zod.z.object({
|
|
3609
|
+
// Identifier of the group to update
|
|
3610
|
+
id: _zod.z.string().uuid(),
|
|
3611
|
+
// Group properties
|
|
3612
|
+
title: _zod.z.string().optional(),
|
|
3613
|
+
configuration: DocumentationItemConfiguration.optional(),
|
|
3614
|
+
// Group placement properties
|
|
3615
|
+
afterPersistentId: _zod.z.string().uuid().optional(),
|
|
3616
|
+
parentPersistentId: _zod.z.string().uuid().optional()
|
|
3617
|
+
});
|
|
3618
|
+
var DTODuplicateDocumentationGroupInput = _zod.z.object({
|
|
3619
|
+
// Identifier of the group to duplicate from
|
|
3620
|
+
id: _zod.z.string(),
|
|
3621
|
+
// New group persistent id
|
|
3622
|
+
persistentId: _zod.z.string().uuid(),
|
|
3623
|
+
// Group placement properties
|
|
3624
|
+
afterPersistentId: _zod.z.string().uuid().optional(),
|
|
3625
|
+
parentPersistentId: _zod.z.string().uuid()
|
|
3626
|
+
});
|
|
3627
|
+
var DTOCreateDocumentationTabGroupInput = _zod.z.object({
|
|
3628
|
+
// New group persistent id
|
|
3629
|
+
persistentId: _zod.z.string().uuid(),
|
|
3630
|
+
// Page that will become first tab of the tab group
|
|
3631
|
+
fromPageId: _zod.z.string(),
|
|
3632
|
+
tabName: _zod.z.string()
|
|
3633
|
+
});
|
|
3634
|
+
var DTODeleteDocumentationTabGroupInput = _zod.z.object({
|
|
3635
|
+
// Deleted group id
|
|
3636
|
+
id: _zod.z.string()
|
|
3637
|
+
});
|
|
3638
|
+
var DTODeleteDocumentationGroupInput = _zod.z.object({
|
|
3639
|
+
// Identifier
|
|
3640
|
+
id: _zod.z.string(),
|
|
3641
|
+
// Deletion options
|
|
3642
|
+
deleteSubtree: _zod.z.boolean().default(false)
|
|
3643
|
+
});
|
|
3644
|
+
|
|
3645
|
+
// src/api/dto/elements/documentation/group-action.ts
|
|
3646
|
+
var SuccessPayload = _zod.z.object({
|
|
3647
|
+
success: _zod.z.literal(true)
|
|
3648
|
+
});
|
|
3649
|
+
var DTODocumentationGroupCreateActionOutputV2 = _zod.z.object({
|
|
3650
|
+
type: _zod.z.literal("DocumentationGroupCreate"),
|
|
3651
|
+
output: SuccessPayload
|
|
3652
|
+
});
|
|
3653
|
+
var DTODocumentationGroupUpdateActionOutputV2 = _zod.z.object({
|
|
3654
|
+
type: _zod.z.literal("DocumentationGroupUpdate"),
|
|
3655
|
+
output: SuccessPayload
|
|
3656
|
+
});
|
|
3657
|
+
var DTODocumentationGroupDuplicateActionOutputV2 = _zod.z.object({
|
|
3658
|
+
type: _zod.z.literal("DocumentationGroupDuplicate"),
|
|
3659
|
+
output: SuccessPayload
|
|
3660
|
+
});
|
|
3661
|
+
var DTODocumentationGroupDeleteActionOutputV2 = _zod.z.object({
|
|
3662
|
+
type: _zod.z.literal("DocumentationGroupDelete"),
|
|
3663
|
+
output: SuccessPayload
|
|
3664
|
+
});
|
|
3665
|
+
var DTODocumentationGroupCreateActionInputV2 = _zod.z.object({
|
|
3666
|
+
type: _zod.z.literal("DocumentationGroupCreate"),
|
|
3667
|
+
input: DTOCreateDocumentationGroupInput
|
|
3668
|
+
});
|
|
3669
|
+
var DTODocumentationGroupUpdateActionInputV2 = _zod.z.object({
|
|
3670
|
+
type: _zod.z.literal("DocumentationGroupUpdate"),
|
|
3671
|
+
input: DTOUpdateDocumentationGroupInput
|
|
3672
|
+
});
|
|
3673
|
+
var DTODocumentationGroupDuplicateActionInputV2 = _zod.z.object({
|
|
3674
|
+
type: _zod.z.literal("DocumentationGroupDuplicate"),
|
|
3675
|
+
input: DTODuplicateDocumentationGroupInput
|
|
3676
|
+
});
|
|
3677
|
+
var DTODocumentationGroupDeleteActionInputV2 = _zod.z.object({
|
|
3678
|
+
type: _zod.z.literal("DocumentationGroupDelete"),
|
|
3679
|
+
input: DTODeleteDocumentationGroupInput
|
|
3680
|
+
});
|
|
3681
|
+
|
|
3682
|
+
// src/api/dto/elements/documentation/page-actions-v2.ts
|
|
3683
|
+
|
|
3684
|
+
|
|
3685
|
+
// src/api/dto/elements/documentation/page-v2.ts
|
|
2721
3686
|
|
|
2722
|
-
// src/api/dto/documentation-v2.ts
|
|
2723
3687
|
var DTODocumentationPageStructureV2 = DocumentationPageV2.omit({
|
|
2724
3688
|
data: true,
|
|
2725
3689
|
meta: true,
|
|
@@ -2729,72 +3693,159 @@ var DTODocumentationPageStructureV2 = DocumentationPageV2.omit({
|
|
|
2729
3693
|
title: _zod.z.string(),
|
|
2730
3694
|
path: _zod.z.string()
|
|
2731
3695
|
});
|
|
2732
|
-
var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend(
|
|
3696
|
+
var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend({
|
|
3697
|
+
configuration: DocumentationItemConfiguration
|
|
3698
|
+
});
|
|
2733
3699
|
var DTODocumentationHierarchyV2 = _zod.z.object({
|
|
2734
3700
|
pages: _zod.z.array(DTODocumentationPageStructureV2),
|
|
2735
|
-
groups: _zod.z.array(
|
|
3701
|
+
groups: _zod.z.array(DTODocumentationGroupStructure)
|
|
2736
3702
|
});
|
|
2737
|
-
|
|
2738
|
-
//
|
|
2739
|
-
|
|
2740
|
-
var DTOCreateDocumentationPageInput = _zod.z.object({
|
|
2741
|
-
parentPersistentId: _zod.z.string().uuid(),
|
|
3703
|
+
var DTOCreateDocumentationPageInputV2 = _zod.z.object({
|
|
3704
|
+
// Identifier
|
|
2742
3705
|
persistentId: _zod.z.string().uuid(),
|
|
3706
|
+
// Page properties
|
|
2743
3707
|
title: _zod.z.string(),
|
|
2744
3708
|
configuration: DocumentationItemConfiguration.optional(),
|
|
3709
|
+
// Page placement properties
|
|
3710
|
+
parentPersistentId: _zod.z.string().uuid(),
|
|
2745
3711
|
afterPersistentId: _zod.z.string().uuid().optional()
|
|
2746
3712
|
});
|
|
2747
|
-
var
|
|
3713
|
+
var DTOUpdateDocumentationPageInputV2 = _zod.z.object({
|
|
3714
|
+
// Identifier of the group to update
|
|
2748
3715
|
id: _zod.z.string(),
|
|
3716
|
+
// Page properties
|
|
2749
3717
|
title: _zod.z.string().optional(),
|
|
2750
3718
|
configuration: DocumentationItemConfiguration.optional(),
|
|
3719
|
+
// Page placement properties
|
|
2751
3720
|
parentPersistentId: _zod.z.string().optional(),
|
|
2752
3721
|
afterPersistentId: _zod.z.string().optional()
|
|
2753
3722
|
});
|
|
2754
|
-
var
|
|
3723
|
+
var DTODuplicateDocumentationPageInputV2 = _zod.z.object({
|
|
3724
|
+
// Identifier of the page to duplicate from
|
|
2755
3725
|
id: _zod.z.string(),
|
|
3726
|
+
// New page persistent id
|
|
2756
3727
|
persistentId: _zod.z.string().uuid(),
|
|
3728
|
+
// Page placement properties
|
|
2757
3729
|
parentPersistentId: _zod.z.string().uuid(),
|
|
2758
3730
|
afterPersistentId: _zod.z.string().uuid().optional()
|
|
2759
3731
|
});
|
|
2760
|
-
var
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
3732
|
+
var DTODeleteDocumentationPageInputV2 = _zod.z.object({
|
|
3733
|
+
// Identifier
|
|
3734
|
+
id: _zod.z.string()
|
|
3735
|
+
});
|
|
3736
|
+
|
|
3737
|
+
// src/api/dto/elements/documentation/page-actions-v2.ts
|
|
3738
|
+
var SuccessPayload2 = _zod.z.object({
|
|
3739
|
+
success: _zod.z.literal(true)
|
|
3740
|
+
});
|
|
3741
|
+
var DTODocumentationPageCreateActionOutputV2 = _zod.z.object({
|
|
3742
|
+
type: _zod.z.literal("DocumentationPageCreate"),
|
|
3743
|
+
output: SuccessPayload2
|
|
3744
|
+
});
|
|
3745
|
+
var DTODocumentationPageUpdateActionOutputV2 = _zod.z.object({
|
|
3746
|
+
type: _zod.z.literal("DocumentationPageUpdate"),
|
|
3747
|
+
output: SuccessPayload2
|
|
3748
|
+
});
|
|
3749
|
+
var DTODocumentationPageDuplicateActionOutputV2 = _zod.z.object({
|
|
3750
|
+
type: _zod.z.literal("DocumentationPageDuplicate"),
|
|
3751
|
+
output: SuccessPayload2
|
|
3752
|
+
});
|
|
3753
|
+
var DTODocumentationPageDeleteActionOutputV2 = _zod.z.object({
|
|
3754
|
+
type: _zod.z.literal("DocumentationPageDelete"),
|
|
3755
|
+
output: SuccessPayload2
|
|
2765
3756
|
});
|
|
2766
|
-
var
|
|
2767
|
-
|
|
3757
|
+
var DTODocumentationPageCreateActionInputV2 = _zod.z.object({
|
|
3758
|
+
type: _zod.z.literal("DocumentationPageCreate"),
|
|
3759
|
+
input: DTOCreateDocumentationPageInputV2
|
|
3760
|
+
});
|
|
3761
|
+
var DTODocumentationPageUpdateActionInputV2 = _zod.z.object({
|
|
3762
|
+
type: _zod.z.literal("DocumentationPageUpdate"),
|
|
3763
|
+
input: DTOUpdateDocumentationPageInputV2
|
|
3764
|
+
});
|
|
3765
|
+
var DTODocumentationPageDuplicateActionInputV2 = _zod.z.object({
|
|
3766
|
+
type: _zod.z.literal("DocumentationPageDuplicate"),
|
|
3767
|
+
input: DTODuplicateDocumentationPageInputV2
|
|
3768
|
+
});
|
|
3769
|
+
var DTODocumentationPageDeleteActionInputV2 = _zod.z.object({
|
|
3770
|
+
type: _zod.z.literal("DocumentationPageDelete"),
|
|
3771
|
+
input: DTODeleteDocumentationPageInputV2
|
|
2768
3772
|
});
|
|
2769
3773
|
|
|
2770
|
-
// src/api/
|
|
3774
|
+
// src/api/dto/elements/documentation/page-v1.ts
|
|
2771
3775
|
|
|
2772
|
-
var
|
|
2773
|
-
|
|
3776
|
+
var DocumentationPageV1DTO = DocumentationPageV1.omit({
|
|
3777
|
+
data: true,
|
|
3778
|
+
meta: true,
|
|
3779
|
+
parentPersistentId: true,
|
|
3780
|
+
sortOrder: true
|
|
3781
|
+
}).extend(DocumentationPageV1.shape.data.shape).extend({
|
|
3782
|
+
title: _zod.z.string(),
|
|
3783
|
+
path: _zod.z.string()
|
|
2774
3784
|
});
|
|
2775
3785
|
|
|
2776
|
-
// src/api/
|
|
3786
|
+
// src/api/dto/elements/elements-action-v2.ts
|
|
2777
3787
|
|
|
2778
|
-
var
|
|
3788
|
+
var DTOElementActionOutput = _zod.z.discriminatedUnion("type", [
|
|
3789
|
+
// Documentation pages
|
|
3790
|
+
DTODocumentationPageCreateActionOutputV2,
|
|
3791
|
+
DTODocumentationPageUpdateActionOutputV2,
|
|
3792
|
+
DTODocumentationPageDuplicateActionOutputV2,
|
|
3793
|
+
DTODocumentationPageDeleteActionOutputV2,
|
|
3794
|
+
// Documentation groups
|
|
3795
|
+
DTODocumentationGroupCreateActionOutputV2,
|
|
3796
|
+
DTODocumentationGroupUpdateActionOutputV2,
|
|
3797
|
+
DTODocumentationGroupDuplicateActionOutputV2,
|
|
3798
|
+
DTODocumentationGroupDeleteActionOutputV2
|
|
3799
|
+
]);
|
|
3800
|
+
var DTOElementActionInput = _zod.z.discriminatedUnion("type", [
|
|
3801
|
+
// Documentation pages
|
|
3802
|
+
DTODocumentationPageCreateActionInputV2,
|
|
3803
|
+
DTODocumentationPageUpdateActionInputV2,
|
|
3804
|
+
DTODocumentationPageDuplicateActionInputV2,
|
|
3805
|
+
DTODocumentationPageDeleteActionInputV2,
|
|
3806
|
+
// Documentation groups
|
|
3807
|
+
DTODocumentationGroupCreateActionInputV2,
|
|
3808
|
+
DTODocumentationGroupUpdateActionInputV2,
|
|
3809
|
+
DTODocumentationGroupDuplicateActionInputV2,
|
|
3810
|
+
DTODocumentationGroupDeleteActionInputV2
|
|
3811
|
+
]);
|
|
3812
|
+
|
|
3813
|
+
// src/api/payloads/documentation/block-definitions.ts
|
|
3814
|
+
|
|
3815
|
+
var DTOGetBlockDefinitionsOutput = _zod.z.object({
|
|
2779
3816
|
definitions: _zod.z.array(PageBlockDefinition)
|
|
2780
3817
|
});
|
|
2781
3818
|
|
|
2782
|
-
// src/
|
|
2783
|
-
|
|
3819
|
+
// src/api/payloads/liveblocks/auth.ts
|
|
3820
|
+
|
|
3821
|
+
var DTOLiveblocksAuthRequest = _zod.z.object({
|
|
3822
|
+
room: _zod.z.string()
|
|
3823
|
+
});
|
|
3824
|
+
|
|
3825
|
+
// src/yjs/design-system-content/documentation-hierarchy.ts
|
|
3826
|
+
function documentationHierarchyToYjs(doc, transaction) {
|
|
2784
3827
|
doc.transact((trx) => {
|
|
2785
3828
|
const pagesMap = getPagesYMap(trx.doc);
|
|
2786
|
-
|
|
2787
|
-
pagesMap.delete(
|
|
3829
|
+
transaction.pageIdsToDelete.forEach((pageId) => {
|
|
3830
|
+
pagesMap.delete(pageId);
|
|
2788
3831
|
});
|
|
2789
|
-
|
|
2790
|
-
|
|
3832
|
+
transaction.pages.forEach((page) => {
|
|
3833
|
+
const sanitizedPage = {
|
|
3834
|
+
...page,
|
|
3835
|
+
data: {}
|
|
3836
|
+
};
|
|
3837
|
+
pagesMap.set(page.id, sanitizedPage);
|
|
2791
3838
|
});
|
|
2792
3839
|
const groupsMap = getGroupsYMap(trx.doc);
|
|
2793
|
-
|
|
2794
|
-
groupsMap.delete(
|
|
3840
|
+
transaction.groupIdsToDelete.forEach((id) => {
|
|
3841
|
+
groupsMap.delete(id);
|
|
2795
3842
|
});
|
|
2796
|
-
|
|
2797
|
-
|
|
3843
|
+
transaction.groups.forEach((group) => {
|
|
3844
|
+
const sanitizedGroup = {
|
|
3845
|
+
...group,
|
|
3846
|
+
data: {}
|
|
3847
|
+
};
|
|
3848
|
+
groupsMap.set(group.id, group);
|
|
2798
3849
|
});
|
|
2799
3850
|
});
|
|
2800
3851
|
return doc;
|
|
@@ -2804,16 +3855,14 @@ function yjsToDocumentationHierarchy(doc) {
|
|
|
2804
3855
|
const groupsMap = getGroupsYMap(doc);
|
|
2805
3856
|
const pages = [];
|
|
2806
3857
|
pagesMap.forEach((page) => {
|
|
2807
|
-
pages.push(
|
|
3858
|
+
pages.push(DocumentationPageV2.parse(page));
|
|
2808
3859
|
});
|
|
2809
3860
|
const groups = [];
|
|
2810
3861
|
groupsMap.forEach((group) => {
|
|
2811
|
-
groups.push(
|
|
3862
|
+
groups.push(ElementGroup.parse(group));
|
|
2812
3863
|
});
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
groups
|
|
2816
|
-
};
|
|
3864
|
+
const hierarchy = documentationElementsToHierarchyDto(pages, groups);
|
|
3865
|
+
return hierarchy;
|
|
2817
3866
|
}
|
|
2818
3867
|
function getPagesYMap(doc) {
|
|
2819
3868
|
return doc.getMap("documentationPages");
|
|
@@ -2822,10 +3871,24 @@ function getGroupsYMap(doc) {
|
|
|
2822
3871
|
return doc.getMap("documentationGroups");
|
|
2823
3872
|
}
|
|
2824
3873
|
|
|
2825
|
-
// src/design-system-content/item-configuration.ts
|
|
3874
|
+
// src/yjs/design-system-content/item-configuration.ts
|
|
3875
|
+
|
|
3876
|
+
var DTODocumentationPageRoomHeaderData = _zod.z.object({
|
|
3877
|
+
title: _zod.z.string(),
|
|
3878
|
+
configuration: DocumentationItemConfiguration
|
|
3879
|
+
});
|
|
3880
|
+
var DTODocumentationPageRoomHeaderDataUpdate = _zod.z.object({
|
|
3881
|
+
title: _zod.z.string().optional(),
|
|
3882
|
+
configuration: DocumentationItemConfiguration.omit({ header: true }).extend({ header: DocumentationItemHeader.partial() }).optional()
|
|
3883
|
+
});
|
|
2826
3884
|
function itemConfigurationToYjs(yDoc, item) {
|
|
2827
3885
|
yDoc.transact((trx) => {
|
|
2828
|
-
const
|
|
3886
|
+
const { title, configuration } = item;
|
|
3887
|
+
const header = _optionalChain([configuration, 'optionalAccess', _8 => _8.header]);
|
|
3888
|
+
if (title !== void 0) {
|
|
3889
|
+
const headerYMap = trx.doc.getMap("itemTitle");
|
|
3890
|
+
headerYMap.set("title", title);
|
|
3891
|
+
}
|
|
2829
3892
|
if (header) {
|
|
2830
3893
|
const headerYMap = trx.doc.getMap("itemHeader");
|
|
2831
3894
|
header.description !== void 0 && headerYMap.set("description", header.description);
|
|
@@ -2838,13 +3901,14 @@ function itemConfigurationToYjs(yDoc, item) {
|
|
|
2838
3901
|
header.showCoverText !== void 0 && headerYMap.set("showCoverText", header.showCoverText);
|
|
2839
3902
|
header.minHeight !== void 0 && headerYMap.set("minHeight", header.minHeight);
|
|
2840
3903
|
}
|
|
2841
|
-
if (
|
|
3904
|
+
if (_optionalChain([configuration, 'optionalAccess', _9 => _9.showSidebar]) !== void 0) {
|
|
2842
3905
|
const configYMap = trx.doc.getMap("itemConfiguration");
|
|
2843
|
-
configYMap.set("showSidebar",
|
|
3906
|
+
configYMap.set("showSidebar", configuration.showSidebar);
|
|
2844
3907
|
}
|
|
2845
3908
|
});
|
|
2846
3909
|
}
|
|
2847
3910
|
function yjsToItemConfiguration(yDoc) {
|
|
3911
|
+
const title = yDoc.getMap("itemTitle").get("title");
|
|
2848
3912
|
const headerYMap = yDoc.getMap("itemHeader");
|
|
2849
3913
|
const rawHeader = {
|
|
2850
3914
|
description: headerYMap.get("description"),
|
|
@@ -2862,23 +3926,22 @@ function yjsToItemConfiguration(yDoc) {
|
|
|
2862
3926
|
showSidebar: configYMap.get("showSidebar"),
|
|
2863
3927
|
header: rawHeader
|
|
2864
3928
|
};
|
|
2865
|
-
return
|
|
3929
|
+
return {
|
|
3930
|
+
title: _zod.z.string().parse(title),
|
|
3931
|
+
configuration: DocumentationItemConfiguration.parse(rawConfig)
|
|
3932
|
+
};
|
|
2866
3933
|
}
|
|
2867
3934
|
|
|
2868
|
-
// src/docs-editor/model/block.ts
|
|
3935
|
+
// src/yjs/docs-editor/model/block.ts
|
|
3936
|
+
var PageBlockEditorModel2 = PageBlockEditorModel;
|
|
2869
3937
|
|
|
2870
|
-
|
|
2871
|
-
id: _zod.z.string(),
|
|
2872
|
-
data: PageBlockDataV2
|
|
2873
|
-
});
|
|
2874
|
-
|
|
2875
|
-
// src/docs-editor/model/page.ts
|
|
3938
|
+
// src/yjs/docs-editor/model/page.ts
|
|
2876
3939
|
|
|
2877
3940
|
var DocumentationPageEditorModel = _zod.z.object({
|
|
2878
|
-
blocks: _zod.z.array(
|
|
3941
|
+
blocks: _zod.z.array(PageBlockEditorModel2)
|
|
2879
3942
|
});
|
|
2880
3943
|
|
|
2881
|
-
// src/docs-editor/prosemirror/schema.ts
|
|
3944
|
+
// src/yjs/docs-editor/prosemirror/schema.ts
|
|
2882
3945
|
var _prosemirrormodel = require('prosemirror-model');
|
|
2883
3946
|
var newSchema = {
|
|
2884
3947
|
nodes: {
|
|
@@ -3554,7 +4617,7 @@ var newSchema = {
|
|
|
3554
4617
|
};
|
|
3555
4618
|
var pmSchema = new (0, _prosemirrormodel.Schema)(newSchema);
|
|
3556
4619
|
|
|
3557
|
-
// src/docs-editor/utils.ts
|
|
4620
|
+
// src/yjs/docs-editor/utils.ts
|
|
3558
4621
|
var BlockParsingUtils = {
|
|
3559
4622
|
singleBlockItem(block) {
|
|
3560
4623
|
if (!block.data.items.length)
|
|
@@ -3639,7 +4702,7 @@ var BlockDefinitionUtils = {
|
|
|
3639
4702
|
}
|
|
3640
4703
|
};
|
|
3641
4704
|
|
|
3642
|
-
// src/docs-editor/blocks-to-prosemirror.ts
|
|
4705
|
+
// src/yjs/docs-editor/blocks-to-prosemirror.ts
|
|
3643
4706
|
var _yprosemirror = require('y-prosemirror');
|
|
3644
4707
|
function pageToYXmlFragment(page, definitions, fragment) {
|
|
3645
4708
|
const doc = pageToProsemirrorDoc(page, definitions);
|
|
@@ -3700,7 +4763,7 @@ function serializeAsRichTextBlock(input) {
|
|
|
3700
4763
|
const textPropertyValue = BlockParsingUtils.richTextPropertyValue(blockItem, richTextProperty.id);
|
|
3701
4764
|
const enrichedInput = { ...input, richTextPropertyValue: textPropertyValue };
|
|
3702
4765
|
const parsedOptions = PageBlockDefinitionRichTextOptions.optional().parse(richTextProperty.options);
|
|
3703
|
-
const style = _nullishCoalesce(_optionalChain([parsedOptions, 'optionalAccess',
|
|
4766
|
+
const style = _nullishCoalesce(_optionalChain([parsedOptions, 'optionalAccess', _10 => _10.richTextStyle]), () => ( "Default"));
|
|
3704
4767
|
switch (style) {
|
|
3705
4768
|
case "Callout":
|
|
3706
4769
|
return serializeAsCallout(enrichedInput);
|
|
@@ -3757,7 +4820,7 @@ function serializeAsMultiRichTextBlock(input) {
|
|
|
3757
4820
|
const textPropertyValue = BlockParsingUtils.multiRichTextPropertyValue(blockItem, multiRichTextProperty.id);
|
|
3758
4821
|
const enrichedInput = { ...input, multiRichTextPropertyValue: textPropertyValue };
|
|
3759
4822
|
const parsedOptions = PageBlockDefinitionMutiRichTextOptions.optional().parse(multiRichTextProperty.options);
|
|
3760
|
-
const style = _nullishCoalesce(_optionalChain([parsedOptions, 'optionalAccess',
|
|
4823
|
+
const style = _nullishCoalesce(_optionalChain([parsedOptions, 'optionalAccess', _11 => _11.multiRichTextStyle]), () => ( "Default"));
|
|
3761
4824
|
switch (style) {
|
|
3762
4825
|
case "Default":
|
|
3763
4826
|
return serializeAsMultiParagraph(enrichedInput);
|
|
@@ -3879,7 +4942,7 @@ function serializeTableNode(node) {
|
|
|
3879
4942
|
return {
|
|
3880
4943
|
type: "image",
|
|
3881
4944
|
attrs: {
|
|
3882
|
-
src: _optionalChain([node, 'access',
|
|
4945
|
+
src: _optionalChain([node, 'access', _12 => _12.value, 'optionalAccess', _13 => _13.url])
|
|
3883
4946
|
}
|
|
3884
4947
|
};
|
|
3885
4948
|
}
|
|
@@ -3899,7 +4962,7 @@ function serializeBlockNodeAttributes(input) {
|
|
|
3899
4962
|
};
|
|
3900
4963
|
}
|
|
3901
4964
|
function richTextHeadingLevel(property) {
|
|
3902
|
-
const style = _optionalChain([property, 'access',
|
|
4965
|
+
const style = _optionalChain([property, 'access', _14 => _14.options, 'optionalAccess', _15 => _15.richTextStyle]);
|
|
3903
4966
|
if (!style)
|
|
3904
4967
|
return void 0;
|
|
3905
4968
|
switch (style) {
|
|
@@ -3997,7 +5060,7 @@ function serializeAsCustomBlock(block, definition) {
|
|
|
3997
5060
|
linksTo: i.linksTo
|
|
3998
5061
|
};
|
|
3999
5062
|
});
|
|
4000
|
-
const columns = _optionalChain([block, 'access',
|
|
5063
|
+
const columns = _optionalChain([block, 'access', _16 => _16.data, 'access', _17 => _17.appearance, 'optionalAccess', _18 => _18.numberOfColumns]);
|
|
4001
5064
|
return {
|
|
4002
5065
|
type: "blockNode",
|
|
4003
5066
|
attrs: {
|
|
@@ -4013,7 +5076,7 @@ function nonNullFilter(item) {
|
|
|
4013
5076
|
return !!item;
|
|
4014
5077
|
}
|
|
4015
5078
|
|
|
4016
|
-
// src/docs-editor/mock.ts
|
|
5079
|
+
// src/yjs/docs-editor/mock.ts
|
|
4017
5080
|
function getMockPageBlockDefinitions() {
|
|
4018
5081
|
return blocks;
|
|
4019
5082
|
}
|
|
@@ -6506,7 +7569,7 @@ var blocks = [
|
|
|
6506
7569
|
}
|
|
6507
7570
|
];
|
|
6508
7571
|
|
|
6509
|
-
// src/docs-editor/prosemirror-to-blocks.ts
|
|
7572
|
+
// src/yjs/docs-editor/prosemirror-to-blocks.ts
|
|
6510
7573
|
|
|
6511
7574
|
|
|
6512
7575
|
function yDocToPage(yDoc, definitions) {
|
|
@@ -6517,7 +7580,7 @@ function yXmlFragmentToPage(fragment, definitions) {
|
|
|
6517
7580
|
return prosemirrorDocToPage(prosemirrorJson, definitions);
|
|
6518
7581
|
}
|
|
6519
7582
|
function prosemirrorDocToPage(prosemirrorDoc, definitions) {
|
|
6520
|
-
const definitionsById =
|
|
7583
|
+
const definitionsById = mapByUnique2(definitions, (d) => d.id);
|
|
6521
7584
|
return {
|
|
6522
7585
|
blocks: (_nullishCoalesce(prosemirrorDoc.content, () => ( []))).map((prosemirrorNode) => {
|
|
6523
7586
|
const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", _zod.z.string());
|
|
@@ -6623,7 +7686,7 @@ function parseAsMultiRichText(prosemirrorNode, definition, property) {
|
|
|
6623
7686
|
value: (_nullishCoalesce(prosemirrorNode.content, () => ( []))).map((listItem) => {
|
|
6624
7687
|
if (listItem.type !== "listItem")
|
|
6625
7688
|
return null;
|
|
6626
|
-
if (!_optionalChain([listItem, 'access',
|
|
7689
|
+
if (!_optionalChain([listItem, 'access', _19 => _19.content, 'optionalAccess', _20 => _20.length]))
|
|
6627
7690
|
return parseRichText([]);
|
|
6628
7691
|
const paragraph = listItem.content[0];
|
|
6629
7692
|
if (paragraph.type !== "paragraph")
|
|
@@ -6666,7 +7729,7 @@ function parseRichTextAttribute(mark) {
|
|
|
6666
7729
|
const href = getProsemirrorAttribute(mark, "href", _zod.z.string().optional());
|
|
6667
7730
|
return {
|
|
6668
7731
|
type: "Link",
|
|
6669
|
-
openInNewWindow: _optionalChain([mark, 'access',
|
|
7732
|
+
openInNewWindow: _optionalChain([mark, 'access', _21 => _21.attrs, 'optionalAccess', _22 => _22.target]) !== "_self",
|
|
6670
7733
|
documentationItemId: itemId,
|
|
6671
7734
|
link: href
|
|
6672
7735
|
};
|
|
@@ -6679,17 +7742,17 @@ function parseAsTable(prosemirrorNode, definition, property) {
|
|
|
6679
7742
|
return null;
|
|
6680
7743
|
const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
|
|
6681
7744
|
const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", _zod.z.boolean().optional()) !== false;
|
|
6682
|
-
const tableChild = _optionalChain([prosemirrorNode, 'access',
|
|
7745
|
+
const tableChild = _optionalChain([prosemirrorNode, 'access', _23 => _23.content, 'optionalAccess', _24 => _24.find, 'call', _25 => _25((c) => c.type === "table")]);
|
|
6683
7746
|
if (!tableChild) {
|
|
6684
7747
|
return emptyTable(id, variantId, 0);
|
|
6685
7748
|
}
|
|
6686
|
-
const rows = _nullishCoalesce(_optionalChain([tableChild, 'access',
|
|
7749
|
+
const rows = _nullishCoalesce(_optionalChain([tableChild, 'access', _26 => _26.content, 'optionalAccess', _27 => _27.filter, 'call', _28 => _28((c) => c.type === "tableRow" && !!_optionalChain([c, 'access', _29 => _29.content, 'optionalAccess', _30 => _30.length]))]), () => ( []));
|
|
6687
7750
|
if (!rows.length) {
|
|
6688
7751
|
return emptyTable(id, variantId, 0);
|
|
6689
7752
|
}
|
|
6690
|
-
const rowHeaderCells = _nullishCoalesce(_optionalChain([rows, 'access',
|
|
6691
|
-
const columnHeaderCells = rows.filter((r) => _optionalChain([r, 'access',
|
|
6692
|
-
const hasHeaderRow = _optionalChain([rows, 'access',
|
|
7753
|
+
const rowHeaderCells = _nullishCoalesce(_optionalChain([rows, 'access', _31 => _31[0], 'access', _32 => _32.content, 'optionalAccess', _33 => _33.filter, 'call', _34 => _34((c) => c.type === "tableHeader"), 'access', _35 => _35.length]), () => ( 0));
|
|
7754
|
+
const columnHeaderCells = rows.filter((r) => _optionalChain([r, 'access', _36 => _36.content, 'optionalAccess', _37 => _37[0], 'optionalAccess', _38 => _38.type]) === "tableHeader").length;
|
|
7755
|
+
const hasHeaderRow = _optionalChain([rows, 'access', _39 => _39[0], 'access', _40 => _40.content, 'optionalAccess', _41 => _41.length]) === rowHeaderCells;
|
|
6693
7756
|
const hasHeaderColumn = rows.length === columnHeaderCells;
|
|
6694
7757
|
const tableValue = {
|
|
6695
7758
|
showBorder: hasBorder,
|
|
@@ -6970,7 +8033,7 @@ function getProsemirrorBlockVariantId(prosemirrorNode) {
|
|
|
6970
8033
|
return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(_zod.z.string()));
|
|
6971
8034
|
}
|
|
6972
8035
|
function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchema) {
|
|
6973
|
-
const parsedAttr = validationSchema.safeParse(_optionalChain([prosemirrorNode, 'access',
|
|
8036
|
+
const parsedAttr = validationSchema.safeParse(_optionalChain([prosemirrorNode, 'access', _42 => _42.attrs, 'optionalAccess', _43 => _43[attributeName]]));
|
|
6974
8037
|
if (parsedAttr.success) {
|
|
6975
8038
|
return parsedAttr.data;
|
|
6976
8039
|
} else {
|
|
@@ -6982,7 +8045,7 @@ function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchem
|
|
|
6982
8045
|
function nonNullFilter2(item) {
|
|
6983
8046
|
return item !== null;
|
|
6984
8047
|
}
|
|
6985
|
-
function
|
|
8048
|
+
function mapByUnique2(items, keyFn) {
|
|
6986
8049
|
const result = /* @__PURE__ */ new Map();
|
|
6987
8050
|
for (const item of items) {
|
|
6988
8051
|
result.set(keyFn(item), item);
|
|
@@ -7023,5 +8086,38 @@ function mapByUnique(items, keyFn) {
|
|
|
7023
8086
|
|
|
7024
8087
|
|
|
7025
8088
|
|
|
7026
|
-
|
|
8089
|
+
|
|
8090
|
+
|
|
8091
|
+
|
|
8092
|
+
|
|
8093
|
+
|
|
8094
|
+
|
|
8095
|
+
|
|
8096
|
+
|
|
8097
|
+
|
|
8098
|
+
|
|
8099
|
+
|
|
8100
|
+
|
|
8101
|
+
|
|
8102
|
+
|
|
8103
|
+
|
|
8104
|
+
|
|
8105
|
+
|
|
8106
|
+
|
|
8107
|
+
|
|
8108
|
+
|
|
8109
|
+
|
|
8110
|
+
|
|
8111
|
+
|
|
8112
|
+
|
|
8113
|
+
|
|
8114
|
+
|
|
8115
|
+
|
|
8116
|
+
|
|
8117
|
+
|
|
8118
|
+
|
|
8119
|
+
|
|
8120
|
+
|
|
8121
|
+
|
|
8122
|
+
exports.BlockDefinitionUtils = BlockDefinitionUtils; exports.BlockParsingUtils = BlockParsingUtils; exports.DTOCreateDocumentationGroupInput = DTOCreateDocumentationGroupInput; exports.DTOCreateDocumentationPageInputV2 = DTOCreateDocumentationPageInputV2; exports.DTOCreateDocumentationTabGroupInput = DTOCreateDocumentationTabGroupInput; exports.DTODeleteDocumentationGroupInput = DTODeleteDocumentationGroupInput; exports.DTODeleteDocumentationPageInputV2 = DTODeleteDocumentationPageInputV2; exports.DTODeleteDocumentationTabGroupInput = DTODeleteDocumentationTabGroupInput; exports.DTODesignSystem = DTODesignSystem; exports.DTODocumentationGroup = DTODocumentationGroup; exports.DTODocumentationGroupCreateActionInputV2 = DTODocumentationGroupCreateActionInputV2; exports.DTODocumentationGroupCreateActionOutputV2 = DTODocumentationGroupCreateActionOutputV2; exports.DTODocumentationGroupDeleteActionInputV2 = DTODocumentationGroupDeleteActionInputV2; exports.DTODocumentationGroupDeleteActionOutputV2 = DTODocumentationGroupDeleteActionOutputV2; exports.DTODocumentationGroupDuplicateActionInputV2 = DTODocumentationGroupDuplicateActionInputV2; exports.DTODocumentationGroupDuplicateActionOutputV2 = DTODocumentationGroupDuplicateActionOutputV2; exports.DTODocumentationGroupStructure = DTODocumentationGroupStructure; exports.DTODocumentationGroupUpdateActionInputV2 = DTODocumentationGroupUpdateActionInputV2; exports.DTODocumentationGroupUpdateActionOutputV2 = DTODocumentationGroupUpdateActionOutputV2; exports.DTODocumentationHierarchyV2 = DTODocumentationHierarchyV2; exports.DTODocumentationPageCreateActionInputV2 = DTODocumentationPageCreateActionInputV2; exports.DTODocumentationPageCreateActionOutputV2 = DTODocumentationPageCreateActionOutputV2; exports.DTODocumentationPageDeleteActionInputV2 = DTODocumentationPageDeleteActionInputV2; exports.DTODocumentationPageDeleteActionOutputV2 = DTODocumentationPageDeleteActionOutputV2; exports.DTODocumentationPageDuplicateActionInputV2 = DTODocumentationPageDuplicateActionInputV2; exports.DTODocumentationPageDuplicateActionOutputV2 = DTODocumentationPageDuplicateActionOutputV2; exports.DTODocumentationPageRoomHeaderData = DTODocumentationPageRoomHeaderData; exports.DTODocumentationPageRoomHeaderDataUpdate = DTODocumentationPageRoomHeaderDataUpdate; exports.DTODocumentationPageStructureV2 = DTODocumentationPageStructureV2; exports.DTODocumentationPageUpdateActionInputV2 = DTODocumentationPageUpdateActionInputV2; exports.DTODocumentationPageUpdateActionOutputV2 = DTODocumentationPageUpdateActionOutputV2; exports.DTODocumentationPageV2 = DTODocumentationPageV2; exports.DTODuplicateDocumentationGroupInput = DTODuplicateDocumentationGroupInput; exports.DTODuplicateDocumentationPageInputV2 = DTODuplicateDocumentationPageInputV2; exports.DTOElementActionInput = DTOElementActionInput; exports.DTOElementActionOutput = DTOElementActionOutput; exports.DTOGetBlockDefinitionsOutput = DTOGetBlockDefinitionsOutput; exports.DTOLiveblocksAuthRequest = DTOLiveblocksAuthRequest; exports.DTOUpdateDocumentationGroupInput = DTOUpdateDocumentationGroupInput; exports.DTOUpdateDocumentationPageInputV2 = DTOUpdateDocumentationPageInputV2; exports.DocumentationPageEditorModel = DocumentationPageEditorModel; exports.DocumentationPageV1DTO = DocumentationPageV1DTO; exports.PageBlockEditorModel = PageBlockEditorModel2; exports.blockDefinitionForBlock = blockDefinitionForBlock; exports.blockToProsemirrorNode = blockToProsemirrorNode; exports.buildDocPagePublishPaths = buildDocPagePublishPaths; exports.calculateElementParentChain = calculateElementParentChain; exports.documentationElementsToHierarchyDto = documentationElementsToHierarchyDto; exports.documentationHierarchyToYjs = documentationHierarchyToYjs; exports.documentationPagesToDTOV1 = documentationPagesToDTOV1; exports.documentationPagesToDTOV2 = documentationPagesToDTOV2; exports.documentationPagesToStructureDTOV2 = documentationPagesToStructureDTOV2; exports.elementGroupsToDocumentationGroupDTO = elementGroupsToDocumentationGroupDTO; exports.elementGroupsToDocumentationGroupStructureDTO = elementGroupsToDocumentationGroupStructureDTO; exports.getMockPageBlockDefinitions = getMockPageBlockDefinitions; exports.itemConfigurationToYjs = itemConfigurationToYjs; exports.pageToProsemirrorDoc = pageToProsemirrorDoc; exports.pageToYXmlFragment = pageToYXmlFragment; exports.pmSchema = pmSchema; exports.prosemirrorDocToPage = prosemirrorDocToPage; exports.prosemirrorNodeToBlock = prosemirrorNodeToBlock; exports.serializeAsCustomBlock = serializeAsCustomBlock; exports.yDocToPage = yDocToPage; exports.yXmlFragmentToPage = yXmlFragmentToPage; exports.yjsToDocumentationHierarchy = yjsToDocumentationHierarchy; exports.yjsToItemConfiguration = yjsToItemConfiguration;
|
|
7027
8123
|
//# sourceMappingURL=index.js.map
|