@kurbo/dkit 0.5.0 → 0.5.1

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 (96) hide show
  1. package/dist/bin.js +119 -26
  2. package/dist/bin.js.map +1 -1
  3. package/package.json +1 -1
  4. package/vendor/registry/blocks/blog-detail/ui/minimal/next/blog-detail.tsx +0 -1
  5. package/vendor/registry/blocks/blog-detail/ui/shadcn/next/blog-detail.tsx +0 -1
  6. package/vendor/registry/blocks/blog-list/ui/minimal/next/blog-list.tsx +0 -1
  7. package/vendor/registry/blocks/blog-list/ui/shadcn/next/blog-list.tsx +0 -1
  8. package/vendor/registry/blocks/blog-list-cards/ui/minimal/next/blog-list-cards.tsx +0 -1
  9. package/vendor/registry/blocks/blog-list-cards/ui/shadcn/next/blog-list-cards.tsx +0 -1
  10. package/vendor/registry/blocks/booking-form-ui/ui/minimal/next/booking-form.tsx +0 -1
  11. package/vendor/registry/blocks/booking-form-ui/ui/shadcn/next/booking-form.tsx +0 -1
  12. package/vendor/registry/blocks/contact-form-ui/ui/minimal/next/contact-form.tsx +0 -1
  13. package/vendor/registry/blocks/contact-form-ui/ui/shadcn/next/contact-form.tsx +0 -1
  14. package/vendor/registry/blocks/faq-list/ui/minimal/next/faq-list.tsx +0 -1
  15. package/vendor/registry/blocks/faq-list/ui/shadcn/next/faq-list.tsx +0 -1
  16. package/vendor/registry/blocks/page-detail/ui/minimal/next/page-detail.tsx +0 -1
  17. package/vendor/registry/blocks/page-detail/ui/shadcn/next/page-detail.tsx +0 -1
  18. package/vendor/registry/blocks/project-detail/ui/minimal/next/project-detail.tsx +0 -1
  19. package/vendor/registry/blocks/project-detail/ui/shadcn/next/project-detail.tsx +0 -1
  20. package/vendor/registry/blocks/project-list/ui/minimal/next/project-list.tsx +0 -1
  21. package/vendor/registry/blocks/project-list/ui/shadcn/next/project-list.tsx +0 -1
  22. package/vendor/registry/blocks/project-list-cards/ui/minimal/next/project-list-cards.tsx +0 -1
  23. package/vendor/registry/blocks/project-list-cards/ui/shadcn/next/project-list-cards.tsx +0 -1
  24. package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel-client.tsx +0 -4
  25. package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel.tsx +0 -1
  26. package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel-client.tsx +0 -1
  27. package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel.tsx +0 -1
  28. package/vendor/registry/blocks/service-detail/ui/minimal/next/service-detail.tsx +0 -1
  29. package/vendor/registry/blocks/service-detail/ui/shadcn/next/service-detail.tsx +0 -1
  30. package/vendor/registry/blocks/service-list/ui/minimal/next/service-list.tsx +0 -1
  31. package/vendor/registry/blocks/service-list/ui/shadcn/next/service-list.tsx +0 -1
  32. package/vendor/registry/blocks/service-list-cards/ui/minimal/next/service-list-cards.tsx +0 -1
  33. package/vendor/registry/blocks/service-list-cards/ui/shadcn/next/service-list-cards.tsx +0 -1
  34. package/vendor/registry/blocks/social-links/ui/minimal/next/social-links.tsx +0 -1
  35. package/vendor/registry/blocks/social-links/ui/shadcn/next/social-links.tsx +0 -1
  36. package/vendor/registry/blocks/team-detail/ui/minimal/next/team-detail.tsx +0 -1
  37. package/vendor/registry/blocks/team-detail/ui/shadcn/next/team-detail.tsx +0 -1
  38. package/vendor/registry/blocks/team-list/ui/minimal/next/team-list.tsx +0 -1
  39. package/vendor/registry/blocks/team-list/ui/shadcn/next/team-list.tsx +0 -1
  40. package/vendor/registry/blocks/team-list-cards/ui/minimal/next/team-list-cards.tsx +0 -1
  41. package/vendor/registry/blocks/team-list-cards/ui/shadcn/next/team-list-cards.tsx +0 -1
  42. package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel-client.tsx +0 -4
  43. package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel.tsx +0 -1
  44. package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel-client.tsx +0 -1
  45. package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel.tsx +0 -1
  46. package/vendor/registry/blocks/testimonials-list/ui/minimal/next/testimonials-list.tsx +0 -1
  47. package/vendor/registry/blocks/testimonials-list/ui/shadcn/next/testimonials-list.tsx +0 -1
  48. package/vendor/registry/blocks/testimonials-list-cards/ui/minimal/next/testimonials-list-cards.tsx +0 -1
  49. package/vendor/registry/blocks/testimonials-list-cards/ui/shadcn/next/testimonials-list-cards.tsx +0 -1
  50. package/vendor/registry/modules/blog/lib.multilocale.ts +124 -129
  51. package/vendor/registry/modules/blog/lib.ts +12 -9
  52. package/vendor/registry/modules/blog/services/seed.json +1 -1
  53. package/vendor/registry/modules/blog/services/seed.multilocale.json +1 -1
  54. package/vendor/registry/modules/blog/types.multilocale.ts +41 -12
  55. package/vendor/registry/modules/blog/types.ts +8 -6
  56. package/vendor/registry/modules/faq/lib.multilocale.ts +30 -30
  57. package/vendor/registry/modules/faq/lib.ts +4 -5
  58. package/vendor/registry/modules/faq/types.multilocale.ts +13 -2
  59. package/vendor/registry/modules/faq/types.ts +4 -2
  60. package/vendor/registry/modules/navigation/lib.multilocale.ts +207 -76
  61. package/vendor/registry/modules/navigation/lib.ts +18 -17
  62. package/vendor/registry/modules/navigation/types.multilocale.ts +24 -4
  63. package/vendor/registry/modules/navigation/types.ts +6 -4
  64. package/vendor/registry/modules/pages/lib.multilocale.ts +34 -39
  65. package/vendor/registry/modules/pages/lib.ts +4 -3
  66. package/vendor/registry/modules/pages/types.multilocale.ts +14 -3
  67. package/vendor/registry/modules/pages/types.ts +5 -3
  68. package/vendor/registry/modules/projects/lib.multilocale.ts +149 -65
  69. package/vendor/registry/modules/projects/lib.ts +6 -6
  70. package/vendor/registry/modules/projects/services/seed.json +2 -2
  71. package/vendor/registry/modules/projects/services/seed.multilocale.json +2 -2
  72. package/vendor/registry/modules/projects/types.multilocale.ts +15 -3
  73. package/vendor/registry/modules/projects/types.ts +5 -3
  74. package/vendor/registry/modules/services/lib.multilocale.ts +143 -63
  75. package/vendor/registry/modules/services/lib.ts +6 -6
  76. package/vendor/registry/modules/services/services/seed.json +4 -4
  77. package/vendor/registry/modules/services/services/seed.multilocale.json +2 -2
  78. package/vendor/registry/modules/services/types.multilocale.ts +13 -3
  79. package/vendor/registry/modules/services/types.ts +5 -3
  80. package/vendor/registry/modules/settings/lib.multilocale.ts +159 -57
  81. package/vendor/registry/modules/settings/types.multilocale.ts +15 -0
  82. package/vendor/registry/modules/settings/types.ts +2 -2
  83. package/vendor/registry/modules/team/lib.multilocale.ts +116 -49
  84. package/vendor/registry/modules/team/lib.ts +4 -3
  85. package/vendor/registry/modules/team/services/seed.json +4 -4
  86. package/vendor/registry/modules/team/services/seed.multilocale.json +2 -2
  87. package/vendor/registry/modules/team/types.multilocale.ts +16 -3
  88. package/vendor/registry/modules/team/types.ts +5 -3
  89. package/vendor/registry/modules/testimonials/lib.multilocale.ts +82 -50
  90. package/vendor/registry/modules/testimonials/services/seed.json +4 -4
  91. package/vendor/registry/modules/testimonials/services/seed.multilocale.json +2 -2
  92. package/vendor/registry/modules/testimonials/types.multilocale.ts +14 -2
  93. package/vendor/registry/modules/testimonials/types.ts +4 -2
  94. package/vendor/registry/shared/helpers.ts +9 -3
  95. package/vendor/registry/shared/i18n.ts +84 -12
  96. package/vendor/registry/shared/prose.css +1 -1
@@ -3,74 +3,140 @@ import {
3
3
  directusFileId,
4
4
  dkitQueryFailed,
5
5
  getDirectus,
6
- readItem,
7
6
  readItems,
8
7
  } from "@/lib/dkit/client";
9
8
  import { collections } from "@/lib/dkit/config";
10
9
  import { queryLimit, statusFilter } from "@/lib/dkit/helpers";
11
10
  import {
12
- isUsableTranslation,
13
- pickTranslation,
14
11
  requireLocaleTranslation,
15
12
  resolveLocale,
16
13
  translationsDeepFilter,
14
+ withLocale,
17
15
  } from "@/lib/dkit/i18n";
18
- import type { DirectusFileRef, GetServiceBySlugOptions, GetServicesOptions, Service, ServiceTranslation } from "./types.multilocale";
16
+ import type {
17
+ DirectusFileRef,
18
+ GetServiceBySlugOptions,
19
+ GetServicesOptions,
20
+ Service,
21
+ ServiceRow,
22
+ } from "./types.multilocale";
19
23
 
20
- export type { DirectusFileRef, GetServiceBySlugOptions, GetServicesOptions, Service, ServiceTranslation } from "./types.multilocale";
24
+ export type {
25
+ DirectusFileRef,
26
+ GetServiceBySlugOptions,
27
+ GetServicesOptions,
28
+ Service,
29
+ ServiceRow,
30
+ ServiceTranslation,
31
+ } from "./types.multilocale";
21
32
 
22
- function flattenService(row: Record<string, unknown>, locale: string): Service | null {
23
- const trans = pickTranslation(row.translations as ServiceTranslation[] | undefined, locale);
24
- if (!isUsableTranslation(trans)) return null;
25
-
26
- return {
27
- id: row.id as string,
28
- status: row.status as Service["status"],
29
- title: trans!.title!,
30
- slug: trans!.slug!,
31
- summary: trans?.summary ?? null,
32
- body: trans?.body ?? null,
33
- image: row.image as Service["image"],
34
- price_label: trans?.price_label ?? null,
35
- sort: (row.sort as number | null) ?? null,
36
- };
33
+ function flattenService(row: ServiceRow, locale: string): Service | null {
34
+ return withLocale(
35
+ row,
36
+ locale,
37
+ (r, t) => ({
38
+ id: r.id,
39
+ status: r.status,
40
+ title: t.title,
41
+ slug: t.slug,
42
+ summary: t.summary ?? null,
43
+ body: t.body ?? null,
44
+ image: r.image,
45
+ price_label: t.price_label ?? null,
46
+ sort: r.sort ?? null,
47
+ }),
48
+ { required: ["title", "slug"] },
49
+ );
37
50
  }
38
51
 
39
- const SERVICE_LIST_FIELDS = ["id", "status", "image", "sort", { translations: ["id", "languages_code", "title", "slug", "price_label", "summary"] }] as const;
40
- const SERVICE_DETAIL_FIELDS = ["id", "status", "image", "sort", { translations: ["id", "languages_code", "title", "slug", "price_label", "summary", "body"] }] as const;
52
+ const SERVICE_LIST_FIELDS = [
53
+ "id",
54
+ "status",
55
+ "image",
56
+ "sort",
57
+ {
58
+ translations: [
59
+ "id",
60
+ "languages_code",
61
+ "title",
62
+ "slug",
63
+ "price_label",
64
+ "summary",
65
+ ],
66
+ },
67
+ ] as const;
68
+ const SERVICE_DETAIL_FIELDS = [
69
+ "id",
70
+ "status",
71
+ "image",
72
+ "sort",
73
+ {
74
+ translations: [
75
+ "id",
76
+ "languages_code",
77
+ "title",
78
+ "slug",
79
+ "price_label",
80
+ "summary",
81
+ "body",
82
+ ],
83
+ },
84
+ ] as const;
41
85
 
42
86
  export function serviceImageUrl(service: Service): string | null {
43
- const id = directusFileId(service.image as string | DirectusFileRef | null | undefined);
87
+ const id = directusFileId(
88
+ service.image as string | DirectusFileRef | null | undefined,
89
+ );
44
90
  return id ? directusAssetUrl(id) : null;
45
91
  }
46
92
 
47
- export async function getServices(options: GetServicesOptions = {}): Promise<Service[]> {
48
- const client = getDirectus(); if (!client) return [];
49
- if (!collections.services) { dkitQueryFailed('collections.services missing — re-run `dkit add services`'); return []; }
93
+ export async function getServices(
94
+ options: GetServicesOptions = {},
95
+ ): Promise<Service[]> {
96
+ const client = getDirectus();
97
+ if (!client) return [];
98
+ if (!collections.services) {
99
+ dkitQueryFailed("collections.services missing — re-run `dkit add services`");
100
+ return [];
101
+ }
50
102
  const locale = await resolveLocale(options.locale);
51
103
  const status = statusFilter(options.status);
52
- const and: Record<string, unknown>[] = [requireLocaleTranslation(locale)];
53
- if (status) and.unshift(status);
104
+ const filter = status
105
+ ? { _and: [status, requireLocaleTranslation(locale)] }
106
+ : requireLocaleTranslation(locale);
54
107
  const limit = queryLimit(options.limit);
55
108
  try {
56
- const rows = await client.request(readItems(collections.services, {
57
- filter: { _and: and },
58
- deep: translationsDeepFilter(locale),
59
- fields: [...SERVICE_LIST_FIELDS], sort: options.sort ?? ["sort"],
60
- ...(limit !== undefined ? { limit } : {}),
61
- }));
62
- return (rows as Record<string, unknown>[])
109
+ const rows = await client.request(
110
+ readItems(collections.services, {
111
+ filter,
112
+ deep: translationsDeepFilter(locale),
113
+ fields: [...SERVICE_LIST_FIELDS],
114
+ sort: options.sort ?? ["sort"],
115
+ ...(limit !== undefined ? { limit } : {}),
116
+ }),
117
+ );
118
+ return (rows as ServiceRow[])
63
119
  .map((r) => flattenService(r, locale))
64
120
  .filter((s): s is Service => s != null);
65
- } catch (err) { dkitQueryFailed(`getServices failed`, err); return []; }
121
+ } catch (err) {
122
+ dkitQueryFailed(`getServices failed`, err);
123
+ return [];
124
+ }
66
125
  }
67
126
 
68
- export async function getServiceBySlug(slug: string, options: GetServiceBySlugOptions = {}): Promise<Service | null> {
69
- const client = getDirectus(); if (!client) return null;
70
- if (!collections.services) { dkitQueryFailed("collections.services missing"); return null; }
127
+ export async function getServiceBySlug(
128
+ slug: string,
129
+ options: GetServiceBySlugOptions = {},
130
+ ): Promise<Service | null> {
131
+ const client = getDirectus();
132
+ if (!client) return null;
133
+ if (!collections.services) {
134
+ dkitQueryFailed("collections.services missing");
135
+ return null;
136
+ }
71
137
  const locale = await resolveLocale(options.locale);
72
138
  const status = statusFilter(options.status);
73
- const and: Record<string, unknown>[] = [{
139
+ const bySlug = {
74
140
  translations: {
75
141
  _and: [
76
142
  { languages_code: { _eq: locale } },
@@ -78,32 +144,46 @@ export async function getServiceBySlug(slug: string, options: GetServiceBySlugOp
78
144
  { title: { _nempty: true } },
79
145
  ],
80
146
  },
81
- }];
82
- if (status) and.unshift(status);
147
+ };
148
+ const filter = status ? { _and: [status, bySlug] } : bySlug;
83
149
  try {
84
- const rows = await client.request(readItems(collections.services, {
85
- filter: { _and: and },
86
- deep: translationsDeepFilter(locale),
87
- fields: [...SERVICE_DETAIL_FIELDS],
88
- limit: 1,
89
- }));
90
- const row = (rows as Record<string, unknown>[])[0]; return row ? flattenService(row, locale) : null;
91
- } catch (err) { dkitQueryFailed(`getServiceBySlug(${slug}) failed`, err); return null; }
150
+ const rows = await client.request(
151
+ readItems(collections.services, {
152
+ filter,
153
+ deep: translationsDeepFilter(locale),
154
+ fields: [...SERVICE_DETAIL_FIELDS],
155
+ limit: 1,
156
+ }),
157
+ );
158
+ const row = (rows as ServiceRow[])[0];
159
+ return row ? flattenService(row, locale) : null;
160
+ } catch (err) {
161
+ dkitQueryFailed(`getServiceBySlug(${slug}) failed`, err);
162
+ return null;
163
+ }
92
164
  }
93
165
 
94
- export async function getServiceById(id: string, options: GetServiceBySlugOptions = {}): Promise<Service | null> {
95
- const client = getDirectus(); if (!client) return null; if (!collections.services) return null;
166
+ export async function getServiceById(
167
+ id: string,
168
+ options: GetServiceBySlugOptions = {},
169
+ ): Promise<Service | null> {
170
+ const client = getDirectus();
171
+ if (!client) return null;
172
+ if (!collections.services) return null;
96
173
  const locale = await resolveLocale(options.locale);
97
174
  try {
98
- const rows = await client.request(readItems(collections.services, {
99
- filter: {
100
- _and: [{ id: { _eq: id } }, requireLocaleTranslation(locale)],
101
- },
102
- deep: translationsDeepFilter(locale),
103
- fields: [...SERVICE_DETAIL_FIELDS],
104
- limit: 1,
105
- }));
106
- const row = (rows as Record<string, unknown>[])[0];
107
- return row ? flattenService(row as Record<string, unknown>, locale) : null;
108
- } catch (err) { dkitQueryFailed(`getServiceById(${id}) failed`, err); return null; }
175
+ const rows = await client.request(
176
+ readItems(collections.services, {
177
+ filter: { _and: [{ id: { _eq: id } }, requireLocaleTranslation(locale)] },
178
+ deep: translationsDeepFilter(locale),
179
+ fields: [...SERVICE_DETAIL_FIELDS],
180
+ limit: 1,
181
+ }),
182
+ );
183
+ const row = (rows as ServiceRow[])[0];
184
+ return row ? flattenService(row, locale) : null;
185
+ } catch (err) {
186
+ dkitQueryFailed(`getServiceById(${id}) failed`, err);
187
+ return null;
188
+ }
109
189
  }
@@ -65,13 +65,12 @@ export async function getServices(
65
65
  return [];
66
66
  }
67
67
  const status = statusFilter(options.status);
68
- const and: Record<string, unknown>[] = [];
69
- if (status) and.push(status);
68
+ const filter = status;
70
69
  const limit = queryLimit(options.limit);
71
70
  try {
72
71
  return await client.request(
73
72
  readItems(collections.services, {
74
- filter: and.length ? { _and: and } : undefined,
73
+ filter,
75
74
  fields: [...SERVICE_LIST_FIELDS],
76
75
  sort: options.sort ?? ["sort", "title"],
77
76
  ...(limit !== undefined ? { limit } : {}),
@@ -97,12 +96,13 @@ export async function getServiceBySlug(
97
96
  return null;
98
97
  }
99
98
  const status = statusFilter(options.status);
100
- const and: Record<string, unknown>[] = [{ slug: { _eq: slug } }];
101
- if (status) and.unshift(status);
99
+ const filter = status
100
+ ? { _and: [status, { slug: { _eq: slug } }] }
101
+ : { slug: { _eq: slug } };
102
102
  try {
103
103
  const rows = await client.request(
104
104
  readItems(collections.services, {
105
- filter: { _and: and },
105
+ filter,
106
106
  fields: [...SERVICE_DETAIL_FIELDS],
107
107
  limit: 1,
108
108
  }),
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "files": [
3
3
  {
4
- "id": "s1000000-0000-4000-8000-000000000001",
4
+ "id": "d1000000-0000-4000-8000-000000000001",
5
5
  "filename_download": "strategy-consulting.jpg",
6
6
  "title": "Sample image — strategy & consulting (Unsplash)",
7
7
  "type": "image/jpeg",
8
8
  "path": "assets/strategy-consulting.jpg"
9
9
  },
10
10
  {
11
- "id": "s1000000-0000-4000-8000-000000000002",
11
+ "id": "d1000000-0000-4000-8000-000000000002",
12
12
  "filename_download": "design-development.jpg",
13
13
  "title": "Sample image — design & development (Unsplash)",
14
14
  "type": "image/jpeg",
@@ -24,7 +24,7 @@
24
24
  "slug": "sample-strategy-consulting",
25
25
  "summary": "Sample service — discovery workshops, roadmapping, and technical advisory for digital products.",
26
26
  "price_label": "From €2,500",
27
- "image": "s1000000-0000-4000-8000-000000000001",
27
+ "image": "d1000000-0000-4000-8000-000000000001",
28
28
  "sort": 1,
29
29
  "body": "<p>This is <strong>sample seed data</strong> from the services module. Replace or delete it once your own offerings are ready.</p><h2>What to verify</h2><p>Use this service to confirm the public API, image field, price label, and rich-text rendering in your app.</p><blockquote><p>Sample HTML includes headings, quotes, and lists so you can judge layout and <code>.dkit-prose</code> immediately after install.</p></blockquote><h3>Includes</h3><ul><li>Stakeholder interviews</li><li>Competitive analysis</li><li>Technical architecture review</li><li>Prioritised roadmap deliverable</li></ul><h3>Next steps</h3><ol><li>Open this item in Directus to edit fields</li><li>Confirm list and detail views render correctly</li><li>Replace every sample field before going to production</li></ol><p>Safe to delete after verifying the install.</p>"
30
30
  },
@@ -35,7 +35,7 @@
35
35
  "slug": "sample-design-development",
36
36
  "summary": "Sample service — end-to-end UI/UX design and full-stack implementation for web applications.",
37
37
  "price_label": "Custom quote",
38
- "image": "s1000000-0000-4000-8000-000000000002",
38
+ "image": "d1000000-0000-4000-8000-000000000002",
39
39
  "sort": 2,
40
40
  "body": "<p>A second sample service lets you test sorting, card layouts, and the <code>price_label</code> display.</p><h2>Fields to check</h2><p><code>status</code> gates public reads. <code>price_label</code> is an optional short string shown in the list and detail views — leave it empty when pricing is not public.</p><h3>Deliverables</h3><ul><li>Wireframes and interactive prototypes</li><li>Visual design and design system</li><li>Front-end and back-end implementation</li><li>Deployment and handover documentation</li></ul><blockquote><p>After install, open this service in your app and confirm list + detail layouts look right before you replace the sample content.</p></blockquote><p>Safe to delete once you have verified the install.</p>"
41
41
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": [
3
3
  {
4
- "id": "s1000000-0000-4000-8000-000000000001",
4
+ "id": "d1000000-0000-4000-8000-000000000001",
5
5
  "filename_download": "strategy-consulting.jpg",
6
6
  "title": "Sample image — strategy & consulting (Unsplash)",
7
7
  "type": "image/jpeg",
@@ -14,7 +14,7 @@
14
14
  "id": "c3c3c3c3-c3c3-4c3c-8c3c-c3c3c3c3c3c3",
15
15
  "status": "published",
16
16
  "sort": 1,
17
- "image": "s1000000-0000-4000-8000-000000000001",
17
+ "image": "d1000000-0000-4000-8000-000000000001",
18
18
  "translations": [
19
19
  {
20
20
  "languages_code": "en-US",
@@ -1,3 +1,5 @@
1
+ type DkitSortField<T extends string> = T | `-${T}`;
2
+
1
3
  export type DirectusFileRef = { id: string };
2
4
 
3
5
  export type ServiceTranslation = {
@@ -11,6 +13,14 @@ export type ServiceTranslation = {
11
13
  body?: string | null;
12
14
  };
13
15
 
16
+ export type ServiceRow = {
17
+ id: string;
18
+ status: "published" | "draft" | "archived";
19
+ image?: string | DirectusFileRef | null;
20
+ sort?: number | null;
21
+ translations?: ServiceTranslation[] | null;
22
+ };
23
+
14
24
  export type Service = {
15
25
  id: string;
16
26
  status: "published" | "draft" | "archived";
@@ -24,13 +34,13 @@ export type Service = {
24
34
  };
25
35
 
26
36
  export type GetServicesOptions = {
27
- status?: string | null;
37
+ status?: Service["status"] | null;
28
38
  limit?: number;
29
- sort?: string[];
39
+ sort?: Array<DkitSortField<"sort" | "id" | "status">>;
30
40
  locale?: string;
31
41
  };
32
42
 
33
43
  export type GetServiceBySlugOptions = {
34
- status?: string | null;
44
+ status?: Service["status"] | null;
35
45
  locale?: string;
36
46
  };
@@ -1,3 +1,5 @@
1
+ type DkitSortField<T extends string> = T | `-${T}`;
2
+
1
3
  export type DirectusFileRef = {
2
4
  id: string;
3
5
  };
@@ -16,11 +18,11 @@ export type Service = {
16
18
 
17
19
  export type GetServicesOptions = {
18
20
  /** Directus status filter. Default `"published"`. Pass `null` to skip. */
19
- status?: string | null;
21
+ status?: Service["status"] | null;
20
22
  limit?: number;
21
- sort?: string[];
23
+ sort?: Array<DkitSortField<"sort" | "id" | "status">>;
22
24
  };
23
25
 
24
26
  export type GetServiceBySlugOptions = {
25
- status?: string | null;
27
+ status?: Service["status"] | null;
26
28
  };