@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.
Files changed (61) hide show
  1. package/dist/index.d.mts +14007 -6383
  2. package/dist/index.d.ts +14007 -6383
  3. package/dist/index.js +1188 -92
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1219 -123
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts +20 -0
  9. package/src/api/conversion/documentation/documentation-group-to-dto.ts +83 -0
  10. package/src/api/conversion/documentation/documentation-page-to-dto-utils.ts +54 -0
  11. package/src/api/conversion/documentation/documentation-page-v1-to-dto.ts +43 -0
  12. package/src/api/conversion/documentation/documentation-page-v2-to-dto.ts +57 -0
  13. package/src/api/conversion/documentation/index.ts +5 -0
  14. package/src/api/conversion/index.ts +1 -0
  15. package/src/api/dto/{design-system.ts → design-systems/design-system.ts} +6 -2
  16. package/src/api/dto/design-systems/index.ts +1 -0
  17. package/src/api/dto/documentation/index.ts +0 -0
  18. package/src/api/dto/elements/documentation/group-action.ts +70 -0
  19. package/src/api/dto/elements/documentation/group.ts +105 -0
  20. package/src/api/dto/elements/documentation/index.ts +5 -0
  21. package/src/api/dto/elements/documentation/page-actions-v2.ts +70 -0
  22. package/src/api/dto/{documentation-v1.ts → elements/documentation/page-v1.ts} +4 -0
  23. package/src/api/dto/elements/documentation/page-v2.ts +87 -0
  24. package/src/api/dto/elements/elements-action-v2.ts +61 -0
  25. package/src/api/dto/elements/index.ts +2 -0
  26. package/src/api/dto/index.ts +2 -3
  27. package/src/api/index.ts +2 -2
  28. package/src/api/payloads/documentation/block-definitions.ts +12 -0
  29. package/src/api/payloads/documentation/index.ts +1 -0
  30. package/src/api/payloads/index.ts +2 -0
  31. package/src/api/payloads/liveblocks/auth.ts +7 -0
  32. package/src/api/payloads/liveblocks/index.ts +1 -0
  33. package/src/index.ts +1 -2
  34. package/src/yjs/design-system-content/documentation-hierarchy.ts +100 -0
  35. package/src/{design-system-content → yjs/design-system-content}/item-configuration.ts +41 -10
  36. package/src/yjs/design-system-content/item-title.ts +0 -0
  37. package/src/yjs/docs-editor/model/block.ts +5 -0
  38. package/src/yjs/index.ts +2 -0
  39. package/src/api/dto/documentation-v2.ts +0 -28
  40. package/src/api/dto/documentation.ts +0 -29
  41. package/src/api/requests/elements/elements-transaction-v2.ts +0 -53
  42. package/src/api/requests/elements/index.ts +0 -1
  43. package/src/api/requests/index.ts +0 -2
  44. package/src/api/requests/post-liveblocks-auth.ts +0 -4
  45. package/src/api/responses/elements/elements-transaction-v2.ts +0 -11
  46. package/src/api/responses/elements/index.ts +0 -1
  47. package/src/api/responses/get-block-definitions.ts +0 -8
  48. package/src/api/responses/index.ts +0 -2
  49. package/src/design-system-content/documentation-hierarchy.ts +0 -74
  50. package/src/docs-editor/model/block.ts +0 -9
  51. /package/src/{design-system-content → yjs/design-system-content}/index.ts +0 -0
  52. /package/src/{docs-editor → yjs/docs-editor}/blocks-to-prosemirror.ts +0 -0
  53. /package/src/{docs-editor → yjs/docs-editor}/index.ts +0 -0
  54. /package/src/{docs-editor → yjs/docs-editor}/mock.ts +0 -0
  55. /package/src/{docs-editor → yjs/docs-editor}/model/index.ts +0 -0
  56. /package/src/{docs-editor → yjs/docs-editor}/model/page.ts +0 -0
  57. /package/src/{docs-editor → yjs/docs-editor}/prosemirror/index.ts +0 -0
  58. /package/src/{docs-editor → yjs/docs-editor}/prosemirror/schema.ts +0 -0
  59. /package/src/{docs-editor → yjs/docs-editor}/prosemirror/types.ts +0 -0
  60. /package/src/{docs-editor → yjs/docs-editor}/prosemirror-to-blocks.ts +0 -0
  61. /package/src/{docs-editor → yjs/docs-editor}/utils.ts +0 -0
package/dist/index.mjs CHANGED
@@ -126,6 +126,7 @@ import { z as z122 } from "zod";
126
126
  import { z as z123 } from "zod";
127
127
  import { z as z124 } from "zod";
128
128
  import { z as z125 } from "zod";
129
+ import slugifyImplementation from "@sindresorhus/slugify";
129
130
  var PluginOAuthRequestSchema = z.object({
130
131
  id: z.string(),
131
132
  codeChallenge: z.string(),
@@ -981,7 +982,12 @@ var PageBlockItemDividerValue = z34.object({});
981
982
  var PageBlockItemEmbedValue = z34.object({
982
983
  value: z34.string().optional(),
983
984
  caption: z34.string().optional(),
984
- height: z34.number().optional()
985
+ height: z34.number().optional(),
986
+ openGraph: z34.object({
987
+ title: z34.string().optional(),
988
+ description: z34.string().optional(),
989
+ imageUrl: z34.string().optional()
990
+ }).optional()
985
991
  });
986
992
  var PageBlockItemFigmaNodeValue = z34.object({
987
993
  selectedPropertyIds: z34.array(z34.string()).optional(),
@@ -2605,11 +2611,31 @@ var DesignSystemVersionRoom = Entity.extend({
2605
2611
  designSystemVersionId: z119.string(),
2606
2612
  liveblocksId: z119.string()
2607
2613
  });
2614
+ var DesignSystemVersionRoomInitialState = z119.object({
2615
+ pages: z119.array(DocumentationPageV2),
2616
+ groups: z119.array(ElementGroup)
2617
+ });
2618
+ var DesignSystemVersionRoomUpdate = DesignSystemVersionRoomInitialState.extend({
2619
+ deletedPageIds: z119.array(z119.string()),
2620
+ deletedGroupIds: z119.array(z119.string())
2621
+ });
2608
2622
  var DocumentationPageRoom = Entity.extend({
2609
2623
  designSystemVersionId: z120.string(),
2610
2624
  documentationPageId: z120.string(),
2611
2625
  liveblocksId: z120.string()
2612
2626
  });
2627
+ var PageBlockEditorModel = z120.object({
2628
+ id: z120.string(),
2629
+ data: PageBlockDataV2
2630
+ });
2631
+ var DocumentationPageRoomRoomUpdate = z120.object({
2632
+ page: DocumentationPageV2,
2633
+ pageParent: ElementGroup
2634
+ });
2635
+ var DocumentationPageRoomInitialState = DocumentationPageRoomRoomUpdate.extend({
2636
+ pageBlocks: z120.array(PageBlockEditorModel),
2637
+ blockDefinitions: z120.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 = z124.object({
2653
2679
  expireAt: z124.date().optional(),
2654
2680
  scope: z124.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 = z125.object({
2657
2763
  from: z125.string(),
2658
2764
  to: z125.string(),
@@ -2674,33 +2780,803 @@ var ContentLoaderPayload = z125.object({
2674
2780
  location: z125.string()
2675
2781
  })
2676
2782
  );
2783
+ function slugify(str, options) {
2784
+ const slug = slugifyImplementation(str ?? "", options);
2785
+ return slug?.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 = parent?.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: 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/dto/design-system.ts
2679
- var DesignSystemDTO = DesignSystem.omit({
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: group.data?.configuration ?? {
3488
+ showSidebar: true,
3489
+ header: defaultDocumentationItemHeader
3490
+ }
3491
+ };
3492
+ });
3493
+ }
3494
+ function elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap) {
3495
+ const childrenIds = 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: group.data?.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: 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-v1.ts
2687
- import { z as z126 } from "zod";
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: z126.string(),
2695
- path: z126.string()
2696
- });
2697
-
2698
- // src/api/dto/documentation-v2.ts
2699
- import { z as z128 } from "zod";
2700
-
2701
- // src/api/dto/documentation.ts
3574
+ // src/api/dto/elements/documentation/group-action.ts
2702
3575
  import { z as z127 } from "zod";
2703
- var DocumentationGroupStructureDTO = ElementGroup.omit({
3576
+
3577
+ // src/api/dto/elements/documentation/group.ts
3578
+ import { z as z126 } from "zod";
3579
+ var DTODocumentationGroupStructure = ElementGroup.omit({
2704
3580
  sortOrder: true,
2705
3581
  parentPersistentId: true,
2706
3582
  brandPersistentId: true,
@@ -2709,17 +3585,105 @@ var DocumentationGroupStructureDTO = ElementGroup.omit({
2709
3585
  data: true,
2710
3586
  shortPersistentId: true
2711
3587
  }).extend({
2712
- title: z127.string(),
2713
- isRoot: z127.boolean(),
2714
- childrenIds: z127.array(z127.string()),
3588
+ title: z126.string(),
3589
+ isRoot: z126.boolean(),
3590
+ childrenIds: z126.array(z126.string()),
2715
3591
  groupBehavior: DocumentationGroupBehavior,
2716
- shortPersistentId: z127.string()
3592
+ shortPersistentId: z126.string()
2717
3593
  });
2718
- var DocumentationGroupDTO = DocumentationGroupStructureDTO.extend({
3594
+ var DTODocumentationGroup = DTODocumentationGroupStructure.extend({
2719
3595
  configuration: DocumentationItemConfiguration
2720
3596
  });
3597
+ var DTOCreateDocumentationGroupInput = z126.object({
3598
+ // Identifier
3599
+ persistentId: z126.string().uuid(),
3600
+ // Group properties
3601
+ title: z126.string(),
3602
+ configuration: DocumentationItemConfiguration.optional(),
3603
+ groupBehavior: DocumentationGroupBehavior,
3604
+ // Group placement properties
3605
+ afterPersistentId: z126.string().uuid().optional(),
3606
+ parentPersistentId: z126.string().uuid()
3607
+ });
3608
+ var DTOUpdateDocumentationGroupInput = z126.object({
3609
+ // Identifier of the group to update
3610
+ id: z126.string().uuid(),
3611
+ // Group properties
3612
+ title: z126.string().optional(),
3613
+ configuration: DocumentationItemConfiguration.optional(),
3614
+ // Group placement properties
3615
+ afterPersistentId: z126.string().uuid().optional(),
3616
+ parentPersistentId: z126.string().uuid().optional()
3617
+ });
3618
+ var DTODuplicateDocumentationGroupInput = z126.object({
3619
+ // Identifier of the group to duplicate from
3620
+ id: z126.string(),
3621
+ // New group persistent id
3622
+ persistentId: z126.string().uuid(),
3623
+ // Group placement properties
3624
+ afterPersistentId: z126.string().uuid().optional(),
3625
+ parentPersistentId: z126.string().uuid()
3626
+ });
3627
+ var DTOCreateDocumentationTabGroupInput = z126.object({
3628
+ // New group persistent id
3629
+ persistentId: z126.string().uuid(),
3630
+ // Page that will become first tab of the tab group
3631
+ fromPageId: z126.string(),
3632
+ tabName: z126.string()
3633
+ });
3634
+ var DTODeleteDocumentationTabGroupInput = z126.object({
3635
+ // Deleted group id
3636
+ id: z126.string()
3637
+ });
3638
+ var DTODeleteDocumentationGroupInput = z126.object({
3639
+ // Identifier
3640
+ id: z126.string(),
3641
+ // Deletion options
3642
+ deleteSubtree: z126.boolean().default(false)
3643
+ });
3644
+
3645
+ // src/api/dto/elements/documentation/group-action.ts
3646
+ var SuccessPayload = z127.object({
3647
+ success: z127.literal(true)
3648
+ });
3649
+ var DTODocumentationGroupCreateActionOutputV2 = z127.object({
3650
+ type: z127.literal("DocumentationGroupCreate"),
3651
+ output: SuccessPayload
3652
+ });
3653
+ var DTODocumentationGroupUpdateActionOutputV2 = z127.object({
3654
+ type: z127.literal("DocumentationGroupUpdate"),
3655
+ output: SuccessPayload
3656
+ });
3657
+ var DTODocumentationGroupDuplicateActionOutputV2 = z127.object({
3658
+ type: z127.literal("DocumentationGroupDuplicate"),
3659
+ output: SuccessPayload
3660
+ });
3661
+ var DTODocumentationGroupDeleteActionOutputV2 = z127.object({
3662
+ type: z127.literal("DocumentationGroupDelete"),
3663
+ output: SuccessPayload
3664
+ });
3665
+ var DTODocumentationGroupCreateActionInputV2 = z127.object({
3666
+ type: z127.literal("DocumentationGroupCreate"),
3667
+ input: DTOCreateDocumentationGroupInput
3668
+ });
3669
+ var DTODocumentationGroupUpdateActionInputV2 = z127.object({
3670
+ type: z127.literal("DocumentationGroupUpdate"),
3671
+ input: DTOUpdateDocumentationGroupInput
3672
+ });
3673
+ var DTODocumentationGroupDuplicateActionInputV2 = z127.object({
3674
+ type: z127.literal("DocumentationGroupDuplicate"),
3675
+ input: DTODuplicateDocumentationGroupInput
3676
+ });
3677
+ var DTODocumentationGroupDeleteActionInputV2 = z127.object({
3678
+ type: z127.literal("DocumentationGroupDelete"),
3679
+ input: DTODeleteDocumentationGroupInput
3680
+ });
3681
+
3682
+ // src/api/dto/elements/documentation/page-actions-v2.ts
3683
+ import { z as z129 } from "zod";
2721
3684
 
2722
- // src/api/dto/documentation-v2.ts
3685
+ // src/api/dto/elements/documentation/page-v2.ts
3686
+ import { z as z128 } from "zod";
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: z128.string(),
2730
3694
  path: z128.string()
2731
3695
  });
2732
- var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend(DocumentationPageV2.shape.data.shape);
3696
+ var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend({
3697
+ configuration: DocumentationItemConfiguration
3698
+ });
2733
3699
  var DTODocumentationHierarchyV2 = z128.object({
2734
3700
  pages: z128.array(DTODocumentationPageStructureV2),
2735
- groups: z128.array(DocumentationGroupStructureDTO)
3701
+ groups: z128.array(DTODocumentationGroupStructure)
2736
3702
  });
2737
-
2738
- // src/api/requests/elements/elements-transaction-v2.ts
2739
- import { z as z129 } from "zod";
2740
- var DTOCreateDocumentationPageInput = z129.object({
2741
- parentPersistentId: z129.string().uuid(),
2742
- persistentId: z129.string().uuid(),
2743
- title: z129.string(),
3703
+ var DTOCreateDocumentationPageInputV2 = z128.object({
3704
+ // Identifier
3705
+ persistentId: z128.string().uuid(),
3706
+ // Page properties
3707
+ title: z128.string(),
2744
3708
  configuration: DocumentationItemConfiguration.optional(),
2745
- afterPersistentId: z129.string().uuid().optional()
2746
- });
2747
- var DTOUpdateDocumentationPageInput = z129.object({
2748
- id: z129.string(),
2749
- title: z129.string().optional(),
3709
+ // Page placement properties
3710
+ parentPersistentId: z128.string().uuid(),
3711
+ afterPersistentId: z128.string().uuid().optional()
3712
+ });
3713
+ var DTOUpdateDocumentationPageInputV2 = z128.object({
3714
+ // Identifier of the group to update
3715
+ id: z128.string(),
3716
+ // Page properties
3717
+ title: z128.string().optional(),
2750
3718
  configuration: DocumentationItemConfiguration.optional(),
2751
- parentPersistentId: z129.string().optional(),
2752
- afterPersistentId: z129.string().optional()
3719
+ // Page placement properties
3720
+ parentPersistentId: z128.string().optional(),
3721
+ afterPersistentId: z128.string().optional()
3722
+ });
3723
+ var DTODuplicateDocumentationPageInputV2 = z128.object({
3724
+ // Identifier of the page to duplicate from
3725
+ id: z128.string(),
3726
+ // New page persistent id
3727
+ persistentId: z128.string().uuid(),
3728
+ // Page placement properties
3729
+ parentPersistentId: z128.string().uuid(),
3730
+ afterPersistentId: z128.string().uuid().optional()
3731
+ });
3732
+ var DTODeleteDocumentationPageInputV2 = z128.object({
3733
+ // Identifier
3734
+ id: z128.string()
3735
+ });
3736
+
3737
+ // src/api/dto/elements/documentation/page-actions-v2.ts
3738
+ var SuccessPayload2 = z129.object({
3739
+ success: z129.literal(true)
3740
+ });
3741
+ var DTODocumentationPageCreateActionOutputV2 = z129.object({
3742
+ type: z129.literal("DocumentationPageCreate"),
3743
+ output: SuccessPayload2
3744
+ });
3745
+ var DTODocumentationPageUpdateActionOutputV2 = z129.object({
3746
+ type: z129.literal("DocumentationPageUpdate"),
3747
+ output: SuccessPayload2
3748
+ });
3749
+ var DTODocumentationPageDuplicateActionOutputV2 = z129.object({
3750
+ type: z129.literal("DocumentationPageDuplicate"),
3751
+ output: SuccessPayload2
3752
+ });
3753
+ var DTODocumentationPageDeleteActionOutputV2 = z129.object({
3754
+ type: z129.literal("DocumentationPageDelete"),
3755
+ output: SuccessPayload2
3756
+ });
3757
+ var DTODocumentationPageCreateActionInputV2 = z129.object({
3758
+ type: z129.literal("DocumentationPageCreate"),
3759
+ input: DTOCreateDocumentationPageInputV2
2753
3760
  });
2754
- var DTODuplicateDocumentationPageInput = z129.object({
2755
- id: z129.string(),
2756
- persistentId: z129.string().uuid(),
2757
- parentPersistentId: z129.string().uuid(),
2758
- afterPersistentId: z129.string().uuid().optional()
3761
+ var DTODocumentationPageUpdateActionInputV2 = z129.object({
3762
+ type: z129.literal("DocumentationPageUpdate"),
3763
+ input: DTOUpdateDocumentationPageInputV2
2759
3764
  });
2760
- var DTODocumentationElementsTransactionInput = z129.object({
2761
- create: z129.array(DTOCreateDocumentationPageInput).optional(),
2762
- update: z129.array(DTOUpdateDocumentationPageInput).optional(),
2763
- duplicate: z129.array(DTODuplicateDocumentationPageInput).optional(),
2764
- delete: z129.array(z129.string()).optional()
3765
+ var DTODocumentationPageDuplicateActionInputV2 = z129.object({
3766
+ type: z129.literal("DocumentationPageDuplicate"),
3767
+ input: DTODuplicateDocumentationPageInputV2
2765
3768
  });
2766
- var DTOElementsTransactionInput = z129.object({
2767
- documentationPages: DTODocumentationElementsTransactionInput
3769
+ var DTODocumentationPageDeleteActionInputV2 = z129.object({
3770
+ type: z129.literal("DocumentationPageDelete"),
3771
+ input: DTODeleteDocumentationPageInputV2
2768
3772
  });
2769
3773
 
2770
- // src/api/requests/post-liveblocks-auth.ts
3774
+ // src/api/dto/elements/documentation/page-v1.ts
2771
3775
  import { z as z130 } from "zod";
2772
- var PostLiveblocksAuth = z130.object({
2773
- room: z130.string()
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: z130.string(),
3783
+ path: z130.string()
2774
3784
  });
2775
3785
 
2776
- // src/api/responses/get-block-definitions.ts
3786
+ // src/api/dto/elements/elements-action-v2.ts
2777
3787
  import { z as z131 } from "zod";
2778
- var GetBlockDefinitionsResponse = z131.object({
2779
- definitions: z131.array(PageBlockDefinition)
3788
+ var DTOElementActionOutput = z131.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 = z131.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
+ import { z as z132 } from "zod";
3815
+ var DTOGetBlockDefinitionsOutput = z132.object({
3816
+ definitions: z132.array(PageBlockDefinition)
2780
3817
  });
2781
3818
 
2782
- // src/design-system-content/documentation-hierarchy.ts
2783
- function documentationHierarchyToYjs(doc, documentationHierarchy, itemsToDelete) {
3819
+ // src/api/payloads/liveblocks/auth.ts
3820
+ import { z as z133 } from "zod";
3821
+ var DTOLiveblocksAuthRequest = z133.object({
3822
+ room: z133.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
- itemsToDelete.pagePersistentIdsToDelete.forEach((persistentId) => {
2787
- pagesMap.delete(persistentId);
3829
+ transaction.pageIdsToDelete.forEach((pageId) => {
3830
+ pagesMap.delete(pageId);
2788
3831
  });
2789
- documentationHierarchy.pages.forEach((page) => {
2790
- pagesMap.set(page.persistentId, page);
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
- itemsToDelete.groupPersistentIdsToDelete.forEach((persistentId) => {
2794
- groupsMap.delete(persistentId);
3840
+ transaction.groupIdsToDelete.forEach((id) => {
3841
+ groupsMap.delete(id);
2795
3842
  });
2796
- documentationHierarchy.groups.forEach((group) => {
2797
- groupsMap.set(group.persistentId, group);
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(DTODocumentationPageStructureV2.parse(page));
3858
+ pages.push(DocumentationPageV2.parse(page));
2808
3859
  });
2809
3860
  const groups = [];
2810
3861
  groupsMap.forEach((group) => {
2811
- groups.push(DocumentationGroupStructureDTO.parse(group));
3862
+ groups.push(ElementGroup.parse(group));
2812
3863
  });
2813
- return {
2814
- pages,
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
+ import { z as z134 } from "zod";
3876
+ var DTODocumentationPageRoomHeaderData = z134.object({
3877
+ title: z134.string(),
3878
+ configuration: DocumentationItemConfiguration
3879
+ });
3880
+ var DTODocumentationPageRoomHeaderDataUpdate = z134.object({
3881
+ title: z134.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 header = item.header;
3886
+ const { title, configuration } = item;
3887
+ const header = configuration?.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 (item.showSidebar !== void 0) {
3904
+ if (configuration?.showSidebar !== void 0) {
2842
3905
  const configYMap = trx.doc.getMap("itemConfiguration");
2843
- configYMap.set("showSidebar", item.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 DocumentationItemConfiguration.parse(rawConfig);
3929
+ return {
3930
+ title: z134.string().parse(title),
3931
+ configuration: DocumentationItemConfiguration.parse(rawConfig)
3932
+ };
2866
3933
  }
2867
3934
 
2868
- // src/docs-editor/model/block.ts
2869
- import { z as z132 } from "zod";
2870
- var PageBlockEditorModel = z132.object({
2871
- id: z132.string(),
2872
- data: PageBlockDataV2
2873
- });
3935
+ // src/yjs/docs-editor/model/block.ts
3936
+ var PageBlockEditorModel2 = PageBlockEditorModel;
2874
3937
 
2875
- // src/docs-editor/model/page.ts
2876
- import { z as z133 } from "zod";
2877
- var DocumentationPageEditorModel = z133.object({
2878
- blocks: z133.array(PageBlockEditorModel)
3938
+ // src/yjs/docs-editor/model/page.ts
3939
+ import { z as z135 } from "zod";
3940
+ var DocumentationPageEditorModel = z135.object({
3941
+ blocks: z135.array(PageBlockEditorModel2)
2879
3942
  });
2880
3943
 
2881
- // src/docs-editor/prosemirror/schema.ts
3944
+ // src/yjs/docs-editor/prosemirror/schema.ts
2882
3945
  import { Schema } from "prosemirror-model";
2883
3946
  var newSchema = {
2884
3947
  nodes: {
@@ -3554,7 +4617,7 @@ var newSchema = {
3554
4617
  };
3555
4618
  var pmSchema = new 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
  import { prosemirrorJSONToYXmlFragment } from "y-prosemirror";
3644
4707
  function pageToYXmlFragment(page, definitions, fragment) {
3645
4708
  const doc = pageToProsemirrorDoc(page, definitions);
@@ -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,9 +7569,9 @@ 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
  import { yXmlFragmentToProsemirrorJSON } from "y-prosemirror";
6511
- import { z as z134 } from "zod";
7574
+ import { z as z136 } from "zod";
6512
7575
  function yDocToPage(yDoc, definitions) {
6513
7576
  return yXmlFragmentToPage(yDoc.getXmlFragment("default"), definitions);
6514
7577
  }
@@ -6517,10 +7580,10 @@ function yXmlFragmentToPage(fragment, definitions) {
6517
7580
  return prosemirrorDocToPage(prosemirrorJson, definitions);
6518
7581
  }
6519
7582
  function prosemirrorDocToPage(prosemirrorDoc, definitions) {
6520
- const definitionsById = mapByUnique(definitions, (d) => d.id);
7583
+ const definitionsById = mapByUnique2(definitions, (d) => d.id);
6521
7584
  return {
6522
7585
  blocks: (prosemirrorDoc.content ?? []).map((prosemirrorNode) => {
6523
- const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", z134.string());
7586
+ const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", z136.string());
6524
7587
  if (!definitionId) {
6525
7588
  console.warn(
6526
7589
  `definitionId on ${prosemirrorNode.type} is required to be interpreted as a block, skipping node`
@@ -6562,7 +7625,7 @@ function parseAsRichText(prosemirrorNode, definition, property) {
6562
7625
  if (!id)
6563
7626
  return null;
6564
7627
  const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
6565
- const calloutType = parseCalloutType(getProsemirrorAttribute(prosemirrorNode, "type", z134.string().optional()));
7628
+ const calloutType = parseCalloutType(getProsemirrorAttribute(prosemirrorNode, "type", z136.string().optional()));
6566
7629
  return {
6567
7630
  // TODO Artem: indent
6568
7631
  id,
@@ -6662,8 +7725,8 @@ function parseRichTextAttribute(mark) {
6662
7725
  case "code":
6663
7726
  return { type: "Code" };
6664
7727
  case "link":
6665
- const itemId = getProsemirrorAttribute(mark, "itemId", z134.string().optional());
6666
- const href = getProsemirrorAttribute(mark, "href", z134.string().optional());
7728
+ const itemId = getProsemirrorAttribute(mark, "itemId", z136.string().optional());
7729
+ const href = getProsemirrorAttribute(mark, "href", z136.string().optional());
6667
7730
  return {
6668
7731
  type: "Link",
6669
7732
  openInNewWindow: mark.attrs?.target !== "_self",
@@ -6678,7 +7741,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
6678
7741
  if (!id)
6679
7742
  return null;
6680
7743
  const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
6681
- const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", z134.boolean().optional()) !== false;
7744
+ const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", z136.boolean().optional()) !== false;
6682
7745
  const tableChild = prosemirrorNode.content?.find((c) => c.type === "table");
6683
7746
  if (!tableChild) {
6684
7747
  return emptyTable(id, variantId, 0);
@@ -6724,9 +7787,9 @@ function parseAsTableCell(prosemirrorNode) {
6724
7787
  const id = getProsemirrorBlockId(prosemirrorNode);
6725
7788
  if (!id)
6726
7789
  return null;
6727
- const textAlign = getProsemirrorAttribute(prosemirrorNode, "textAlign", z134.string().optional());
7790
+ const textAlign = getProsemirrorAttribute(prosemirrorNode, "textAlign", z136.string().optional());
6728
7791
  let columnWidth;
6729
- const columnWidthArray = getProsemirrorAttribute(prosemirrorNode, "colwidth", z134.array(z134.number()).optional());
7792
+ const columnWidthArray = getProsemirrorAttribute(prosemirrorNode, "colwidth", z136.array(z136.number()).optional());
6730
7793
  if (columnWidthArray) {
6731
7794
  columnWidth = columnWidthArray[0];
6732
7795
  }
@@ -6760,7 +7823,7 @@ function parseAsTableNode(prosemirrorNode) {
6760
7823
  value: parseRichText(prosemirrorNode.content ?? [])
6761
7824
  };
6762
7825
  case "image":
6763
- const url = getProsemirrorAttribute(prosemirrorNode, "src", z134.string().optional());
7826
+ const url = getProsemirrorAttribute(prosemirrorNode, "src", z136.string().optional());
6764
7827
  if (!url)
6765
7828
  return null;
6766
7829
  return {
@@ -6854,7 +7917,7 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
6854
7917
  };
6855
7918
  }
6856
7919
  function parseBlockItems(prosemirrorNode, definition) {
6857
- const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", z134.string());
7920
+ const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", z136.string());
6858
7921
  if (!itemsString)
6859
7922
  return null;
6860
7923
  const itemsJson = JSON.parse(itemsString);
@@ -6866,11 +7929,11 @@ function parseBlockItems(prosemirrorNode, definition) {
6866
7929
  }
6867
7930
  function parseAppearance(prosemirrorNode) {
6868
7931
  const appearance = {};
6869
- const columns = getProsemirrorAttribute(prosemirrorNode, "columns", z134.number().optional());
7932
+ const columns = getProsemirrorAttribute(prosemirrorNode, "columns", z136.number().optional());
6870
7933
  if (columns) {
6871
7934
  appearance.numberOfColumns = columns;
6872
7935
  }
6873
- const backgroundColor = getProsemirrorAttribute(prosemirrorNode, "backgroundColor", z134.string().optional());
7936
+ const backgroundColor = getProsemirrorAttribute(prosemirrorNode, "backgroundColor", z136.string().optional());
6874
7937
  if (backgroundColor) {
6875
7938
  const parsedColor = PageBlockColorV2.safeParse(JSON.parse(backgroundColor));
6876
7939
  if (parsedColor.success) {
@@ -6961,13 +8024,13 @@ function valueSchemaForPropertyType(type) {
6961
8024
  }
6962
8025
  }
6963
8026
  function getProsemirrorBlockId(prosemirrorNode) {
6964
- const id = getProsemirrorAttribute(prosemirrorNode, "id", z134.string());
8027
+ const id = getProsemirrorAttribute(prosemirrorNode, "id", z136.string());
6965
8028
  if (!id)
6966
8029
  console.warn(`Prosemirror attribute "id" on ${prosemirrorNode.type} is required`);
6967
8030
  return id;
6968
8031
  }
6969
8032
  function getProsemirrorBlockVariantId(prosemirrorNode) {
6970
- return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(z134.string()));
8033
+ return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(z136.string()));
6971
8034
  }
6972
8035
  function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchema) {
6973
8036
  const parsedAttr = validationSchema.safeParse(prosemirrorNode.attrs?.[attributeName]);
@@ -6982,7 +8045,7 @@ function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchem
6982
8045
  function nonNullFilter2(item) {
6983
8046
  return item !== null;
6984
8047
  }
6985
- function mapByUnique(items, keyFn) {
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);
@@ -6992,25 +8055,58 @@ function mapByUnique(items, keyFn) {
6992
8055
  export {
6993
8056
  BlockDefinitionUtils,
6994
8057
  BlockParsingUtils,
6995
- DTOCreateDocumentationPageInput,
6996
- DTODocumentationElementsTransactionInput,
8058
+ DTOCreateDocumentationGroupInput,
8059
+ DTOCreateDocumentationPageInputV2,
8060
+ DTOCreateDocumentationTabGroupInput,
8061
+ DTODeleteDocumentationGroupInput,
8062
+ DTODeleteDocumentationPageInputV2,
8063
+ DTODeleteDocumentationTabGroupInput,
8064
+ DTODesignSystem,
8065
+ DTODocumentationGroup,
8066
+ DTODocumentationGroupCreateActionInputV2,
8067
+ DTODocumentationGroupCreateActionOutputV2,
8068
+ DTODocumentationGroupDeleteActionInputV2,
8069
+ DTODocumentationGroupDeleteActionOutputV2,
8070
+ DTODocumentationGroupDuplicateActionInputV2,
8071
+ DTODocumentationGroupDuplicateActionOutputV2,
8072
+ DTODocumentationGroupStructure,
8073
+ DTODocumentationGroupUpdateActionInputV2,
8074
+ DTODocumentationGroupUpdateActionOutputV2,
6997
8075
  DTODocumentationHierarchyV2,
8076
+ DTODocumentationPageCreateActionInputV2,
8077
+ DTODocumentationPageCreateActionOutputV2,
8078
+ DTODocumentationPageDeleteActionInputV2,
8079
+ DTODocumentationPageDeleteActionOutputV2,
8080
+ DTODocumentationPageDuplicateActionInputV2,
8081
+ DTODocumentationPageDuplicateActionOutputV2,
8082
+ DTODocumentationPageRoomHeaderData,
8083
+ DTODocumentationPageRoomHeaderDataUpdate,
6998
8084
  DTODocumentationPageStructureV2,
8085
+ DTODocumentationPageUpdateActionInputV2,
8086
+ DTODocumentationPageUpdateActionOutputV2,
6999
8087
  DTODocumentationPageV2,
7000
- DTODuplicateDocumentationPageInput,
7001
- DTOElementsTransactionInput,
7002
- DTOUpdateDocumentationPageInput,
7003
- DesignSystemDTO,
7004
- DocumentationGroupDTO,
7005
- DocumentationGroupStructureDTO,
8088
+ DTODuplicateDocumentationGroupInput,
8089
+ DTODuplicateDocumentationPageInputV2,
8090
+ DTOElementActionInput,
8091
+ DTOElementActionOutput,
8092
+ DTOGetBlockDefinitionsOutput,
8093
+ DTOLiveblocksAuthRequest,
8094
+ DTOUpdateDocumentationGroupInput,
8095
+ DTOUpdateDocumentationPageInputV2,
7006
8096
  DocumentationPageEditorModel,
7007
8097
  DocumentationPageV1DTO,
7008
- GetBlockDefinitionsResponse,
7009
- PageBlockEditorModel,
7010
- PostLiveblocksAuth,
8098
+ PageBlockEditorModel2 as PageBlockEditorModel,
7011
8099
  blockDefinitionForBlock,
7012
8100
  blockToProsemirrorNode,
8101
+ buildDocPagePublishPaths,
8102
+ calculateElementParentChain,
8103
+ documentationElementsToHierarchyDto,
7013
8104
  documentationHierarchyToYjs,
8105
+ documentationPagesToDTOV1,
8106
+ documentationPagesToDTOV2,
8107
+ documentationPagesToStructureDTOV2,
8108
+ elementGroupsToDocumentationGroupDTO,
8109
+ elementGroupsToDocumentationGroupStructureDTO,
7014
8110
  getMockPageBlockDefinitions,
7015
8111
  itemConfigurationToYjs,
7016
8112
  pageToProsemirrorDoc,