@kurbo/dkit 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/bin.js +8066 -0
- package/dist/bin.js.map +1 -0
- package/package.json +58 -0
- package/vendor/registry/blocks/blog-detail/module.json +27 -0
- package/vendor/registry/blocks/blog-detail/ui/minimal/next/blog-detail.tsx +26 -0
- package/vendor/registry/blocks/blog-detail/ui/minimal/nuxt/BlogDetail.vue +27 -0
- package/vendor/registry/blocks/blog-detail/ui/shadcn/next/blog-detail.tsx +106 -0
- package/vendor/registry/blocks/blog-detail/ui/shadcn/nuxt/BlogDetail.vue +116 -0
- package/vendor/registry/blocks/blog-list/module.json +26 -0
- package/vendor/registry/blocks/blog-list/ui/minimal/next/blog-list.tsx +130 -0
- package/vendor/registry/blocks/blog-list/ui/minimal/nuxt/BlogList.vue +62 -0
- package/vendor/registry/blocks/blog-list/ui/shadcn/next/blog-list.tsx +109 -0
- package/vendor/registry/blocks/blog-list/ui/shadcn/nuxt/BlogList.vue +100 -0
- package/vendor/registry/blocks/blog-list-cards/module.json +27 -0
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/next/blog-list-cards.tsx +130 -0
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/nuxt/BlogListCards.vue +114 -0
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/next/blog-list-cards.tsx +119 -0
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/nuxt/BlogListCards.vue +113 -0
- package/vendor/registry/blocks/booking-form-ui/module.json +15 -0
- package/vendor/registry/blocks/booking-form-ui/ui/minimal/next/booking-form.tsx +89 -0
- package/vendor/registry/blocks/booking-form-ui/ui/shadcn/next/booking-form.tsx +92 -0
- package/vendor/registry/blocks/contact-form-ui/module.json +27 -0
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/next/contact-form.tsx +45 -0
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/nuxt/ContactForm.vue +79 -0
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/next/contact-form.tsx +55 -0
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/nuxt/ContactForm.vue +92 -0
- package/vendor/registry/blocks/faq-list/module.json +15 -0
- package/vendor/registry/blocks/faq-list/ui/minimal/next/faq-list.tsx +78 -0
- package/vendor/registry/blocks/faq-list/ui/shadcn/next/faq-list.tsx +77 -0
- package/vendor/registry/blocks/maintenance-gate/module.json +13 -0
- package/vendor/registry/blocks/maintenance-gate/ui/minimal/next/maintenance-gate.tsx +135 -0
- package/vendor/registry/blocks/maintenance-gate/ui/shadcn/next/maintenance-gate.tsx +87 -0
- package/vendor/registry/blocks/nav-footer/module.json +13 -0
- package/vendor/registry/blocks/nav-footer/ui/minimal/next/nav-footer.tsx +55 -0
- package/vendor/registry/blocks/nav-footer/ui/shadcn/next/nav-footer.tsx +41 -0
- package/vendor/registry/blocks/nav-header/module.json +14 -0
- package/vendor/registry/blocks/nav-header/ui/minimal/next/nav-header.tsx +244 -0
- package/vendor/registry/blocks/nav-header/ui/shadcn/next/nav-header-client.tsx +185 -0
- package/vendor/registry/blocks/nav-header/ui/shadcn/next/nav-header.tsx +12 -0
- package/vendor/registry/blocks/page-detail/module.json +26 -0
- package/vendor/registry/blocks/page-detail/ui/minimal/next/page-detail.tsx +26 -0
- package/vendor/registry/blocks/page-detail/ui/minimal/nuxt/PageDetail.vue +26 -0
- package/vendor/registry/blocks/page-detail/ui/shadcn/next/page-detail.tsx +61 -0
- package/vendor/registry/blocks/page-detail/ui/shadcn/nuxt/PageDetail.vue +62 -0
- package/vendor/registry/blocks/project-detail/module.json +15 -0
- package/vendor/registry/blocks/project-detail/ui/minimal/next/project-detail.tsx +58 -0
- package/vendor/registry/blocks/project-detail/ui/shadcn/next/project-detail.tsx +91 -0
- package/vendor/registry/blocks/project-list/module.json +14 -0
- package/vendor/registry/blocks/project-list/ui/minimal/next/project-list.tsx +104 -0
- package/vendor/registry/blocks/project-list/ui/shadcn/next/project-list.tsx +81 -0
- package/vendor/registry/blocks/project-list-cards/module.json +15 -0
- package/vendor/registry/blocks/project-list-cards/ui/minimal/next/project-list-cards.tsx +125 -0
- package/vendor/registry/blocks/project-list-cards/ui/shadcn/next/project-list-cards.tsx +94 -0
- package/vendor/registry/blocks/projects-carousel/module.json +15 -0
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel-client.tsx +239 -0
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel.tsx +24 -0
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel-client.tsx +102 -0
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel.tsx +24 -0
- package/vendor/registry/blocks/service-detail/module.json +15 -0
- package/vendor/registry/blocks/service-detail/ui/minimal/next/service-detail.tsx +49 -0
- package/vendor/registry/blocks/service-detail/ui/shadcn/next/service-detail.tsx +75 -0
- package/vendor/registry/blocks/service-list/module.json +14 -0
- package/vendor/registry/blocks/service-list/ui/minimal/next/service-list.tsx +103 -0
- package/vendor/registry/blocks/service-list/ui/shadcn/next/service-list.tsx +80 -0
- package/vendor/registry/blocks/service-list-cards/module.json +15 -0
- package/vendor/registry/blocks/service-list-cards/ui/minimal/next/service-list-cards.tsx +124 -0
- package/vendor/registry/blocks/service-list-cards/ui/shadcn/next/service-list-cards.tsx +92 -0
- package/vendor/registry/blocks/site-brand/module.json +13 -0
- package/vendor/registry/blocks/site-brand/ui/minimal/next/site-brand.tsx +61 -0
- package/vendor/registry/blocks/site-brand/ui/shadcn/next/site-brand.tsx +48 -0
- package/vendor/registry/blocks/site-logo/module.json +13 -0
- package/vendor/registry/blocks/site-logo/ui/minimal/next/site-logo.tsx +37 -0
- package/vendor/registry/blocks/site-logo/ui/shadcn/next/site-logo.tsx +34 -0
- package/vendor/registry/blocks/social-links/module.json +13 -0
- package/vendor/registry/blocks/social-links/ui/minimal/next/social-links.tsx +55 -0
- package/vendor/registry/blocks/social-links/ui/shadcn/next/social-links.tsx +46 -0
- package/vendor/registry/blocks/team-detail/module.json +15 -0
- package/vendor/registry/blocks/team-detail/ui/minimal/next/team-detail.tsx +113 -0
- package/vendor/registry/blocks/team-detail/ui/shadcn/next/team-detail.tsx +77 -0
- package/vendor/registry/blocks/team-list/module.json +14 -0
- package/vendor/registry/blocks/team-list/ui/minimal/next/team-list.tsx +113 -0
- package/vendor/registry/blocks/team-list/ui/shadcn/next/team-list.tsx +77 -0
- package/vendor/registry/blocks/team-list-cards/module.json +15 -0
- package/vendor/registry/blocks/team-list-cards/ui/minimal/next/team-list-cards.tsx +111 -0
- package/vendor/registry/blocks/team-list-cards/ui/shadcn/next/team-list-cards.tsx +83 -0
- package/vendor/registry/blocks/testimonials-carousel/module.json +15 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel-client.tsx +230 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel.tsx +23 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel-client.tsx +91 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel.tsx +23 -0
- package/vendor/registry/blocks/testimonials-list/module.json +14 -0
- package/vendor/registry/blocks/testimonials-list/ui/minimal/next/testimonials-list.tsx +109 -0
- package/vendor/registry/blocks/testimonials-list/ui/shadcn/next/testimonials-list.tsx +72 -0
- package/vendor/registry/blocks/testimonials-list-cards/module.json +15 -0
- package/vendor/registry/blocks/testimonials-list-cards/ui/minimal/next/testimonials-list-cards.tsx +114 -0
- package/vendor/registry/blocks/testimonials-list-cards/ui/shadcn/next/testimonials-list-cards.tsx +72 -0
- package/vendor/registry/core/languages/policies.json +25 -0
- package/vendor/registry/core/languages/seed.json +16 -0
- package/vendor/registry/core/languages/snapshot.json +94 -0
- package/vendor/registry/modules/blog/access/policies.json +49 -0
- package/vendor/registry/modules/blog/access/policies.multilocale.json +67 -0
- package/vendor/registry/modules/blog/lib.multilocale.ts +552 -0
- package/vendor/registry/modules/blog/lib.ts +346 -0
- package/vendor/registry/modules/blog/module.json +50 -0
- package/vendor/registry/modules/blog/schema/snapshot.json +701 -0
- package/vendor/registry/modules/blog/schema/snapshot.multilocale.json +884 -0
- package/vendor/registry/modules/blog/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/blog/services/assets/ada-lovelace-avatar.jpg +0 -0
- package/vendor/registry/modules/blog/services/assets/hello-from-dkit-cover.jpg +0 -0
- package/vendor/registry/modules/blog/services/seed.json +70 -0
- package/vendor/registry/modules/blog/services/seed.multilocale.json +90 -0
- package/vendor/registry/modules/blog/types.multilocale.ts +96 -0
- package/vendor/registry/modules/blog/types.ts +62 -0
- package/vendor/registry/modules/booking-form/access/policies.json +25 -0
- package/vendor/registry/modules/booking-form/access/policies.multilocale.json +27 -0
- package/vendor/registry/modules/booking-form/lib.multilocale.ts +71 -0
- package/vendor/registry/modules/booking-form/lib.ts +77 -0
- package/vendor/registry/modules/booking-form/module.json +32 -0
- package/vendor/registry/modules/booking-form/schema/snapshot.json +294 -0
- package/vendor/registry/modules/booking-form/schema/snapshot.multilocale.json +467 -0
- package/vendor/registry/modules/booking-form/services/flows.json +19 -0
- package/vendor/registry/modules/booking-form/types.multilocale.ts +29 -0
- package/vendor/registry/modules/booking-form/types.ts +27 -0
- package/vendor/registry/modules/contact-form/access/policies.json +25 -0
- package/vendor/registry/modules/contact-form/access/policies.multilocale.json +27 -0
- package/vendor/registry/modules/contact-form/lib.multilocale.ts +65 -0
- package/vendor/registry/modules/contact-form/lib.ts +67 -0
- package/vendor/registry/modules/contact-form/module.json +32 -0
- package/vendor/registry/modules/contact-form/schema/snapshot.json +193 -0
- package/vendor/registry/modules/contact-form/schema/snapshot.multilocale.json +293 -0
- package/vendor/registry/modules/contact-form/services/flows.json +19 -0
- package/vendor/registry/modules/contact-form/types.multilocale.ts +21 -0
- package/vendor/registry/modules/contact-form/types.ts +19 -0
- package/vendor/registry/modules/faq/access/policies.json +25 -0
- package/vendor/registry/modules/faq/access/policies.multilocale.json +18 -0
- package/vendor/registry/modules/faq/lib.multilocale.ts +120 -0
- package/vendor/registry/modules/faq/lib.ts +73 -0
- package/vendor/registry/modules/faq/module.json +31 -0
- package/vendor/registry/modules/faq/schema/snapshot.json +180 -0
- package/vendor/registry/modules/faq/schema/snapshot.multilocale.json +116 -0
- package/vendor/registry/modules/faq/services/seed.json +38 -0
- package/vendor/registry/modules/faq/services/seed.multilocale.json +32 -0
- package/vendor/registry/modules/faq/types.multilocale.ts +31 -0
- package/vendor/registry/modules/faq/types.ts +17 -0
- package/vendor/registry/modules/navigation/access/policies.json +31 -0
- package/vendor/registry/modules/navigation/access/policies.multilocale.json +51 -0
- package/vendor/registry/modules/navigation/lib.multilocale.ts +198 -0
- package/vendor/registry/modules/navigation/lib.ts +252 -0
- package/vendor/registry/modules/navigation/module.json +46 -0
- package/vendor/registry/modules/navigation/schema/snapshot.json +453 -0
- package/vendor/registry/modules/navigation/schema/snapshot.multilocale.json +864 -0
- package/vendor/registry/modules/navigation/services/seed.json +103 -0
- package/vendor/registry/modules/navigation/services/seed.multilocale.json +88 -0
- package/vendor/registry/modules/navigation/types.multilocale.ts +60 -0
- package/vendor/registry/modules/navigation/types.ts +44 -0
- package/vendor/registry/modules/pages/access/policies.json +25 -0
- package/vendor/registry/modules/pages/access/policies.multilocale.json +18 -0
- package/vendor/registry/modules/pages/lib.multilocale.ts +166 -0
- package/vendor/registry/modules/pages/lib.ts +123 -0
- package/vendor/registry/modules/pages/module.json +39 -0
- package/vendor/registry/modules/pages/schema/snapshot.json +247 -0
- package/vendor/registry/modules/pages/schema/snapshot.multilocale.json +187 -0
- package/vendor/registry/modules/pages/services/seed.json +24 -0
- package/vendor/registry/modules/pages/services/seed.multilocale.json +34 -0
- package/vendor/registry/modules/pages/types.multilocale.ts +37 -0
- package/vendor/registry/modules/pages/types.ts +21 -0
- package/vendor/registry/modules/projects/access/policies.json +31 -0
- package/vendor/registry/modules/projects/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/projects/lib.multilocale.ts +111 -0
- package/vendor/registry/modules/projects/lib.ts +138 -0
- package/vendor/registry/modules/projects/module.json +48 -0
- package/vendor/registry/modules/projects/schema/snapshot.json +348 -0
- package/vendor/registry/modules/projects/schema/snapshot.multilocale.json +577 -0
- package/vendor/registry/modules/projects/services/ATTRIBUTION.md +7 -0
- package/vendor/registry/modules/projects/services/assets/brand-identity-cover.jpg +0 -0
- package/vendor/registry/modules/projects/services/seed.json +40 -0
- package/vendor/registry/modules/projects/services/seed.multilocale.json +31 -0
- package/vendor/registry/modules/projects/types.multilocale.ts +38 -0
- package/vendor/registry/modules/projects/types.ts +28 -0
- package/vendor/registry/modules/services/access/policies.json +31 -0
- package/vendor/registry/modules/services/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/services/lib.multilocale.ts +109 -0
- package/vendor/registry/modules/services/lib.ts +134 -0
- package/vendor/registry/modules/services/module.json +47 -0
- package/vendor/registry/modules/services/schema/snapshot.json +305 -0
- package/vendor/registry/modules/services/schema/snapshot.multilocale.json +510 -0
- package/vendor/registry/modules/services/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/services/services/assets/design-development.jpg +0 -0
- package/vendor/registry/modules/services/services/assets/strategy-consulting.jpg +0 -0
- package/vendor/registry/modules/services/services/seed.json +44 -0
- package/vendor/registry/modules/services/services/seed.multilocale.json +31 -0
- package/vendor/registry/modules/services/types.multilocale.ts +36 -0
- package/vendor/registry/modules/services/types.ts +26 -0
- package/vendor/registry/modules/settings/access/policies.json +31 -0
- package/vendor/registry/modules/settings/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/settings/lib.multilocale.ts +158 -0
- package/vendor/registry/modules/settings/lib.ts +259 -0
- package/vendor/registry/modules/settings/module.json +33 -0
- package/vendor/registry/modules/settings/schema/snapshot.json +315 -0
- package/vendor/registry/modules/settings/schema/snapshot.multilocale.json +586 -0
- package/vendor/registry/modules/settings/services/assets/dkit-logo.svg +4 -0
- package/vendor/registry/modules/settings/services/seed.json +31 -0
- package/vendor/registry/modules/settings/services/seed.multilocale.json +42 -0
- package/vendor/registry/modules/settings/types.multilocale.ts +72 -0
- package/vendor/registry/modules/settings/types.ts +94 -0
- package/vendor/registry/modules/team/access/policies.json +31 -0
- package/vendor/registry/modules/team/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/team/lib.multilocale.ts +88 -0
- package/vendor/registry/modules/team/lib.ts +120 -0
- package/vendor/registry/modules/team/module.json +47 -0
- package/vendor/registry/modules/team/schema/snapshot.json +295 -0
- package/vendor/registry/modules/team/schema/snapshot.multilocale.json +525 -0
- package/vendor/registry/modules/team/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/team/services/assets/morgan-lee-photo.jpg +0 -0
- package/vendor/registry/modules/team/services/assets/taylor-kim-photo.jpg +0 -0
- package/vendor/registry/modules/team/services/seed.json +52 -0
- package/vendor/registry/modules/team/services/seed.multilocale.json +30 -0
- package/vendor/registry/modules/team/types.multilocale.ts +33 -0
- package/vendor/registry/modules/team/types.ts +27 -0
- package/vendor/registry/modules/testimonials/access/policies.json +31 -0
- package/vendor/registry/modules/testimonials/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/testimonials/lib.multilocale.ts +93 -0
- package/vendor/registry/modules/testimonials/lib.ts +85 -0
- package/vendor/registry/modules/testimonials/module.json +41 -0
- package/vendor/registry/modules/testimonials/schema/snapshot.json +248 -0
- package/vendor/registry/modules/testimonials/schema/snapshot.multilocale.json +462 -0
- package/vendor/registry/modules/testimonials/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/testimonials/services/assets/jane-doe-avatar.jpg +0 -0
- package/vendor/registry/modules/testimonials/services/assets/sample-author-avatar.jpg +0 -0
- package/vendor/registry/modules/testimonials/services/seed.json +49 -0
- package/vendor/registry/modules/testimonials/services/seed.multilocale.json +30 -0
- package/vendor/registry/modules/testimonials/types.multilocale.ts +27 -0
- package/vendor/registry/modules/testimonials/types.ts +22 -0
- package/vendor/registry/registry.json +832 -0
- package/vendor/registry/shared/helpers.ts +16 -0
- package/vendor/registry/shared/i18n.ts +74 -0
- package/vendor/registry/shared/minimal.css +83 -0
- package/vendor/registry/shared/paths.ts +50 -0
- package/vendor/registry/shared/prose.css +113 -0
- package/vendor/registry/tsconfig.json +49 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"items": {
|
|
3
|
+
"nav_menus": [
|
|
4
|
+
{
|
|
5
|
+
"id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
6
|
+
"status": "published",
|
|
7
|
+
"name": "Primary",
|
|
8
|
+
"key": "primary",
|
|
9
|
+
"description": "Main header navigation"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
13
|
+
"status": "published",
|
|
14
|
+
"name": "Footer",
|
|
15
|
+
"key": "footer",
|
|
16
|
+
"description": "Footer link row"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"nav_items": [
|
|
20
|
+
{
|
|
21
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0001",
|
|
22
|
+
"status": "published",
|
|
23
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
24
|
+
"label": "Blog",
|
|
25
|
+
"href": "/blog",
|
|
26
|
+
"open_in_new_tab": false,
|
|
27
|
+
"sort": 1
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0002",
|
|
31
|
+
"status": "published",
|
|
32
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
33
|
+
"label": "Contact",
|
|
34
|
+
"href": "/contact",
|
|
35
|
+
"open_in_new_tab": false,
|
|
36
|
+
"sort": 2
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0003",
|
|
40
|
+
"status": "published",
|
|
41
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
42
|
+
"label": "More",
|
|
43
|
+
"href": "#",
|
|
44
|
+
"open_in_new_tab": false,
|
|
45
|
+
"sort": 3
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0004",
|
|
49
|
+
"status": "published",
|
|
50
|
+
"parent": "cccccccc-cccc-4ccc-8ccc-cccccccc0003",
|
|
51
|
+
"label": "About",
|
|
52
|
+
"href": "/about",
|
|
53
|
+
"open_in_new_tab": false,
|
|
54
|
+
"sort": 1
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0005",
|
|
58
|
+
"status": "published",
|
|
59
|
+
"parent": "cccccccc-cccc-4ccc-8ccc-cccccccc0003",
|
|
60
|
+
"label": "Hello",
|
|
61
|
+
"href": "/hello",
|
|
62
|
+
"open_in_new_tab": false,
|
|
63
|
+
"sort": 2
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0006",
|
|
67
|
+
"status": "published",
|
|
68
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
69
|
+
"label": "Blog",
|
|
70
|
+
"href": "/blog",
|
|
71
|
+
"open_in_new_tab": false,
|
|
72
|
+
"sort": 1
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0007",
|
|
76
|
+
"status": "published",
|
|
77
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
78
|
+
"label": "Contact",
|
|
79
|
+
"href": "/contact",
|
|
80
|
+
"open_in_new_tab": false,
|
|
81
|
+
"sort": 2
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0008",
|
|
85
|
+
"status": "published",
|
|
86
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
87
|
+
"label": "About",
|
|
88
|
+
"href": "/about",
|
|
89
|
+
"open_in_new_tab": false,
|
|
90
|
+
"sort": 3
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0009",
|
|
94
|
+
"status": "published",
|
|
95
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
96
|
+
"label": "Hello",
|
|
97
|
+
"href": "/hello",
|
|
98
|
+
"open_in_new_tab": false,
|
|
99
|
+
"sort": 4
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"items": {
|
|
3
|
+
"nav_menus": [
|
|
4
|
+
{
|
|
5
|
+
"id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
6
|
+
"status": "published",
|
|
7
|
+
"key": "primary",
|
|
8
|
+
"translations": [
|
|
9
|
+
{
|
|
10
|
+
"languages_code": "en-US",
|
|
11
|
+
"name": "Primary",
|
|
12
|
+
"description": "Main header navigation"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
18
|
+
"status": "published",
|
|
19
|
+
"key": "footer",
|
|
20
|
+
"translations": [
|
|
21
|
+
{
|
|
22
|
+
"languages_code": "en-US",
|
|
23
|
+
"name": "Footer",
|
|
24
|
+
"description": "Footer link row"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"nav_items": [
|
|
30
|
+
{
|
|
31
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0001",
|
|
32
|
+
"status": "published",
|
|
33
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
34
|
+
"open_in_new_tab": false,
|
|
35
|
+
"sort": 1,
|
|
36
|
+
"translations": [
|
|
37
|
+
{
|
|
38
|
+
"languages_code": "en-US",
|
|
39
|
+
"label": "Blog",
|
|
40
|
+
"href": "/blog"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0002",
|
|
46
|
+
"status": "published",
|
|
47
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0001",
|
|
48
|
+
"open_in_new_tab": false,
|
|
49
|
+
"sort": 2,
|
|
50
|
+
"translations": [
|
|
51
|
+
{
|
|
52
|
+
"languages_code": "en-US",
|
|
53
|
+
"label": "Contact",
|
|
54
|
+
"href": "/contact"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0006",
|
|
60
|
+
"status": "published",
|
|
61
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
62
|
+
"open_in_new_tab": false,
|
|
63
|
+
"sort": 1,
|
|
64
|
+
"translations": [
|
|
65
|
+
{
|
|
66
|
+
"languages_code": "en-US",
|
|
67
|
+
"label": "Blog",
|
|
68
|
+
"href": "/blog"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "cccccccc-cccc-4ccc-8ccc-cccccccc0007",
|
|
74
|
+
"status": "published",
|
|
75
|
+
"menu": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbb0002",
|
|
76
|
+
"open_in_new_tab": false,
|
|
77
|
+
"sort": 2,
|
|
78
|
+
"translations": [
|
|
79
|
+
{
|
|
80
|
+
"languages_code": "en-US",
|
|
81
|
+
"label": "Contact",
|
|
82
|
+
"href": "/contact"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type NavMenuTranslation = {
|
|
2
|
+
id: number;
|
|
3
|
+
nav_menus_id?: string;
|
|
4
|
+
languages_code?: string | { code?: string };
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type NavItemTranslation = {
|
|
10
|
+
id: number;
|
|
11
|
+
nav_items_id?: string;
|
|
12
|
+
languages_code?: string | { code?: string };
|
|
13
|
+
label: string;
|
|
14
|
+
href: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type NavMenu = {
|
|
18
|
+
id: string;
|
|
19
|
+
status: "published" | "draft" | "archived";
|
|
20
|
+
name: string;
|
|
21
|
+
key: string;
|
|
22
|
+
description?: string | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type NavItem = {
|
|
26
|
+
id: string;
|
|
27
|
+
status: "published" | "draft" | "archived";
|
|
28
|
+
menu?: string | NavMenu | null;
|
|
29
|
+
parent?: string | NavItem | null;
|
|
30
|
+
label: string;
|
|
31
|
+
href: string;
|
|
32
|
+
open_in_new_tab?: boolean | null;
|
|
33
|
+
sort?: number | null;
|
|
34
|
+
children?: NavItem[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type NavMenuTree = {
|
|
38
|
+
id: string;
|
|
39
|
+
key: string;
|
|
40
|
+
name: string;
|
|
41
|
+
items: NavItem[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type GetNavMenusOptions = {
|
|
45
|
+
status?: string | null;
|
|
46
|
+
limit?: number;
|
|
47
|
+
sort?: string[];
|
|
48
|
+
locale?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type GetNavMenuByKeyOptions = {
|
|
52
|
+
status?: string | null;
|
|
53
|
+
locale?: string;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type GetNavItemsOptions = {
|
|
57
|
+
status?: string | null;
|
|
58
|
+
tree?: boolean;
|
|
59
|
+
locale?: string;
|
|
60
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type NavMenu = {
|
|
2
|
+
id: string;
|
|
3
|
+
status: "published" | "draft" | "archived";
|
|
4
|
+
name: string;
|
|
5
|
+
key: string;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type NavItem = {
|
|
10
|
+
id: string;
|
|
11
|
+
status: "published" | "draft" | "archived";
|
|
12
|
+
menu?: string | NavMenu | null;
|
|
13
|
+
parent?: string | NavItem | null;
|
|
14
|
+
label: string;
|
|
15
|
+
href: string;
|
|
16
|
+
open_in_new_tab?: boolean | null;
|
|
17
|
+
sort?: number | null;
|
|
18
|
+
children?: NavItem[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Menu + nested items tree returned by getNavMenuByKey. */
|
|
22
|
+
export type NavMenuTree = {
|
|
23
|
+
id: string;
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
items: NavItem[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type GetNavMenusOptions = {
|
|
30
|
+
/** Directus status filter. Default `"published"`. Pass `null` to skip. */
|
|
31
|
+
status?: string | null;
|
|
32
|
+
limit?: number;
|
|
33
|
+
sort?: string[];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type GetNavMenuByKeyOptions = {
|
|
37
|
+
status?: string | null;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type GetNavItemsOptions = {
|
|
41
|
+
status?: string | null;
|
|
42
|
+
/** When true, return a nested tree (default). Flat list when false. */
|
|
43
|
+
tree?: boolean;
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"policies": [
|
|
3
|
+
{
|
|
4
|
+
"name": "dkit Pages Public Read",
|
|
5
|
+
"icon": "public",
|
|
6
|
+
"description": "Public read for WYSIWYG pages (flat rules — Core-compatible). UI filters published status.",
|
|
7
|
+
"admin_access": false,
|
|
8
|
+
"app_access": false
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"permissions": [
|
|
12
|
+
{
|
|
13
|
+
"policy": "dkit Pages Public Read",
|
|
14
|
+
"collection": "pages",
|
|
15
|
+
"action": "read",
|
|
16
|
+
"fields": ["*"]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"access": [
|
|
20
|
+
{
|
|
21
|
+
"role": "$public",
|
|
22
|
+
"policy": "dkit Pages Public Read"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"policies": [
|
|
3
|
+
{
|
|
4
|
+
"name": "dkit Pages Public Read",
|
|
5
|
+
"icon": "public",
|
|
6
|
+
"description": "Public read for pages incl. translation table (flat rules — Core-compatible). UI filters published status.",
|
|
7
|
+
"admin_access": false,
|
|
8
|
+
"app_access": false
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"permissions": [
|
|
12
|
+
{ "policy": "dkit Pages Public Read", "collection": "pages", "action": "read", "fields": ["*"] },
|
|
13
|
+
{ "policy": "dkit Pages Public Read", "collection": "pages_translations", "action": "read", "fields": ["*"] }
|
|
14
|
+
],
|
|
15
|
+
"access": [
|
|
16
|
+
{ "role": "$public", "policy": "dkit Pages Public Read" }
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dkitQueryFailed,
|
|
3
|
+
getDirectus,
|
|
4
|
+
readItem,
|
|
5
|
+
readItems,
|
|
6
|
+
} from "@/lib/dkit/client";
|
|
7
|
+
import { collections } from "@/lib/dkit/config";
|
|
8
|
+
import { queryLimit, statusFilter } from "@/lib/dkit/helpers";
|
|
9
|
+
import {
|
|
10
|
+
isUsableTranslation,
|
|
11
|
+
pickTranslation,
|
|
12
|
+
requireLocaleTranslation,
|
|
13
|
+
resolveLocale,
|
|
14
|
+
translationsDeepFilter,
|
|
15
|
+
} from "@/lib/dkit/i18n";
|
|
16
|
+
import type {
|
|
17
|
+
GetPageBySlugOptions,
|
|
18
|
+
GetPagesOptions,
|
|
19
|
+
SitePage,
|
|
20
|
+
SitePageTranslation,
|
|
21
|
+
} from "./types.multilocale";
|
|
22
|
+
|
|
23
|
+
export type {
|
|
24
|
+
GetPageBySlugOptions,
|
|
25
|
+
GetPagesOptions,
|
|
26
|
+
SitePage,
|
|
27
|
+
SitePageTranslation,
|
|
28
|
+
} from "./types.multilocale";
|
|
29
|
+
|
|
30
|
+
function flattenPage(row: Record<string, unknown>, locale: string): SitePage | null {
|
|
31
|
+
const trans = pickTranslation(
|
|
32
|
+
row.translations as SitePageTranslation[] | undefined,
|
|
33
|
+
locale,
|
|
34
|
+
);
|
|
35
|
+
if (!isUsableTranslation(trans)) return null;
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
id: row.id as string,
|
|
39
|
+
status: row.status as SitePage["status"],
|
|
40
|
+
title: trans!.title!,
|
|
41
|
+
slug: trans!.slug!,
|
|
42
|
+
excerpt: trans?.excerpt ?? null,
|
|
43
|
+
body: trans?.body ?? null,
|
|
44
|
+
published_at: (row.published_at as string | null) ?? null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const PAGE_LIST_FIELDS = [
|
|
49
|
+
"id",
|
|
50
|
+
"status",
|
|
51
|
+
"published_at",
|
|
52
|
+
{ translations: ["id", "languages_code", "title", "slug", "excerpt"] },
|
|
53
|
+
] as const;
|
|
54
|
+
|
|
55
|
+
const PAGE_DETAIL_FIELDS = [
|
|
56
|
+
"id",
|
|
57
|
+
"status",
|
|
58
|
+
"published_at",
|
|
59
|
+
{ translations: ["id", "languages_code", "title", "slug", "excerpt", "body"] },
|
|
60
|
+
] as const;
|
|
61
|
+
|
|
62
|
+
export async function getPages(
|
|
63
|
+
options: GetPagesOptions = {},
|
|
64
|
+
): Promise<SitePage[]> {
|
|
65
|
+
const client = getDirectus();
|
|
66
|
+
if (!client) return [];
|
|
67
|
+
if (!collections.pages) {
|
|
68
|
+
dkitQueryFailed(
|
|
69
|
+
'collections.pages missing from lib/dkit/config — re-run `dkit add pages`',
|
|
70
|
+
);
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const locale = await resolveLocale(options.locale);
|
|
74
|
+
const status = statusFilter(options.status);
|
|
75
|
+
const and: Record<string, unknown>[] = [requireLocaleTranslation(locale)];
|
|
76
|
+
if (status) and.unshift(status);
|
|
77
|
+
const limit = queryLimit(options.limit);
|
|
78
|
+
try {
|
|
79
|
+
const rows = await client.request(
|
|
80
|
+
readItems(collections.pages, {
|
|
81
|
+
filter: { _and: and },
|
|
82
|
+
deep: translationsDeepFilter(locale),
|
|
83
|
+
fields: [...PAGE_LIST_FIELDS],
|
|
84
|
+
sort: options.sort ?? ["-published_at"],
|
|
85
|
+
...(limit !== undefined ? { limit } : {}),
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
return (rows as Record<string, unknown>[])
|
|
89
|
+
.map((r) => flattenPage(r, locale))
|
|
90
|
+
.filter((p): p is SitePage => p != null);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
dkitQueryFailed(`getPages failed (collection=${collections.pages})`, err);
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function getPageBySlug(
|
|
98
|
+
slug: string,
|
|
99
|
+
options: GetPageBySlugOptions = {},
|
|
100
|
+
): Promise<SitePage | null> {
|
|
101
|
+
const client = getDirectus();
|
|
102
|
+
if (!client) return null;
|
|
103
|
+
if (!collections.pages) {
|
|
104
|
+
dkitQueryFailed("collections.pages missing from lib/dkit/config");
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const locale = await resolveLocale(options.locale);
|
|
108
|
+
const status = statusFilter(options.status);
|
|
109
|
+
const and: Record<string, unknown>[] = [
|
|
110
|
+
{
|
|
111
|
+
translations: {
|
|
112
|
+
_and: [
|
|
113
|
+
{ languages_code: { _eq: locale } },
|
|
114
|
+
{ slug: { _eq: slug } },
|
|
115
|
+
{ title: { _nempty: true } },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
if (status) and.unshift(status);
|
|
121
|
+
try {
|
|
122
|
+
const rows = await client.request(
|
|
123
|
+
readItems(collections.pages, {
|
|
124
|
+
filter: { _and: and },
|
|
125
|
+
deep: translationsDeepFilter(locale),
|
|
126
|
+
fields: [...PAGE_DETAIL_FIELDS],
|
|
127
|
+
limit: 1,
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
const row = (rows as Record<string, unknown>[])[0];
|
|
131
|
+
return row ? flattenPage(row, locale) : null;
|
|
132
|
+
} catch (err) {
|
|
133
|
+
dkitQueryFailed(`getPageBySlug(${slug}) failed (collection=${collections.pages})`, err);
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export async function getPageById(
|
|
139
|
+
id: string,
|
|
140
|
+
options: GetPageBySlugOptions = {},
|
|
141
|
+
): Promise<SitePage | null> {
|
|
142
|
+
const client = getDirectus();
|
|
143
|
+
if (!client) return null;
|
|
144
|
+
if (!collections.pages) return null;
|
|
145
|
+
const locale = await resolveLocale(options.locale);
|
|
146
|
+
try {
|
|
147
|
+
const rows = await client.request(
|
|
148
|
+
readItems(collections.pages, {
|
|
149
|
+
filter: {
|
|
150
|
+
_and: [{ id: { _eq: id } }, requireLocaleTranslation(locale)],
|
|
151
|
+
},
|
|
152
|
+
deep: translationsDeepFilter(locale),
|
|
153
|
+
fields: [...PAGE_DETAIL_FIELDS],
|
|
154
|
+
limit: 1,
|
|
155
|
+
}),
|
|
156
|
+
);
|
|
157
|
+
const row = (rows as Record<string, unknown>[])[0];
|
|
158
|
+
return row ? flattenPage(row, locale) : null;
|
|
159
|
+
} catch (err) {
|
|
160
|
+
dkitQueryFailed(`getPageById(${id}) failed`, err);
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** @deprecated prefer getPageBySlug */
|
|
166
|
+
export const getPage = getPageBySlug;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dkitQueryFailed,
|
|
3
|
+
getDirectus,
|
|
4
|
+
readItem,
|
|
5
|
+
readItems,
|
|
6
|
+
} from "@/lib/dkit/client";
|
|
7
|
+
import { collections } from "@/lib/dkit/config";
|
|
8
|
+
import { queryLimit, statusFilter } from "@/lib/dkit/helpers";
|
|
9
|
+
import type {
|
|
10
|
+
GetPageBySlugOptions,
|
|
11
|
+
GetPagesOptions,
|
|
12
|
+
SitePage,
|
|
13
|
+
} from "./types";
|
|
14
|
+
|
|
15
|
+
export type {
|
|
16
|
+
GetPageBySlugOptions,
|
|
17
|
+
GetPagesOptions,
|
|
18
|
+
SitePage,
|
|
19
|
+
} from "./types";
|
|
20
|
+
|
|
21
|
+
const PAGE_LIST_FIELDS = [
|
|
22
|
+
"id",
|
|
23
|
+
"status",
|
|
24
|
+
"title",
|
|
25
|
+
"slug",
|
|
26
|
+
"excerpt",
|
|
27
|
+
"published_at",
|
|
28
|
+
] as const;
|
|
29
|
+
|
|
30
|
+
const PAGE_DETAIL_FIELDS = [
|
|
31
|
+
"id",
|
|
32
|
+
"status",
|
|
33
|
+
"title",
|
|
34
|
+
"slug",
|
|
35
|
+
"body",
|
|
36
|
+
"published_at",
|
|
37
|
+
"excerpt",
|
|
38
|
+
] as const;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Pages module list helper.
|
|
42
|
+
* Module id is `pages`, so the name is `getPages` (not `getPagesPages`).
|
|
43
|
+
* Defaults to status=published (pass status: null to skip).
|
|
44
|
+
*/
|
|
45
|
+
export async function getPages(
|
|
46
|
+
options: GetPagesOptions = {},
|
|
47
|
+
): Promise<SitePage[]> {
|
|
48
|
+
const client = getDirectus();
|
|
49
|
+
if (!client) return [];
|
|
50
|
+
if (!collections.pages) {
|
|
51
|
+
dkitQueryFailed(
|
|
52
|
+
'collections.pages missing from lib/dkit/config — re-run `dkit add pages` (check collection prefix matches Directus, e.g. "dkit_pages")',
|
|
53
|
+
);
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const limit = queryLimit(options.limit);
|
|
57
|
+
try {
|
|
58
|
+
return await client.request(
|
|
59
|
+
readItems(collections.pages, {
|
|
60
|
+
filter: statusFilter(options.status),
|
|
61
|
+
fields: [...PAGE_LIST_FIELDS],
|
|
62
|
+
sort: options.sort ?? ["-published_at"],
|
|
63
|
+
...(limit !== undefined ? { limit } : {}),
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
dkitQueryFailed(
|
|
68
|
+
`getPages failed (collection=${collections.pages})`,
|
|
69
|
+
err,
|
|
70
|
+
);
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function getPageBySlug(
|
|
76
|
+
slug: string,
|
|
77
|
+
options: GetPageBySlugOptions = {},
|
|
78
|
+
): Promise<SitePage | null> {
|
|
79
|
+
const client = getDirectus();
|
|
80
|
+
if (!client) return null;
|
|
81
|
+
if (!collections.pages) {
|
|
82
|
+
dkitQueryFailed("collections.pages missing from lib/dkit/config");
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const status = statusFilter(options.status);
|
|
86
|
+
const and: Record<string, unknown>[] = [{ slug: { _eq: slug } }];
|
|
87
|
+
if (status) and.unshift(status);
|
|
88
|
+
try {
|
|
89
|
+
const rows = await client.request(
|
|
90
|
+
readItems(collections.pages, {
|
|
91
|
+
filter: { _and: and },
|
|
92
|
+
fields: [...PAGE_DETAIL_FIELDS],
|
|
93
|
+
limit: 1,
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
return rows[0] ?? null;
|
|
97
|
+
} catch (err) {
|
|
98
|
+
dkitQueryFailed(
|
|
99
|
+
`getPageBySlug(${slug}) failed (collection=${collections.pages})`,
|
|
100
|
+
err,
|
|
101
|
+
);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export async function getPageById(id: string): Promise<SitePage | null> {
|
|
107
|
+
const client = getDirectus();
|
|
108
|
+
if (!client) return null;
|
|
109
|
+
if (!collections.pages) return null;
|
|
110
|
+
try {
|
|
111
|
+
return await client.request(
|
|
112
|
+
readItem(collections.pages, id, {
|
|
113
|
+
fields: [...PAGE_DETAIL_FIELDS],
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
dkitQueryFailed(`getPageById(${id}) failed`, err);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @deprecated prefer getPageBySlug */
|
|
123
|
+
export const getPage = getPageBySlug;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "dkit:module",
|
|
3
|
+
"id": "pages",
|
|
4
|
+
"title": "Pages (WYSIWYG)",
|
|
5
|
+
"description": "Simple published pages with a rich-text body — not the M2A page-builder",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"directus": {
|
|
8
|
+
"min": "11.0.0"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": [
|
|
11
|
+
"@directus/sdk"
|
|
12
|
+
],
|
|
13
|
+
"layers": [
|
|
14
|
+
"schema",
|
|
15
|
+
"access",
|
|
16
|
+
"services",
|
|
17
|
+
"types"
|
|
18
|
+
],
|
|
19
|
+
"defaultBlocks": [
|
|
20
|
+
"page-detail"
|
|
21
|
+
],
|
|
22
|
+
"templates": {
|
|
23
|
+
"detail": {
|
|
24
|
+
"default": "page-detail",
|
|
25
|
+
"options": [
|
|
26
|
+
"page-detail"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"collections": [
|
|
31
|
+
"site",
|
|
32
|
+
"pages"
|
|
33
|
+
],
|
|
34
|
+
"defaultBasePath": "/pages",
|
|
35
|
+
"multilocale": {
|
|
36
|
+
"supported": true,
|
|
37
|
+
"mode": "translations"
|
|
38
|
+
}
|
|
39
|
+
}
|