@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.
- package/dist/bin.js +119 -26
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/vendor/registry/blocks/blog-detail/ui/minimal/next/blog-detail.tsx +0 -1
- package/vendor/registry/blocks/blog-detail/ui/shadcn/next/blog-detail.tsx +0 -1
- package/vendor/registry/blocks/blog-list/ui/minimal/next/blog-list.tsx +0 -1
- package/vendor/registry/blocks/blog-list/ui/shadcn/next/blog-list.tsx +0 -1
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/next/blog-list-cards.tsx +0 -1
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/next/blog-list-cards.tsx +0 -1
- package/vendor/registry/blocks/booking-form-ui/ui/minimal/next/booking-form.tsx +0 -1
- package/vendor/registry/blocks/booking-form-ui/ui/shadcn/next/booking-form.tsx +0 -1
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/next/contact-form.tsx +0 -1
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/next/contact-form.tsx +0 -1
- package/vendor/registry/blocks/faq-list/ui/minimal/next/faq-list.tsx +0 -1
- package/vendor/registry/blocks/faq-list/ui/shadcn/next/faq-list.tsx +0 -1
- package/vendor/registry/blocks/page-detail/ui/minimal/next/page-detail.tsx +0 -1
- package/vendor/registry/blocks/page-detail/ui/shadcn/next/page-detail.tsx +0 -1
- package/vendor/registry/blocks/project-detail/ui/minimal/next/project-detail.tsx +0 -1
- package/vendor/registry/blocks/project-detail/ui/shadcn/next/project-detail.tsx +0 -1
- package/vendor/registry/blocks/project-list/ui/minimal/next/project-list.tsx +0 -1
- package/vendor/registry/blocks/project-list/ui/shadcn/next/project-list.tsx +0 -1
- package/vendor/registry/blocks/project-list-cards/ui/minimal/next/project-list-cards.tsx +0 -1
- package/vendor/registry/blocks/project-list-cards/ui/shadcn/next/project-list-cards.tsx +0 -1
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel-client.tsx +0 -4
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel.tsx +0 -1
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel-client.tsx +0 -1
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel.tsx +0 -1
- package/vendor/registry/blocks/service-detail/ui/minimal/next/service-detail.tsx +0 -1
- package/vendor/registry/blocks/service-detail/ui/shadcn/next/service-detail.tsx +0 -1
- package/vendor/registry/blocks/service-list/ui/minimal/next/service-list.tsx +0 -1
- package/vendor/registry/blocks/service-list/ui/shadcn/next/service-list.tsx +0 -1
- package/vendor/registry/blocks/service-list-cards/ui/minimal/next/service-list-cards.tsx +0 -1
- package/vendor/registry/blocks/service-list-cards/ui/shadcn/next/service-list-cards.tsx +0 -1
- package/vendor/registry/blocks/social-links/ui/minimal/next/social-links.tsx +0 -1
- package/vendor/registry/blocks/social-links/ui/shadcn/next/social-links.tsx +0 -1
- package/vendor/registry/blocks/team-detail/ui/minimal/next/team-detail.tsx +0 -1
- package/vendor/registry/blocks/team-detail/ui/shadcn/next/team-detail.tsx +0 -1
- package/vendor/registry/blocks/team-list/ui/minimal/next/team-list.tsx +0 -1
- package/vendor/registry/blocks/team-list/ui/shadcn/next/team-list.tsx +0 -1
- package/vendor/registry/blocks/team-list-cards/ui/minimal/next/team-list-cards.tsx +0 -1
- package/vendor/registry/blocks/team-list-cards/ui/shadcn/next/team-list-cards.tsx +0 -1
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel-client.tsx +0 -4
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel.tsx +0 -1
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel-client.tsx +0 -1
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel.tsx +0 -1
- package/vendor/registry/blocks/testimonials-list/ui/minimal/next/testimonials-list.tsx +0 -1
- package/vendor/registry/blocks/testimonials-list/ui/shadcn/next/testimonials-list.tsx +0 -1
- package/vendor/registry/blocks/testimonials-list-cards/ui/minimal/next/testimonials-list-cards.tsx +0 -1
- package/vendor/registry/blocks/testimonials-list-cards/ui/shadcn/next/testimonials-list-cards.tsx +0 -1
- package/vendor/registry/modules/blog/lib.multilocale.ts +124 -129
- package/vendor/registry/modules/blog/lib.ts +12 -9
- package/vendor/registry/modules/blog/services/seed.json +1 -1
- package/vendor/registry/modules/blog/services/seed.multilocale.json +1 -1
- package/vendor/registry/modules/blog/types.multilocale.ts +41 -12
- package/vendor/registry/modules/blog/types.ts +8 -6
- package/vendor/registry/modules/faq/lib.multilocale.ts +30 -30
- package/vendor/registry/modules/faq/lib.ts +4 -5
- package/vendor/registry/modules/faq/types.multilocale.ts +13 -2
- package/vendor/registry/modules/faq/types.ts +4 -2
- package/vendor/registry/modules/navigation/lib.multilocale.ts +207 -76
- package/vendor/registry/modules/navigation/lib.ts +18 -17
- package/vendor/registry/modules/navigation/types.multilocale.ts +24 -4
- package/vendor/registry/modules/navigation/types.ts +6 -4
- package/vendor/registry/modules/pages/lib.multilocale.ts +34 -39
- package/vendor/registry/modules/pages/lib.ts +4 -3
- package/vendor/registry/modules/pages/types.multilocale.ts +14 -3
- package/vendor/registry/modules/pages/types.ts +5 -3
- package/vendor/registry/modules/projects/lib.multilocale.ts +149 -65
- package/vendor/registry/modules/projects/lib.ts +6 -6
- package/vendor/registry/modules/projects/services/seed.json +2 -2
- package/vendor/registry/modules/projects/services/seed.multilocale.json +2 -2
- package/vendor/registry/modules/projects/types.multilocale.ts +15 -3
- package/vendor/registry/modules/projects/types.ts +5 -3
- package/vendor/registry/modules/services/lib.multilocale.ts +143 -63
- package/vendor/registry/modules/services/lib.ts +6 -6
- package/vendor/registry/modules/services/services/seed.json +4 -4
- package/vendor/registry/modules/services/services/seed.multilocale.json +2 -2
- package/vendor/registry/modules/services/types.multilocale.ts +13 -3
- package/vendor/registry/modules/services/types.ts +5 -3
- package/vendor/registry/modules/settings/lib.multilocale.ts +159 -57
- package/vendor/registry/modules/settings/types.multilocale.ts +15 -0
- package/vendor/registry/modules/settings/types.ts +2 -2
- package/vendor/registry/modules/team/lib.multilocale.ts +116 -49
- package/vendor/registry/modules/team/lib.ts +4 -3
- package/vendor/registry/modules/team/services/seed.json +4 -4
- package/vendor/registry/modules/team/services/seed.multilocale.json +2 -2
- package/vendor/registry/modules/team/types.multilocale.ts +16 -3
- package/vendor/registry/modules/team/types.ts +5 -3
- package/vendor/registry/modules/testimonials/lib.multilocale.ts +82 -50
- package/vendor/registry/modules/testimonials/services/seed.json +4 -4
- package/vendor/registry/modules/testimonials/services/seed.multilocale.json +2 -2
- package/vendor/registry/modules/testimonials/types.multilocale.ts +14 -2
- package/vendor/registry/modules/testimonials/types.ts +4 -2
- package/vendor/registry/shared/helpers.ts +9 -3
- package/vendor/registry/shared/i18n.ts +84 -12
- package/vendor/registry/shared/prose.css +1 -1
package/dist/bin.js
CHANGED
|
@@ -4766,9 +4766,21 @@ import fs8 from "fs";
|
|
|
4766
4766
|
import path9 from "path";
|
|
4767
4767
|
var COLLECTION_TYPES = {
|
|
4768
4768
|
/* blog */
|
|
4769
|
-
posts: {
|
|
4770
|
-
|
|
4771
|
-
|
|
4769
|
+
posts: {
|
|
4770
|
+
moduleId: "blog",
|
|
4771
|
+
typeName: "BlogPost",
|
|
4772
|
+
wireTypeName: "BlogPostRow"
|
|
4773
|
+
},
|
|
4774
|
+
authors: {
|
|
4775
|
+
moduleId: "blog",
|
|
4776
|
+
typeName: "BlogAuthor",
|
|
4777
|
+
wireTypeName: "BlogAuthorRow"
|
|
4778
|
+
},
|
|
4779
|
+
categories: {
|
|
4780
|
+
moduleId: "blog",
|
|
4781
|
+
typeName: "BlogCategory",
|
|
4782
|
+
wireTypeName: "BlogCategoryRow"
|
|
4783
|
+
},
|
|
4772
4784
|
posts_categories: { moduleId: "blog", typeName: "PostsCategoriesRow" },
|
|
4773
4785
|
posts_translations: { moduleId: "blog", typeName: "BlogPostTranslation" },
|
|
4774
4786
|
categories_translations: {
|
|
@@ -4780,24 +4792,62 @@ var COLLECTION_TYPES = {
|
|
|
4780
4792
|
typeName: "BlogAuthorTranslation"
|
|
4781
4793
|
},
|
|
4782
4794
|
/* pages */
|
|
4783
|
-
pages: {
|
|
4795
|
+
pages: {
|
|
4796
|
+
moduleId: "pages",
|
|
4797
|
+
typeName: "SitePage",
|
|
4798
|
+
wireTypeName: "SitePageRow"
|
|
4799
|
+
},
|
|
4784
4800
|
pages_translations: { moduleId: "pages", typeName: "SitePageTranslation" },
|
|
4785
4801
|
/* page-builder */
|
|
4786
|
-
builder_pages: {
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4802
|
+
builder_pages: {
|
|
4803
|
+
moduleId: "page-builder",
|
|
4804
|
+
typeName: "BuilderPage",
|
|
4805
|
+
wireTypeName: "BuilderPageRow"
|
|
4806
|
+
},
|
|
4807
|
+
block_hero: {
|
|
4808
|
+
moduleId: "page-builder",
|
|
4809
|
+
typeName: "BlockHero",
|
|
4810
|
+
wireTypeName: "BlockHeroRow"
|
|
4811
|
+
},
|
|
4812
|
+
block_richtext: {
|
|
4813
|
+
moduleId: "page-builder",
|
|
4814
|
+
typeName: "BlockRichtext",
|
|
4815
|
+
wireTypeName: "BlockRichtextRow"
|
|
4816
|
+
},
|
|
4817
|
+
block_cta: {
|
|
4818
|
+
moduleId: "page-builder",
|
|
4819
|
+
typeName: "BlockCta",
|
|
4820
|
+
wireTypeName: "BlockCtaRow"
|
|
4821
|
+
},
|
|
4822
|
+
block_faq: {
|
|
4823
|
+
moduleId: "page-builder",
|
|
4824
|
+
typeName: "BlockFaq",
|
|
4825
|
+
wireTypeName: "BlockFaqRow"
|
|
4826
|
+
},
|
|
4827
|
+
block_faq_items: {
|
|
4828
|
+
moduleId: "page-builder",
|
|
4829
|
+
typeName: "BlockFaqItem",
|
|
4830
|
+
wireTypeName: "BlockFaqItemRow"
|
|
4831
|
+
},
|
|
4832
|
+
block_card_grid: {
|
|
4833
|
+
moduleId: "page-builder",
|
|
4834
|
+
typeName: "BlockCardGrid",
|
|
4835
|
+
wireTypeName: "BlockCardGridRow"
|
|
4836
|
+
},
|
|
4793
4837
|
block_card_grid_cards: {
|
|
4794
4838
|
moduleId: "page-builder",
|
|
4795
|
-
typeName: "BlockCardGridCard"
|
|
4839
|
+
typeName: "BlockCardGridCard",
|
|
4840
|
+
wireTypeName: "BlockCardGridCardRow"
|
|
4841
|
+
},
|
|
4842
|
+
block_carousel: {
|
|
4843
|
+
moduleId: "page-builder",
|
|
4844
|
+
typeName: "BlockCarousel",
|
|
4845
|
+
wireTypeName: "BlockCarouselRow"
|
|
4796
4846
|
},
|
|
4797
|
-
block_carousel: { moduleId: "page-builder", typeName: "BlockCarousel" },
|
|
4798
4847
|
block_carousel_slides: {
|
|
4799
4848
|
moduleId: "page-builder",
|
|
4800
|
-
typeName: "BlockCarouselSlide"
|
|
4849
|
+
typeName: "BlockCarouselSlide",
|
|
4850
|
+
wireTypeName: "BlockCarouselSlideRow"
|
|
4801
4851
|
},
|
|
4802
4852
|
block_featured_blog: {
|
|
4803
4853
|
moduleId: "page-builder",
|
|
@@ -4860,6 +4910,7 @@ var COLLECTION_TYPES = {
|
|
|
4860
4910
|
site_settings: {
|
|
4861
4911
|
moduleId: "settings",
|
|
4862
4912
|
typeName: "SiteSettings",
|
|
4913
|
+
wireTypeName: "SiteSettingsRow",
|
|
4863
4914
|
singleton: true
|
|
4864
4915
|
},
|
|
4865
4916
|
site_settings_translations: {
|
|
@@ -4867,8 +4918,16 @@ var COLLECTION_TYPES = {
|
|
|
4867
4918
|
typeName: "SiteSettingsTranslation"
|
|
4868
4919
|
},
|
|
4869
4920
|
/* navigation */
|
|
4870
|
-
nav_menus: {
|
|
4871
|
-
|
|
4921
|
+
nav_menus: {
|
|
4922
|
+
moduleId: "navigation",
|
|
4923
|
+
typeName: "NavMenu",
|
|
4924
|
+
wireTypeName: "NavMenuRow"
|
|
4925
|
+
},
|
|
4926
|
+
nav_items: {
|
|
4927
|
+
moduleId: "navigation",
|
|
4928
|
+
typeName: "NavItem",
|
|
4929
|
+
wireTypeName: "NavItemRow"
|
|
4930
|
+
},
|
|
4872
4931
|
nav_menus_translations: {
|
|
4873
4932
|
moduleId: "navigation",
|
|
4874
4933
|
typeName: "NavMenuTranslation"
|
|
@@ -4878,31 +4937,51 @@ var COLLECTION_TYPES = {
|
|
|
4878
4937
|
typeName: "NavItemTranslation"
|
|
4879
4938
|
},
|
|
4880
4939
|
/* faq */
|
|
4881
|
-
faq_items: {
|
|
4940
|
+
faq_items: {
|
|
4941
|
+
moduleId: "faq",
|
|
4942
|
+
typeName: "FaqItem",
|
|
4943
|
+
wireTypeName: "FaqItemRow"
|
|
4944
|
+
},
|
|
4882
4945
|
faq_items_translations: {
|
|
4883
4946
|
moduleId: "faq",
|
|
4884
4947
|
typeName: "FaqItemTranslation"
|
|
4885
4948
|
},
|
|
4886
4949
|
/* testimonials */
|
|
4887
|
-
testimonials: {
|
|
4950
|
+
testimonials: {
|
|
4951
|
+
moduleId: "testimonials",
|
|
4952
|
+
typeName: "Testimonial",
|
|
4953
|
+
wireTypeName: "TestimonialRow"
|
|
4954
|
+
},
|
|
4888
4955
|
testimonials_translations: {
|
|
4889
4956
|
moduleId: "testimonials",
|
|
4890
4957
|
typeName: "TestimonialTranslation"
|
|
4891
4958
|
},
|
|
4892
4959
|
/* projects */
|
|
4893
|
-
projects: {
|
|
4960
|
+
projects: {
|
|
4961
|
+
moduleId: "projects",
|
|
4962
|
+
typeName: "Project",
|
|
4963
|
+
wireTypeName: "ProjectRow"
|
|
4964
|
+
},
|
|
4894
4965
|
projects_translations: {
|
|
4895
4966
|
moduleId: "projects",
|
|
4896
4967
|
typeName: "ProjectTranslation"
|
|
4897
4968
|
},
|
|
4898
4969
|
/* services */
|
|
4899
|
-
services: {
|
|
4970
|
+
services: {
|
|
4971
|
+
moduleId: "services",
|
|
4972
|
+
typeName: "Service",
|
|
4973
|
+
wireTypeName: "ServiceRow"
|
|
4974
|
+
},
|
|
4900
4975
|
services_translations: {
|
|
4901
4976
|
moduleId: "services",
|
|
4902
4977
|
typeName: "ServiceTranslation"
|
|
4903
4978
|
},
|
|
4904
4979
|
/* team */
|
|
4905
|
-
team_members: {
|
|
4980
|
+
team_members: {
|
|
4981
|
+
moduleId: "team",
|
|
4982
|
+
typeName: "TeamMember",
|
|
4983
|
+
wireTypeName: "TeamMemberRow"
|
|
4984
|
+
},
|
|
4906
4985
|
team_members_translations: {
|
|
4907
4986
|
moduleId: "team",
|
|
4908
4987
|
typeName: "TeamMemberTranslation"
|
|
@@ -4914,17 +4993,19 @@ function writeDkitClient(projectRoot, config, collectionMap = config.collections
|
|
|
4914
4993
|
const installed = new Set(Object.keys(config.modules ?? {}));
|
|
4915
4994
|
const importsByModule = /* @__PURE__ */ new Map();
|
|
4916
4995
|
const schemaFields = [];
|
|
4996
|
+
const useWire = Boolean(config.multilocale);
|
|
4917
4997
|
for (const [logical, physical] of Object.entries(collectionMap)) {
|
|
4918
4998
|
const binding = COLLECTION_TYPES[logical];
|
|
4919
4999
|
if (!binding) continue;
|
|
4920
5000
|
if (!installed.has(binding.moduleId)) continue;
|
|
5001
|
+
const schemaType = useWire && binding.wireTypeName ? binding.wireTypeName : binding.typeName;
|
|
4921
5002
|
let set = importsByModule.get(binding.moduleId);
|
|
4922
5003
|
if (!set) {
|
|
4923
5004
|
set = /* @__PURE__ */ new Set();
|
|
4924
5005
|
importsByModule.set(binding.moduleId, set);
|
|
4925
5006
|
}
|
|
4926
|
-
set.add(
|
|
4927
|
-
const typeExpr = binding.singleton ?
|
|
5007
|
+
set.add(schemaType);
|
|
5008
|
+
const typeExpr = binding.singleton ? schemaType : `${schemaType}[]`;
|
|
4928
5009
|
schemaFields.push(` ${JSON.stringify(physical)}: ${typeExpr};`);
|
|
4929
5010
|
}
|
|
4930
5011
|
const importLines = [...importsByModule.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([moduleId, types]) => {
|
|
@@ -4956,6 +5037,8 @@ ${schemaFields.length ? `${schemaFields.join("\n")}
|
|
|
4956
5037
|
const clientContents = `/** Generated by dkit \u2014 shared typed Directus client + asset helpers.
|
|
4957
5038
|
* Modules must import getDirectus / directusFileId / directusAssetUrl from here \u2014
|
|
4958
5039
|
* never redefine them in lib/dkit/<module>.ts.
|
|
5040
|
+
*
|
|
5041
|
+
* Typing pipeline: module *.types \u2192 schema (DkitSchema) \u2192 this client \u2192 services \u2192 UI.
|
|
4959
5042
|
*/
|
|
4960
5043
|
import {
|
|
4961
5044
|
createDirectus,
|
|
@@ -4971,6 +5054,8 @@ export type { DkitSchema } from "./schema";
|
|
|
4971
5054
|
|
|
4972
5055
|
export type DirectusFileRef = { id: string };
|
|
4973
5056
|
|
|
5057
|
+
export type DkitClient = ReturnType<typeof createDkitClient>;
|
|
5058
|
+
|
|
4974
5059
|
function directusBaseUrl(): string | undefined {
|
|
4975
5060
|
return (
|
|
4976
5061
|
process.env.DIRECTUS_URL ||
|
|
@@ -4980,6 +5065,10 @@ function directusBaseUrl(): string | undefined {
|
|
|
4980
5065
|
);
|
|
4981
5066
|
}
|
|
4982
5067
|
|
|
5068
|
+
function createDkitClient(url: string) {
|
|
5069
|
+
return createDirectus<DkitSchema>(url).with(rest());
|
|
5070
|
+
}
|
|
5071
|
+
|
|
4983
5072
|
/**
|
|
4984
5073
|
* Log soft-fail query problems in development.
|
|
4985
5074
|
* Production stays quiet so empty lists don\u2019t spam logs.
|
|
@@ -4997,7 +5086,7 @@ export function dkitQueryFailed(context: string, err?: unknown): void {
|
|
|
4997
5086
|
* Server-side Directus client (public role / no admin token).
|
|
4998
5087
|
* Returns null when DIRECTUS_URL is unset so pages can fail soft.
|
|
4999
5088
|
*/
|
|
5000
|
-
export function getDirectus() {
|
|
5089
|
+
export function getDirectus(): DkitClient | null {
|
|
5001
5090
|
const url = directusBaseUrl();
|
|
5002
5091
|
if (!url) {
|
|
5003
5092
|
dkitQueryFailed(
|
|
@@ -5005,7 +5094,7 @@ export function getDirectus() {
|
|
|
5005
5094
|
);
|
|
5006
5095
|
return null;
|
|
5007
5096
|
}
|
|
5008
|
-
return
|
|
5097
|
+
return createDkitClient(url);
|
|
5009
5098
|
}
|
|
5010
5099
|
|
|
5011
5100
|
/** Normalize a string id or expanded file object to a file id. */
|
|
@@ -6443,12 +6532,16 @@ ${collectionsEntries}
|
|
|
6443
6532
|
} as const;
|
|
6444
6533
|
|
|
6445
6534
|
export type DkitCollection = keyof typeof collections;
|
|
6535
|
+
/** Physical Directus collection name (schema key). */
|
|
6536
|
+
export type DkitCollectionName = (typeof collections)[DkitCollection];
|
|
6446
6537
|
|
|
6447
6538
|
export const modules = {
|
|
6448
6539
|
${modulesEntries}
|
|
6449
6540
|
} as const;
|
|
6450
6541
|
|
|
6451
|
-
export function collection
|
|
6542
|
+
export function collection<K extends DkitCollection>(
|
|
6543
|
+
name: K,
|
|
6544
|
+
): (typeof collections)[K] {
|
|
6452
6545
|
return collections[name];
|
|
6453
6546
|
}
|
|
6454
6547
|
|