@nocode-factory/sanity-kit 2.53.0 → 2.54.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 CHANGED
@@ -35,6 +35,7 @@ reste d'avant la 2.0.0 (figé en 1.8.0) : le retirer.
35
35
  | Site, rendu des sections | `applyDefaults(section, defaults, isDraft ? reattributeTo(source, section._key) : undefined)` ; défauts lus avec `componentDefaultsQuery(types, projection)` |
36
36
  | Site, design system | page `/design-system/composant?type=<nom>` (rendu réel d'un composant, voir le starter) |
37
37
  | Studio, redirections | structure : `redirectsStructure(S, {icon})` (sous-dossiers Manual / Slug changes / Languages) ; type `redirect` : `const c = redirectConflicts({siteRoutes, i18n: {defaultLocale}})`, `from` → `rule.custom(c.from)`, `to` → `rule.custom(c.to)` (publication refusée en cas de conflit) |
38
+ | Studio, collections | structure : vue table (tri, filtres par colonne, export CSV) — `.child(ncfCollectionTable(S, options, type))` sur une entrée de collection, ou `...ncfCollections(S, context, options)` pour la découverte auto |
38
39
 
39
40
  Puis, depuis `studio/` :
40
41
 
@@ -44,6 +45,36 @@ npx ncf-kit doctor
44
45
 
45
46
  Zéro ✖ = projet complet. Sortie 1 sinon (utilisable en CI).
46
47
 
48
+ ## Collections : vue table (façon Airtable)
49
+
50
+ Cliquer une collection dans l'onglet **Structure** ouvre une **table** plutôt que
51
+ la liste native : une colonne par champ du CMS (texte, nombre, booléen, date et
52
+ **références** résolues en titre), ajout/masquage des colonnes, **tri** et
53
+ **filtre** par colonne, et **export CSV** de la vue courante. Lecture seule :
54
+ cliquer une ligne ouvre le document dans l'éditeur. Les colonnes sont tirées du
55
+ schéma — rien à déclarer.
56
+
57
+ Deux façons de la brancher dans le résolveur de structure :
58
+
59
+ ```ts
60
+ import {ncfCollections, ncfCollectionTable} from '@nocode-factory/sanity-kit'
61
+
62
+ // 1. Découverte auto : une entrée par type de document (hors pages / types du kit).
63
+ structure: (S, context) =>
64
+ S.list().title('Contenu').items([
65
+ /* …autres entrées… */
66
+ ...ncfCollections(S, context, ncfOptions),
67
+ ])
68
+
69
+ // 2. Au cas par cas : la table comme vue d'une entrée de collection existante.
70
+ S.listItem().title('Articles').child(ncfCollectionTable(S, ncfOptions, 'article'))
71
+ ```
72
+
73
+ Sélection des types : par défaut tous les types de documents hors pages,
74
+ singletons techniques et types du kit. Affiner avec
75
+ `collections: {include: [...], exclude: [...], labels: {type: 'Libellé'}}` dans
76
+ `ncfKit(options)`.
77
+
47
78
  ## Design system : la page de tous les styles et composants
48
79
 
49
80
  La page `/design-system` du site (option `componentPreview.path`) est **LA page du
@@ -136,7 +136,12 @@ function resolveConfig(input) {
136
136
  label: column.label?.trim() || column.key.trim(),
137
137
  paths: [column.path].flat().map((path) => path.trim()).filter(Boolean),
138
138
  type: column.type ?? "text"
139
- }))
139
+ })),
140
+ collections: {
141
+ include: (input.collections?.include ?? []).map((name) => name.trim()).filter(Boolean),
142
+ exclude: (input.collections?.exclude ?? []).map((name) => name.trim()).filter(Boolean),
143
+ labels: input.collections?.labels ?? {}
144
+ }
140
145
  };
141
146
  }
142
147
  /**
@@ -271,4 +276,4 @@ function finalPath(input, pageType, config, redirects) {
271
276
  }
272
277
  export { DEFAULT_PAGE_BUILDER_FIELD as _, depth as a, segments as c, normalizePath as d, resolveConfig as f, DEFAULT_INTERNAL_FIELDS as g, DEFAULT_I18N as h, redirectMapOf as i, toPath as l, DEFAULT_COMPONENT_PREVIEW as m, followRedirects as n, pageTypeFor as o, DEFAULT_BOARD_TAGS as p, redirectKey as r, parentPath as s, finalPath as t, toUrl as u, DEFAULT_SLUG_FIELD as v, DEFAULT_TITLE_FIELD as y };
273
278
 
274
- //# sourceMappingURL=finalUrl-CaFXmYvm.js.map
279
+ //# sourceMappingURL=finalUrl-IXF3zbT9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalUrl-IXF3zbT9.js","names":[],"sources":["../src/config/defaults.ts","../src/config/resolve.ts","../src/lib/paths.ts","../src/lib/finalUrl.ts"],"sourcesContent":["import type {\n NcfBoardTag,\n NcfInternalField,\n NcfComponentPreviewConfig,\n NcfI18nConfig,\n NcfToolsConfig,\n} from './types'\n\nexport const DEFAULT_PAGE_BUILDER_FIELD = 'sections'\nexport const DEFAULT_SLUG_FIELD = 'slug'\nexport const DEFAULT_TITLE_FIELD = 'title'\nexport const DEFAULT_BLOCK_NAMESPACE = ''\n\n/**\n * Chemins essayés pour savoir si une page est indexable. Le premier\n * correspond à la convention du starter (`seo.noindex`), le second couvre les\n * schémas qui portent le drapeau à la racine.\n */\nexport const DEFAULT_NOINDEX_FIELDS = ['seo.noindex', 'noindex']\n\n// Aucune langue par défaut : la langue principale (master) vient TOUJOURS du projet\n// (`defaultLocale`, sinon la première de `locales`). Un site peut avoir le français,\n// l'anglais ou toute autre langue comme master.\nexport const DEFAULT_I18N: Omit<Required<NcfI18nConfig>, 'defaultsSourceLocale' | 'defaultLocale'> = {\n field: 'language',\n locales: [],\n}\n\n/**\n * Convention NoCode Factory : page `/design-system` dans le front, captures\n * dans `/sections/<nom>.png` générées au push par GitHub Actions.\n */\nexport const DEFAULT_COMPONENT_PREVIEW: Required<NcfComponentPreviewConfig> = {\n provider: 'designSystemPage',\n path: '/design-system',\n anchor: '{name}',\n thumbnail: '/sections/{name}.png',\n defaultsType: 'componentDefaults',\n live: '/design-system/composant?type={name}',\n}\n\nexport const DEFAULT_TOOLS: Required<NcfToolsConfig> = {\n pages: true,\n components: true,\n history: true,\n designSystem: true,\n assets: true,\n}\n\n/**\n * Outils rangés dans « Plus » : Vision (console GROQ) et la planification\n * (« Scheduled drafts » quand les Releases sont désactivées, « Releases » sinon :\n * le même outil, nommé `releases` ; `schedules` couvre les anciennes versions).\n */\nexport const DEFAULT_TOOLBAR_MORE = ['vision', 'releases', 'schedules']\n\n/**\n * Étiquettes de suivi par défaut : l'avancement d'une refonte, pas un statut\n * de publication. Elles vivent dans le document de disposition du kit, donc\n * aucun schéma client n'est modifié.\n */\nexport const DEFAULT_BOARD_TAGS: NcfBoardTag[] = [\n {id: 'en-cours', label: 'In progress', color: '#f5a623'},\n {id: 'fait', label: 'Done', color: '#43d675'},\n {id: 'a-relire', label: 'To review', color: '#2276fc'},\n {id: 'a-refondre', label: 'To rework', color: '#f03e3e'},\n]\n\n/**\n * Colonnes de gestion interne par défaut. Volontairement peu nombreuses : ce\n * sont celles qu'on redemande sur tous les projets. `internalFields` les\n * remplace entièrement.\n */\nexport const DEFAULT_INTERNAL_FIELDS: NcfInternalField[] = [\n {id: 'owner', label: 'Owner', type: 'text'},\n {id: 'audience', label: 'Audience', type: 'text'},\n {id: 'role', label: 'Page role', type: 'text'},\n]\n\n/**\n * Service du kit, hébergé par NoCode Factory.\n *\n * Renseigné d'office pour qu'un Studio n'ait rien à configurer : il se\n * signale au démarrage, et c'est ce qui permet de savoir quels projets\n * utilisent le kit. `endpoint` le remplace pour une instance privée.\n */\nexport const DEFAULT_SERVICE_ENDPOINT = 'https://dkoxgivytgsmvqmjvmjt.supabase.co/functions/v1'\n","import {\n DEFAULT_BLOCK_NAMESPACE,\n DEFAULT_BOARD_TAGS,\n DEFAULT_INTERNAL_FIELDS,\n DEFAULT_SERVICE_ENDPOINT,\n DEFAULT_COMPONENT_PREVIEW,\n DEFAULT_I18N,\n DEFAULT_NOINDEX_FIELDS,\n DEFAULT_PAGE_BUILDER_FIELD,\n DEFAULT_SLUG_FIELD,\n DEFAULT_TITLE_FIELD,\n DEFAULT_TOOLBAR_MORE, DEFAULT_TOOLS,\n} from './defaults'\nimport type {\n NcfEnvironment,\n NcfKitConfig,\n NcfPageTypeConfig,\n ResolvedKitConfig,\n ResolvedPageType,\n} from './types'\n\nconst trimTrailingSlash = (url: string) => url.replace(/\\/+$/, '')\n\n/** Garantit un chemin absolu ('accueil' -> '/accueil', '' -> '/'). */\nexport const normalizePath = (path: string): string => {\n const trimmed = path.trim()\n if (!trimmed || trimmed === '/') return '/'\n const withSlash = trimmed.startsWith('/') ? trimmed : `/${trimmed}`\n return withSlash.length > 1 ? trimTrailingSlash(withSlash) : withSlash\n}\n\nfunction resolvePageType(\n entry: NcfPageTypeConfig,\n defaults: {slugField: string; titleField: string},\n): ResolvedPageType {\n if (typeof entry === 'string') {\n return {\n type: entry.trim(),\n slugField: defaults.slugField,\n path: null,\n pathPrefix: null,\n localizedPrefixes: null,\n titleField: defaults.titleField,\n }\n }\n\n // `path` gagne sur `slugField` : une page à chemin fixe (l'accueil) n'a pas\n // de slug à lire, même si le type en porte un par ailleurs.\n const path = typeof entry.path === 'string' ? normalizePath(entry.path) : null\n const slugField =\n entry.slugField === null ? null : (entry.slugField?.trim() || defaults.slugField)\n\n // Un préfixe vide ou '/' vaut « à la racine » : pas de préfixe.\n const prefix = typeof entry.pathPrefix === 'string' ? normalizePath(entry.pathPrefix) : '/'\n\n return {\n type: (entry.type ?? '').trim(),\n slugField: path ? null : slugField,\n path,\n // Conservé même avec `path` (qui gagne au calcul du chemin) : la validation\n // peut ainsi signaler le préfixe inutile.\n pathPrefix: prefix === '/' ? null : prefix,\n localizedPrefixes: entry.localizedPrefixes\n ? Object.fromEntries(Object.entries(entry.localizedPrefixes).map(([l, p]) => [l, normalizePath(p) === '/' ? '' : normalizePath(p)]))\n : null,\n titleField: entry.titleField?.trim() || defaults.titleField,\n }\n}\n\n/** Applique les valeurs par défaut. Ne valide rien : voir `validateConfig`. */\nexport function resolveConfig(input: NcfKitConfig): ResolvedKitConfig {\n const slugField = input.slugField?.trim() || DEFAULT_SLUG_FIELD\n const titleField = input.titleField?.trim() || DEFAULT_TITLE_FIELD\n\n const pageTypes = (Array.isArray(input.pageTypes) ? input.pageTypes : []).map((entry) =>\n resolvePageType(entry, {slugField, titleField}),\n )\n\n const i18n =\n input.i18n === false || input.i18n === undefined\n ? null\n : (() => {\n const locales = (input.i18n.locales ?? DEFAULT_I18N.locales).map((l) => l.trim()).filter(Boolean)\n // Master : `defaultLocale`, sinon la première langue. Jamais une langue écrite\n // dans le kit (absente : signalé par validateConfig).\n const defaultLocale = input.i18n.defaultLocale?.trim() || locales[0] || ''\n return {\n field: input.i18n.field?.trim() || DEFAULT_I18N.field,\n defaultLocale,\n locales,\n // Valeurs par défaut des composants : écrites dans la langue master,\n // traduites vers les autres (sauf choix explicite du projet).\n defaultsSourceLocale: input.i18n.defaultsSourceLocale?.trim() || defaultLocale,\n }\n })()\n\n return {\n pageTypes,\n codedPages: (input.siteRoutes?.fixed ?? [])\n .filter((f) => f.pageSlug && !f.homePage && !f.system && !f.notFound)\n .map((f) => ({pageSlug: f.pageSlug as string, path: normalizePath(f.path), localized: f.localized ?? null})),\n redirectType: input.redirectType?.trim() || 'redirect',\n pageTypeNames: pageTypes.map((p) => p.type).filter(Boolean),\n pageBuilderField: input.pageBuilderField?.trim() || DEFAULT_PAGE_BUILDER_FIELD,\n blockNamespace: input.blockNamespace ?? DEFAULT_BLOCK_NAMESPACE,\n noindexFields: input.noindexField\n ? [input.noindexField].flat().map((field) => field.trim()).filter(Boolean)\n : DEFAULT_NOINDEX_FIELDS,\n previewUrl: input.previewUrl ? trimTrailingSlash(input.previewUrl.trim()) : null,\n environments: resolveEnvironments(input),\n pageThumbnail: input.pageThumbnail?.trim() || null,\n i18n,\n componentPreview: {\n provider: input.componentPreview?.provider ?? DEFAULT_COMPONENT_PREVIEW.provider,\n path: input.componentPreview?.path ?? DEFAULT_COMPONENT_PREVIEW.path,\n anchor: input.componentPreview?.anchor ?? DEFAULT_COMPONENT_PREVIEW.anchor,\n thumbnail: input.componentPreview?.thumbnail ?? DEFAULT_COMPONENT_PREVIEW.thumbnail,\n defaultsType: input.componentPreview?.defaultsType ?? DEFAULT_COMPONENT_PREVIEW.defaultsType,\n live: input.componentPreview?.live ?? DEFAULT_COMPONENT_PREVIEW.live,\n },\n serviceEndpoint:\n input.serviceEndpoint === false\n ? null\n : trimTrailingSlash((input.serviceEndpoint || DEFAULT_SERVICE_ENDPOINT).trim()),\n history: input.history?.projectKey?.trim()\n ? {\n projectKey: input.history.projectKey.trim(),\n endpoint: trimTrailingSlash(\n (input.history.endpoint || input.serviceEndpoint || DEFAULT_SERVICE_ENDPOINT).trim(),\n ),\n }\n : null,\n // Le JSON-LD IA s'appuie sur le même service que la traduction : sans\n // `history.projectKey`, il n'y a pas d'IA à brancher.\n jsonLd:\n input.jsonLd?.enabled && input.history?.projectKey?.trim()\n ? {field: input.jsonLd.field?.trim() || 'jsonLd'}\n : null,\n tools: {...DEFAULT_TOOLS, ...input.tools},\n moreTools: input.moreTools === false ? [] : (input.moreTools ?? DEFAULT_TOOLBAR_MORE),\n boardTags: input.boardTags?.length ? input.boardTags : DEFAULT_BOARD_TAGS,\n internalFields: input.internalFields?.length\n ? input.internalFields\n : DEFAULT_INTERNAL_FIELDS,\n // Additif : le schéma du client fournit déjà l'essentiel, ceci ne sert\n // qu'à ce qu'un parcours de schéma ne sait pas exprimer.\n documentColumns: (input.documentColumns ?? []).map((column) => ({\n key: column.key.trim(),\n label: column.label?.trim() || column.key.trim(),\n paths: [column.path].flat().map((path) => path.trim()).filter(Boolean),\n type: column.type ?? 'text',\n })),\n collections: {\n include: (input.collections?.include ?? []).map((name) => name.trim()).filter(Boolean),\n exclude: (input.collections?.exclude ?? []).map((name) => name.trim()).filter(Boolean),\n labels: input.collections?.labels ?? {},\n },\n }\n}\n\n\n/**\n * Préproduction déduite de la production, par convention.\n *\n * NoCode Factory assigne à chaque projet un domaine Vercel **fixe** pour la\n * branche `preprod`, de la forme `preview-<projet>.vercel.app`. Fixe parce\n * qu'un lien de partage doit survivre au commit suivant : une URL de\n * déploiement change à chaque poussée, un domaine assigné non.\n *\n * La déduire évite de la déclarer neuf fois. Elle n'est proposée que pour un\n * hôte Vercel — ailleurs la convention ne s'applique pas — et `environments`\n * la remplace dès qu'on la déclare explicitement.\n */\nexport function conventionalPreprodUrl(previewUrl: string | null): string | null {\n if (!previewUrl) return null\n try {\n const url = new URL(previewUrl)\n if (!url.hostname.endsWith('.vercel.app')) return null\n // Une préproduction ne se dérive pas d'une préproduction.\n if (url.hostname.startsWith('preview-')) return null\n return `${url.protocol}//preview-${url.hostname}`\n } catch {\n return null\n }\n}\n\n/**\n * Environnements d'aperçu.\n *\n * `previewUrl` en fournit toujours un, nommé « Production » : un projet qui\n * n'en déclare pas d'autres doit quand même pouvoir basculer entre brouillons\n * et contenu en ligne.\n *\n * Quand `environments` mentionne déjà `previewUrl`, on ne le double pas.\n */\nfunction resolveEnvironments(input: NcfKitConfig): NcfEnvironment[] {\n const declared = (input.environments ?? [])\n .map((environment) => ({\n id: environment.id.trim(),\n label: environment.label?.trim() || environment.id.trim(),\n url: trimTrailingSlash((environment.url ?? '').trim()),\n }))\n .filter((environment) => environment.id && environment.url)\n\n const preview = input.previewUrl ? trimTrailingSlash(input.previewUrl.trim()) : null\n if (!preview) return declared\n\n const production = declared.some((environment) => environment.url === preview)\n ? []\n : [{id: 'production', label: 'Production', url: preview}]\n\n // La préproduction conventionnelle complète la liste, sauf si le projet en\n // a déjà déclaré une — sa déclaration explicite fait foi.\n //\n // On compare l'identifiant autant que l'URL : un projet dont le domaine ne\n // suit pas exactement la convention déclare bien un `preprod`, à une autre\n // adresse. En n'écartant que par l'URL, on en ajoutait un second portant le\n // même identifiant, et la configuration devenait invalide.\n const conventional = conventionalPreprodUrl(preview)\n const hasPreprod =\n declared.some(\n (environment) => environment.url === conventional || environment.id === 'preprod',\n ) || input.preprodUrl === false\n\n const preprod =\n conventional && !hasPreprod\n ? [{id: 'preprod', label: 'Staging', url: conventional}]\n : []\n\n return [...production, ...preprod, ...declared]\n}\n","import {normalizePath} from '../config/resolve'\nimport type {ResolvedI18n, ResolvedPageType} from '../config/types'\n\nexport interface PathInput {\n /** Valeur du champ slug (`slug.current`). Peut contenir des `/`. */\n slug?: string | null\n /** Chemin fixe du type de page, s'il en a un. */\n path?: string | null\n /** Préfixe d'URL du type de page ('/blog'), devant le slug. */\n pathPrefix?: string | null\n /** Préfixe par langue (dossiers traduits) : celui de `locale` gagne sur `pathPrefix`. */\n localizedPrefixes?: Record<string, string> | null\n /** Langue du document. */\n locale?: string | null\n}\n\n/**\n * Chemin d'une page sur le site. Le chemin fixe l'emporte sur le slug, le\n * préfixe du type se place devant le slug ('/blog' + 'mon-article'), et la\n * langue par défaut n'est pas préfixée (convention Next.js du starter).\n */\nexport function toPath(input: PathInput, i18n: ResolvedI18n | null): string | null {\n const localized = input.locale ? input.localizedPrefixes?.[input.locale] : undefined\n const raw = localized !== undefined ? localized : input.pathPrefix\n const prefix = typeof raw === 'string' && raw ? normalizePath(raw) : '/'\n const base =\n typeof input.path === 'string' && input.path\n ? normalizePath(input.path)\n : input.slug\n ? normalizePath(prefix === '/' ? input.slug : `${prefix}/${input.slug.replace(/^\\/+/, '')}`)\n : null\n\n if (base === null) return null\n if (!i18n || !input.locale || input.locale === i18n.defaultLocale) return base\n return base === '/' ? `/${input.locale}` : `/${input.locale}${base}`\n}\n\n/** URL absolue d'une page, ou `null` si le front n'est pas configuré. */\nexport function toUrl(previewUrl: string | null, path: string | null): string | null {\n if (!previewUrl || path === null) return null\n return path === '/' ? previewUrl : `${previewUrl}${path}`\n}\n\n/** Segments d'un chemin : '/services/plomberie' -> ['services', 'plomberie']. */\nexport function segments(path: string): string[] {\n return path.split('/').filter(Boolean)\n}\n\n/** Profondeur dans l'arborescence. '/' vaut 0. */\nexport function depth(path: string): number {\n return segments(path).length\n}\n\n/**\n * Chemin du parent, ou `null` à la racine. Sert au placement automatique du\n * board : '/services/plomberie' -> '/services'.\n */\nexport function parentPath(path: string): string | null {\n const parts = segments(path)\n if (parts.length === 0) return null\n if (parts.length === 1) return '/'\n return `/${parts.slice(0, -1).join('/')}`\n}\n\n/** Le type de page correspondant à un document. */\nexport function pageTypeFor(\n type: string,\n pageTypes: ResolvedPageType[],\n): ResolvedPageType | undefined {\n return pageTypes.find((p) => p.type === type)\n}\n","import type {ResolvedKitConfig, ResolvedPageType} from '../config/types'\nimport {toPath} from './paths'\n\n/** Clé de comparaison des redirections (comme le site) : minuscules, sans « / » final, sans ? ni #. */\nexport const redirectKey = (path: string) => {\n const clean = (path.trim().split(/[?#]/)[0] ?? '').toLowerCase()\n return clean.length > 1 ? clean.replace(/\\/+$/, '') : clean\n}\n\n/** Table des redirections du Studio : départ (normalisé) -> destination. */\nexport type RedirectMap = Map<string, string>\n\nexport function redirectMapOf(rows: readonly {from?: string | null; to?: string | null}[]): RedirectMap {\n const map: RedirectMap = new Map()\n for (const r of rows) {\n if (!r.from?.startsWith('/') || !r.to) continue\n const key = redirectKey(r.from)\n if (key !== redirectKey(r.to) && !map.has(key)) map.set(key, r.to.trim())\n }\n return map\n}\n\n/** Destination finale d'une adresse (chaîne de redirections suivie, boucles ignorées). */\nexport function followRedirects(path: string, redirects: RedirectMap | null | undefined): string {\n if (!redirects?.size) return path\n let current = path\n const seen = new Set<string>()\n for (let hop = 0; hop < 5; hop++) {\n const next = redirects.get(redirectKey(current))\n if (!next || seen.has(next)) break\n seen.add(next)\n current = next\n }\n return current\n}\n\n/**\n * URL FINALE d'une page (celle qui répond 200, sans redirection) : adresse réelle\n * d'une page codée (registre `siteRoutes`, dossier de la langue), sinon dossier et\n * slug de la langue ; puis destination si l'adresse est le départ d'une redirection\n * du Studio. Affichée partout dans le kit (onglet Pages, board, Presentation, slug).\n */\nexport function finalPath(\n input: {slug: string | null; locale: string | null},\n pageType: ResolvedPageType | null | undefined,\n config: Pick<ResolvedKitConfig, 'i18n' | 'codedPages'>,\n redirects?: RedirectMap | null,\n): string | null {\n if (!pageType) return null\n const atRoot = !pageType.path && !pageType.pathPrefix && !pageType.localizedPrefixes\n const coded = atRoot && input.slug ? config.codedPages.find((c) => c.pageSlug === input.slug) : undefined\n const path = coded\n ? toPath({path: (input.locale && coded.localized?.[input.locale]) || coded.path, locale: input.locale}, config.i18n)\n : toPath(\n {slug: input.slug, path: pageType.path, pathPrefix: pageType.pathPrefix, localizedPrefixes: pageType.localizedPrefixes, locale: input.locale},\n config.i18n,\n )\n return path === null ? null : followRedirects(path, redirects)\n}\n"],"mappings":"AAQ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;;AAQA,SAAgB,UACd,OACA,UACA,QACA,WACe;CACf,IAAI,CAAC,UAAU,OAAO;CAEtB,IAAM,QADS,CAAC,SAAS,QAAQ,CAAC,SAAS,cAAc,CAAC,SAAS,qBAC3C,MAAM,OAAO,OAAO,WAAW,MAAM,MAAM,EAAE,aAAa,MAAM,IAAI,IAAI,KAAA,GAC1F,OACF,OADS,QACF;EAAC,MAAO,MAAM,UAAU,MAAM,YAAY,MAAM,WAAY,MAAM;EAAM,QAAQ,MAAM;CAAM,IAEjG;EAAC,MAAM,MAAM;EAAM,MAAM,SAAS;EAAM,YAAY,SAAS;EAAY,mBAAmB,SAAS;EAAmB,QAAQ,MAAM;CAAM,GAFxC,OAAO,IAI7G;CACJ,OAAO,SAAS,OAAO,OAAO,gBAAgB,MAAM,SAAS;AAC/D"}
@@ -267,6 +267,19 @@ interface NcfKitConfig {
267
267
  * Défaut : meta description, titre SEO, indexabilité.
268
268
  */
269
269
  documentColumns?: NcfDocumentColumn[];
270
+ /**
271
+ * Vue table « Airtable » des collections, posée dans l'onglet Structure via
272
+ * `ncfCollections(S, context, options)`. Par défaut, tous les types de
273
+ * documents hors pages, redirections et types techniques du kit sont
274
+ * proposés. `include` fixe une liste explicite (fait foi), `exclude` retire
275
+ * des types, `labels` renomme l'entrée d'un type.
276
+ */
277
+ collections?: NcfCollectionsConfig;
278
+ }
279
+ interface NcfCollectionsConfig {
280
+ include?: string[];
281
+ exclude?: string[];
282
+ labels?: Record<string, string>;
270
283
  }
271
284
  interface ResolvedPageType {
272
285
  type: string;
@@ -321,6 +334,12 @@ interface ResolvedKitConfig {
321
334
  boardTags: NcfBoardTag[];
322
335
  internalFields: NcfInternalField[];
323
336
  documentColumns: ResolvedDocumentColumn[];
337
+ collections: ResolvedCollections;
338
+ }
339
+ interface ResolvedCollections {
340
+ include: string[];
341
+ exclude: string[];
342
+ labels: Record<string, string>;
324
343
  }
325
344
  interface ResolvedHistory {
326
345
  projectKey: string;
@@ -522,5 +541,5 @@ declare function fixCrossLanguageReferences(client: SanityClient, options: {
522
541
  defaultLocale: string;
523
542
  apply?: boolean;
524
543
  }): Promise<CrossLanguageReport>;
525
- export { ResolvedDocumentColumn as A, NcfInternalFieldOption as C, NcfToolName as D, NcfPageTypeInput as E, ResolvedI18n as M, ResolvedKitConfig as N, NcfToolsConfig as O, ResolvedPageType as P, NcfInternalField as S, NcfPageTypeConfig as T, NcfComponentPreviewConfig as _, pageTypesFromSiteRoutes as a, NcfHistoryConfig as b, componentDefaultsMainDocuments as c, requiredUnlessDefault as d, requiredUnlessDefaultFor as f, NcfBoardTag as g, KitContextValue as h, SiteRoutesRegistry as i, ResolvedHistory as j, ResolvedComponentPreview as k, defaultsFieldName as l, IssueLevel as m, fixCrossLanguageReferences as n, DEFAULT_COMPONENT_DEFAULTS_TYPE as o, ConfigIssue as p, withSameLanguageReferences as r, componentDefaultsMainDocument as s, CrossLanguageReport as t, defineComponentDefaults as u, NcfDocumentColumn as v, NcfKitConfig as w, NcfI18nConfig as x, NcfEnvironment as y };
526
- //# sourceMappingURL=fixCrossLanguageReferences-w3whO9xM.d.ts.map
544
+ export { ResolvedCollections as A, NcfInternalField as C, NcfPageTypeInput as D, NcfPageTypeConfig as E, ResolvedKitConfig as F, ResolvedPageType as I, ResolvedDocumentColumn as M, ResolvedHistory as N, NcfToolName as O, ResolvedI18n as P, NcfI18nConfig as S, NcfKitConfig as T, NcfCollectionsConfig as _, pageTypesFromSiteRoutes as a, NcfEnvironment as b, componentDefaultsMainDocuments as c, requiredUnlessDefault as d, requiredUnlessDefaultFor as f, NcfBoardTag as g, KitContextValue as h, SiteRoutesRegistry as i, ResolvedComponentPreview as j, NcfToolsConfig as k, defaultsFieldName as l, IssueLevel as m, fixCrossLanguageReferences as n, DEFAULT_COMPONENT_DEFAULTS_TYPE as o, ConfigIssue as p, withSameLanguageReferences as r, componentDefaultsMainDocument as s, CrossLanguageReport as t, defineComponentDefaults as u, NcfComponentPreviewConfig as v, NcfInternalFieldOption as w, NcfHistoryConfig as x, NcfDocumentColumn as y };
545
+ //# sourceMappingURL=fixCrossLanguageReferences-C1VsmGsJ.d.ts.map
@@ -1,4 +1,4 @@
1
- import { l as toPath } from "./finalUrl-CaFXmYvm.js";
1
+ import { l as toPath } from "./finalUrl-IXF3zbT9.js";
2
2
  import { defineField, defineType } from "sanity";
3
3
  /** Identifiant stable de la redirection d'une version (mise à jour, jamais dupliquée). */
4
4
  const translationRedirectId = (versionId) => `redirect-translation-${versionId.replace(/^drafts\./, "").replace(/[^A-Za-z0-9_-]/g, "-")}`;
@@ -340,4 +340,4 @@ async function fixCrossLanguageReferences(client, options) {
340
340
  }
341
341
  export { componentDefaultsMainDocument as a, defineComponentDefaults as c, syncTranslationRedirects as d, translationRedirectId as f, DEFAULT_COMPONENT_DEFAULTS_TYPE as i, requiredUnlessDefault as l, withSameLanguageReferences as n, componentDefaultsMainDocuments as o, translationRedirectOptions as p, pageTypesFromSiteRoutes as r, defaultsFieldName as s, fixCrossLanguageReferences as t, requiredUnlessDefaultFor as u };
342
342
 
343
- //# sourceMappingURL=fixCrossLanguageReferences-BeXywAAU.js.map
343
+ //# sourceMappingURL=fixCrossLanguageReferences-CDczoic9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fixCrossLanguageReferences-BeXywAAU.js","names":["isObj"],"sources":["../src/lib/translationRedirects.ts","../src/schema/componentDefaults.ts","../src/lib/siteRoutes.ts","../src/schema/sameLanguageReferences.ts","../src/lib/fixCrossLanguageReferences.ts"],"sourcesContent":["import type {SanityClient} from 'sanity'\nimport {toPath} from './paths'\n\ntype Obj = Record<string, unknown>\n\nexport interface TranslationRedirectOptions {\n /** Champ de langue des documents. */\n field?: string\n /** Langue principale : son slug est le slug « d'origine ». */\n defaultLocale: string\n /** Types qui ont une page par document (préfixe d'adresse du registre). */\n types: {type: string; pathPrefix?: string | null; localizedPrefixes?: Record<string, string> | null; slugField?: string}[]\n /** Type de document des redirections (champs from, to, permanent, note). */\n redirectType?: string\n /** `false` : simulation, rien n'est écrit. Défaut : true. */\n apply?: boolean\n}\n\nexport interface TranslationRedirect {\n id: string\n from: string\n to: string\n note: string\n}\n\n/** Identifiant stable de la redirection d'une version (mise à jour, jamais dupliquée). */\nexport const translationRedirectId = (versionId: string) => `redirect-translation-${versionId.replace(/^drafts\\./, '').replace(/[^A-Za-z0-9_-]/g, '-')}`\n\n/**\n * RÈGLE D'OR DU MULTILINGUE, adresses : chaque version a un slug dans SA langue, et\n * l'adresse « slug d'origine dans cette langue » redirige vers elle (une page\n * /rouge, traduite /en/red : /en/rouge redirige vers /en/red). Enregistré comme\n * une vraie redirection (visible dans le Studio, « Redirects »), une par version,\n * mise à jour si un slug change. Rien quand le slug est le même, ni quand l'adresse\n * d'origine est déjà une vraie page de cette langue.\n *\n * `seeds` : documents dont on traite le groupe de traductions (tous si absent).\n * `override` : valeurs d'une version en cours de publication (pas encore lisibles).\n */\nexport async function syncTranslationRedirects(\n client: SanityClient,\n options: TranslationRedirectOptions,\n seeds?: string[],\n override?: {id: string; slug?: string | null; language?: string | null},\n): Promise<TranslationRedirect[]> {\n const field = options.field ?? 'language'\n const redirectType = options.redirectType ?? 'redirect'\n const byType = new Map(options.types.map((t) => [t.type, t]))\n const c = client.withConfig({perspective: 'raw'})\n const types = [...byType.keys()]\n if (!types.length) return []\n\n // Groupes de traductions des types à pages (publiés).\n const groups = await c.fetch<{translations?: {language?: string; _key?: string; value?: {_ref?: string}}[]}[]>(\n seeds?.length\n ? `*[_type == \"translation.metadata\" && count(translations[value._ref in $seeds]) > 0]{translations}`\n : `*[_type == \"translation.metadata\" && count(schemaTypes[@ in $types]) > 0]{translations}`,\n {seeds: (seeds ?? []).map((s) => s.replace(/^drafts\\./, '')), types},\n )\n const ids = [...new Set(groups.flatMap((g) => (g.translations ?? []).map((t) => t.value?._ref).filter((x): x is string => !!x)))]\n if (!ids.length) return []\n const docs = await c.fetch<Obj[]>(`*[_id in $ids]{_id, _type, ${field}, \"slugs\": {\"slug\": slug.current}, title}`, {ids})\n const byId = new Map(docs.map((d) => [String(d._id), d]))\n const slugOf = (d: Obj | undefined) => {\n if (!d) return null\n if (override && d._id === override.id && override.slug !== undefined) return override.slug\n return ((d.slugs as Obj | undefined)?.slug as string | undefined) ?? null\n }\n const langOf = (d: Obj | undefined) => (override && d?._id === override.id && override.language ? override.language : (d?.[field] as string | undefined))\n\n const wanted: TranslationRedirect[] = []\n const stale: string[] = []\n for (const g of groups) {\n const versions = (g.translations ?? []).map((t) => byId.get(t.value?._ref ?? '')).filter((d): d is Obj => !!d)\n const master = versions.find((d) => langOf(d) === options.defaultLocale)\n const masterSlug = slugOf(master)\n for (const v of versions) {\n if (v === master) continue\n const id = translationRedirectId(String(v._id))\n const t = byType.get(String(v._type))\n const language = langOf(v)\n const slug = slugOf(v)\n const from = t && masterSlug && language ? toPath({slug: masterSlug, pathPrefix: t.pathPrefix, localizedPrefixes: t.localizedPrefixes, locale: language}, {field, defaultLocale: options.defaultLocale, locales: [], defaultsSourceLocale: options.defaultLocale}) : null\n const to = t && slug && language ? toPath({slug, pathPrefix: t.pathPrefix, localizedPrefixes: t.localizedPrefixes, locale: language}, {field, defaultLocale: options.defaultLocale, locales: [], defaultsSourceLocale: options.defaultLocale}) : null\n if (!from || !to || from === to) {\n stale.push(id)\n continue\n }\n // L'adresse d'origine est une vraie page de cette langue : pas de redirection.\n const taken = await c.fetch<number>(\n `count(*[_type == $type && ${field} == $language && slug.current == $slug && !(_id in path(\"drafts.**\")) && _id != $self])`,\n {type: v._type, language, slug: masterSlug, self: v._id},\n )\n if (taken) {\n stale.push(id)\n continue\n }\n wanted.push({id, from, to, note: `Created automatically: ${language?.toUpperCase()} version of \"${String(master?.title ?? masterSlug)}\" (translated address)`})\n }\n }\n\n if (options.apply !== false) {\n const tx = c.transaction()\n // Une redirection qui partirait d'une adresse devenue une vraie page est retirée.\n const targets = wanted.map((w) => w.to)\n const loops = targets.length ? await c.fetch<string[]>(`*[_type == $redirectType && from in $targets]._id`, {redirectType, targets}) : []\n for (const id of loops) if (!wanted.some((w) => w.id === id)) tx.delete(id)\n for (const w of wanted) tx.createOrReplace({_id: w.id, _type: redirectType, from: w.from, to: w.to, permanent: true, note: w.note})\n for (const id of stale) tx.delete(id)\n await tx.commit({visibility: 'async'})\n }\n return wanted\n}\n\n/** Options de `syncTranslationRedirects` tirées de la configuration du kit (types à pages avec slug). */\nexport function translationRedirectOptions(config: {\n i18n: {field: string; defaultLocale: string} | null\n pageTypes: {type: string; slugField: string | null; path: string | null; pathPrefix: string | null; localizedPrefixes?: Record<string, string> | null}[]\n}): TranslationRedirectOptions | null {\n if (!config.i18n) return null\n const types = config.pageTypes.filter((t) => t.slugField && !t.path).map((t) => ({type: t.type, pathPrefix: t.pathPrefix, localizedPrefixes: t.localizedPrefixes ?? null, slugField: t.slugField ?? 'slug'}))\n return types.length ? {field: config.i18n.field, defaultLocale: config.i18n.defaultLocale, types} : null\n}\n","import {defineField, defineType, type Rule} from 'sanity'\n\n/**\n * VALEURS PAR DÉFAUT DES COMPOSANTS, côté Studio.\n *\n * Un document (un par langue) avec un bloc par composant de la bibliothèque,\n * GÉNÉRÉ depuis les schémas des sections : une section ajoutée y apparaît sans\n * rien faire. Une instance dont un champ est vide affiche la valeur par défaut ;\n * un champ rempli (override) n'est jamais écrasé. Côté site :\n * `@nocode-factory/sanity-kit/web/defaults`. Dans le Studio, l'onglet Composants\n * ouvre chaque composant (rendu réel + réglages), et une pastille bleue marque\n * chaque champ d'instance qui diffère de la valeur par défaut.\n *\n * Deux règles pour les champs de section, qui en découlent :\n * - jamais d'`initialValue` (ce serait un override involontaire) ;\n * - « obligatoire » = `requiredUnlessDefault`.\n */\n\ntype FieldDef = {name: string; type: string; validation?: unknown; initialValue?: unknown; fields?: FieldDef[]; of?: FieldDef[]; [k: string]: unknown}\ntype SectionDef = {name: string; title?: string; fields: FieldDef[]}\n\nexport const DEFAULT_COMPONENT_DEFAULTS_TYPE = 'componentDefaults'\n\n/** Nom du champ d'un composant dans le document des valeurs par défaut : `section.cta` -> `cta`. */\nexport function defaultsFieldName(type: string, namespace = 'section.'): string {\n return type.startsWith(namespace) ? type.slice(namespace.length) : type\n}\n\n// Dans les valeurs par défaut, rien n'est obligatoire et rien n'est prérempli.\nconst relax = (f: FieldDef): FieldDef => {\n const {validation: _v, initialValue: _i, ...rest} = f\n return {\n ...rest,\n ...(rest.fields ? {fields: rest.fields.map(relax)} : {}),\n ...(rest.of ? {of: rest.of.map(relax)} : {}),\n }\n}\n\n/** Document « Composants : valeurs par défaut », généré depuis les sections. */\nexport function defineComponentDefaults(options: {sections: readonly unknown[]; name?: string; title?: string; namespace?: string}) {\n const {name = DEFAULT_COMPONENT_DEFAULTS_TYPE, title = '🧩 Components: default values', namespace = 'section.'} = options\n return defineType({\n name,\n title,\n type: 'document',\n description:\n 'Values applied to every instance of a component whose field is empty. A field filled in an instance takes precedence (override).',\n fields: (options.sections as SectionDef[]).map((t) =>\n defineField({\n name: defaultsFieldName(t.name, namespace),\n title: t.title || t.name,\n type: 'object',\n description: 'Default values of this component. Empty = design system value.',\n options: {collapsible: true, collapsed: true},\n // Un champ propre à l'instance (options.instanceOnly, ex. ancre) n'a pas de\n // valeur par défaut : absent des réglages du composant.\n fields: t.fields.filter((f) => !(f.options as {instanceOnly?: boolean} | undefined)?.instanceOnly).map(relax) as never,\n }),\n ),\n preview: {prepare: () => ({title: title.replace(/^\\S+\\s/, '')})},\n })\n}\n\nconst isEmpty = (v: unknown) => v === undefined || v === null || v === '' || (Array.isArray(v) && v.length === 0)\n\n/**\n * Règle « obligatoire SAUF si le composant a une valeur par défaut » pour un autre\n * type de document des valeurs par défaut ou un autre espace de noms.\n * `validation: requiredUnlessDefaultFor({type: 'mesDefauts'})`\n */\nexport function requiredUnlessDefaultFor(options: {type?: string; namespace?: string} = {}) {\n const {type: defaultsType = DEFAULT_COMPONENT_DEFAULTS_TYPE, namespace = 'section.'} = options\n return <R>(rule: R): R =>\n (rule as unknown as Rule).custom(async (value, context) => {\n if (!isEmpty(value)) return true\n const type = (context.parent as {_type?: string} | undefined)?._type\n const field = context.path?.[context.path.length - 1]\n const name = type ? defaultsFieldName(type, namespace) : ''\n if (!type?.startsWith(namespace) || typeof field !== 'string' || !/^\\w+$/.test(name) || !/^\\w+$/.test(field)) return 'Required.'\n const language = (context.document as {language?: string} | undefined)?.language ?? null\n const inherited = await context\n .getClient({apiVersion: '2024-10-01'})\n .fetch(\n `*[_type == $defaultsType && !(_id in path(\"drafts.**\")) && ($language == null || language == $language)][0].${name}.${field}`,\n {defaultsType, language},\n )\n return isEmpty(inherited) ? 'Required (or set it in Components > default values).' : true\n }) as unknown as R\n}\n\n/**\n * Champ de section obligatoire, SAUF si le composant a une valeur par défaut\n * pour ce champ (elle s'affichera). Tout type de champ.\n * `validation: requiredUnlessDefault`\n */\nexport const requiredUnlessDefault: <R>(rule: R) => R = requiredUnlessDefaultFor()\n\n/**\n * Presentation : la page qui rend un composant seul (par défaut\n * `/design-system/composant`) a pour document principal les valeurs par défaut.\n * Rendu réel et réglages côte à côte, en direct.\n * `presentationTool({resolve: {mainDocuments: defineDocuments([componentDefaultsMainDocument({language: 'fr'})])}})`\n */\nexport function componentDefaultsMainDocument(options: {language?: string; route?: string; type?: string} = {}): {route: string; filter: string} {\n const {language, route = '/design-system/composant', type = DEFAULT_COMPONENT_DEFAULTS_TYPE} = options\n const safeLang = language && /^[a-z]{2}(-[A-Za-z]{2})?$/.test(language) ? language : null\n return {route, filter: `_type == \"${type}\"${safeLang ? ` && language == \"${safeLang}\"` : ''}`}\n}\n\n/**\n * Presentation : les pages du design system ont pour document principal les valeurs\n * par défaut des composants. `/design-system` (toute la bibliothèque) et\n * `/design-system/composant` (un composant seul) : cliquer un composant ouvre ses\n * réglages globaux, et un style changé change le composant partout où il n'est\n * pas surchargé.\n * `presentationTool({resolve: {mainDocuments: defineDocuments(componentDefaultsMainDocuments({language: 'fr'}))}})`\n */\nexport function componentDefaultsMainDocuments(\n options: {language?: string; type?: string; routes?: string[]} = {},\n): {route: string; filter: string}[] {\n const {routes = ['/design-system/composant', '/design-system'], ...rest} = options\n return routes.map((route) => componentDefaultsMainDocument({...rest, route}))\n}\n","import type {NcfPageTypeInput} from '../config/types'\n\n/**\n * Registre des pages du starter NoCode Factory (`web/app/lib/site-routes.json`).\n * Seules les clés lues ici sont typées : le fichier en porte d'autres\n * (sections, titres, noindex) qui ne concernent pas le kit.\n */\nexport interface SiteRoutesRegistry {\n fixed?: {path: string; homePage?: boolean; system?: boolean; notFound?: boolean; pageSlug?: string; localized?: Record<string, string>}[]\n collections?: {type: string; pathPrefix?: string; localized?: Record<string, string>}[]\n}\n\n/**\n * `pageTypes` déduits du registre du starter, pour ne pas redire au kit ce que\n * le site sait déjà : l'accueil (chemin fixe `/`) et chaque collection avec\n * son préfixe d'URL (`/blog`, `/produits`, ou la racine).\n *\n * ```ts\n * import routes from '../web/app/lib/site-routes.json'\n * ncfKit({pageTypes: pageTypesFromSiteRoutes(routes)})\n * ```\n *\n * `homePageType` : nom du type de l'accueil dans le schéma (le registre ne le\n * porte pas). Les pages codées du registre (`pageSlug`) ne sont pas des types :\n * elles n'apparaissent pas ici.\n */\nexport function pageTypesFromSiteRoutes(\n routes: SiteRoutesRegistry,\n options: {homePageType?: string | null} = {},\n): NcfPageTypeInput[] {\n const homePageType = options.homePageType === undefined ? 'homePage' : options.homePageType\n const out: NcfPageTypeInput[] = []\n\n if (homePageType && routes.fixed?.some((r) => r.homePage)) {\n out.push({type: homePageType, path: '/'})\n }\n for (const collection of routes.collections ?? []) {\n if (!collection.type) continue\n const prefix = (collection.pathPrefix ?? '').trim()\n const localized = collection.localized && Object.keys(collection.localized).length ? {localizedPrefixes: collection.localized} : {}\n out.push(prefix ? {type: collection.type, pathPrefix: prefix, ...localized} : {type: collection.type, ...localized})\n }\n return out\n}\n","import type {NcfKitConfig} from '../config/types'\n\ntype Obj = Record<string, unknown>\ntype FilterResult = {filter?: string; params?: Record<string, unknown>}\ntype FilterFn = (context: {document?: Obj; [key: string]: unknown}) => FilterResult | Promise<FilterResult>\n\n// Objet de configuration simple (jamais un élément React, une icône ou une instance).\nconst isObj = (v: unknown): v is Obj => {\n if (!v || typeof v !== 'object' || Array.isArray(v) || '$$typeof' in v) return false\n const proto = Object.getPrototypeOf(v)\n return proto === Object.prototype || proto === null\n}\n\n/**\n * RÈGLE D'OR DU MULTILINGUE : une référence ne propose que des documents de la\n * MÊME langue que le document en cours (un article EN ne voit que les catégories EN,\n * une page FR que les pages FR). Les documents sans langue (logos, régions, assets…)\n * restent proposés. Un document commun à toutes les langues (Navigation…) vise la\n * langue principale.\n *\n * Pose ce filtre sur TOUS les champs de référence des types donnés (champs, listes,\n * objets imbriqués, annotations du texte riche), combiné avec un filtre déjà présent.\n * À appliquer aux types du projet :\n *\n * ```ts\n * schema: {types: withSameLanguageReferences(schemaTypes, ncfOptions)}\n * ```\n */\nexport function withSameLanguageReferences<T>(types: T[], options: Pick<NcfKitConfig, 'i18n'>): T[] {\n const i18n = options.i18n\n if (!i18n) return types\n const field = i18n.field ?? 'language'\n const fallback = i18n.defaultLocale ?? i18n.locales?.[0]\n const condition = `(!defined(${field}) || ${field} == $ncfLanguage)`\n const languageOf = (document: Obj | undefined) => (typeof document?.[field] === 'string' && document[field]) || fallback\n\n const wrap = (opts: Obj | undefined): Obj => {\n const previous = opts?.filter\n const previousParams = (opts?.filterParams as Record<string, unknown> | undefined) ?? {}\n const filter: FilterFn = async (context) => {\n const base: FilterResult =\n typeof previous === 'function'\n ? ((await (previous as FilterFn)(context)) ?? {})\n : typeof previous === 'string'\n ? {filter: previous, params: previousParams}\n : {}\n return {\n filter: base.filter ? `(${base.filter}) && ${condition}` : condition,\n params: {...(base.params ?? {}), ncfLanguage: languageOf(context.document)},\n }\n }\n const {filterParams: _ignored, ...rest} = opts ?? {}\n return {...rest, filter}\n }\n\n const visit = (node: unknown): unknown => {\n if (Array.isArray(node)) return node.map(visit)\n if (!isObj(node)) return node\n const out: Obj = {}\n for (const [key, value] of Object.entries(node)) out[key] = key === 'options' || key === 'initialValue' || key === 'validation' ? value : visit(value)\n if (node.type === 'reference' && Array.isArray(node.to)) out.options = wrap(node.options as Obj | undefined)\n return out\n }\n return types.map((t) => visit(t) as T)\n}\n","import type {SanityClient} from 'sanity'\n\ntype Obj = Record<string, unknown>\nconst isObj = (v: unknown): v is Obj => !!v && typeof v === 'object' && !Array.isArray(v)\nconst bare = (id: string) => id.replace(/^drafts\\./, '')\n\nexport interface CrossLanguageReport {\n /** Références repointées (ou à repointer en simulation). */\n fixed: {documentId: string; path: string; from: string; to: string}[]\n /** Références croisées sans équivalent dans la langue du document (laissées). */\n missing: {documentId: string; path: string; ref: string; language: string}[]\n}\n\n/** Références d'une valeur, avec leur chemin de patch (`a.b[_key==\"x\"].c`). */\nfunction refs(value: unknown, path: string, out: {path: string; ref: string}[]) {\n if (Array.isArray(value)) {\n value.forEach((item, i) => refs(item, `${path}[${isObj(item) && typeof item._key === 'string' ? `_key==\"${item._key}\"` : i}]`, out))\n return\n }\n if (!isObj(value)) return\n if (typeof value._ref === 'string' && !/^(image|file)-/.test(value._ref)) out.push({path: `${path}._ref`, ref: value._ref})\n for (const [k, v] of Object.entries(value)) if (!k.startsWith('_')) refs(v, path ? `${path}.${k}` : k, out)\n}\n\n/**\n * RÈGLE D'OR DU MULTILINGUE, côté données : chaque référence d'un document vise un\n * document de SA langue (document sans langue : la langue principale). Une\n * référence croisée est repointée vers la traduction de la bonne langue (liens de\n * traduction) ; sans traduction, elle est signalée et laissée. Publiés et\n * brouillons. `apply: false` : simulation.\n *\n * ```ts\n * // studio/scripts/references-same-language.ts (sanity exec --with-user-token)\n * const report = await fixCrossLanguageReferences(getCliClient(...), {defaultLocale: 'fr', apply})\n * ```\n */\nexport async function fixCrossLanguageReferences(\n client: SanityClient,\n options: {field?: string; defaultLocale: string; apply?: boolean},\n): Promise<CrossLanguageReport> {\n const field = options.field ?? 'language'\n const c = client.withConfig({perspective: 'raw'})\n const docs = await c.fetch<Obj[]>(\n `*[!(_type match \"system.*\") && !(_type match \"sanity.*\") && !(_type match \"ncf.*\") && _type != \"translation.metadata\"]`,\n )\n const language = new Map<string, string>()\n for (const d of docs) if (typeof d[field] === 'string') language.set(bare(String(d._id)), String(d[field]))\n const metas = await c.fetch<{translations?: {language?: string; _key?: string; value?: {_ref?: string}}[]}[]>(\n `*[_type == \"translation.metadata\"]{translations}`,\n )\n const equivalent = new Map<string, Map<string, string>>()\n for (const m of metas) {\n const group = new Map<string, string>()\n for (const t of m.translations ?? []) if (t.value?._ref) group.set(t.language ?? t._key ?? '', t.value._ref)\n for (const id of group.values()) equivalent.set(id, group)\n }\n\n const report: CrossLanguageReport = {fixed: [], missing: []}\n for (const d of docs) {\n const own = typeof d[field] === 'string' ? String(d[field]) : options.defaultLocale\n const found: {path: string; ref: string}[] = []\n for (const [k, v] of Object.entries(d)) if (!k.startsWith('_')) refs(v, k, found)\n const set: Record<string, string> = {}\n for (const {path, ref} of found) {\n const target = language.get(bare(ref))\n if (!target || target === own) continue\n const to = equivalent.get(bare(ref))?.get(own)\n if (to) {\n set[path] = to\n report.fixed.push({documentId: String(d._id), path, from: ref, to})\n } else report.missing.push({documentId: String(d._id), path, ref, language: own})\n }\n if (options.apply && Object.keys(set).length) await c.patch(String(d._id)).ifRevisionId(String(d._rev)).set(set).commit({visibility: 'async'})\n }\n return report\n}\n"],"mappings":";;;AA0BA,MAAa,yBAAyB,cAAsB,wBAAwB,UAAU,QAAQ,aAAa,EAAE,CAAC,CAAC,QAAQ,mBAAmB,GAAG;;;;;;;;;;;;AAarJ,eAAsB,yBACpB,QACA,SACA,OACA,UACgC;CAChC,IAAM,QAAQ,QAAQ,SAAS,YACzB,eAAe,QAAQ,gBAAgB,YACvC,SAAS,IAAI,IAAI,QAAQ,MAAM,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GACtD,IAAI,OAAO,WAAW,EAAC,aAAa,MAAK,CAAC,GAC1C,QAAQ,CAAC,GAAG,OAAO,KAAK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K,MAAM;EACpB,IAAM,MAAM,OAAO,EAAE,UAAW,WAAW,OAAO,EAAE,MAAM,IAAI,QAAQ,eAChE,QAAuC,CAAC;EAC9C,KAAK,IAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG,AAAK,EAAE,WAAW,GAAG,KAAG,KAAK,GAAG,GAAG,KAAK;EAChF,IAAM,MAA8B,CAAC;EACrC,KAAK,IAAM,EAAC,MAAM,SAAQ,OAAO;GAC/B,IAAM,SAAS,SAAS,IAAI,KAAK,GAAG,CAAC;GACrC,IAAI,CAAC,UAAU,WAAW,KAAK;GAC/B,IAAM,KAAK,WAAW,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG;GAC7C,AAAI,MACF,IAAI,QAAQ,IACZ,OAAO,MAAM,KAAK;IAAC,YAAY,OAAO,EAAE,GAAG;IAAG;IAAM,MAAM;IAAK;GAAE,CAAC,KAC7D,OAAO,QAAQ,KAAK;IAAC,YAAY,OAAO,EAAE,GAAG;IAAG;IAAM;IAAK,UAAU;GAAG,CAAC;EAClF;EACA,AAAI,QAAQ,SAAS,OAAO,KAAK,GAAG,CAAC,CAAC,UAAQ,MAAM,EAAE,MAAM,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,EAAC,YAAY,QAAO,CAAC;CAC/I;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"fixCrossLanguageReferences-CDczoic9.js","names":["isObj"],"sources":["../src/lib/translationRedirects.ts","../src/schema/componentDefaults.ts","../src/lib/siteRoutes.ts","../src/schema/sameLanguageReferences.ts","../src/lib/fixCrossLanguageReferences.ts"],"sourcesContent":["import type {SanityClient} from 'sanity'\nimport {toPath} from './paths'\n\ntype Obj = Record<string, unknown>\n\nexport interface TranslationRedirectOptions {\n /** Champ de langue des documents. */\n field?: string\n /** Langue principale : son slug est le slug « d'origine ». */\n defaultLocale: string\n /** Types qui ont une page par document (préfixe d'adresse du registre). */\n types: {type: string; pathPrefix?: string | null; localizedPrefixes?: Record<string, string> | null; slugField?: string}[]\n /** Type de document des redirections (champs from, to, permanent, note). */\n redirectType?: string\n /** `false` : simulation, rien n'est écrit. Défaut : true. */\n apply?: boolean\n}\n\nexport interface TranslationRedirect {\n id: string\n from: string\n to: string\n note: string\n}\n\n/** Identifiant stable de la redirection d'une version (mise à jour, jamais dupliquée). */\nexport const translationRedirectId = (versionId: string) => `redirect-translation-${versionId.replace(/^drafts\\./, '').replace(/[^A-Za-z0-9_-]/g, '-')}`\n\n/**\n * RÈGLE D'OR DU MULTILINGUE, adresses : chaque version a un slug dans SA langue, et\n * l'adresse « slug d'origine dans cette langue » redirige vers elle (une page\n * /rouge, traduite /en/red : /en/rouge redirige vers /en/red). Enregistré comme\n * une vraie redirection (visible dans le Studio, « Redirects »), une par version,\n * mise à jour si un slug change. Rien quand le slug est le même, ni quand l'adresse\n * d'origine est déjà une vraie page de cette langue.\n *\n * `seeds` : documents dont on traite le groupe de traductions (tous si absent).\n * `override` : valeurs d'une version en cours de publication (pas encore lisibles).\n */\nexport async function syncTranslationRedirects(\n client: SanityClient,\n options: TranslationRedirectOptions,\n seeds?: string[],\n override?: {id: string; slug?: string | null; language?: string | null},\n): Promise<TranslationRedirect[]> {\n const field = options.field ?? 'language'\n const redirectType = options.redirectType ?? 'redirect'\n const byType = new Map(options.types.map((t) => [t.type, t]))\n const c = client.withConfig({perspective: 'raw'})\n const types = [...byType.keys()]\n if (!types.length) return []\n\n // Groupes de traductions des types à pages (publiés).\n const groups = await c.fetch<{translations?: {language?: string; _key?: string; value?: {_ref?: string}}[]}[]>(\n seeds?.length\n ? `*[_type == \"translation.metadata\" && count(translations[value._ref in $seeds]) > 0]{translations}`\n : `*[_type == \"translation.metadata\" && count(schemaTypes[@ in $types]) > 0]{translations}`,\n {seeds: (seeds ?? []).map((s) => s.replace(/^drafts\\./, '')), types},\n )\n const ids = [...new Set(groups.flatMap((g) => (g.translations ?? []).map((t) => t.value?._ref).filter((x): x is string => !!x)))]\n if (!ids.length) return []\n const docs = await c.fetch<Obj[]>(`*[_id in $ids]{_id, _type, ${field}, \"slugs\": {\"slug\": slug.current}, title}`, {ids})\n const byId = new Map(docs.map((d) => [String(d._id), d]))\n const slugOf = (d: Obj | undefined) => {\n if (!d) return null\n if (override && d._id === override.id && override.slug !== undefined) return override.slug\n return ((d.slugs as Obj | undefined)?.slug as string | undefined) ?? null\n }\n const langOf = (d: Obj | undefined) => (override && d?._id === override.id && override.language ? override.language : (d?.[field] as string | undefined))\n\n const wanted: TranslationRedirect[] = []\n const stale: string[] = []\n for (const g of groups) {\n const versions = (g.translations ?? []).map((t) => byId.get(t.value?._ref ?? '')).filter((d): d is Obj => !!d)\n const master = versions.find((d) => langOf(d) === options.defaultLocale)\n const masterSlug = slugOf(master)\n for (const v of versions) {\n if (v === master) continue\n const id = translationRedirectId(String(v._id))\n const t = byType.get(String(v._type))\n const language = langOf(v)\n const slug = slugOf(v)\n const from = t && masterSlug && language ? toPath({slug: masterSlug, pathPrefix: t.pathPrefix, localizedPrefixes: t.localizedPrefixes, locale: language}, {field, defaultLocale: options.defaultLocale, locales: [], defaultsSourceLocale: options.defaultLocale}) : null\n const to = t && slug && language ? toPath({slug, pathPrefix: t.pathPrefix, localizedPrefixes: t.localizedPrefixes, locale: language}, {field, defaultLocale: options.defaultLocale, locales: [], defaultsSourceLocale: options.defaultLocale}) : null\n if (!from || !to || from === to) {\n stale.push(id)\n continue\n }\n // L'adresse d'origine est une vraie page de cette langue : pas de redirection.\n const taken = await c.fetch<number>(\n `count(*[_type == $type && ${field} == $language && slug.current == $slug && !(_id in path(\"drafts.**\")) && _id != $self])`,\n {type: v._type, language, slug: masterSlug, self: v._id},\n )\n if (taken) {\n stale.push(id)\n continue\n }\n wanted.push({id, from, to, note: `Created automatically: ${language?.toUpperCase()} version of \"${String(master?.title ?? masterSlug)}\" (translated address)`})\n }\n }\n\n if (options.apply !== false) {\n const tx = c.transaction()\n // Une redirection qui partirait d'une adresse devenue une vraie page est retirée.\n const targets = wanted.map((w) => w.to)\n const loops = targets.length ? await c.fetch<string[]>(`*[_type == $redirectType && from in $targets]._id`, {redirectType, targets}) : []\n for (const id of loops) if (!wanted.some((w) => w.id === id)) tx.delete(id)\n for (const w of wanted) tx.createOrReplace({_id: w.id, _type: redirectType, from: w.from, to: w.to, permanent: true, note: w.note})\n for (const id of stale) tx.delete(id)\n await tx.commit({visibility: 'async'})\n }\n return wanted\n}\n\n/** Options de `syncTranslationRedirects` tirées de la configuration du kit (types à pages avec slug). */\nexport function translationRedirectOptions(config: {\n i18n: {field: string; defaultLocale: string} | null\n pageTypes: {type: string; slugField: string | null; path: string | null; pathPrefix: string | null; localizedPrefixes?: Record<string, string> | null}[]\n}): TranslationRedirectOptions | null {\n if (!config.i18n) return null\n const types = config.pageTypes.filter((t) => t.slugField && !t.path).map((t) => ({type: t.type, pathPrefix: t.pathPrefix, localizedPrefixes: t.localizedPrefixes ?? null, slugField: t.slugField ?? 'slug'}))\n return types.length ? {field: config.i18n.field, defaultLocale: config.i18n.defaultLocale, types} : null\n}\n","import {defineField, defineType, type Rule} from 'sanity'\n\n/**\n * VALEURS PAR DÉFAUT DES COMPOSANTS, côté Studio.\n *\n * Un document (un par langue) avec un bloc par composant de la bibliothèque,\n * GÉNÉRÉ depuis les schémas des sections : une section ajoutée y apparaît sans\n * rien faire. Une instance dont un champ est vide affiche la valeur par défaut ;\n * un champ rempli (override) n'est jamais écrasé. Côté site :\n * `@nocode-factory/sanity-kit/web/defaults`. Dans le Studio, l'onglet Composants\n * ouvre chaque composant (rendu réel + réglages), et une pastille bleue marque\n * chaque champ d'instance qui diffère de la valeur par défaut.\n *\n * Deux règles pour les champs de section, qui en découlent :\n * - jamais d'`initialValue` (ce serait un override involontaire) ;\n * - « obligatoire » = `requiredUnlessDefault`.\n */\n\ntype FieldDef = {name: string; type: string; validation?: unknown; initialValue?: unknown; fields?: FieldDef[]; of?: FieldDef[]; [k: string]: unknown}\ntype SectionDef = {name: string; title?: string; fields: FieldDef[]}\n\nexport const DEFAULT_COMPONENT_DEFAULTS_TYPE = 'componentDefaults'\n\n/** Nom du champ d'un composant dans le document des valeurs par défaut : `section.cta` -> `cta`. */\nexport function defaultsFieldName(type: string, namespace = 'section.'): string {\n return type.startsWith(namespace) ? type.slice(namespace.length) : type\n}\n\n// Dans les valeurs par défaut, rien n'est obligatoire et rien n'est prérempli.\nconst relax = (f: FieldDef): FieldDef => {\n const {validation: _v, initialValue: _i, ...rest} = f\n return {\n ...rest,\n ...(rest.fields ? {fields: rest.fields.map(relax)} : {}),\n ...(rest.of ? {of: rest.of.map(relax)} : {}),\n }\n}\n\n/** Document « Composants : valeurs par défaut », généré depuis les sections. */\nexport function defineComponentDefaults(options: {sections: readonly unknown[]; name?: string; title?: string; namespace?: string}) {\n const {name = DEFAULT_COMPONENT_DEFAULTS_TYPE, title = '🧩 Components: default values', namespace = 'section.'} = options\n return defineType({\n name,\n title,\n type: 'document',\n description:\n 'Values applied to every instance of a component whose field is empty. A field filled in an instance takes precedence (override).',\n fields: (options.sections as SectionDef[]).map((t) =>\n defineField({\n name: defaultsFieldName(t.name, namespace),\n title: t.title || t.name,\n type: 'object',\n description: 'Default values of this component. Empty = design system value.',\n options: {collapsible: true, collapsed: true},\n // Un champ propre à l'instance (options.instanceOnly, ex. ancre) n'a pas de\n // valeur par défaut : absent des réglages du composant.\n fields: t.fields.filter((f) => !(f.options as {instanceOnly?: boolean} | undefined)?.instanceOnly).map(relax) as never,\n }),\n ),\n preview: {prepare: () => ({title: title.replace(/^\\S+\\s/, '')})},\n })\n}\n\nconst isEmpty = (v: unknown) => v === undefined || v === null || v === '' || (Array.isArray(v) && v.length === 0)\n\n/**\n * Règle « obligatoire SAUF si le composant a une valeur par défaut » pour un autre\n * type de document des valeurs par défaut ou un autre espace de noms.\n * `validation: requiredUnlessDefaultFor({type: 'mesDefauts'})`\n */\nexport function requiredUnlessDefaultFor(options: {type?: string; namespace?: string} = {}) {\n const {type: defaultsType = DEFAULT_COMPONENT_DEFAULTS_TYPE, namespace = 'section.'} = options\n return <R>(rule: R): R =>\n (rule as unknown as Rule).custom(async (value, context) => {\n if (!isEmpty(value)) return true\n const type = (context.parent as {_type?: string} | undefined)?._type\n const field = context.path?.[context.path.length - 1]\n const name = type ? defaultsFieldName(type, namespace) : ''\n if (!type?.startsWith(namespace) || typeof field !== 'string' || !/^\\w+$/.test(name) || !/^\\w+$/.test(field)) return 'Required.'\n const language = (context.document as {language?: string} | undefined)?.language ?? null\n const inherited = await context\n .getClient({apiVersion: '2024-10-01'})\n .fetch(\n `*[_type == $defaultsType && !(_id in path(\"drafts.**\")) && ($language == null || language == $language)][0].${name}.${field}`,\n {defaultsType, language},\n )\n return isEmpty(inherited) ? 'Required (or set it in Components > default values).' : true\n }) as unknown as R\n}\n\n/**\n * Champ de section obligatoire, SAUF si le composant a une valeur par défaut\n * pour ce champ (elle s'affichera). Tout type de champ.\n * `validation: requiredUnlessDefault`\n */\nexport const requiredUnlessDefault: <R>(rule: R) => R = requiredUnlessDefaultFor()\n\n/**\n * Presentation : la page qui rend un composant seul (par défaut\n * `/design-system/composant`) a pour document principal les valeurs par défaut.\n * Rendu réel et réglages côte à côte, en direct.\n * `presentationTool({resolve: {mainDocuments: defineDocuments([componentDefaultsMainDocument({language: 'fr'})])}})`\n */\nexport function componentDefaultsMainDocument(options: {language?: string; route?: string; type?: string} = {}): {route: string; filter: string} {\n const {language, route = '/design-system/composant', type = DEFAULT_COMPONENT_DEFAULTS_TYPE} = options\n const safeLang = language && /^[a-z]{2}(-[A-Za-z]{2})?$/.test(language) ? language : null\n return {route, filter: `_type == \"${type}\"${safeLang ? ` && language == \"${safeLang}\"` : ''}`}\n}\n\n/**\n * Presentation : les pages du design system ont pour document principal les valeurs\n * par défaut des composants. `/design-system` (toute la bibliothèque) et\n * `/design-system/composant` (un composant seul) : cliquer un composant ouvre ses\n * réglages globaux, et un style changé change le composant partout où il n'est\n * pas surchargé.\n * `presentationTool({resolve: {mainDocuments: defineDocuments(componentDefaultsMainDocuments({language: 'fr'}))}})`\n */\nexport function componentDefaultsMainDocuments(\n options: {language?: string; type?: string; routes?: string[]} = {},\n): {route: string; filter: string}[] {\n const {routes = ['/design-system/composant', '/design-system'], ...rest} = options\n return routes.map((route) => componentDefaultsMainDocument({...rest, route}))\n}\n","import type {NcfPageTypeInput} from '../config/types'\n\n/**\n * Registre des pages du starter NoCode Factory (`web/app/lib/site-routes.json`).\n * Seules les clés lues ici sont typées : le fichier en porte d'autres\n * (sections, titres, noindex) qui ne concernent pas le kit.\n */\nexport interface SiteRoutesRegistry {\n fixed?: {path: string; homePage?: boolean; system?: boolean; notFound?: boolean; pageSlug?: string; localized?: Record<string, string>}[]\n collections?: {type: string; pathPrefix?: string; localized?: Record<string, string>}[]\n}\n\n/**\n * `pageTypes` déduits du registre du starter, pour ne pas redire au kit ce que\n * le site sait déjà : l'accueil (chemin fixe `/`) et chaque collection avec\n * son préfixe d'URL (`/blog`, `/produits`, ou la racine).\n *\n * ```ts\n * import routes from '../web/app/lib/site-routes.json'\n * ncfKit({pageTypes: pageTypesFromSiteRoutes(routes)})\n * ```\n *\n * `homePageType` : nom du type de l'accueil dans le schéma (le registre ne le\n * porte pas). Les pages codées du registre (`pageSlug`) ne sont pas des types :\n * elles n'apparaissent pas ici.\n */\nexport function pageTypesFromSiteRoutes(\n routes: SiteRoutesRegistry,\n options: {homePageType?: string | null} = {},\n): NcfPageTypeInput[] {\n const homePageType = options.homePageType === undefined ? 'homePage' : options.homePageType\n const out: NcfPageTypeInput[] = []\n\n if (homePageType && routes.fixed?.some((r) => r.homePage)) {\n out.push({type: homePageType, path: '/'})\n }\n for (const collection of routes.collections ?? []) {\n if (!collection.type) continue\n const prefix = (collection.pathPrefix ?? '').trim()\n const localized = collection.localized && Object.keys(collection.localized).length ? {localizedPrefixes: collection.localized} : {}\n out.push(prefix ? {type: collection.type, pathPrefix: prefix, ...localized} : {type: collection.type, ...localized})\n }\n return out\n}\n","import type {NcfKitConfig} from '../config/types'\n\ntype Obj = Record<string, unknown>\ntype FilterResult = {filter?: string; params?: Record<string, unknown>}\ntype FilterFn = (context: {document?: Obj; [key: string]: unknown}) => FilterResult | Promise<FilterResult>\n\n// Objet de configuration simple (jamais un élément React, une icône ou une instance).\nconst isObj = (v: unknown): v is Obj => {\n if (!v || typeof v !== 'object' || Array.isArray(v) || '$$typeof' in v) return false\n const proto = Object.getPrototypeOf(v)\n return proto === Object.prototype || proto === null\n}\n\n/**\n * RÈGLE D'OR DU MULTILINGUE : une référence ne propose que des documents de la\n * MÊME langue que le document en cours (un article EN ne voit que les catégories EN,\n * une page FR que les pages FR). Les documents sans langue (logos, régions, assets…)\n * restent proposés. Un document commun à toutes les langues (Navigation…) vise la\n * langue principale.\n *\n * Pose ce filtre sur TOUS les champs de référence des types donnés (champs, listes,\n * objets imbriqués, annotations du texte riche), combiné avec un filtre déjà présent.\n * À appliquer aux types du projet :\n *\n * ```ts\n * schema: {types: withSameLanguageReferences(schemaTypes, ncfOptions)}\n * ```\n */\nexport function withSameLanguageReferences<T>(types: T[], options: Pick<NcfKitConfig, 'i18n'>): T[] {\n const i18n = options.i18n\n if (!i18n) return types\n const field = i18n.field ?? 'language'\n const fallback = i18n.defaultLocale ?? i18n.locales?.[0]\n const condition = `(!defined(${field}) || ${field} == $ncfLanguage)`\n const languageOf = (document: Obj | undefined) => (typeof document?.[field] === 'string' && document[field]) || fallback\n\n const wrap = (opts: Obj | undefined): Obj => {\n const previous = opts?.filter\n const previousParams = (opts?.filterParams as Record<string, unknown> | undefined) ?? {}\n const filter: FilterFn = async (context) => {\n const base: FilterResult =\n typeof previous === 'function'\n ? ((await (previous as FilterFn)(context)) ?? {})\n : typeof previous === 'string'\n ? {filter: previous, params: previousParams}\n : {}\n return {\n filter: base.filter ? `(${base.filter}) && ${condition}` : condition,\n params: {...(base.params ?? {}), ncfLanguage: languageOf(context.document)},\n }\n }\n const {filterParams: _ignored, ...rest} = opts ?? {}\n return {...rest, filter}\n }\n\n const visit = (node: unknown): unknown => {\n if (Array.isArray(node)) return node.map(visit)\n if (!isObj(node)) return node\n const out: Obj = {}\n for (const [key, value] of Object.entries(node)) out[key] = key === 'options' || key === 'initialValue' || key === 'validation' ? value : visit(value)\n if (node.type === 'reference' && Array.isArray(node.to)) out.options = wrap(node.options as Obj | undefined)\n return out\n }\n return types.map((t) => visit(t) as T)\n}\n","import type {SanityClient} from 'sanity'\n\ntype Obj = Record<string, unknown>\nconst isObj = (v: unknown): v is Obj => !!v && typeof v === 'object' && !Array.isArray(v)\nconst bare = (id: string) => id.replace(/^drafts\\./, '')\n\nexport interface CrossLanguageReport {\n /** Références repointées (ou à repointer en simulation). */\n fixed: {documentId: string; path: string; from: string; to: string}[]\n /** Références croisées sans équivalent dans la langue du document (laissées). */\n missing: {documentId: string; path: string; ref: string; language: string}[]\n}\n\n/** Références d'une valeur, avec leur chemin de patch (`a.b[_key==\"x\"].c`). */\nfunction refs(value: unknown, path: string, out: {path: string; ref: string}[]) {\n if (Array.isArray(value)) {\n value.forEach((item, i) => refs(item, `${path}[${isObj(item) && typeof item._key === 'string' ? `_key==\"${item._key}\"` : i}]`, out))\n return\n }\n if (!isObj(value)) return\n if (typeof value._ref === 'string' && !/^(image|file)-/.test(value._ref)) out.push({path: `${path}._ref`, ref: value._ref})\n for (const [k, v] of Object.entries(value)) if (!k.startsWith('_')) refs(v, path ? `${path}.${k}` : k, out)\n}\n\n/**\n * RÈGLE D'OR DU MULTILINGUE, côté données : chaque référence d'un document vise un\n * document de SA langue (document sans langue : la langue principale). Une\n * référence croisée est repointée vers la traduction de la bonne langue (liens de\n * traduction) ; sans traduction, elle est signalée et laissée. Publiés et\n * brouillons. `apply: false` : simulation.\n *\n * ```ts\n * // studio/scripts/references-same-language.ts (sanity exec --with-user-token)\n * const report = await fixCrossLanguageReferences(getCliClient(...), {defaultLocale: 'fr', apply})\n * ```\n */\nexport async function fixCrossLanguageReferences(\n client: SanityClient,\n options: {field?: string; defaultLocale: string; apply?: boolean},\n): Promise<CrossLanguageReport> {\n const field = options.field ?? 'language'\n const c = client.withConfig({perspective: 'raw'})\n const docs = await c.fetch<Obj[]>(\n `*[!(_type match \"system.*\") && !(_type match \"sanity.*\") && !(_type match \"ncf.*\") && _type != \"translation.metadata\"]`,\n )\n const language = new Map<string, string>()\n for (const d of docs) if (typeof d[field] === 'string') language.set(bare(String(d._id)), String(d[field]))\n const metas = await c.fetch<{translations?: {language?: string; _key?: string; value?: {_ref?: string}}[]}[]>(\n `*[_type == \"translation.metadata\"]{translations}`,\n )\n const equivalent = new Map<string, Map<string, string>>()\n for (const m of metas) {\n const group = new Map<string, string>()\n for (const t of m.translations ?? []) if (t.value?._ref) group.set(t.language ?? t._key ?? '', t.value._ref)\n for (const id of group.values()) equivalent.set(id, group)\n }\n\n const report: CrossLanguageReport = {fixed: [], missing: []}\n for (const d of docs) {\n const own = typeof d[field] === 'string' ? String(d[field]) : options.defaultLocale\n const found: {path: string; ref: string}[] = []\n for (const [k, v] of Object.entries(d)) if (!k.startsWith('_')) refs(v, k, found)\n const set: Record<string, string> = {}\n for (const {path, ref} of found) {\n const target = language.get(bare(ref))\n if (!target || target === own) continue\n const to = equivalent.get(bare(ref))?.get(own)\n if (to) {\n set[path] = to\n report.fixed.push({documentId: String(d._id), path, from: ref, to})\n } else report.missing.push({documentId: String(d._id), path, ref, language: own})\n }\n if (options.apply && Object.keys(set).length) await c.patch(String(d._id)).ifRevisionId(String(d._rev)).set(set).commit({visibility: 'async'})\n }\n return report\n}\n"],"mappings":";;;AA0BA,MAAa,yBAAyB,cAAsB,wBAAwB,UAAU,QAAQ,aAAa,EAAE,CAAC,CAAC,QAAQ,mBAAmB,GAAG;;;;;;;;;;;;AAarJ,eAAsB,yBACpB,QACA,SACA,OACA,UACgC;CAChC,IAAM,QAAQ,QAAQ,SAAS,YACzB,eAAe,QAAQ,gBAAgB,YACvC,SAAS,IAAI,IAAI,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,IAAM,MAAM,MAAM,OAAO,GAAG,WAAW,IAAI,IAAI,KAAK;CAC3D;CAEA,IAAM,SAA8B;EAAC,OAAO,CAAC;EAAG,SAAS,CAAC;CAAC;CAC3D,KAAK,IAAM,KAAK,MAAM;EACpB,IAAM,MAAM,OAAO,EAAE,UAAW,WAAW,OAAO,EAAE,MAAM,IAAI,QAAQ,eAChE,QAAuC,CAAC;EAC9C,KAAK,IAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG,AAAK,EAAE,WAAW,GAAG,KAAG,KAAK,GAAG,GAAG,KAAK;EAChF,IAAM,MAA8B,CAAC;EACrC,KAAK,IAAM,EAAC,MAAM,SAAQ,OAAO;GAC/B,IAAM,SAAS,SAAS,IAAI,KAAK,GAAG,CAAC;GACrC,IAAI,CAAC,UAAU,WAAW,KAAK;GAC/B,IAAM,KAAK,WAAW,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG;GAC7C,AAAI,MACF,IAAI,QAAQ,IACZ,OAAO,MAAM,KAAK;IAAC,YAAY,OAAO,EAAE,GAAG;IAAG;IAAM,MAAM;IAAK;GAAE,CAAC,KAC7D,OAAO,QAAQ,KAAK;IAAC,YAAY,OAAO,EAAE,GAAG;IAAG;IAAM;IAAK,UAAU;GAAG,CAAC;EAClF;EACA,AAAI,QAAQ,SAAS,OAAO,KAAK,GAAG,CAAC,CAAC,UAAQ,MAAM,EAAE,MAAM,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,EAAC,YAAY,QAAO,CAAC;CAC/I;CACA,OAAO;AACT"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { a as CodeEmbedTypeOptions, i as codeEditorInput, n as CodeEditorInput, o as defineCodeEmbedType, r as CodeLanguage, t as CodeEmbedInput } from "./CodeEmbedInput-CobMRQ5s.js";
2
- import { A as ResolvedDocumentColumn, C as NcfInternalFieldOption, D as NcfToolName, E as NcfPageTypeInput, M as ResolvedI18n, N as ResolvedKitConfig, O as NcfToolsConfig, P as ResolvedPageType, S as NcfInternalField, T as NcfPageTypeConfig, _ as NcfComponentPreviewConfig, a as pageTypesFromSiteRoutes, b as NcfHistoryConfig, c as componentDefaultsMainDocuments, d as requiredUnlessDefault, f as requiredUnlessDefaultFor, g as NcfBoardTag, h as KitContextValue, i as SiteRoutesRegistry, j as ResolvedHistory, k as ResolvedComponentPreview, l as defaultsFieldName, m as IssueLevel, n as fixCrossLanguageReferences, o as DEFAULT_COMPONENT_DEFAULTS_TYPE, p as ConfigIssue, r as withSameLanguageReferences, s as componentDefaultsMainDocument, t as CrossLanguageReport, u as defineComponentDefaults, v as NcfDocumentColumn, w as NcfKitConfig, x as NcfI18nConfig, y as NcfEnvironment } from "./fixCrossLanguageReferences-w3whO9xM.js";
2
+ import { A as ResolvedCollections, C as NcfInternalField, D as NcfPageTypeInput, E as NcfPageTypeConfig, F as ResolvedKitConfig, I as ResolvedPageType, M as ResolvedDocumentColumn, N as ResolvedHistory, O as NcfToolName, P as ResolvedI18n, S as NcfI18nConfig, T as NcfKitConfig, _ as NcfCollectionsConfig, a as pageTypesFromSiteRoutes, b as NcfEnvironment, c as componentDefaultsMainDocuments, d as requiredUnlessDefault, f as requiredUnlessDefaultFor, g as NcfBoardTag, h as KitContextValue, i as SiteRoutesRegistry, j as ResolvedComponentPreview, k as NcfToolsConfig, l as defaultsFieldName, m as IssueLevel, n as fixCrossLanguageReferences, o as DEFAULT_COMPONENT_DEFAULTS_TYPE, p as ConfigIssue, r as withSameLanguageReferences, s as componentDefaultsMainDocument, t as CrossLanguageReport, u as defineComponentDefaults, v as NcfComponentPreviewConfig, w as NcfInternalFieldOption, x as NcfHistoryConfig, y as NcfDocumentColumn } from "./fixCrossLanguageReferences-C1VsmGsJ.js";
3
3
  import { ComponentType, ReactNode } from "react";
4
4
  import { AssetSourceComponentProps, LayoutProps, SanityClient, Schema, Tool, ToolMenuProps } from "sanity";
5
5
  import { PreviewHeaderProps } from "sanity/presentation";
6
+ import { ListItemBuilder, StructureBuilder, StructureResolverContext } from "sanity/structure";
6
7
  /** Garantit un chemin absolu ('accueil' -> '/accueil', '' -> '/'). */
7
8
  export declare const normalizePath: (path: string) => string;
8
9
  /** Applique les valeurs par défaut. Ne valide rien : voir `validateConfig`. */
@@ -654,7 +655,7 @@ interface SortOptions {
654
655
  /** Ordre manuel (liste d'ids), pour le tri « manual ». */
655
656
  pageOrder?: readonly string[];
656
657
  }
657
- export declare function sortRows(rows: readonly PageRow[], key: SortKey, direction: SortDirection, options?: SortOptions): PageRow[];
658
+ declare function sortRows$1(rows: readonly PageRow[], key: SortKey, direction: SortDirection, options?: SortOptions): PageRow[];
658
659
  interface PageFilters {
659
660
  types?: readonly string[];
660
661
  statuses?: readonly PageStatus[];
@@ -662,7 +663,7 @@ interface PageFilters {
662
663
  /** Recherche insensible à la casse et aux accents, sur le titre et le chemin. */
663
664
  search?: string;
664
665
  }
665
- export declare function filterRows(rows: readonly PageRow[], filters: PageFilters): PageRow[];
666
+ declare function filterRows$1(rows: readonly PageRow[], filters: PageFilters): PageRow[];
666
667
  /** Langues réellement présentes, pour ne proposer que des filtres utiles. */
667
668
  export declare function localesInRows(rows: readonly PageRow[]): string[];
668
669
  /**
@@ -834,7 +835,7 @@ export declare function thumbnailUrl(asset: Pick<AssetDoc, 'url' | '_type'>, opt
834
835
  h?: number;
835
836
  }): string | undefined;
836
837
  type AssetSortKey = 'date' | 'name' | 'size' | 'type';
837
- type SortDirection$1 = 'asc' | 'desc';
838
+ type SortDirection$2 = 'asc' | 'desc';
838
839
  type AssetTypeFilter = 'all' | 'image' | 'file';
839
840
  type AssetUsageFilter = 'all' | 'used' | 'unused';
840
841
  interface AssetFilter {
@@ -845,7 +846,7 @@ interface AssetFilter {
845
846
  /** Filtre par recherche, type (image/fichier) et usage. */
846
847
  export declare function filterAssets(assets: readonly AssetDoc[], filter?: AssetFilter): AssetDoc[];
847
848
  /** Tri stable par date / nom / taille / type. */
848
- export declare function sortAssets(assets: readonly AssetDoc[], key: AssetSortKey, direction?: SortDirection$1): AssetDoc[];
849
+ export declare function sortAssets(assets: readonly AssetDoc[], key: AssetSortKey, direction?: SortDirection$2): AssetDoc[];
849
850
  interface AssetAssignment {
850
851
  /** `_id` de l'asset. */
851
852
  assetId: string;
@@ -1426,7 +1427,7 @@ export declare function ActorName(props: {
1426
1427
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
1427
1428
  * le vérifie.
1428
1429
  */
1429
- export declare const KIT_VERSION = "2.53.0";
1430
+ export declare const KIT_VERSION = "2.54.0";
1430
1431
  /**
1431
1432
  * Données de la page proposées comme colonnes.
1432
1433
  *
@@ -1893,6 +1894,171 @@ export declare function blockName(type: string, namespace: string): string;
1893
1894
  export declare function fillTemplate(template: string, type: string, namespace: string): string;
1894
1895
  /** Libellé lisible par défaut : 'imageText' -> 'Image text'. */
1895
1896
  export declare function humanizeBlockName(type: string, namespace: string): string;
1897
+ /**
1898
+ * Vue table d'UNE collection, à utiliser comme enfant d'une entrée de structure
1899
+ * pour que cliquer la collection ouvre la table (au lieu de la liste native) :
1900
+ *
1901
+ * ```ts
1902
+ * S.listItem().title('Articles').child(ncfCollectionTable(S, ncfOptions, 'article'))
1903
+ * ```
1904
+ */
1905
+ export declare function ncfCollectionTable(S: StructureBuilder, options: NcfKitConfig, type: string, opts?: {
1906
+ title?: string;
1907
+ }): import("sanity/structure").ComponentBuilder;
1908
+ /**
1909
+ * Entrées « collection » pour la structure du Studio, une par type découvert,
1910
+ * chacune ouvrant la vue table. À épandre dans la liste racine :
1911
+ *
1912
+ * ```ts
1913
+ * structure: (S, context) =>
1914
+ * S.list().title('Contenu').items([..., ...ncfCollections(S, context, ncfOptions)])
1915
+ * ```
1916
+ */
1917
+ export declare function ncfCollections(S: StructureBuilder, context: StructureResolverContext, options: NcfKitConfig): ListItemBuilder[];
1918
+ interface CollectionTableProps {
1919
+ type: string;
1920
+ }
1921
+ export declare function CollectionTable({ type }: CollectionTableProps): import("react").JSX.Element;
1922
+ /**
1923
+ * Colonnes de la vue table d'une collection.
1924
+ *
1925
+ * À la différence de `deriveDocumentColumns` (onglet Pages, uniquement des
1926
+ * valeurs scalaires), on garde ici les **références** : une collection se lit
1927
+ * surtout par ses liens (auteur, catégorie…). Une colonne porte donc son
1928
+ * expression GROQ toute faite plutôt qu'une simple liste de chemins.
1929
+ */
1930
+ type CollectionColumnKind = 'text' | 'number' | 'boolean' | 'date' | 'reference';
1931
+ interface CollectionColumn {
1932
+ /** Clé de projection, sûre (sert de nom de champ GROQ). */
1933
+ key: string;
1934
+ label: string;
1935
+ kind: CollectionColumnKind;
1936
+ /** Expression GROQ relative au document, p. ex. `title` ou `author->title`. */
1937
+ projection: string;
1938
+ }
1939
+ interface DeriveCollectionOptions {
1940
+ /** Profondeur d'imbrication explorée dans les objets. 1 couvre `seo.title`. */
1941
+ depth?: number;
1942
+ }
1943
+ /**
1944
+ * Colonnes tirées du schéma d'un type de collection. Aucune liste à tenir :
1945
+ * chaque champ scalaire, date ou référence devient une colonne proposable. Les
1946
+ * tableaux, images, fichiers et blocs sont écartés — rien à rendre en ligne.
1947
+ */
1948
+ export declare function deriveCollectionColumns(type: SchemaTypeLike | undefined, options?: DeriveCollectionOptions): CollectionColumn[];
1949
+ /** Nom du champ titre d'une collection, pour la colonne mise en avant. */
1950
+ export declare function titleColumn(columns: readonly CollectionColumn[]): CollectionColumn | undefined;
1951
+ type CellValue = string | number | boolean | null;
1952
+ interface CollectionCell {
1953
+ /** Valeur brute, pour un tri typé. */
1954
+ raw: CellValue;
1955
+ /** Valeur mise en forme, pour l'affichage, le filtre et le CSV. */
1956
+ text: string;
1957
+ }
1958
+ interface CollectionRow {
1959
+ /** Id de base (sans `drafts.`), pour ouvrir le document. */
1960
+ id: string;
1961
+ updatedAt: string | null;
1962
+ /** Vrai si l'item n'existe qu'en brouillon (jamais publié). */
1963
+ draftOnly: boolean;
1964
+ cells: Record<string, CollectionCell>;
1965
+ }
1966
+ /** Document tel que renvoyé par `buildCollectionQuery`. */
1967
+ interface CollectionDoc {
1968
+ _id: string;
1969
+ _updatedAt?: string | null;
1970
+ [key: string]: unknown;
1971
+ }
1972
+ /**
1973
+ * Documents → lignes, une par item. Le client (perspective `raw`) renvoie le
1974
+ * brouillon ET la version publiée : on les fusionne par id de base, en gardant
1975
+ * le brouillon s'il existe (valeurs les plus fraîches).
1976
+ */
1977
+ export declare function buildCollectionRows(docs: readonly CollectionDoc[], columns: readonly CollectionColumn[]): CollectionRow[];
1978
+ interface CollectionState {
1979
+ /** Toutes les colonnes possibles du type (pour le sélecteur). */
1980
+ allColumns: CollectionColumn[];
1981
+ /** Colonnes réellement affichées (celles projetées). */
1982
+ visibleColumns: CollectionColumn[];
1983
+ rows: CollectionRow[];
1984
+ loading: boolean;
1985
+ error: Error | null;
1986
+ refresh: () => void;
1987
+ }
1988
+ /**
1989
+ * Données d'une collection pour la vue table : colonnes tirées du schéma,
1990
+ * lignes en direct. Seules les colonnes visibles sont projetées (comme
1991
+ * `usePages`), pour ne pas tirer tout le schéma sur chaque document.
1992
+ */
1993
+ export declare function useCollection(type: string, visibleKeys: readonly string[]): CollectionState;
1994
+ /**
1995
+ * Découverte des types « collection » à montrer en table. Pur : prend la liste
1996
+ * des types du schéma (nom + nature JSON) et rend les types de documents
1997
+ * retenus. L'appelant (helper de structure) fournit la liste d'exclusion
1998
+ * complète — pages, redirections, types techniques du kit, `sanity.*`.
1999
+ */
2000
+ interface SchemaTypeInfo {
2001
+ name: string;
2002
+ jsonType?: string;
2003
+ }
2004
+ interface DiscoverOptions {
2005
+ /** Types à ne jamais lister (pages, redirections, types du kit…). */
2006
+ exclude?: readonly string[];
2007
+ /** Liste explicite : si fournie, elle fait foi (surcharge l'auto-découverte). */
2008
+ include?: readonly string[];
2009
+ }
2010
+ /**
2011
+ * Types de collection retenus.
2012
+ *
2013
+ * - `include` fournie → on respecte cette liste (dans son ordre), en gardant
2014
+ * seulement ce qui est un type de document connu et hors `exclude`.
2015
+ * - sinon → tous les types de documents, moins `exclude` et les types réservés,
2016
+ * triés par nom pour une liste stable.
2017
+ */
2018
+ export declare function discoverCollectionTypes(types: readonly SchemaTypeInfo[], options?: DiscoverOptions): string[];
2019
+ /**
2020
+ * Requête d'une collection : `_id`, `_updatedAt`, et une projection par colonne
2021
+ * **visible** (clé préfixée `ncfData_` pour ne jamais heurter un champ du
2022
+ * client). Les expressions des colonnes sont construites par le kit à partir de
2023
+ * chemins déjà validés (`deriveCollectionColumns`), donc sûres ; la clé est
2024
+ * revérifiée par prudence avant interpolation.
2025
+ *
2026
+ * Le type passe en paramètre (`$type`), jamais interpolé dans la requête.
2027
+ *
2028
+ * On ne filtre pas les brouillons : le client (perspective `raw`) renvoie
2029
+ * `drafts.x` ET `x`, que `buildCollectionRows` fusionne par id de base — sans
2030
+ * quoi un item jamais publié n'apparaîtrait pas.
2031
+ */
2032
+ export declare function buildCollectionQuery(columns: readonly CollectionColumn[]): string;
2033
+ type SortDirection$1 = 'asc' | 'desc';
2034
+ interface CollectionSort {
2035
+ /** Clé de colonne, ou `null` pour l'ordre d'arrivée. */
2036
+ key: string | null;
2037
+ direction: SortDirection$1;
2038
+ }
2039
+ interface CollectionFilters {
2040
+ /** Recherche globale sur les colonnes visibles. */
2041
+ search?: string;
2042
+ /** Filtre « contient » par colonne (clé → texte recherché). */
2043
+ columns?: Record<string, string>;
2044
+ }
2045
+ declare function sortRows(rows: readonly CollectionRow[], sort: CollectionSort, columns: readonly CollectionColumn[]): CollectionRow[];
2046
+ declare function filterRows(rows: readonly CollectionRow[], filters: CollectionFilters, visibleColumns: readonly CollectionColumn[]): CollectionRow[];
2047
+ /**
2048
+ * Lignes → CSV. En-têtes = libellés des colonnes visibles, cellules = le texte
2049
+ * déjà mis en forme (`row.cells[key].text`). Lignes séparées par CRLF, comme
2050
+ * l'attendent les tableurs. Pur : l'appelant ajoute l'éventuel BOM au moment du
2051
+ * téléchargement.
2052
+ */
2053
+ export declare function toCsv(rows: readonly CollectionRow[], columns: readonly CollectionColumn[]): string;
2054
+ /**
2055
+ * Propose un fichier texte au téléchargement depuis le navigateur. Déclenché
2056
+ * par un clic de l'utilisateur (bouton « Exporter »), jamais tout seul.
2057
+ *
2058
+ * Un BOM UTF-8 est ajouté par défaut pour que les accents s'affichent dans
2059
+ * Excel. No-op hors navigateur (rendu serveur, tests).
2060
+ */
2061
+ export declare function downloadText(filename: string, text: string, mime?: string, withBom?: boolean): void;
1896
2062
  /** Une entrée de `presentationTool({resolve: {mainDocuments: defineDocuments([...])}})`. */
1897
2063
  interface MainDocumentRoute {
1898
2064
  route: string;
@@ -1926,5 +2092,5 @@ export declare const NCF_DESIGN_SYSTEM_TOOL = "ncf-design-system";
1926
2092
  export declare const NCF_ASSETS_TOOL = "ncf-assets";
1927
2093
  export declare const NCF_TOOL_NAMES: readonly ["ncf-pages", "ncf-components", "ncf-history", "ncf-design-system", "ncf-assets"];
1928
2094
  export declare const ncfKit: import("sanity").Plugin<NcfKitConfig>;
1929
- export { type AddColumnInput, type Annotation, type AnnotationsState, type AssetAssignment, type AssetDoc, type AssetFolder, type AssetMetaState, type AssetSortKey, type AssetTypeFilter, type AssetUploadState, type AssetUsageFilter, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, CodeEditorInput, CodeEmbedInput, type CodeEmbedTypeOptions, type CodeLanguage, type CollectedLinks, type ColorBy, type ColorOptions, type ComponentEntry, type ComponentGroup, type ComponentGrouping, type ConfigIssue, type CrossLanguageReport, DEFAULT_COMPONENT_DEFAULTS_TYPE, type DeriveOptions, type FolderSelection, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MainDocumentRoute, type MergedDoc, type NcfBoardTag, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageBuilderResolution, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc, codeEditorInput, componentDefaultsMainDocument, componentDefaultsMainDocuments, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, fixCrossLanguageReferences, pageTypesFromSiteRoutes, requiredUnlessDefault, requiredUnlessDefaultFor, withSameLanguageReferences };
2095
+ export { type AddColumnInput, type Annotation, type AnnotationsState, type AssetAssignment, type AssetDoc, type AssetFolder, type AssetMetaState, type AssetSortKey, type AssetTypeFilter, type AssetUploadState, type AssetUsageFilter, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, CodeEditorInput, CodeEmbedInput, type CodeEmbedTypeOptions, type CodeLanguage, type CollectedLinks, type CollectionCell, type CollectionColumn, type CollectionColumnKind, type CollectionDoc, type CollectionFilters, type CollectionRow, type CollectionSort, type CollectionState, type ColorBy, type ColorOptions, type ComponentEntry, type ComponentGroup, type ComponentGrouping, type ConfigIssue, type CrossLanguageReport, DEFAULT_COMPONENT_DEFAULTS_TYPE, type DeriveOptions, type FolderSelection, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MainDocumentRoute, type MergedDoc, type NcfBoardTag, type NcfCollectionsConfig, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageBuilderResolution, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedCollections, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeInfo, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc, codeEditorInput, componentDefaultsMainDocument, componentDefaultsMainDocuments, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, filterRows as filterCollectionRows, filterRows$1 as filterRows, fixCrossLanguageReferences, pageTypesFromSiteRoutes, requiredUnlessDefault, requiredUnlessDefaultFor, sortRows as sortCollectionRows, sortRows$1 as sortRows, withSameLanguageReferences };
1930
2096
  //# sourceMappingURL=index.d.ts.map