@supernova-studio/client 0.15.0 → 0.17.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 (62) hide show
  1. package/dist/index.d.mts +35218 -4953
  2. package/dist/index.d.ts +35218 -4953
  3. package/dist/index.js +1167 -81
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1195 -109
  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 +66 -0
  19. package/src/api/dto/elements/documentation/group-bulk-action.ts +32 -0
  20. package/src/api/dto/elements/documentation/group.ts +85 -0
  21. package/src/api/dto/elements/documentation/index.ts +7 -0
  22. package/src/api/dto/elements/documentation/page-actions-v2.ts +66 -0
  23. package/src/api/dto/elements/documentation/page-bulk-action-v2.ts +33 -0
  24. package/src/api/dto/{documentation-v1.ts → elements/documentation/page-v1.ts} +4 -0
  25. package/src/api/dto/elements/documentation/page-v2.ts +87 -0
  26. package/src/api/dto/elements/elements-action-v2.ts +61 -0
  27. package/src/api/dto/elements/elements-bulk-action-v2.ts +25 -0
  28. package/src/api/dto/elements/index.ts +3 -0
  29. package/src/api/dto/index.ts +2 -3
  30. package/src/api/index.ts +2 -2
  31. package/src/api/payloads/documentation/block-definitions.ts +12 -0
  32. package/src/api/payloads/documentation/index.ts +1 -0
  33. package/src/api/payloads/index.ts +2 -0
  34. package/src/api/payloads/liveblocks/auth.ts +7 -0
  35. package/src/api/payloads/liveblocks/index.ts +1 -0
  36. package/src/index.ts +1 -2
  37. package/src/yjs/design-system-content/documentation-hierarchy.ts +100 -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/{design-system-content → yjs/design-system-content}/index.ts +0 -0
  51. /package/src/{design-system-content → yjs/design-system-content}/item-configuration.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/block.ts +0 -0
  56. /package/src/{docs-editor → yjs/docs-editor}/model/index.ts +0 -0
  57. /package/src/{docs-editor → yjs/docs-editor}/model/page.ts +0 -0
  58. /package/src/{docs-editor → yjs/docs-editor}/prosemirror/index.ts +0 -0
  59. /package/src/{docs-editor → yjs/docs-editor}/prosemirror/schema.ts +0 -0
  60. /package/src/{docs-editor → yjs/docs-editor}/prosemirror/types.ts +0 -0
  61. /package/src/{docs-editor → yjs/docs-editor}/prosemirror-to-blocks.ts +0 -0
  62. /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(),
@@ -2605,6 +2606,16 @@ var DesignSystemVersionRoom = Entity.extend({
2605
2606
  designSystemVersionId: z119.string(),
2606
2607
  liveblocksId: z119.string()
2607
2608
  });
2609
+ var DesignSystemVersionRoomInitialState = z119.object({
2610
+ pages: z119.array(DocumentationPageV2),
2611
+ groups: z119.array(ElementGroup),
2612
+ deletedPagePersistentIds: z119.array(z119.string()),
2613
+ deletedGroupPersistentIds: z119.array(z119.string())
2614
+ });
2615
+ var DesignSystemVersionRoomUpdate = DesignSystemVersionRoomInitialState.extend({
2616
+ deletedPagePersistentIds: z119.array(z119.string()),
2617
+ deletedGroupPersistentIds: z119.array(z119.string())
2618
+ });
2608
2619
  var DocumentationPageRoom = Entity.extend({
2609
2620
  designSystemVersionId: z120.string(),
2610
2621
  documentationPageId: z120.string(),
@@ -2653,6 +2664,86 @@ var PersonalAccessToken = z124.object({
2653
2664
  expireAt: z124.date().optional(),
2654
2665
  scope: z124.string().optional()
2655
2666
  });
2667
+ var SupernovaException = class _SupernovaException extends Error {
2668
+ //
2669
+ // Properties
2670
+ //
2671
+ constructor(type, message) {
2672
+ super(`${type}: ${message}`);
2673
+ this.type = type;
2674
+ }
2675
+ static wrongFormat(message) {
2676
+ return new _SupernovaException("WrongFormat", message);
2677
+ }
2678
+ static accessDenied(message) {
2679
+ return new _SupernovaException("AccessDenied", message);
2680
+ }
2681
+ static notFound(message) {
2682
+ return new _SupernovaException("ResourceNotFound", message);
2683
+ }
2684
+ static timeout(message) {
2685
+ return new _SupernovaException("Timeout", message);
2686
+ }
2687
+ static conflict(message) {
2688
+ return new _SupernovaException("Conflict", message);
2689
+ }
2690
+ static notImplemented(message) {
2691
+ return new _SupernovaException("NotImplemented", message);
2692
+ }
2693
+ static wrongActionOrder(message) {
2694
+ return new _SupernovaException("WrongActionOrder", message);
2695
+ }
2696
+ static invalidOperation(message) {
2697
+ return new _SupernovaException("InvalidOperation", message);
2698
+ }
2699
+ static shouldNotHappen(message) {
2700
+ return new _SupernovaException("UnexpectedError", message);
2701
+ }
2702
+ static ipRestricted(message) {
2703
+ return new _SupernovaException("IPRestricted", message);
2704
+ }
2705
+ static planRestricted(message) {
2706
+ return new _SupernovaException("PlanRestricted", message);
2707
+ }
2708
+ static missingWorkspacePermission(message) {
2709
+ return new _SupernovaException("MissingWorkspacePermission", message);
2710
+ }
2711
+ static missingExporterPermission(message) {
2712
+ return new _SupernovaException("MissingExporterPermission", message);
2713
+ }
2714
+ static missingIntegration(message) {
2715
+ return new _SupernovaException("AccessDenied", message);
2716
+ }
2717
+ static noAccess(message) {
2718
+ return new _SupernovaException("NoAccess", message);
2719
+ }
2720
+ //
2721
+ // To refactor
2722
+ //
2723
+ static badRequest(message) {
2724
+ return new _SupernovaException("BadRequest", message);
2725
+ }
2726
+ };
2727
+ function mapByUnique(items, keyFn) {
2728
+ const result = /* @__PURE__ */ new Map();
2729
+ for (const item of items) {
2730
+ result.set(keyFn(item), item);
2731
+ }
2732
+ return result;
2733
+ }
2734
+ function groupBy(items, keyFn) {
2735
+ const result = /* @__PURE__ */ new Map();
2736
+ for (const item of items) {
2737
+ const key = keyFn(item);
2738
+ const array = result.get(key);
2739
+ if (array) {
2740
+ array.push(item);
2741
+ } else {
2742
+ result.set(key, [item]);
2743
+ }
2744
+ }
2745
+ return result;
2746
+ }
2656
2747
  var ContentLoadInstruction = z125.object({
2657
2748
  from: z125.string(),
2658
2749
  to: z125.string(),
@@ -2674,33 +2765,803 @@ var ContentLoaderPayload = z125.object({
2674
2765
  location: z125.string()
2675
2766
  })
2676
2767
  );
2768
+ function slugify(str, options) {
2769
+ const slug = slugifyImplementation(str ?? "", options);
2770
+ return slug?.length > 0 ? slug : "item";
2771
+ }
2772
+ var RESERVED_SLUGS = [
2773
+ "workspaces",
2774
+ "workspace",
2775
+ "api0",
2776
+ "api1",
2777
+ "api2",
2778
+ "custom",
2779
+ "x-sn-reserved",
2780
+ // further elements copied from https://github.com/shouldbee/reserved-usernames/blob/master/reserved-usernames.json
2781
+ "0",
2782
+ "about",
2783
+ "access",
2784
+ "account",
2785
+ "accounts",
2786
+ "activate",
2787
+ "activities",
2788
+ "activity",
2789
+ "ad",
2790
+ "add",
2791
+ "address",
2792
+ "adm",
2793
+ "admin",
2794
+ "administration",
2795
+ "administrator",
2796
+ "ads",
2797
+ "adult",
2798
+ "advertising",
2799
+ "affiliate",
2800
+ "affiliates",
2801
+ "ajax",
2802
+ "all",
2803
+ "alpha",
2804
+ "analysis",
2805
+ "analytics",
2806
+ "android",
2807
+ "anon",
2808
+ "anonymous",
2809
+ "api",
2810
+ "app",
2811
+ "apps",
2812
+ "archive",
2813
+ "archives",
2814
+ "article",
2815
+ "asct",
2816
+ "asset",
2817
+ "assets",
2818
+ "atom",
2819
+ "auth",
2820
+ "authentication",
2821
+ "avatar",
2822
+ "backup",
2823
+ "balancer-manager",
2824
+ "banner",
2825
+ "banners",
2826
+ "beta",
2827
+ "billing",
2828
+ "bin",
2829
+ "blog",
2830
+ "blogs",
2831
+ "board",
2832
+ "book",
2833
+ "bookmark",
2834
+ "bot",
2835
+ "bots",
2836
+ "bug",
2837
+ "business",
2838
+ "cache",
2839
+ "cadastro",
2840
+ "calendar",
2841
+ "call",
2842
+ "campaign",
2843
+ "cancel",
2844
+ "captcha",
2845
+ "career",
2846
+ "careers",
2847
+ "cart",
2848
+ "categories",
2849
+ "category",
2850
+ "cgi",
2851
+ "cgi-bin",
2852
+ "changelog",
2853
+ "chat",
2854
+ "check",
2855
+ "checking",
2856
+ "checkout",
2857
+ "client",
2858
+ "cliente",
2859
+ "clients",
2860
+ "code",
2861
+ "codereview",
2862
+ "comercial",
2863
+ "comment",
2864
+ "comments",
2865
+ "communities",
2866
+ "community",
2867
+ "company",
2868
+ "compare",
2869
+ "compras",
2870
+ "config",
2871
+ "configuration",
2872
+ "connect",
2873
+ "contact",
2874
+ "contact-us",
2875
+ "contact_us",
2876
+ "contactus",
2877
+ "contest",
2878
+ "contribute",
2879
+ "corp",
2880
+ "create",
2881
+ "css",
2882
+ "dashboard",
2883
+ "data",
2884
+ "db",
2885
+ "default",
2886
+ "delete",
2887
+ "demo",
2888
+ "design",
2889
+ "designer",
2890
+ "destroy",
2891
+ "dev",
2892
+ "devel",
2893
+ "developer",
2894
+ "developers",
2895
+ "diagram",
2896
+ "diary",
2897
+ "dict",
2898
+ "dictionary",
2899
+ "die",
2900
+ "dir",
2901
+ "direct_messages",
2902
+ "directory",
2903
+ "dist",
2904
+ "doc",
2905
+ "docs",
2906
+ "documentation",
2907
+ "domain",
2908
+ "download",
2909
+ "downloads",
2910
+ "ecommerce",
2911
+ "edit",
2912
+ "editor",
2913
+ "edu",
2914
+ "education",
2915
+ "email",
2916
+ "employment",
2917
+ "empty",
2918
+ "end",
2919
+ "enterprise",
2920
+ "entries",
2921
+ "entry",
2922
+ "error",
2923
+ "errors",
2924
+ "eval",
2925
+ "event",
2926
+ "exit",
2927
+ "explore",
2928
+ "facebook",
2929
+ "faq",
2930
+ "favorite",
2931
+ "favorites",
2932
+ "feature",
2933
+ "features",
2934
+ "feed",
2935
+ "feedback",
2936
+ "feeds",
2937
+ "file",
2938
+ "files",
2939
+ "first",
2940
+ "flash",
2941
+ "fleet",
2942
+ "fleets",
2943
+ "flog",
2944
+ "follow",
2945
+ "followers",
2946
+ "following",
2947
+ "forgot",
2948
+ "form",
2949
+ "forum",
2950
+ "forums",
2951
+ "founder",
2952
+ "free",
2953
+ "friend",
2954
+ "friends",
2955
+ "ftp",
2956
+ "gadget",
2957
+ "gadgets",
2958
+ "game",
2959
+ "games",
2960
+ "get",
2961
+ "ghost",
2962
+ "gift",
2963
+ "gifts",
2964
+ "gist",
2965
+ "github",
2966
+ "graph",
2967
+ "group",
2968
+ "groups",
2969
+ "guest",
2970
+ "guests",
2971
+ "help",
2972
+ "home",
2973
+ "homepage",
2974
+ "host",
2975
+ "hosting",
2976
+ "hostmaster",
2977
+ "hostname",
2978
+ "howto",
2979
+ "hpg",
2980
+ "html",
2981
+ "http",
2982
+ "httpd",
2983
+ "https",
2984
+ "i",
2985
+ "iamges",
2986
+ "icon",
2987
+ "icons",
2988
+ "id",
2989
+ "idea",
2990
+ "ideas",
2991
+ "image",
2992
+ "images",
2993
+ "imap",
2994
+ "img",
2995
+ "index",
2996
+ "indice",
2997
+ "info",
2998
+ "information",
2999
+ "inquiry",
3000
+ "instagram",
3001
+ "intranet",
3002
+ "invitations",
3003
+ "invite",
3004
+ "ipad",
3005
+ "iphone",
3006
+ "irc",
3007
+ "is",
3008
+ "issue",
3009
+ "issues",
3010
+ "it",
3011
+ "item",
3012
+ "items",
3013
+ "java",
3014
+ "javascript",
3015
+ "job",
3016
+ "jobs",
3017
+ "join",
3018
+ "js",
3019
+ "json",
3020
+ "jump",
3021
+ "knowledgebase",
3022
+ "language",
3023
+ "languages",
3024
+ "last",
3025
+ "ldap-status",
3026
+ "legal",
3027
+ "license",
3028
+ "link",
3029
+ "links",
3030
+ "linux",
3031
+ "list",
3032
+ "lists",
3033
+ "log",
3034
+ "log-in",
3035
+ "log-out",
3036
+ "log_in",
3037
+ "log_out",
3038
+ "login",
3039
+ "logout",
3040
+ "logs",
3041
+ "m",
3042
+ "mac",
3043
+ "mail",
3044
+ "mail1",
3045
+ "mail2",
3046
+ "mail3",
3047
+ "mail4",
3048
+ "mail5",
3049
+ "mailer",
3050
+ "mailing",
3051
+ "maintenance",
3052
+ "manager",
3053
+ "manual",
3054
+ "map",
3055
+ "maps",
3056
+ "marketing",
3057
+ "master",
3058
+ "me",
3059
+ "media",
3060
+ "member",
3061
+ "members",
3062
+ "message",
3063
+ "messages",
3064
+ "messenger",
3065
+ "microblog",
3066
+ "microblogs",
3067
+ "mine",
3068
+ "mis",
3069
+ "mob",
3070
+ "mobile",
3071
+ "movie",
3072
+ "movies",
3073
+ "mp3",
3074
+ "msg",
3075
+ "msn",
3076
+ "music",
3077
+ "musicas",
3078
+ "mx",
3079
+ "my",
3080
+ "mysql",
3081
+ "name",
3082
+ "named",
3083
+ "nan",
3084
+ "navi",
3085
+ "navigation",
3086
+ "net",
3087
+ "network",
3088
+ "new",
3089
+ "news",
3090
+ "newsletter",
3091
+ "nick",
3092
+ "nickname",
3093
+ "notes",
3094
+ "noticias",
3095
+ "notification",
3096
+ "notifications",
3097
+ "notify",
3098
+ "ns",
3099
+ "ns1",
3100
+ "ns10",
3101
+ "ns2",
3102
+ "ns3",
3103
+ "ns4",
3104
+ "ns5",
3105
+ "ns6",
3106
+ "ns7",
3107
+ "ns8",
3108
+ "ns9",
3109
+ "null",
3110
+ "oauth",
3111
+ "oauth_clients",
3112
+ "offer",
3113
+ "offers",
3114
+ "official",
3115
+ "old",
3116
+ "online",
3117
+ "openid",
3118
+ "operator",
3119
+ "order",
3120
+ "orders",
3121
+ "organization",
3122
+ "organizations",
3123
+ "overview",
3124
+ "owner",
3125
+ "owners",
3126
+ "page",
3127
+ "pager",
3128
+ "pages",
3129
+ "panel",
3130
+ "password",
3131
+ "payment",
3132
+ "perl",
3133
+ "phone",
3134
+ "photo",
3135
+ "photoalbum",
3136
+ "photos",
3137
+ "php",
3138
+ "phpmyadmin",
3139
+ "phppgadmin",
3140
+ "phpredisadmin",
3141
+ "pic",
3142
+ "pics",
3143
+ "ping",
3144
+ "plan",
3145
+ "plans",
3146
+ "plugin",
3147
+ "plugins",
3148
+ "policy",
3149
+ "pop",
3150
+ "pop3",
3151
+ "popular",
3152
+ "portal",
3153
+ "post",
3154
+ "postfix",
3155
+ "postmaster",
3156
+ "posts",
3157
+ "pr",
3158
+ "premium",
3159
+ "press",
3160
+ "price",
3161
+ "pricing",
3162
+ "privacy",
3163
+ "privacy-policy",
3164
+ "privacy_policy",
3165
+ "privacypolicy",
3166
+ "private",
3167
+ "product",
3168
+ "products",
3169
+ "profile",
3170
+ "project",
3171
+ "projects",
3172
+ "promo",
3173
+ "pub",
3174
+ "public",
3175
+ "purpose",
3176
+ "put",
3177
+ "python",
3178
+ "query",
3179
+ "random",
3180
+ "ranking",
3181
+ "read",
3182
+ "readme",
3183
+ "recent",
3184
+ "recruit",
3185
+ "recruitment",
3186
+ "register",
3187
+ "registration",
3188
+ "release",
3189
+ "remove",
3190
+ "replies",
3191
+ "report",
3192
+ "reports",
3193
+ "repositories",
3194
+ "repository",
3195
+ "req",
3196
+ "request",
3197
+ "requests",
3198
+ "reset",
3199
+ "roc",
3200
+ "root",
3201
+ "rss",
3202
+ "ruby",
3203
+ "rule",
3204
+ "sag",
3205
+ "sale",
3206
+ "sales",
3207
+ "sample",
3208
+ "samples",
3209
+ "save",
3210
+ "school",
3211
+ "script",
3212
+ "scripts",
3213
+ "search",
3214
+ "secure",
3215
+ "security",
3216
+ "self",
3217
+ "send",
3218
+ "server",
3219
+ "server-info",
3220
+ "server-status",
3221
+ "service",
3222
+ "services",
3223
+ "session",
3224
+ "sessions",
3225
+ "setting",
3226
+ "settings",
3227
+ "setup",
3228
+ "share",
3229
+ "shop",
3230
+ "show",
3231
+ "sign-in",
3232
+ "sign-up",
3233
+ "sign_in",
3234
+ "sign_up",
3235
+ "signin",
3236
+ "signout",
3237
+ "signup",
3238
+ "site",
3239
+ "sitemap",
3240
+ "sites",
3241
+ "smartphone",
3242
+ "smtp",
3243
+ "soporte",
3244
+ "source",
3245
+ "spec",
3246
+ "special",
3247
+ "sql",
3248
+ "src",
3249
+ "ssh",
3250
+ "ssl",
3251
+ "ssladmin",
3252
+ "ssladministrator",
3253
+ "sslwebmaster",
3254
+ "staff",
3255
+ "stage",
3256
+ "staging",
3257
+ "start",
3258
+ "stat",
3259
+ "state",
3260
+ "static",
3261
+ "stats",
3262
+ "status",
3263
+ "store",
3264
+ "stores",
3265
+ "stories",
3266
+ "style",
3267
+ "styleguide",
3268
+ "stylesheet",
3269
+ "stylesheets",
3270
+ "subdomain",
3271
+ "subscribe",
3272
+ "subscriptions",
3273
+ "suporte",
3274
+ "support",
3275
+ "svn",
3276
+ "swf",
3277
+ "sys",
3278
+ "sysadmin",
3279
+ "sysadministrator",
3280
+ "system",
3281
+ "tablet",
3282
+ "tablets",
3283
+ "tag",
3284
+ "talk",
3285
+ "task",
3286
+ "tasks",
3287
+ "team",
3288
+ "teams",
3289
+ "tech",
3290
+ "telnet",
3291
+ "term",
3292
+ "terms",
3293
+ "terms-of-service",
3294
+ "terms_of_service",
3295
+ "termsofservice",
3296
+ "test",
3297
+ "test1",
3298
+ "test2",
3299
+ "test3",
3300
+ "teste",
3301
+ "testing",
3302
+ "tests",
3303
+ "theme",
3304
+ "themes",
3305
+ "thread",
3306
+ "threads",
3307
+ "tmp",
3308
+ "todo",
3309
+ "tool",
3310
+ "tools",
3311
+ "top",
3312
+ "topic",
3313
+ "topics",
3314
+ "tos",
3315
+ "tour",
3316
+ "translations",
3317
+ "trends",
3318
+ "tutorial",
3319
+ "tux",
3320
+ "tv",
3321
+ "twitter",
3322
+ "undef",
3323
+ "unfollow",
3324
+ "unsubscribe",
3325
+ "update",
3326
+ "upload",
3327
+ "uploads",
3328
+ "url",
3329
+ "usage",
3330
+ "user",
3331
+ "username",
3332
+ "users",
3333
+ "usuario",
3334
+ "vendas",
3335
+ "ver",
3336
+ "version",
3337
+ "video",
3338
+ "videos",
3339
+ "visitor",
3340
+ "watch",
3341
+ "weather",
3342
+ "web",
3343
+ "webhook",
3344
+ "webhooks",
3345
+ "webmail",
3346
+ "webmaster",
3347
+ "website",
3348
+ "websites",
3349
+ "welcome",
3350
+ "widget",
3351
+ "widgets",
3352
+ "wiki",
3353
+ "win",
3354
+ "windows",
3355
+ "word",
3356
+ "work",
3357
+ "works",
3358
+ "workshop",
3359
+ "ww",
3360
+ "wws",
3361
+ "www",
3362
+ "www1",
3363
+ "www2",
3364
+ "www3",
3365
+ "www4",
3366
+ "www5",
3367
+ "www6",
3368
+ "www7",
3369
+ "wwws",
3370
+ "wwww",
3371
+ "xfn",
3372
+ "xml",
3373
+ "xmpp",
3374
+ "xpg",
3375
+ "xxx",
3376
+ "yaml",
3377
+ "year",
3378
+ "yml",
3379
+ "you",
3380
+ "yourdomain",
3381
+ "yourname",
3382
+ "yoursite",
3383
+ "yourusername",
3384
+ "latest",
3385
+ "live",
3386
+ "preview",
3387
+ "learn",
3388
+ "supernova",
3389
+ "super-nova"
3390
+ ];
3391
+ var RESERVED_SLUGS_SET = new Set(RESERVED_SLUGS);
3392
+
3393
+ // src/api/conversion/documentation/documentation-page-to-dto-utils.ts
3394
+ function buildDocPagePublishPaths(groups, pages) {
3395
+ const groupPersistentIdToGroupMap = mapByUnique(groups, (group) => group.persistentId);
3396
+ const result = /* @__PURE__ */ new Map();
3397
+ for (const page of pages) {
3398
+ const parentChain = calculateElementParentChain(page.parentPersistentId, groupPersistentIdToGroupMap);
3399
+ let pathV1 = `${page.userSlug || page.slug}.html`;
3400
+ let pathV2 = `${slugify(page.meta.name)}-${page.shortPersistentId}`;
3401
+ for (const parent of parentChain) {
3402
+ if (!parent.parentPersistentId)
3403
+ continue;
3404
+ pathV1 = `${parent.userSlug || parent.slug}/${pathV1}`;
3405
+ pathV2 = `${slugify(parent.meta.name)}/${pathV2}`;
3406
+ }
3407
+ pathV1 = `/${pathV1}`;
3408
+ pathV2 = `/${pathV2}`;
3409
+ result.set(page.persistentId, pathV2);
3410
+ }
3411
+ return result;
3412
+ }
3413
+ function calculateElementParentChain(elementParentPersistentId, groupPersistentIdToGroupMap) {
3414
+ const result = [];
3415
+ let parentId = elementParentPersistentId;
3416
+ while (parentId) {
3417
+ const parent = groupPersistentIdToGroupMap.get(parentId);
3418
+ if (parent)
3419
+ result.push(parent);
3420
+ parentId = parent?.parentPersistentId;
3421
+ }
3422
+ return result;
3423
+ }
3424
+
3425
+ // src/api/conversion/documentation/documentation-page-v2-to-dto.ts
3426
+ function documentationPagesToStructureDTOV2(pages, groups) {
3427
+ const pathsMap = buildDocPagePublishPaths(groups, pages);
3428
+ return pages.map((page) => documentationPageToStructureDTOV2(page, pathsMap));
3429
+ }
3430
+ function documentationPagesToDTOV2(pages, groups) {
3431
+ const pathsMap = buildDocPagePublishPaths(groups, pages);
3432
+ return pages.map((page) => {
3433
+ return {
3434
+ ...documentationPageToStructureDTOV2(page, pathsMap),
3435
+ configuration: page.data.configuration ?? {
3436
+ showSidebar: true,
3437
+ header: defaultDocumentationItemHeader
3438
+ }
3439
+ };
3440
+ });
3441
+ }
3442
+ function documentationPageToStructureDTOV2(page, pagePathMap) {
3443
+ let path = pagePathMap.get(page.persistentId);
3444
+ if (!path)
3445
+ throw new Error(`Path for page ${page.id} was not calculated`);
3446
+ if (path.startsWith("/"))
3447
+ path = path.substring(1);
3448
+ return {
3449
+ id: page.id,
3450
+ designSystemVersionId: page.designSystemVersionId,
3451
+ persistentId: page.persistentId,
3452
+ shortPersistentId: page.shortPersistentId,
3453
+ title: page.meta.name,
3454
+ slug: page.slug,
3455
+ userSlug: page.userSlug,
3456
+ createdAt: page.createdAt,
3457
+ updatedAt: page.updatedAt,
3458
+ path
3459
+ };
3460
+ }
3461
+
3462
+ // src/api/conversion/documentation/documentation-group-to-dto.ts
3463
+ function elementGroupsToDocumentationGroupStructureDTO(groups, pages) {
3464
+ const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
3465
+ return groups.map((group) => elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap));
3466
+ }
3467
+ function elementGroupsToDocumentationGroupDTO(groups, pages) {
3468
+ const childrenIdsMap = calculateChildrenIdsMap(pages, groups);
3469
+ return groups.map((group) => {
3470
+ return {
3471
+ ...elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap),
3472
+ configuration: group.data?.configuration ?? {
3473
+ showSidebar: true,
3474
+ header: defaultDocumentationItemHeader
3475
+ }
3476
+ };
3477
+ });
3478
+ }
3479
+ function elementGroupToDocumentationGroupStructureDTO(group, childrenIdsMap) {
3480
+ const childrenIds = childrenIdsMap.get(group.persistentId) ?? [];
3481
+ if (!group.shortPersistentId) {
3482
+ throw new Error(`Short persistent id is required for docs groups, group id: ${group.id}`);
3483
+ }
3484
+ return {
3485
+ id: group.id,
3486
+ designSystemVersionId: group.designSystemVersionId,
3487
+ persistentId: group.persistentId,
3488
+ slug: group.slug,
3489
+ userSlug: group.userSlug,
3490
+ createdAt: group.createdAt,
3491
+ updatedAt: group.updatedAt,
3492
+ title: group.meta.name,
3493
+ childrenIds,
3494
+ isRoot: !group.parentPersistentId,
3495
+ groupBehavior: group.data?.behavior ?? "Group",
3496
+ shortPersistentId: group.shortPersistentId
3497
+ };
3498
+ }
3499
+ function calculateChildrenIdsMap(elements, groups) {
3500
+ const byParentId = groupBy([...elements, ...groups], (e) => e.parentPersistentId);
3501
+ const childrenIdsMap = /* @__PURE__ */ new Map();
3502
+ for (const [parentPersistentId, children] of byParentId) {
3503
+ if (!parentPersistentId)
3504
+ continue;
3505
+ children.sort((lhs, rhs) => lhs.sortOrder - rhs.sortOrder);
3506
+ childrenIdsMap.set(
3507
+ parentPersistentId,
3508
+ children.map((c) => c.persistentId)
3509
+ );
3510
+ }
3511
+ return childrenIdsMap;
3512
+ }
3513
+
3514
+ // src/api/conversion/documentation/documentation-elements-to-hierarchy-v2-dto.ts
3515
+ function documentationElementsToHierarchyDto(docPages, docGroups) {
3516
+ return {
3517
+ pages: documentationPagesToStructureDTOV2(docPages, docGroups),
3518
+ groups: elementGroupsToDocumentationGroupStructureDTO(docGroups, docPages)
3519
+ };
3520
+ }
3521
+
3522
+ // src/api/conversion/documentation/documentation-page-v1-to-dto.ts
3523
+ function documentationPagesToDTOV1(pages, groups) {
3524
+ const pathsMap = buildDocPagePublishPaths(groups, pages);
3525
+ return pages.map((page) => {
3526
+ let path = pathsMap.get(page.persistentId);
3527
+ if (!path)
3528
+ throw SupernovaException.conflict(`Path for page ${page.id} was not calculated`);
3529
+ if (path.startsWith("/"))
3530
+ path = path.substring(1);
3531
+ return {
3532
+ id: page.id,
3533
+ designSystemVersionId: page.designSystemVersionId,
3534
+ persistentId: page.persistentId,
3535
+ shortPersistentId: page.shortPersistentId,
3536
+ title: page.meta.name,
3537
+ blocks: page.data.blocks,
3538
+ slug: page.slug,
3539
+ userSlug: page.userSlug,
3540
+ configuration: page.data.configuration ?? {
3541
+ showSidebar: true,
3542
+ header: defaultDocumentationItemHeader
3543
+ },
3544
+ createdAt: page.createdAt,
3545
+ updatedAt: page.updatedAt,
3546
+ path
3547
+ };
3548
+ });
3549
+ }
2677
3550
 
2678
- // src/api/dto/design-system.ts
2679
- var DesignSystemDTO = DesignSystem.omit({
3551
+ // src/api/dto/design-systems/design-system.ts
3552
+ var DTODesignSystem = DesignSystem.omit({
2680
3553
  name: true,
2681
3554
  description: true
2682
3555
  }).extend({
2683
3556
  meta: ObjectMeta
2684
3557
  });
2685
3558
 
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
3559
+ // src/api/dto/elements/documentation/group-action.ts
2702
3560
  import { z as z127 } from "zod";
2703
- var DocumentationGroupStructureDTO = ElementGroup.omit({
3561
+
3562
+ // src/api/dto/elements/documentation/group.ts
3563
+ import { z as z126 } from "zod";
3564
+ var DTODocumentationGroupStructure = ElementGroup.omit({
2704
3565
  sortOrder: true,
2705
3566
  parentPersistentId: true,
2706
3567
  brandPersistentId: true,
@@ -2709,92 +3570,284 @@ var DocumentationGroupStructureDTO = ElementGroup.omit({
2709
3570
  data: true,
2710
3571
  shortPersistentId: true
2711
3572
  }).extend({
2712
- title: z127.string(),
2713
- isRoot: z127.boolean(),
2714
- childrenIds: z127.array(z127.string()),
3573
+ title: z126.string(),
3574
+ isRoot: z126.boolean(),
3575
+ childrenIds: z126.array(z126.string()),
2715
3576
  groupBehavior: DocumentationGroupBehavior,
2716
- shortPersistentId: z127.string()
3577
+ shortPersistentId: z126.string()
2717
3578
  });
2718
- var DocumentationGroupDTO = DocumentationGroupStructureDTO.extend({
3579
+ var DTODocumentationGroup = DTODocumentationGroupStructure.extend({
2719
3580
  configuration: DocumentationItemConfiguration
2720
3581
  });
3582
+ var DTOCreateDocumentationGroupInput = z126.object({
3583
+ // Identifier
3584
+ persistentId: z126.string().uuid(),
3585
+ // Group properties
3586
+ title: z126.string(),
3587
+ configuration: DocumentationItemConfiguration.optional(),
3588
+ groupBehavior: DocumentationGroupBehavior,
3589
+ // Group placement properties
3590
+ afterPersistentId: z126.string().uuid().optional(),
3591
+ parentPersistentId: z126.string().uuid()
3592
+ });
3593
+ var DTOUpdateDocumentationGroupInput = z126.object({
3594
+ // Identifier of the group to update
3595
+ id: z126.string().uuid(),
3596
+ // Group properties
3597
+ title: z126.string().optional(),
3598
+ configuration: DocumentationItemConfiguration.optional()
3599
+ });
3600
+ var DTODuplicateDocumentationGroupInput = z126.object({
3601
+ // Identifier of the group to duplicate from
3602
+ id: z126.string(),
3603
+ // New group persistent id
3604
+ persistentId: z126.string().uuid(),
3605
+ // Group placement properties
3606
+ afterPersistentId: z126.string().uuid().optional(),
3607
+ parentPersistentId: z126.string().uuid()
3608
+ });
3609
+ var DTODeleteDocumentationGroupInput = z126.object({
3610
+ // Identifier
3611
+ id: z126.string(),
3612
+ // Deletion options
3613
+ deleteSubtree: z126.boolean().default(false)
3614
+ });
2721
3615
 
2722
- // src/api/dto/documentation-v2.ts
3616
+ // src/api/dto/elements/documentation/group-action.ts
3617
+ var DTODocumentationGroupCreateActionOutputV2 = z127.object({
3618
+ type: z127.literal("DocumentationGroupCreate"),
3619
+ output: DTODocumentationGroup
3620
+ });
3621
+ var DTODocumentationGroupUpdateActionOutputV2 = z127.object({
3622
+ type: z127.literal("DocumentationGroupUpdate"),
3623
+ output: DTODocumentationGroup
3624
+ });
3625
+ var DTODocumentationGroupDuplicateActionOutputV2 = z127.object({
3626
+ type: z127.literal("DocumentationGroupDuplicate"),
3627
+ output: DTODocumentationGroup
3628
+ });
3629
+ var DTODocumentationGroupDeleteActionOutputV2 = z127.object({
3630
+ type: z127.literal("DocumentationGroupDelete"),
3631
+ output: z127.string()
3632
+ });
3633
+ var DTODocumentationGroupCreateActionInputV2 = z127.object({
3634
+ type: z127.literal("DocumentationGroupCreate"),
3635
+ input: DTOCreateDocumentationGroupInput
3636
+ });
3637
+ var DTODocumentationGroupUpdateActionInputV2 = z127.object({
3638
+ type: z127.literal("DocumentationGroupUpdate"),
3639
+ input: DTOUpdateDocumentationGroupInput
3640
+ });
3641
+ var DTODocumentationGroupDuplicateActionInputV2 = z127.object({
3642
+ type: z127.literal("DocumentationGroupDuplicate"),
3643
+ input: DTODuplicateDocumentationGroupInput
3644
+ });
3645
+ var DTODocumentationGroupDeleteActionInputV2 = z127.object({
3646
+ type: z127.literal("DocumentationGroupDelete"),
3647
+ input: DTODeleteDocumentationGroupInput
3648
+ });
3649
+
3650
+ // src/api/dto/elements/documentation/group-bulk-action.ts
3651
+ import { z as z128 } from "zod";
3652
+ var DTODocumentationGroupBulkActionOutputV2 = z128.object({
3653
+ created: z128.array(DTODocumentationGroup),
3654
+ updated: z128.array(DTODocumentationGroup),
3655
+ deleted: z128.array(z128.string())
3656
+ });
3657
+ var DTODocumentationGroupBulkActionInputV2 = z128.object({
3658
+ create: z128.array(DTOCreateDocumentationGroupInput).optional(),
3659
+ update: z128.array(DTOUpdateDocumentationGroupInput).optional(),
3660
+ duplicate: z128.array(DTODuplicateDocumentationGroupInput).optional(),
3661
+ delete: z128.array(z128.string()).optional()
3662
+ });
3663
+
3664
+ // src/api/dto/elements/documentation/page-actions-v2.ts
3665
+ import { z as z130 } from "zod";
3666
+
3667
+ // src/api/dto/elements/documentation/page-v2.ts
3668
+ import { z as z129 } from "zod";
2723
3669
  var DTODocumentationPageStructureV2 = DocumentationPageV2.omit({
2724
3670
  data: true,
2725
3671
  meta: true,
2726
3672
  parentPersistentId: true,
2727
3673
  sortOrder: true
2728
3674
  }).extend({
2729
- title: z128.string(),
2730
- path: z128.string()
3675
+ title: z129.string(),
3676
+ path: z129.string()
2731
3677
  });
2732
- var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend(DocumentationPageV2.shape.data.shape);
2733
- var DTODocumentationHierarchyV2 = z128.object({
2734
- pages: z128.array(DTODocumentationPageStructureV2),
2735
- groups: z128.array(DocumentationGroupStructureDTO)
3678
+ var DTODocumentationPageV2 = DTODocumentationPageStructureV2.extend({
3679
+ configuration: DocumentationItemConfiguration
2736
3680
  });
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(),
3681
+ var DTODocumentationHierarchyV2 = z129.object({
3682
+ pages: z129.array(DTODocumentationPageStructureV2),
3683
+ groups: z129.array(DTODocumentationGroupStructure)
3684
+ });
3685
+ var DTOCreateDocumentationPageInputV2 = z129.object({
3686
+ // Identifier
2742
3687
  persistentId: z129.string().uuid(),
3688
+ // Page properties
2743
3689
  title: z129.string(),
2744
3690
  configuration: DocumentationItemConfiguration.optional(),
3691
+ // Page placement properties
3692
+ parentPersistentId: z129.string().uuid(),
2745
3693
  afterPersistentId: z129.string().uuid().optional()
2746
3694
  });
2747
- var DTOUpdateDocumentationPageInput = z129.object({
3695
+ var DTOUpdateDocumentationPageInputV2 = z129.object({
3696
+ // Identifier of the group to update
2748
3697
  id: z129.string(),
3698
+ // Page properties
2749
3699
  title: z129.string().optional(),
2750
3700
  configuration: DocumentationItemConfiguration.optional(),
3701
+ // Page placement properties
2751
3702
  parentPersistentId: z129.string().optional(),
2752
3703
  afterPersistentId: z129.string().optional()
2753
3704
  });
2754
- var DTODuplicateDocumentationPageInput = z129.object({
3705
+ var DTODuplicateDocumentationPageInputV2 = z129.object({
3706
+ // Identifier of the page to duplicate from
2755
3707
  id: z129.string(),
3708
+ // New page persistent id
2756
3709
  persistentId: z129.string().uuid(),
3710
+ // Page placement properties
2757
3711
  parentPersistentId: z129.string().uuid(),
2758
3712
  afterPersistentId: z129.string().uuid().optional()
2759
3713
  });
2760
- var DTODocumentationTransactionInput = 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()
2765
- });
2766
- var DTOElementsTransactionInput = z129.object({
2767
- documentationPages: DTODocumentationTransactionInput
3714
+ var DTODeleteDocumentationPageInputV2 = z129.object({
3715
+ // Identifier
3716
+ id: z129.string()
2768
3717
  });
2769
3718
 
2770
- // src/api/requests/post-liveblocks-auth.ts
2771
- import { z as z130 } from "zod";
2772
- var PostLiveblocksAuth = z130.object({
2773
- room: z130.string()
3719
+ // src/api/dto/elements/documentation/page-actions-v2.ts
3720
+ var DTODocumentationPageCreateActionOutputV2 = z130.object({
3721
+ type: z130.literal("DocumentationPageCreate"),
3722
+ output: DTODocumentationPageV2
3723
+ });
3724
+ var DTODocumentationPageUpdateActionOutputV2 = z130.object({
3725
+ type: z130.literal("DocumentationPageUpdate"),
3726
+ output: DTODocumentationPageV2
3727
+ });
3728
+ var DTODocumentationPageDuplicateActionOutputV2 = z130.object({
3729
+ type: z130.literal("DocumentationPageDuplicate"),
3730
+ output: DTODocumentationPageV2
3731
+ });
3732
+ var DTODocumentationPageDeleteActionOutputV2 = z130.object({
3733
+ type: z130.literal("DocumentationPageDelete"),
3734
+ output: z130.string()
3735
+ });
3736
+ var DTODocumentationPageCreateActionInputV2 = z130.object({
3737
+ type: z130.literal("DocumentationPageCreate"),
3738
+ input: DTOCreateDocumentationPageInputV2
3739
+ });
3740
+ var DTODocumentationPageUpdateActionInputV2 = z130.object({
3741
+ type: z130.literal("DocumentationPageUpdate"),
3742
+ input: DTOUpdateDocumentationPageInputV2
3743
+ });
3744
+ var DTODocumentationPageDuplicateActionInputV2 = z130.object({
3745
+ type: z130.literal("DocumentationPageDuplicate"),
3746
+ input: DTODuplicateDocumentationPageInputV2
3747
+ });
3748
+ var DTODocumentationPageDeleteActionInputV2 = z130.object({
3749
+ type: z130.literal("DocumentationPageDelete"),
3750
+ input: DTODeleteDocumentationPageInputV2
2774
3751
  });
2775
3752
 
2776
- // src/api/responses/get-block-definitions.ts
3753
+ // src/api/dto/elements/documentation/page-bulk-action-v2.ts
2777
3754
  import { z as z131 } from "zod";
2778
- var GetBlockDefinitionsResponse = z131.object({
2779
- definitions: z131.array(PageBlockDefinition)
3755
+ var DTODocumentationPageBulkActionOutputV2 = z131.object({
3756
+ created: z131.array(DTODocumentationPageV2),
3757
+ updated: z131.array(DTODocumentationPageV2),
3758
+ deleted: z131.array(z131.string())
3759
+ });
3760
+ var DTODocumentationPageBulkActionInputV2 = z131.object({
3761
+ create: z131.array(DTOCreateDocumentationPageInputV2).optional(),
3762
+ update: z131.array(DTOUpdateDocumentationPageInputV2).optional(),
3763
+ duplicate: z131.array(DTODuplicateDocumentationPageInputV2).optional(),
3764
+ delete: z131.array(DTODeleteDocumentationPageInputV2).optional()
3765
+ });
3766
+
3767
+ // src/api/dto/elements/documentation/page-v1.ts
3768
+ import { z as z132 } from "zod";
3769
+ var DocumentationPageV1DTO = DocumentationPageV1.omit({
3770
+ data: true,
3771
+ meta: true,
3772
+ parentPersistentId: true,
3773
+ sortOrder: true
3774
+ }).extend(DocumentationPageV1.shape.data.shape).extend({
3775
+ title: z132.string(),
3776
+ path: z132.string()
2780
3777
  });
2781
3778
 
2782
- // src/design-system-content/documentation-hierarchy.ts
2783
- function documentationHierarchyToYjs(doc, documentationHierarchy, itemsToDelete) {
3779
+ // src/api/dto/elements/elements-action-v2.ts
3780
+ import { z as z133 } from "zod";
3781
+ var DTOElementActionOutput = z133.discriminatedUnion("type", [
3782
+ // Documentation pages
3783
+ DTODocumentationPageCreateActionOutputV2,
3784
+ DTODocumentationPageUpdateActionOutputV2,
3785
+ DTODocumentationPageDuplicateActionOutputV2,
3786
+ DTODocumentationPageDeleteActionOutputV2,
3787
+ // Documentation groups
3788
+ DTODocumentationGroupCreateActionOutputV2,
3789
+ DTODocumentationGroupUpdateActionOutputV2,
3790
+ DTODocumentationGroupDuplicateActionOutputV2,
3791
+ DTODocumentationGroupDeleteActionOutputV2
3792
+ ]);
3793
+ var DTOElementActionInput = z133.discriminatedUnion("type", [
3794
+ // Documentation pages
3795
+ DTODocumentationPageCreateActionInputV2,
3796
+ DTODocumentationPageUpdateActionInputV2,
3797
+ DTODocumentationPageDuplicateActionInputV2,
3798
+ DTODocumentationPageDeleteActionInputV2,
3799
+ // Documentation groups
3800
+ DTODocumentationGroupCreateActionInputV2,
3801
+ DTODocumentationGroupUpdateActionInputV2,
3802
+ DTODocumentationGroupDuplicateActionInputV2,
3803
+ DTODocumentationGroupDeleteActionInputV2
3804
+ ]);
3805
+
3806
+ // src/api/dto/elements/elements-bulk-action-v2.ts
3807
+ import { z as z134 } from "zod";
3808
+ var DTOElementsBulkActionOutputV2 = z134.object({
3809
+ documentationPages: DTODocumentationPageBulkActionOutputV2
3810
+ });
3811
+ var DTOElementsBulkActionInputV2 = z134.object({
3812
+ documentationPages: DTODocumentationPageBulkActionInputV2
3813
+ });
3814
+
3815
+ // src/api/payloads/documentation/block-definitions.ts
3816
+ import { z as z135 } from "zod";
3817
+ var DTOGetBlockDefinitionsOutput = z135.object({
3818
+ definitions: z135.array(PageBlockDefinition)
3819
+ });
3820
+
3821
+ // src/api/payloads/liveblocks/auth.ts
3822
+ import { z as z136 } from "zod";
3823
+ var DTOLiveblocksAuthRequest = z136.object({
3824
+ room: z136.string()
3825
+ });
3826
+
3827
+ // src/yjs/design-system-content/documentation-hierarchy.ts
3828
+ function documentationHierarchyToYjs(doc, transaction) {
2784
3829
  doc.transact((trx) => {
2785
3830
  const pagesMap = getPagesYMap(trx.doc);
2786
- itemsToDelete.pagePersistentIdsToDelete.forEach((persistentId) => {
2787
- pagesMap.delete(persistentId);
3831
+ transaction.pageIdsToDelete.forEach((pageId) => {
3832
+ pagesMap.delete(pageId);
2788
3833
  });
2789
- documentationHierarchy.pages.forEach((page) => {
2790
- pagesMap.set(page.persistentId, page);
3834
+ transaction.pages.forEach((page) => {
3835
+ const sanitizedPage = {
3836
+ ...page,
3837
+ data: {}
3838
+ };
3839
+ pagesMap.set(page.id, sanitizedPage);
2791
3840
  });
2792
3841
  const groupsMap = getGroupsYMap(trx.doc);
2793
- itemsToDelete.groupPersistentIdsToDelete.forEach((persistentId) => {
2794
- groupsMap.delete(persistentId);
3842
+ transaction.groupIdsToDelete.forEach((id) => {
3843
+ groupsMap.delete(id);
2795
3844
  });
2796
- documentationHierarchy.groups.forEach((group) => {
2797
- groupsMap.set(group.persistentId, group);
3845
+ transaction.groups.forEach((group) => {
3846
+ const sanitizedGroup = {
3847
+ ...group,
3848
+ data: {}
3849
+ };
3850
+ groupsMap.set(group.id, group);
2798
3851
  });
2799
3852
  });
2800
3853
  return doc;
@@ -2804,16 +3857,14 @@ function yjsToDocumentationHierarchy(doc) {
2804
3857
  const groupsMap = getGroupsYMap(doc);
2805
3858
  const pages = [];
2806
3859
  pagesMap.forEach((page) => {
2807
- pages.push(DTODocumentationPageStructureV2.parse(page));
3860
+ pages.push(DocumentationPageV2.parse(page));
2808
3861
  });
2809
3862
  const groups = [];
2810
3863
  groupsMap.forEach((group) => {
2811
- groups.push(DocumentationGroupStructureDTO.parse(group));
3864
+ groups.push(ElementGroup.parse(group));
2812
3865
  });
2813
- return {
2814
- pages,
2815
- groups
2816
- };
3866
+ const hierarchy = documentationElementsToHierarchyDto(pages, groups);
3867
+ return hierarchy;
2817
3868
  }
2818
3869
  function getPagesYMap(doc) {
2819
3870
  return doc.getMap("documentationPages");
@@ -2822,7 +3873,7 @@ function getGroupsYMap(doc) {
2822
3873
  return doc.getMap("documentationGroups");
2823
3874
  }
2824
3875
 
2825
- // src/design-system-content/item-configuration.ts
3876
+ // src/yjs/design-system-content/item-configuration.ts
2826
3877
  function itemConfigurationToYjs(yDoc, item) {
2827
3878
  yDoc.transact((trx) => {
2828
3879
  const header = item.header;
@@ -2865,20 +3916,20 @@ function yjsToItemConfiguration(yDoc) {
2865
3916
  return DocumentationItemConfiguration.parse(rawConfig);
2866
3917
  }
2867
3918
 
2868
- // src/docs-editor/model/block.ts
2869
- import { z as z132 } from "zod";
2870
- var PageBlockEditorModel = z132.object({
2871
- id: z132.string(),
3919
+ // src/yjs/docs-editor/model/block.ts
3920
+ import { z as z137 } from "zod";
3921
+ var PageBlockEditorModel = z137.object({
3922
+ id: z137.string(),
2872
3923
  data: PageBlockDataV2
2873
3924
  });
2874
3925
 
2875
- // src/docs-editor/model/page.ts
2876
- import { z as z133 } from "zod";
2877
- var DocumentationPageEditorModel = z133.object({
2878
- blocks: z133.array(PageBlockEditorModel)
3926
+ // src/yjs/docs-editor/model/page.ts
3927
+ import { z as z138 } from "zod";
3928
+ var DocumentationPageEditorModel = z138.object({
3929
+ blocks: z138.array(PageBlockEditorModel)
2879
3930
  });
2880
3931
 
2881
- // src/docs-editor/prosemirror/schema.ts
3932
+ // src/yjs/docs-editor/prosemirror/schema.ts
2882
3933
  import { Schema } from "prosemirror-model";
2883
3934
  var newSchema = {
2884
3935
  nodes: {
@@ -3554,7 +4605,7 @@ var newSchema = {
3554
4605
  };
3555
4606
  var pmSchema = new Schema(newSchema);
3556
4607
 
3557
- // src/docs-editor/utils.ts
4608
+ // src/yjs/docs-editor/utils.ts
3558
4609
  var BlockParsingUtils = {
3559
4610
  singleBlockItem(block) {
3560
4611
  if (!block.data.items.length)
@@ -3639,7 +4690,7 @@ var BlockDefinitionUtils = {
3639
4690
  }
3640
4691
  };
3641
4692
 
3642
- // src/docs-editor/blocks-to-prosemirror.ts
4693
+ // src/yjs/docs-editor/blocks-to-prosemirror.ts
3643
4694
  import { prosemirrorJSONToYXmlFragment } from "y-prosemirror";
3644
4695
  function pageToYXmlFragment(page, definitions, fragment) {
3645
4696
  const doc = pageToProsemirrorDoc(page, definitions);
@@ -4013,7 +5064,7 @@ function nonNullFilter(item) {
4013
5064
  return !!item;
4014
5065
  }
4015
5066
 
4016
- // src/docs-editor/mock.ts
5067
+ // src/yjs/docs-editor/mock.ts
4017
5068
  function getMockPageBlockDefinitions() {
4018
5069
  return blocks;
4019
5070
  }
@@ -6506,9 +7557,9 @@ var blocks = [
6506
7557
  }
6507
7558
  ];
6508
7559
 
6509
- // src/docs-editor/prosemirror-to-blocks.ts
7560
+ // src/yjs/docs-editor/prosemirror-to-blocks.ts
6510
7561
  import { yXmlFragmentToProsemirrorJSON } from "y-prosemirror";
6511
- import { z as z134 } from "zod";
7562
+ import { z as z139 } from "zod";
6512
7563
  function yDocToPage(yDoc, definitions) {
6513
7564
  return yXmlFragmentToPage(yDoc.getXmlFragment("default"), definitions);
6514
7565
  }
@@ -6517,10 +7568,10 @@ function yXmlFragmentToPage(fragment, definitions) {
6517
7568
  return prosemirrorDocToPage(prosemirrorJson, definitions);
6518
7569
  }
6519
7570
  function prosemirrorDocToPage(prosemirrorDoc, definitions) {
6520
- const definitionsById = mapByUnique(definitions, (d) => d.id);
7571
+ const definitionsById = mapByUnique2(definitions, (d) => d.id);
6521
7572
  return {
6522
7573
  blocks: (prosemirrorDoc.content ?? []).map((prosemirrorNode) => {
6523
- const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", z134.string());
7574
+ const definitionId = getProsemirrorAttribute(prosemirrorNode, "definitionId", z139.string());
6524
7575
  if (!definitionId) {
6525
7576
  console.warn(
6526
7577
  `definitionId on ${prosemirrorNode.type} is required to be interpreted as a block, skipping node`
@@ -6562,7 +7613,7 @@ function parseAsRichText(prosemirrorNode, definition, property) {
6562
7613
  if (!id)
6563
7614
  return null;
6564
7615
  const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
6565
- const calloutType = parseCalloutType(getProsemirrorAttribute(prosemirrorNode, "type", z134.string().optional()));
7616
+ const calloutType = parseCalloutType(getProsemirrorAttribute(prosemirrorNode, "type", z139.string().optional()));
6566
7617
  return {
6567
7618
  // TODO Artem: indent
6568
7619
  id,
@@ -6662,8 +7713,8 @@ function parseRichTextAttribute(mark) {
6662
7713
  case "code":
6663
7714
  return { type: "Code" };
6664
7715
  case "link":
6665
- const itemId = getProsemirrorAttribute(mark, "itemId", z134.string().optional());
6666
- const href = getProsemirrorAttribute(mark, "href", z134.string().optional());
7716
+ const itemId = getProsemirrorAttribute(mark, "itemId", z139.string().optional());
7717
+ const href = getProsemirrorAttribute(mark, "href", z139.string().optional());
6667
7718
  return {
6668
7719
  type: "Link",
6669
7720
  openInNewWindow: mark.attrs?.target !== "_self",
@@ -6678,7 +7729,7 @@ function parseAsTable(prosemirrorNode, definition, property) {
6678
7729
  if (!id)
6679
7730
  return null;
6680
7731
  const variantId = getProsemirrorBlockVariantId(prosemirrorNode);
6681
- const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", z134.boolean().optional()) !== false;
7732
+ const hasBorder = getProsemirrorAttribute(prosemirrorNode, "hasBorder", z139.boolean().optional()) !== false;
6682
7733
  const tableChild = prosemirrorNode.content?.find((c) => c.type === "table");
6683
7734
  if (!tableChild) {
6684
7735
  return emptyTable(id, variantId, 0);
@@ -6724,9 +7775,9 @@ function parseAsTableCell(prosemirrorNode) {
6724
7775
  const id = getProsemirrorBlockId(prosemirrorNode);
6725
7776
  if (!id)
6726
7777
  return null;
6727
- const textAlign = getProsemirrorAttribute(prosemirrorNode, "textAlign", z134.string().optional());
7778
+ const textAlign = getProsemirrorAttribute(prosemirrorNode, "textAlign", z139.string().optional());
6728
7779
  let columnWidth;
6729
- const columnWidthArray = getProsemirrorAttribute(prosemirrorNode, "colwidth", z134.array(z134.number()).optional());
7780
+ const columnWidthArray = getProsemirrorAttribute(prosemirrorNode, "colwidth", z139.array(z139.number()).optional());
6730
7781
  if (columnWidthArray) {
6731
7782
  columnWidth = columnWidthArray[0];
6732
7783
  }
@@ -6760,7 +7811,7 @@ function parseAsTableNode(prosemirrorNode) {
6760
7811
  value: parseRichText(prosemirrorNode.content ?? [])
6761
7812
  };
6762
7813
  case "image":
6763
- const url = getProsemirrorAttribute(prosemirrorNode, "src", z134.string().optional());
7814
+ const url = getProsemirrorAttribute(prosemirrorNode, "src", z139.string().optional());
6764
7815
  if (!url)
6765
7816
  return null;
6766
7817
  return {
@@ -6854,7 +7905,7 @@ function parseAsCustomBlock(prosemirrorNode, definition) {
6854
7905
  };
6855
7906
  }
6856
7907
  function parseBlockItems(prosemirrorNode, definition) {
6857
- const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", z134.string());
7908
+ const itemsString = getProsemirrorAttribute(prosemirrorNode, "items", z139.string());
6858
7909
  if (!itemsString)
6859
7910
  return null;
6860
7911
  const itemsJson = JSON.parse(itemsString);
@@ -6866,11 +7917,11 @@ function parseBlockItems(prosemirrorNode, definition) {
6866
7917
  }
6867
7918
  function parseAppearance(prosemirrorNode) {
6868
7919
  const appearance = {};
6869
- const columns = getProsemirrorAttribute(prosemirrorNode, "columns", z134.number().optional());
7920
+ const columns = getProsemirrorAttribute(prosemirrorNode, "columns", z139.number().optional());
6870
7921
  if (columns) {
6871
7922
  appearance.numberOfColumns = columns;
6872
7923
  }
6873
- const backgroundColor = getProsemirrorAttribute(prosemirrorNode, "backgroundColor", z134.string().optional());
7924
+ const backgroundColor = getProsemirrorAttribute(prosemirrorNode, "backgroundColor", z139.string().optional());
6874
7925
  if (backgroundColor) {
6875
7926
  const parsedColor = PageBlockColorV2.safeParse(JSON.parse(backgroundColor));
6876
7927
  if (parsedColor.success) {
@@ -6961,13 +8012,13 @@ function valueSchemaForPropertyType(type) {
6961
8012
  }
6962
8013
  }
6963
8014
  function getProsemirrorBlockId(prosemirrorNode) {
6964
- const id = getProsemirrorAttribute(prosemirrorNode, "id", z134.string());
8015
+ const id = getProsemirrorAttribute(prosemirrorNode, "id", z139.string());
6965
8016
  if (!id)
6966
8017
  console.warn(`Prosemirror attribute "id" on ${prosemirrorNode.type} is required`);
6967
8018
  return id;
6968
8019
  }
6969
8020
  function getProsemirrorBlockVariantId(prosemirrorNode) {
6970
- return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(z134.string()));
8021
+ return getProsemirrorAttribute(prosemirrorNode, "variantId", nullishToOptional(z139.string()));
6971
8022
  }
6972
8023
  function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchema) {
6973
8024
  const parsedAttr = validationSchema.safeParse(prosemirrorNode.attrs?.[attributeName]);
@@ -6982,7 +8033,7 @@ function getProsemirrorAttribute(prosemirrorNode, attributeName, validationSchem
6982
8033
  function nonNullFilter2(item) {
6983
8034
  return item !== null;
6984
8035
  }
6985
- function mapByUnique(items, keyFn) {
8036
+ function mapByUnique2(items, keyFn) {
6986
8037
  const result = /* @__PURE__ */ new Map();
6987
8038
  for (const item of items) {
6988
8039
  result.set(keyFn(item), item);
@@ -6992,25 +8043,60 @@ function mapByUnique(items, keyFn) {
6992
8043
  export {
6993
8044
  BlockDefinitionUtils,
6994
8045
  BlockParsingUtils,
6995
- DTOCreateDocumentationPageInput,
8046
+ DTOCreateDocumentationGroupInput,
8047
+ DTOCreateDocumentationPageInputV2,
8048
+ DTODeleteDocumentationGroupInput,
8049
+ DTODeleteDocumentationPageInputV2,
8050
+ DTODesignSystem,
8051
+ DTODocumentationGroup,
8052
+ DTODocumentationGroupBulkActionInputV2,
8053
+ DTODocumentationGroupBulkActionOutputV2,
8054
+ DTODocumentationGroupCreateActionInputV2,
8055
+ DTODocumentationGroupCreateActionOutputV2,
8056
+ DTODocumentationGroupDeleteActionInputV2,
8057
+ DTODocumentationGroupDeleteActionOutputV2,
8058
+ DTODocumentationGroupDuplicateActionInputV2,
8059
+ DTODocumentationGroupDuplicateActionOutputV2,
8060
+ DTODocumentationGroupStructure,
8061
+ DTODocumentationGroupUpdateActionInputV2,
8062
+ DTODocumentationGroupUpdateActionOutputV2,
6996
8063
  DTODocumentationHierarchyV2,
8064
+ DTODocumentationPageBulkActionInputV2,
8065
+ DTODocumentationPageBulkActionOutputV2,
8066
+ DTODocumentationPageCreateActionInputV2,
8067
+ DTODocumentationPageCreateActionOutputV2,
8068
+ DTODocumentationPageDeleteActionInputV2,
8069
+ DTODocumentationPageDeleteActionOutputV2,
8070
+ DTODocumentationPageDuplicateActionInputV2,
8071
+ DTODocumentationPageDuplicateActionOutputV2,
6997
8072
  DTODocumentationPageStructureV2,
8073
+ DTODocumentationPageUpdateActionInputV2,
8074
+ DTODocumentationPageUpdateActionOutputV2,
6998
8075
  DTODocumentationPageV2,
6999
- DTODocumentationTransactionInput,
7000
- DTODuplicateDocumentationPageInput,
7001
- DTOElementsTransactionInput,
7002
- DTOUpdateDocumentationPageInput,
7003
- DesignSystemDTO,
7004
- DocumentationGroupDTO,
7005
- DocumentationGroupStructureDTO,
8076
+ DTODuplicateDocumentationGroupInput,
8077
+ DTODuplicateDocumentationPageInputV2,
8078
+ DTOElementActionInput,
8079
+ DTOElementActionOutput,
8080
+ DTOElementsBulkActionInputV2,
8081
+ DTOElementsBulkActionOutputV2,
8082
+ DTOGetBlockDefinitionsOutput,
8083
+ DTOLiveblocksAuthRequest,
8084
+ DTOUpdateDocumentationGroupInput,
8085
+ DTOUpdateDocumentationPageInputV2,
7006
8086
  DocumentationPageEditorModel,
7007
8087
  DocumentationPageV1DTO,
7008
- GetBlockDefinitionsResponse,
7009
8088
  PageBlockEditorModel,
7010
- PostLiveblocksAuth,
7011
8089
  blockDefinitionForBlock,
7012
8090
  blockToProsemirrorNode,
8091
+ buildDocPagePublishPaths,
8092
+ calculateElementParentChain,
8093
+ documentationElementsToHierarchyDto,
7013
8094
  documentationHierarchyToYjs,
8095
+ documentationPagesToDTOV1,
8096
+ documentationPagesToDTOV2,
8097
+ documentationPagesToStructureDTOV2,
8098
+ elementGroupsToDocumentationGroupDTO,
8099
+ elementGroupsToDocumentationGroupStructureDTO,
7014
8100
  getMockPageBlockDefinitions,
7015
8101
  itemConfigurationToYjs,
7016
8102
  pageToProsemirrorDoc,