@lupinum/ginko-content 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/README.md +18 -4
  2. package/compatibility.json +1 -1
  3. package/dist/cli.mjs +317 -294
  4. package/dist/cms-import/index.js +5 -1
  5. package/dist/config.d.mts +1 -1
  6. package/dist/config.mjs +1 -1
  7. package/dist/core/cache-hints.d.ts +9 -1
  8. package/dist/core/content/collection.js +1 -1
  9. package/dist/core/content/path.js +1 -1
  10. package/dist/core/errors.js +5 -1
  11. package/dist/core/provider-errors +1 -0
  12. package/dist/core/provider-errors.d.ts +10 -0
  13. package/dist/core/provider-errors.js +27 -0
  14. package/dist/core/query/execute.js +12 -3
  15. package/dist/core/query/filter.js +2 -2
  16. package/dist/core/query/lower.js +5 -4
  17. package/dist/features/navigation/build.js +14 -6
  18. package/dist/features/navigation/canonical.js +1 -1
  19. package/dist/features/sitemap/query.js +2 -2
  20. package/dist/integrations/nitro/ingest.d.ts +3 -3
  21. package/dist/integrations/nitro/ingest.js +3 -3
  22. package/dist/integrations/nitro/storage.js +3 -1
  23. package/dist/module.d.mts +151 -526
  24. package/dist/module.json +1 -1
  25. package/dist/module.mjs +1091 -722
  26. package/dist/parsers/csv.js +4 -3
  27. package/dist/parsers/index.d.ts +2 -5
  28. package/dist/parsers/index.js +2 -2
  29. package/dist/parsers/markdown-plugins.d.ts +1 -0
  30. package/dist/parsers/markdown-plugins.js +83 -1
  31. package/dist/parsers/markdown.js +1 -1
  32. package/dist/public/client.d.ts +3 -2
  33. package/dist/public/client.js +2 -2
  34. package/dist/public/provider-errors.d.ts +2 -1
  35. package/dist/public/provider-errors.js +1 -18
  36. package/dist/public/provider.d.ts +3 -10
  37. package/dist/public/server.d.ts +6 -1
  38. package/dist/public/server.js +33 -0
  39. package/dist/runtime/agent-paths +1 -0
  40. package/dist/runtime/agent-paths.d.ts +6 -0
  41. package/dist/runtime/agent-paths.js +41 -0
  42. package/dist/runtime/app/components/internal/MarkdownRenderer.d.ts +1 -1
  43. package/dist/runtime/app/composables/head.d.ts +3 -0
  44. package/dist/runtime/app/composables/head.js +2 -1
  45. package/dist/runtime/app/composables/hot-reload +1 -0
  46. package/dist/runtime/app/composables/hot-reload.d.ts +5 -0
  47. package/dist/runtime/app/composables/hot-reload.js +15 -0
  48. package/dist/runtime/app/composables/locale-context.d.ts +1 -1
  49. package/dist/runtime/app/composables/locale-context.js +2 -1
  50. package/dist/runtime/app/composables/locale.js +2 -2
  51. package/dist/runtime/app/composables/search.js +10 -6
  52. package/dist/runtime/app/composables/use-content-document +1 -0
  53. package/dist/runtime/app/composables/use-content-document.d.ts +29 -0
  54. package/dist/runtime/app/composables/use-content-document.js +44 -0
  55. package/dist/runtime/app/composables/use-content-list +1 -0
  56. package/dist/runtime/app/composables/use-content-list.d.ts +43 -0
  57. package/dist/runtime/app/composables/use-content-list.js +98 -0
  58. package/dist/runtime/app/composables/use-content-navigation +1 -0
  59. package/dist/runtime/app/composables/use-content-navigation.d.ts +40 -0
  60. package/dist/runtime/app/composables/use-content-navigation.js +102 -0
  61. package/dist/runtime/app/composables/use-content-page +1 -0
  62. package/dist/runtime/app/composables/use-content-page.d.ts +47 -0
  63. package/dist/runtime/app/composables/use-content-page.js +142 -0
  64. package/dist/runtime/app/composables/use-content-shared +1 -0
  65. package/dist/runtime/app/composables/use-content-shared.d.ts +13 -0
  66. package/dist/runtime/app/composables/use-content-shared.js +29 -0
  67. package/dist/runtime/app/composables/use-content.d.ts +11 -206
  68. package/dist/runtime/app/composables/use-content.js +4 -377
  69. package/dist/runtime/app/plugins/hot-reload +1 -0
  70. package/dist/runtime/app/plugins/hot-reload.js +6 -0
  71. package/dist/runtime/query/backlinks +1 -0
  72. package/dist/runtime/query/backlinks.d.ts +8 -0
  73. package/dist/runtime/query/backlinks.js +90 -0
  74. package/dist/runtime/query/context +1 -0
  75. package/dist/runtime/query/context.d.ts +20 -0
  76. package/dist/runtime/query/context.js +0 -0
  77. package/dist/runtime/query/documents +1 -0
  78. package/dist/runtime/query/documents.d.ts +6 -0
  79. package/dist/runtime/query/documents.js +98 -0
  80. package/dist/runtime/query/errors +1 -0
  81. package/dist/runtime/query/errors.d.ts +1 -0
  82. package/dist/runtime/query/errors.js +4 -0
  83. package/dist/runtime/query/handles +1 -0
  84. package/dist/runtime/query/handles.d.ts +2 -0
  85. package/dist/runtime/query/handles.js +7 -0
  86. package/dist/runtime/query/locale-options +1 -0
  87. package/dist/runtime/query/locale-options.d.ts +5 -0
  88. package/dist/runtime/query/locale-options.js +14 -0
  89. package/dist/runtime/query/localized-docs +1 -0
  90. package/dist/runtime/query/localized-docs.d.ts +17 -0
  91. package/dist/runtime/query/localized-docs.js +44 -0
  92. package/dist/runtime/query/navigation +1 -0
  93. package/dist/runtime/query/navigation.d.ts +22 -0
  94. package/dist/runtime/query/navigation.js +73 -0
  95. package/dist/runtime/query/pagination +1 -0
  96. package/dist/runtime/query/pagination.d.ts +7 -0
  97. package/dist/runtime/query/pagination.js +78 -0
  98. package/dist/runtime/query/populate +1 -0
  99. package/dist/runtime/query/populate.d.ts +9 -0
  100. package/dist/runtime/query/populate.js +106 -0
  101. package/dist/runtime/query/responses +1 -0
  102. package/dist/runtime/query/responses.d.ts +10 -0
  103. package/dist/runtime/query/responses.js +47 -0
  104. package/dist/runtime/query/unified.d.ts +4 -20
  105. package/dist/runtime/query/unified.js +14 -544
  106. package/dist/runtime/query/variants +1 -0
  107. package/dist/runtime/query/variants.d.ts +11 -0
  108. package/dist/runtime/query/variants.js +36 -0
  109. package/dist/runtime/server/agent-http +1 -0
  110. package/dist/runtime/server/agent-http.d.ts +7 -0
  111. package/dist/runtime/server/agent-http.js +36 -0
  112. package/dist/runtime/server/agent-markdown +1 -0
  113. package/dist/runtime/server/agent-markdown.d.ts +83 -0
  114. package/dist/runtime/server/agent-markdown.js +449 -0
  115. package/dist/runtime/server/agent-site +1 -0
  116. package/dist/runtime/server/agent-site.d.ts +38 -0
  117. package/dist/runtime/server/agent-site.js +273 -0
  118. package/dist/runtime/server/api/agent-llms +1 -0
  119. package/dist/runtime/server/api/agent-llms-full +1 -0
  120. package/dist/runtime/server/api/agent-llms-full.d.ts +2 -0
  121. package/dist/runtime/server/api/agent-llms-full.js +13 -0
  122. package/dist/runtime/server/api/agent-llms.d.ts +2 -0
  123. package/dist/runtime/server/api/agent-llms.js +14 -0
  124. package/dist/runtime/server/api/agent-raw +1 -0
  125. package/dist/runtime/server/api/agent-raw.d.ts +2 -0
  126. package/dist/runtime/server/api/agent-raw.js +17 -0
  127. package/dist/runtime/server/api/locales.d.ts +2 -2
  128. package/dist/runtime/server/api/locales.js +4 -2
  129. package/dist/runtime/server/api/navigation.d.ts +1 -1
  130. package/dist/runtime/server/api/query.d.ts +1 -1
  131. package/dist/runtime/server/api/query.js +4 -1
  132. package/dist/runtime/server/api/revalidate.js +2 -2
  133. package/dist/runtime/server/api/site-data.d.ts +1 -1
  134. package/dist/runtime/server/collection-helpers.js +2 -1
  135. package/dist/runtime/server/middleware/agent-link-headers +1 -0
  136. package/dist/runtime/server/middleware/agent-link-headers.d.ts +2 -0
  137. package/dist/runtime/server/middleware/agent-link-headers.js +42 -0
  138. package/dist/runtime/server/middleware/agent-markdown +1 -0
  139. package/dist/runtime/server/middleware/agent-markdown.d.ts +2 -0
  140. package/dist/runtime/server/middleware/agent-markdown.js +43 -0
  141. package/dist/runtime/server/plugins/sitemap.js +1 -0
  142. package/dist/runtime/server/provider-query.d.ts +8 -5
  143. package/dist/runtime/server/provider-query.js +50 -8
  144. package/dist/runtime/server/provider-result.d.ts +19 -2
  145. package/dist/runtime/server/providers/filesystem.js +4 -1
  146. package/dist/runtime/server/providers/index.d.ts +3 -1
  147. package/dist/runtime/server/providers/index.js +2 -2
  148. package/dist/runtime/server/query-api.js +2 -1
  149. package/dist/runtime/server/query-executor.d.ts +3 -2
  150. package/dist/runtime/server/query-executor.js +13 -5
  151. package/dist/runtime/server/search.js +1 -1
  152. package/dist/runtime/server/sitemap-provider.js +40 -1
  153. package/dist/runtime/server/sitemap.js +3 -2
  154. package/dist/runtime/transformers/component-resolver.js +2 -1
  155. package/dist/runtime/utils/content-components.d.ts +0 -5
  156. package/dist/storage/content.d.ts +2 -9
  157. package/dist/storage/references.d.ts +1 -8
  158. package/dist/storage/references.js +9 -4
  159. package/dist/testing/provider-contract.js +3 -4
  160. package/dist/testing/provider-fixture.d.ts +3 -1
  161. package/dist/testing/provider-fixture.js +27 -14
  162. package/dist/types/config.d.ts +77 -0
  163. package/dist/types/config.js +23 -0
  164. package/dist/types/module.d.ts +15 -5
  165. package/dist/types/query-parts/collections +1 -0
  166. package/dist/types/query-parts/collections.d.ts +15 -0
  167. package/dist/types/query-parts/collections.js +0 -0
  168. package/dist/types/query-parts/public +1 -0
  169. package/dist/types/query-parts/public.d.ts +202 -0
  170. package/dist/types/query-parts/public.js +0 -0
  171. package/dist/types/query-parts/results +1 -0
  172. package/dist/types/query-parts/results.d.ts +95 -0
  173. package/dist/types/query-parts/results.js +0 -0
  174. package/dist/types/query-parts/transport +1 -0
  175. package/dist/types/query-parts/transport.d.ts +103 -0
  176. package/dist/types/query-parts/transport.js +0 -0
  177. package/dist/types/query.d.ts +4 -870
  178. package/dist/types/query.js +4 -0
  179. package/dist/types/runtime.d.ts +2 -2
  180. package/dist/types/virtual.d.ts +54 -0
  181. package/dist/types.d.mts +2 -2
  182. package/dist/web-types.json +1 -1
  183. package/package.json +5 -5
  184. package/dist/runtime/app/composables/web-socket +0 -1
  185. package/dist/runtime/app/composables/web-socket.d.ts +0 -3
  186. package/dist/runtime/app/composables/web-socket.js +0 -65
  187. package/dist/runtime/app/plugins/ws +0 -1
  188. package/dist/runtime/app/plugins/ws.js +0 -7
  189. /package/dist/runtime/app/plugins/{ws.d.ts → hot-reload.d.ts} +0 -0
package/dist/module.d.mts CHANGED
@@ -1,12 +1,11 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { ModuleOptions as ModuleOptions$1, ContentContext as ContentContext$1, ContentRevalidateOptions as ContentRevalidateOptions$1 } from '../dist/types/module';
3
+ import { StorageValue } from 'unstorage';
2
4
  import { MarkdownOptions as MarkdownOptions$1, ParsedContent as ParsedContent$1 } from '../dist/types/content';
3
5
  import { ContentCollectionConfig as ContentCollectionConfig$1, ContentCollectionI18nConfig as ContentCollectionI18nConfig$1 } from '../dist/types/config';
4
- export { defineCollection, defineContentConfig, reference } from '../dist/types/config';
5
- import { StorageValue } from 'unstorage';
6
- import { ModuleOptions as ModuleOptions$1, ContentContext as ContentContext$1, ContentRevalidateOptions as ContentRevalidateOptions$1 } from '../dist/types/module';
6
+ export { agentMetadataFields, defineAgentAppPage, defineAgentMarkdownPolicy, defineAgentMetadataFields, defineAgentSection, defineCollection, defineContentConfig, reference } from '../dist/types/config';
7
7
  import { ZodType, z } from 'zod';
8
8
  import { ContentSearchPublicRuntimeConfig as ContentSearchPublicRuntimeConfig$1 } from '../dist/types/search';
9
- import { ListenOptions } from 'listhen';
10
9
 
11
10
  /**
12
11
  * Locale settings for a collection that ships translated variants.
@@ -72,6 +71,67 @@ interface ContentCmsCollectionConfig {
72
71
  fields?: Record<string, ContentCmsFieldConfig>;
73
72
  settings?: unknown;
74
73
  }
74
+ declare const agentMetadataFields: readonly ["title", "description", "url", "route", "locale", "section", "collection", "source", "updated"];
75
+ type AgentMetadataField = typeof agentMetadataFields[number];
76
+ type AgentMetadataFieldList = readonly AgentMetadataField[];
77
+ interface ContentAgentMarkdownOptions {
78
+ includeInIndex?: boolean;
79
+ includeInFull?: boolean;
80
+ metadata?: AgentMetadataFieldList;
81
+ }
82
+ interface ContentAgentCollectionConfig {
83
+ section?: string;
84
+ markdown?: boolean | ContentAgentMarkdownOptions;
85
+ }
86
+ type ContentAgentLocalizedValue = string | Record<string, string>;
87
+ interface ContentAgentSiteConfig {
88
+ title: ContentAgentLocalizedValue;
89
+ description: ContentAgentLocalizedValue;
90
+ url?: string;
91
+ defaultLocale?: string;
92
+ locales?: string[];
93
+ profile?: string;
94
+ contentSignals?: {
95
+ search?: boolean;
96
+ aiInput?: boolean;
97
+ aiTrain?: boolean;
98
+ };
99
+ }
100
+ interface ContentAgentMarkdownMetadataConfig {
101
+ enabled?: boolean;
102
+ defaultFields?: AgentMetadataFieldList;
103
+ }
104
+ interface ContentAgentMarkdownPolicyConfig {
105
+ metadata?: boolean | AgentMetadataFieldList | ContentAgentMarkdownMetadataConfig;
106
+ }
107
+ interface ContentAgentSectionConfig {
108
+ id: string;
109
+ title: ContentAgentLocalizedValue;
110
+ order?: number;
111
+ }
112
+ interface ContentAgentAppPageContext {
113
+ locale: string;
114
+ defaultLocale?: string;
115
+ siteUrl: string;
116
+ }
117
+ interface ContentAgentAppPageConfig {
118
+ id: string;
119
+ route: ContentAgentLocalizedValue;
120
+ section: string;
121
+ title: ContentAgentLocalizedValue | ((ctx: ContentAgentAppPageContext) => string | Promise<string>);
122
+ description: ContentAgentLocalizedValue | ((ctx: ContentAgentAppPageContext) => string | Promise<string>);
123
+ updated?: string;
124
+ includeInIndex?: boolean;
125
+ includeInFull?: boolean;
126
+ metadata?: AgentMetadataFieldList;
127
+ render: (ctx: ContentAgentAppPageContext) => string | Promise<string>;
128
+ }
129
+ interface ContentAgentConfig {
130
+ site?: ContentAgentSiteConfig;
131
+ markdown?: ContentAgentMarkdownPolicyConfig;
132
+ sections?: ContentAgentSectionConfig[];
133
+ pages?: ContentAgentAppPageConfig[];
134
+ }
75
135
  /**
76
136
  * Object source shape accepted for Nuxt Content v3 migration.
77
137
  */
@@ -145,6 +205,12 @@ interface ContentCollectionConfig<TSchema extends ZodType | undefined = ZodType
145
205
  * source, i18n, and schema information.
146
206
  */
147
207
  cms?: ContentCmsCollectionConfig;
208
+ /**
209
+ * Agent-facing collection exposure. Collections declare only whether pages
210
+ * produce normalized markdown and which agent section they belong to. Root
211
+ * `agent` config owns site policy; the Ginko module owns route plumbing.
212
+ */
213
+ agent?: ContentAgentCollectionConfig;
148
214
  }
149
215
  type ContentProviderName = 'filesystem' | (string & {});
150
216
  type DefineCollectionOptions<TSchema extends ZodType | undefined = ZodType | undefined> = Omit<ContentCollectionConfig<TSchema>, 'source' | 'exclude'>;
@@ -176,6 +242,12 @@ interface ContentConfig<TCollections extends Record<string, ContentCollectionCon
176
242
  * modules register themselves, so app configs usually do not need this.
177
243
  */
178
244
  providers?: Record<string, string>;
245
+ /**
246
+ * Agent-facing site map and markdown output. Ginko owns the repetitive
247
+ * `/llms.txt`, raw markdown, and static route plumbing; apps provide site
248
+ * facts and app-owned page renderers here.
249
+ */
250
+ agent?: ContentAgentConfig;
179
251
  /**
180
252
  * Named content collections keyed by the identifier used at query time.
181
253
  */
@@ -594,123 +666,36 @@ interface ContentQueryCountResponse {
594
666
  */
595
667
  type ContentQueryResponse<T> = ContentQueryFindResponse<T> | ContentQueryFindOneResponse<T> | ContentQueryCountResponse;
596
668
 
597
- /**
598
- * Query
599
- */
600
669
  interface ContentQuerySortParams {
601
- /**
602
- * Locale specifier for sorting
603
- * A string with a BCP 47 language tag
604
- *
605
- * @default undefined
606
- */
607
670
  $locale?: string;
608
- /**
609
- * Whether numeric collation should be used, such that "1" < "2" < "10".
610
- * Possible values are `true` and `false`;
611
- *
612
- * @default false
613
- */
614
671
  $numeric?: boolean;
615
- /**
616
- * Whether upper case or lower case should sort first.
617
- * Possible values are `"upper"`, `"lower"`, or `"false"`
618
- *
619
- * @default "depends on locale"
620
- */
621
672
  $caseFirst?: 'upper' | 'lower' | 'false';
622
- /**
623
- * Which differences in the strings should lead to non-zero result values. Possible values are:
624
- * - "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A.
625
- * - "accent": Only strings that differ in base letters or accents and other diacritic marks compare as unequal. Examples: a ≠ b, a ≠ á, a = A.
626
- * - "case": Only strings that differ in base letters or case compare as unequal. Examples: a ≠ b, a = á, a ≠ A.
627
- * - "variant": Strings that differ in base letters, accents and other diacritic marks, or case compare as unequal. Other differences may also be taken into consideration. Examples: a ≠ b, a ≠ á, a ≠ A.
628
- *
629
- * @default "variant"
630
- */
631
673
  $sensitivity?: 'base' | 'accent' | 'case' | 'variant';
632
674
  }
633
675
  interface ContentQuerySortFields {
634
676
  [field: string]: -1 | 1;
635
677
  }
636
678
  type ContentQuerySortOptions = ContentQuerySortParams | ContentQuerySortFields;
637
- /**
638
- * @internal
639
- */
640
679
  interface ContentQueryBuilderWhere extends Partial<Record<keyof ParsedContentInternalMeta, string | number | boolean | RegExp | ContentQueryBuilderWhere>> {
641
- /**
642
- * Match only if all nested conditions are true.
643
- **/
644
680
  $and?: ContentQueryBuilderWhere[];
645
- /**
646
- * Match if any nested condition is true.
647
- **/
648
681
  $or?: ContentQueryBuilderWhere[];
649
- /**
650
- * Match when the nested condition is false.
651
- **/
652
682
  $not?: string | number | boolean | RegExp | ContentQueryBuilderWhere;
653
- /**
654
- * Match if item equals condition.
655
- **/
656
683
  $eq?: string | number | boolean | RegExp;
657
- /**
658
- * Match if item does not equal condition.
659
- **/
660
684
  $ne?: string | number | boolean | RegExp;
661
- /**
662
- * Check if item is greater than condition.
663
- */
664
685
  $gt?: number | string;
665
- /**
666
- * Check if item is greater than or equal to condition.
667
- */
668
686
  $gte?: number | string;
669
- /**
670
- * Check if item is less than condition.
671
- */
672
687
  $lt?: number | string;
673
- /**
674
- * Check if item is less than or equal to condition.
675
- */
676
688
  $lte?: number | string;
677
- /**
678
- * Provides regular expression capabilities for pattern matching strings.
679
- */
680
689
  $regex?: RegExp | string;
681
- /**
682
- * Match when a string field starts with the given prefix.
683
- */
684
690
  $prefix?: string;
685
- /**
686
- * Match if type of item equals condition.
687
- */
688
691
  $type?: string;
689
- /**
690
- * Check key existence.
691
- */
692
692
  $exists?: boolean;
693
- /**
694
- * Match if item contains every condition or every rule in the condition array.
695
- **/
696
693
  $contains?: Array<string | number | boolean> | string | number | boolean;
697
- /**
698
- * Match if item contains at least one rule from the condition array.
699
- */
700
694
  $containsAny?: Array<string | number | boolean>;
701
- /**
702
- * Ignore case when checking string containment.
703
- **/
704
695
  $icontains?: string;
705
- /**
706
- * Match if item is in condition array.
707
- **/
708
696
  $in?: Array<string | number | boolean>;
709
697
  [key: string]: string | number | boolean | RegExp | ContentQueryBuilderWhere | Array<string | number | boolean | ContentQueryBuilderWhere> | undefined;
710
698
  }
711
- /**
712
- * @internal
713
- */
714
699
  interface ContentQueryBuilderParams {
715
700
  collection?: string;
716
701
  first?: boolean;
@@ -746,284 +731,135 @@ type CollectionQueryOperator<T> = '=' | '!=' | 'EXISTS' | 'TYPE' | (ComparableVa
746
731
  type CollectionQueryValue<T, O extends CollectionQueryOperator<T>> = O extends '=' | '!=' ? EqualityValue<T> : O extends '>' | '>=' | '<' | '<=' ? ComparableValue<T> : O extends 'IN' | 'NOT IN' ? MembershipValue<T> : O extends 'CONTAINS' ? ContainsValue<T> : O extends 'CONTAINS_ANY' ? ContainsAnyValue<T> : O extends 'REGEX' ? RegexValue<T> : O extends 'ICONTAINS' ? IContainsValue<T> : O extends 'EXISTS' ? boolean | undefined : O extends 'TYPE' ? TypeValue : never;
747
732
  type QueryOrderDirection = 'ASC' | 'DESC';
748
733
  interface QueryOrderOptions {
749
- /**
750
- * BCP 47 locale passed to `Intl.Collator` for string ordering.
751
- */
752
734
  locale?: string;
753
- /**
754
- * Enable numeric ordering so `"2"` sorts before `"10"`.
755
- */
756
735
  numeric?: boolean;
757
- /**
758
- * Control whether upper- or lower-case letters sort first.
759
- */
760
736
  caseFirst?: ContentQuerySortParams['$caseFirst'];
761
- /**
762
- * Collation sensitivity used by string comparison.
763
- */
764
737
  sensitivity?: ContentQuerySortParams['$sensitivity'];
765
738
  }
766
- /**
767
- * Builder passed to grouped `andWhere` / `orWhere` callbacks.
768
- */
769
739
  interface QueryGroupBuilder<T = ParsedContentMeta> {
770
740
  where<K extends CollectionQueryField<T>, O extends CollectionQueryOperator<CollectionQueryFieldValue<T, K>>>(field: K, operator: O, value?: CollectionQueryValue<CollectionQueryFieldValue<T, K>, O>): QueryGroupBuilder<T>;
771
741
  andWhere(groupFactory: QueryGroupFunction<T>): QueryGroupBuilder<T>;
772
742
  orWhere(groupFactory: QueryGroupFunction<T>): QueryGroupBuilder<T>;
773
743
  }
774
- /**
775
- * Factory used to build grouped nested conditions.
776
- */
777
744
  type QueryGroupFunction<T = ParsedContentMeta> = (group: QueryGroupBuilder<T>) => QueryGroupBuilder<T>;
778
- /**
779
- * Options for locale-aware navigation queries.
780
- */
745
+ interface ContentQueryBuilder<T = ParsedContentMeta> {
746
+ where<K extends CollectionQueryField<T>, O extends CollectionQueryOperator<CollectionQueryFieldValue<T, K>>>(field: K, operator: O, value?: CollectionQueryValue<CollectionQueryFieldValue<T, K>, O>): ContentQueryBuilder<T>;
747
+ andWhere(groupFactory: QueryGroupFunction<T>): ContentQueryBuilder<T>;
748
+ orWhere(groupFactory: QueryGroupFunction<T>): ContentQueryBuilder<T>;
749
+ select<const K extends readonly Extract<keyof T, string>[]>(...fields: K): ContentQueryBuilder<Pick<T, K[number]>>;
750
+ order<K extends CollectionQueryField<T>>(field: K, direction: QueryOrderDirection, options?: QueryOrderOptions): ContentQueryBuilder<T>;
751
+ limit(count: number): ContentQueryBuilder<T>;
752
+ skip(count: number): ContentQueryBuilder<T>;
753
+ params: () => ContentQueryBuilderParams;
754
+ locale(locale: string, options?: {
755
+ fallback?: boolean | string[];
756
+ }): ContentQueryBuilder<T>;
757
+ all(): Promise<Array<T>>;
758
+ first(): Promise<T | undefined>;
759
+ count(): Promise<number>;
760
+ }
761
+ interface CollectionQueryBuilder<T = ParsedContentMeta> extends ContentQueryBuilder<T> {
762
+ select<const K extends readonly Extract<keyof T, string>[]>(...fields: K): CollectionQueryBuilder<Pick<T, K[number]>>;
763
+ }
764
+ interface ContentQueryRequest {
765
+ params(): ContentQueryBuilderParams;
766
+ }
767
+ type ContentQueryFetcher<T> = (query: ContentQueryRequest) => Promise<ContentQueryResponse<T>>;
768
+ type QueryMatchOperator = (item: unknown, condition: unknown) => boolean;
769
+
770
+ declare global {
771
+ interface GinkoContentCollectionMap {
772
+ }
773
+ interface GinkoContentCollectionI18nMap {
774
+ }
775
+ }
776
+ interface ContentCollectionMap extends GinkoContentCollectionMap {
777
+ }
778
+ interface ContentCollectionI18nMap extends GinkoContentCollectionI18nMap {
779
+ }
780
+ type ContentCollectionName = keyof GinkoContentCollectionMap & string;
781
+ type ContentCollectionItem<K extends ContentCollectionName> = ContentCollectionMap[K];
782
+ type ContentCollectionStringName = [ContentCollectionName] extends [never] ? string : ContentCollectionName;
783
+ type ContentCollectionTarget = ContentCollectionHandle | ContentCollectionStringName;
784
+
781
785
  interface ContentCollectionNavigationOptions<TField extends string = string> {
782
- /**
783
- * Extra document fields to merge onto each returned navigation item.
784
- */
785
786
  fields?: TField[];
786
- /**
787
- * Locale to resolve against for translated collections.
788
- */
789
787
  locale?: string;
790
- /**
791
- * When `true`, keep canonical paths instead of locale-prefixed paths.
792
- */
793
788
  canonical?: boolean;
794
789
  }
795
- /**
796
- * Options for previous/next navigation helpers.
797
- */
798
790
  type ContentCollectionItemSurroundingsOptions<TField extends string = string> = ContentCollectionNavigationOptions<TField>;
799
- /**
800
- * Options for extracting searchable sections from collection pages.
801
- */
802
791
  interface ContentCollectionSearchSectionsOptions {
803
- /**
804
- * Tags ignored while flattening page content into search text.
805
- */
806
792
  ignoredTags?: string[];
807
- /**
808
- * Extra top-level fields copied from each page onto every emitted section.
809
- */
810
793
  extraFields?: string[];
811
- /**
812
- * Query predicate applied before extracting searchable sections.
813
- */
814
794
  filterQuery?: ContentQueryBuilderWhere;
815
- /**
816
- * Lowest heading level that starts a new section.
817
- */
818
795
  minHeading?: `h${1 | 2 | 3 | 4 | 5 | 6}`;
819
- /**
820
- * Highest heading level that starts a new section.
821
- */
822
796
  maxHeading?: `h${1 | 2 | 3 | 4 | 5 | 6}`;
823
- /**
824
- * Locale to resolve against for translated collections.
825
- */
826
797
  locale?: string;
827
- /**
828
- * When `true`, keep canonical paths instead of locale-prefixed paths.
829
- */
830
798
  canonical?: boolean;
831
799
  }
832
- /**
833
- * Options for locale-aware page resolution.
834
- */
835
800
  interface ContentCollectionPageOptions {
836
- /**
837
- * Preferred locale to resolve.
838
- */
839
801
  locale?: string;
840
- /**
841
- * Enable or customize locale fallback resolution.
842
- *
843
- * Pass `true` to use configured fallbacks, or an explicit locale list to
844
- * override the configured chain for this query.
845
- */
846
802
  fallback?: string[] | boolean;
847
- /**
848
- * When `true`, keep canonical paths in the returned route metadata.
849
- */
803
+ exact?: boolean;
850
804
  canonical?: boolean;
851
805
  }
852
- /**
853
- * Options for route metadata resolution without loading full page content.
854
- */
855
806
  interface ContentCollectionRouteMetaOptions {
856
- /**
857
- * Preferred locale to resolve.
858
- */
859
807
  locale?: string;
860
- /**
861
- * Enable or customize locale fallback resolution.
862
- */
863
808
  fallback?: string[] | boolean;
809
+ exact?: boolean;
864
810
  }
865
- /**
866
- * Options for resolving an authored reference value into a document.
867
- */
868
811
  interface ResolveContentReferenceOptions {
869
- /**
870
- * Preferred locale to resolve.
871
- */
872
812
  locale?: string;
873
- /**
874
- * Enable or customize locale fallback resolution.
875
- */
876
813
  fallback?: string[] | boolean;
877
- /**
878
- * When `true`, require an exact locale match and skip fallback lookup.
879
- */
880
814
  exact?: boolean;
881
- /**
882
- * Restrict resolution to a single collection.
883
- */
884
815
  collection?: string;
885
816
  }
886
- /**
887
- * Locale variant entry returned by the internal locale-variant endpoint.
888
- */
889
817
  interface ContentLocaleEntry {
890
- /**
891
- * Stable locale-agnostic identity shared by every translated variant.
892
- */
893
818
  canonicalKey: string;
894
- /**
895
- * Locale code for the matching variant.
896
- */
897
819
  locale: string;
898
- /**
899
- * Resolved route path for the variant, when the variant is routable.
900
- */
901
820
  path?: string;
902
821
  }
903
- /**
904
- * Route metadata for a single locale variant of a page.
905
- */
906
822
  interface ContentLocaleRoute {
907
823
  locale: string;
908
824
  path: string;
909
825
  canonicalPath: string;
910
826
  }
911
- /**
912
- * One entry in the per-locale path map attached to a localized document.
913
- *
914
- * `translated` is `true` when a concrete variant exists in that locale, `false`
915
- * when the resolver fell back to another locale's path. `fallback` names the
916
- * locale that supplied the path when `translated` is false.
917
- */
918
827
  interface LocalePathEntry {
919
- /**
920
- * Locale-prefixed route path (the URL the user navigates to).
921
- */
922
828
  path: string;
923
- /**
924
- * `true` when this locale has its own variant; `false` when the path was
925
- * supplied by a fallback locale.
926
- */
927
829
  translated: boolean;
928
- /**
929
- * Locale that backed this entry when `translated` is `false`.
930
- */
931
830
  fallback?: string;
932
831
  }
933
- /**
934
- * Public resolution metadata attached to localized content results.
935
- *
936
- * Internal `_requestedLocale`, `_resolvedLocale`, and `_fallback` fields remain
937
- * storage/query implementation details. UI code should read this object.
938
- */
939
832
  interface ContentResolvedMeta {
940
- /**
941
- * Locale of the concrete content variant that backed this result.
942
- */
943
833
  locale: string;
944
- /**
945
- * Locale requested by the caller, when locale resolution was part of the
946
- * query.
947
- */
948
834
  requestedLocale?: string;
949
- /**
950
- * `true` when the concrete content variant came from a different locale than
951
- * the requested locale.
952
- */
953
835
  fallback: boolean;
954
- /**
955
- * Locale that supplied the content when `fallback` is true.
956
- */
957
836
  fallbackLocale?: string;
958
- /**
959
- * Public route path returned to the user.
960
- */
961
837
  path: string;
962
- /**
963
- * Requested route path before locale fallback, when known.
964
- */
965
838
  requestedPath?: string;
966
- /**
967
- * Requested public route before locale fallback, when known.
968
- */
969
839
  requestedRoute?: string;
970
- /**
971
- * Requested authored ref before locale fallback, when known.
972
- */
973
840
  requestedRef?: string;
974
- /**
975
- * Locales that have concrete variants for this content identity.
976
- */
977
841
  availableLocales: string[];
978
842
  }
979
- /**
980
- * Locale-aware routing metadata attached to route-backed page payloads.
981
- */
982
843
  interface ContentRouteMeta {
983
844
  locale: string;
984
845
  defaultLocale: string;
985
846
  path: string;
986
847
  canonicalPath: string;
987
848
  variants: ContentLocaleRoute[];
988
- /**
989
- * Map of every configured locale to its localized path. Includes a
990
- * `translated` flag and a `fallback` source when a locale has no variant.
991
- */
992
849
  localePaths: Record<string, LocalePathEntry>;
993
- /**
994
- * Public explanation of the locale/path resolution used for this result.
995
- */
996
850
  resolved: ContentResolvedMeta;
997
851
  }
998
- /**
999
- * Full page payload returned by route-aware unified query helpers and internal route helpers.
1000
- */
1001
852
  type ContentPageResult<T = ParsedContentMeta> = T & ContentRouteMeta & {
1002
- /**
1003
- * Locale-agnostic path stem derived from the source file.
1004
- */
1005
853
  stem: string;
1006
- /**
1007
- * Source file extension when it can be inferred.
1008
- */
1009
854
  extension?: string;
1010
855
  };
1011
- /**
1012
- * Alternate locale entry used in sitemap output.
1013
- */
1014
856
  interface ContentSitemapAlternative {
1015
857
  hreflang: string;
1016
858
  href: string;
1017
859
  }
1018
- /**
1019
- * Sitemap image entry discovered from page content or metadata.
1020
- */
1021
860
  interface ContentSitemapImage {
1022
861
  loc: string;
1023
862
  }
1024
- /**
1025
- * Sitemap entry produced by `queryCollectionsSitemapEntries`.
1026
- */
1027
863
  interface ContentSitemapEntry {
1028
864
  loc: string;
1029
865
  _sitemap?: string;
@@ -1031,132 +867,15 @@ interface ContentSitemapEntry {
1031
867
  alternatives?: ContentSitemapAlternative[];
1032
868
  images?: ContentSitemapImage[];
1033
869
  }
1034
- /**
1035
- * Searchable document section produced by the internal search-section builder.
1036
- */
1037
870
  interface ContentSearchSection {
1038
- /**
1039
- * Stable section id, usually the page path or path plus anchor hash.
1040
- */
1041
871
  id: string;
1042
- /**
1043
- * Heading or page title for the section.
1044
- */
1045
872
  title: string;
1046
- /**
1047
- * Ancestor heading trail leading to this section.
1048
- */
1049
873
  titles: string[];
1050
- /**
1051
- * Heading depth that opened the section.
1052
- */
1053
874
  level: number;
1054
- /**
1055
- * Flattened text content used by the search index.
1056
- */
1057
875
  content: string;
1058
876
  [key: string]: unknown;
1059
877
  }
1060
- interface ContentQueryBuilder<T = ParsedContentMeta> {
1061
- /**
1062
- * Filter results with an explicit field/operator/value clause.
1063
- */
1064
- where<K extends CollectionQueryField<T>, O extends CollectionQueryOperator<CollectionQueryFieldValue<T, K>>>(field: K, operator: O, value?: CollectionQueryValue<CollectionQueryFieldValue<T, K>, O>): ContentQueryBuilder<T>;
1065
- /**
1066
- * Add a grouped AND clause.
1067
- */
1068
- andWhere(groupFactory: QueryGroupFunction<T>): ContentQueryBuilder<T>;
1069
- /**
1070
- * Add a grouped OR clause.
1071
- */
1072
- orWhere(groupFactory: QueryGroupFunction<T>): ContentQueryBuilder<T>;
1073
- /**
1074
- * Select a subset of fields.
1075
- */
1076
- select<const K extends readonly Extract<keyof T, string>[]>(...fields: K): ContentQueryBuilder<Pick<T, K[number]>>;
1077
- /**
1078
- * Order the result set by a field.
1079
- */
1080
- order<K extends CollectionQueryField<T>>(field: K, direction: QueryOrderDirection, options?: QueryOrderOptions): ContentQueryBuilder<T>;
1081
- /**
1082
- * Limit number of results.
1083
- */
1084
- limit(count: number): ContentQueryBuilder<T>;
1085
- /**
1086
- * Skip number of results.
1087
- */
1088
- skip(count: number): ContentQueryBuilder<T>;
1089
- /**
1090
- * Retrieve query builder params.
1091
- * @internal
1092
- */
1093
- params: () => ContentQueryBuilderParams;
1094
- /**
1095
- * Filter contents based on locale.
1096
- */
1097
- locale(locale: string, options?: {
1098
- fallback?: boolean | string[];
1099
- }): ContentQueryBuilder<T>;
1100
- /**
1101
- * Fetch list of contents.
1102
- */
1103
- all(): Promise<Array<T>>;
1104
- /**
1105
- * Fetch the first matched content.
1106
- */
1107
- first(): Promise<T | undefined>;
1108
- /**
1109
- * Count matched contents.
1110
- */
1111
- count(): Promise<number>;
1112
- }
1113
- interface CollectionQueryBuilder<T = ParsedContentMeta> extends ContentQueryBuilder<T> {
1114
- select<const K extends readonly Extract<keyof T, string>[]>(...fields: K): CollectionQueryBuilder<Pick<T, K[number]>>;
1115
- }
1116
- /**
1117
- * Minimal request shape consumed by the query transport.
1118
- */
1119
- interface ContentQueryRequest {
1120
- params(): ContentQueryBuilderParams;
1121
- }
1122
- /**
1123
- * Internal transport used by the immutable query builder.
1124
- */
1125
- type ContentQueryFetcher<T> = (query: ContentQueryRequest) => Promise<ContentQueryResponse<T>>;
1126
- type QueryMatchOperator = (item: unknown, condition: unknown) => boolean;
1127
- declare global {
1128
- interface GinkoContentCollectionMap {
1129
- }
1130
- interface GinkoContentCollectionI18nMap {
1131
- }
1132
- }
1133
- interface ContentCollectionMap extends GinkoContentCollectionMap {
1134
- }
1135
- interface ContentCollectionI18nMap extends GinkoContentCollectionI18nMap {
1136
- }
1137
- type ContentCollectionName = keyof GinkoContentCollectionMap & string;
1138
- type ContentCollectionItem<K extends ContentCollectionName> = ContentCollectionMap[K];
1139
- type ContentCollectionStringName = [ContentCollectionName] extends [never] ? string : ContentCollectionName;
1140
- type ContentCollectionTarget = ContentCollectionHandle | ContentCollectionStringName;
1141
- /**
1142
- * ============================================================================
1143
- * Unified Query API — public surface (ADR-0016)
1144
- * ============================================================================
1145
- *
1146
- * The types below back the unified query API exposed via `one`, `many`,
1147
- * `resolveOne`, `variants`, `tree`, `neighbors` and their `useContent*`
1148
- * composable mirrors. The public vocabulary is deliberately split:
1149
- *
1150
- * - `by` identifies exactly one document by route path or authored ref.
1151
- * - `where` filters a result set by document fields.
1152
- * - `resolveOne` returns diagnostics; `one` is the ergonomic doc-only view.
1153
- */
1154
- /**
1155
- * MongoDB-style operator object applied to a single field. Mirrors the subset
1156
- * of `ContentQueryBuilderWhere` operators that are safe for public use.
1157
- *
1158
- * @template TValue Concrete field value type (used to narrow operator operands).
1159
- */
878
+
1160
879
  interface QueryOperators<TValue = unknown> {
1161
880
  $eq?: TValue;
1162
881
  $ne?: TValue;
@@ -1174,11 +893,6 @@ interface QueryOperators<TValue = unknown> {
1174
893
  $prefix?: TValue extends string ? string : never;
1175
894
  $not?: TValue | QueryOperators<TValue>;
1176
895
  }
1177
- /**
1178
- * Identify exactly one document. `path` is stored content `_path`, `route` is
1179
- * public app URL, and `ref` is authored stable identity. They are mutually
1180
- * exclusive at the type level.
1181
- */
1182
896
  type ContentSelector = {
1183
897
  path: string;
1184
898
  route?: never;
@@ -1194,10 +908,6 @@ type ContentSelector = {
1194
908
  };
1195
909
  type WhereValue<T> = T | QueryOperators<T>;
1196
910
  type PathWhere = string | QueryOperators<string>;
1197
- /**
1198
- * MongoDB-style filter object generic on the document shape. `where.path` is a
1199
- * documented route-path filter and compiles to the internal `_path` field.
1200
- */
1201
911
  type QueryWhere<T = ParsedContentMeta> = {
1202
912
  path?: PathWhere;
1203
913
  $and?: QueryWhere<T>[];
@@ -1206,42 +916,23 @@ type QueryWhere<T = ParsedContentMeta> = {
1206
916
  } & {
1207
917
  [K in Exclude<keyof T, 'path'>]?: WhereValue<NonNullable<T[K]>>;
1208
918
  };
1209
- /**
1210
- * Sort spec: `asc` / `desc` are preferred; `1` / `-1` remain accepted because
1211
- * they map directly to the transport shape.
1212
- */
1213
919
  type SortDirection = 'asc' | 'desc' | 1 | -1;
1214
920
  type SortSpec<T = ParsedContentMeta> = string extends keyof T ? {
1215
921
  [key: string]: SortDirection | undefined;
1216
922
  } : {
1217
923
  [K in keyof T]?: SortDirection;
1218
924
  };
1219
- /**
1220
- * Schema of a collection handle (recovered from its `__schema` phantom).
1221
- *
1222
- * Uses `StrictParsedContentMeta` (no `[key: string]: unknown` index signature)
1223
- * as the base so `keyof HandleSchema<H>` is a finite union of the user's
1224
- * declared schema fields plus the internal `_*` meta fields. This is what
1225
- * makes `QueryWhere<HandleSchema<H>>` reject typo'd field names at compile time.
1226
- */
1227
925
  type HandleSchema<H> = H extends {
1228
926
  __schema: infer S;
1229
927
  } ? S extends {
1230
928
  _output: infer O;
1231
929
  } ? O & StrictParsedContentMeta : StrictParsedContentMeta : H extends ContentCollectionName ? ContentCollectionMap[H] & StrictParsedContentMeta : StrictParsedContentMeta;
1232
930
  type SelectFields<H> = string extends H ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof HandleSchema<H>, string>>;
1233
- /**
1234
- * Runtime document shape inferred from a collection handle.
1235
- */
1236
931
  type DocumentFromHandle<H> = H extends {
1237
932
  __schema: {
1238
933
  _output: infer O;
1239
934
  };
1240
935
  } ? O & StrictParsedContent : H extends ContentCollectionName ? ContentCollectionMap[H] : ParsedContent;
1241
- /**
1242
- * Explicit reference population map. Keys are fields on the source document;
1243
- * values are target collection handles.
1244
- */
1245
936
  type PopulateSpec = Record<string, ContentCollectionTarget>;
1246
937
  type PopulatedDocument<T, P> = P extends undefined ? T : P extends PopulateSpec ? string extends keyof P ? T : Omit<T, keyof P> & {
1247
938
  [K in keyof P & keyof T]: T[K] extends ReadonlyArray<unknown> ? Array<LocalizedDoc<DocumentFromHandle<P[K]>>> : LocalizedDoc<DocumentFromHandle<P[K]>> | null;
@@ -1252,15 +943,9 @@ type PopulateFromOptions<O> = O extends {
1252
943
  type PopulateOption<P extends PopulateSpec | undefined = undefined> = {
1253
944
  populate?: P;
1254
945
  };
1255
- /**
1256
- * Whether a collection handle declares i18n at the type level.
1257
- */
1258
946
  type HandleIsI18n<H> = H extends {
1259
947
  __i18n: infer I;
1260
- } ? I extends true ? true : false : H extends keyof GinkoContentCollectionI18nMap ? true : false;
1261
- /**
1262
- * Locale option made required when the handle is i18n.
1263
- */
948
+ } ? I extends true ? true : false : H extends keyof ContentCollectionI18nMap ? true : false;
1264
949
  type LocaleOption<H, OptKey extends string = 'locale'> = HandleIsI18n<H> extends true ? {
1265
950
  [K in OptKey]: string;
1266
951
  } : {
@@ -1275,24 +960,15 @@ type BacklinksLocaleOption<Target, Source> = HandleIsI18n<Target> extends true ?
1275
960
  locale?: string;
1276
961
  };
1277
962
  type LocaleFallback = false | true | 'default' | string | string[];
1278
- /**
1279
- * Document shape returned from `one`, `many` and `resolveOne`. Every doc carries the
1280
- * route metadata (`path`, `localePaths`, `locale`, ...) the route resolver
1281
- * already produces, so locale switching needs no extra round trip.
1282
- */
1283
- type LocalizedDoc<T = ParsedContentMeta> = T & ContentRouteMeta & {
1284
- /**
1285
- * Locale-agnostic path stem derived from the source file.
1286
- */
963
+ type LocalizedContentDocument<T = ParsedContentMeta> = T & ContentRouteMeta & {
964
+ locale: string;
965
+ path: string;
966
+ canonicalPath: string;
967
+ localePaths: Record<string, LocalePathEntry>;
1287
968
  stem?: string;
1288
- /**
1289
- * Source file extension when it can be inferred.
1290
- */
1291
969
  extension?: string;
1292
970
  };
1293
- /**
1294
- * Explain how `resolveOne` interpreted the request and what it matched.
1295
- */
971
+ type LocalizedDoc<T = ParsedContentMeta> = LocalizedContentDocument<T>;
1296
972
  interface ResolutionEnvelope {
1297
973
  requested: {
1298
974
  collection: string;
@@ -1316,25 +992,16 @@ interface ResolutionEnvelope {
1316
992
  locale?: string;
1317
993
  };
1318
994
  }
1319
- /**
1320
- * Result returned by `resolveOne`.
1321
- */
1322
995
  interface ResolveOneResult<T = ParsedContentMeta> {
1323
996
  doc: LocalizedDoc<T> | null;
1324
997
  explain: ResolutionEnvelope;
1325
998
  }
1326
- /**
1327
- * Options accepted by `resolveOne(handle, options)` and `one(handle, options)`.
1328
- */
1329
999
  type ResolveOneOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = {
1330
1000
  by: ContentSelector;
1331
1001
  fallback?: LocaleFallback;
1332
1002
  select?: SelectFields<H>;
1333
1003
  } & LocaleOption<H> & PopulateOption<P>;
1334
1004
  type OneOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = ResolveOneOptions<H, P>;
1335
- /**
1336
- * Options accepted by `many(handle, options)`.
1337
- */
1338
1005
  type ManyOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = {
1339
1006
  where?: QueryWhere<HandleSchema<H>>;
1340
1007
  sort?: SortSpec<HandleSchema<H>>;
@@ -1343,26 +1010,10 @@ type ManyOptions<H = unknown, P extends PopulateSpec | undefined = undefined> =
1343
1010
  fallback?: LocaleFallback;
1344
1011
  select?: SelectFields<H>;
1345
1012
  } & LocaleOption<H> & PopulateOption<P>;
1346
- /**
1347
- * Options accepted by `paginate(handle, options)`.
1348
- */
1349
1013
  type PaginationOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = Omit<ManyOptions<H, P>, 'skip' | 'limit'> & {
1350
- /**
1351
- * One-based page number.
1352
- *
1353
- * @default 1
1354
- */
1355
1014
  page?: number;
1356
- /**
1357
- * Number of documents per page.
1358
- *
1359
- * @default 10
1360
- */
1361
1015
  limit?: number;
1362
1016
  };
1363
- /**
1364
- * Result returned by `paginate()` and `useContentPagination()`.
1365
- */
1366
1017
  interface PaginationResult<T = ParsedContentMeta> {
1367
1018
  data: Array<LocalizedDoc<T>>;
1368
1019
  page: number;
@@ -1380,22 +1031,9 @@ type SourceName<S> = S extends string ? S : S extends {
1380
1031
  } ? Extract<N, string> : string;
1381
1032
  type BacklinkFields<S = BacklinkSource | ReadonlyArray<BacklinkSource>> = ReadonlyArray<string> | Partial<Record<SourceName<S extends ReadonlyArray<infer I> ? I : S>, ReadonlyArray<string>>>;
1382
1033
  type DocumentFromSource<S> = S extends ReadonlyArray<infer I> ? DocumentFromHandle<I> : DocumentFromHandle<S>;
1383
- /**
1384
- * Options accepted by `backlinks(targetHandle, options)`.
1385
- */
1386
1034
  type BacklinksOptions<Target = unknown, Source extends BacklinkSource | ReadonlyArray<BacklinkSource> = BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined> = {
1387
- /**
1388
- * Target document to find incoming references for.
1389
- */
1390
1035
  by: ContentSelector;
1391
- /**
1392
- * Source collection handle(s) to scan for references.
1393
- */
1394
1036
  from: Source;
1395
- /**
1396
- * Explicit reference fields on the source collection(s). When omitted,
1397
- * fields are inferred from source handles that use `reference()`.
1398
- */
1399
1037
  fields?: BacklinkFields<Source>;
1400
1038
  sort?: SortSpec<DocumentFromSource<Source>>;
1401
1039
  limit?: number;
@@ -1404,38 +1042,23 @@ type BacklinksOptions<Target = unknown, Source extends BacklinkSource | Readonly
1404
1042
  select?: string extends Source ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof DocumentFromSource<Source>, string>>;
1405
1043
  } & BacklinksLocaleOption<Target, Source> & PopulateOption<P>;
1406
1044
  type BacklinksResult<Source extends BacklinkSource | ReadonlyArray<BacklinkSource> = BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined> = Array<LocalizedDoc<PopulatedDocument<DocumentFromSource<Source>, P>>>;
1407
- /**
1408
- * Options accepted by `variants(handle, options)`.
1409
- */
1410
1045
  type VariantsOptions<H = unknown> = {
1411
1046
  by: ContentSelector;
1412
- /**
1413
- * Restrict to a subset of locales. Defaults to all configured locales.
1414
- */
1415
1047
  locales?: string[];
1416
1048
  } & LocaleOption<H>;
1417
- /**
1418
- * Variant entry returned by `variants()` and `useContentVariants()`.
1419
- */
1420
1049
  interface ContentVariant<_T = ParsedContentMeta> {
1421
1050
  locale: string;
1422
1051
  path: string;
1423
1052
  translated: boolean;
1424
1053
  fallback?: string;
1425
1054
  }
1426
- /**
1427
- * Options accepted by `tree(handle, options)`.
1428
- */
1429
1055
  type TreeOptions<H = unknown, Fields extends ReadonlyArray<keyof HandleSchema<H> | string> | undefined = undefined> = {
1430
1056
  where?: QueryWhere<HandleSchema<H>>;
1431
1057
  sort?: SortSpec<HandleSchema<H>>;
1432
1058
  fields?: Fields;
1433
1059
  fallback?: LocaleFallback;
1434
- } & LocaleOption<H>;
1435
- /**
1436
- * Typed navigation item. Requested `fields` are preserved in the return type
1437
- * without keeping the old open index signature.
1438
- */
1060
+ locale?: string;
1061
+ };
1439
1062
  type ContentTreeItem<T = ParsedContentMeta, Fields extends ReadonlyArray<keyof T | string> | undefined = undefined> = {
1440
1063
  title: string;
1441
1064
  path: string;
@@ -1443,20 +1066,11 @@ type ContentTreeItem<T = ParsedContentMeta, Fields extends ReadonlyArray<keyof T
1443
1066
  children?: Array<ContentTreeItem<T, Fields>>;
1444
1067
  } & (Fields extends ReadonlyArray<infer K> ? Pick<T, Extract<K, keyof T>> : Record<never, never>);
1445
1068
 
1446
- /**
1447
- * Options accepted by `neighbors(handle, options)`.
1448
- *
1449
- * Identifying the anchor document lives in `filter`, same as every other
1450
- * verb. Only the reserved selectors `path` and `ref` are accepted.
1451
- */
1452
1069
  type NeighborsOptions<H = unknown> = {
1453
1070
  by: ContentSelector;
1454
1071
  fallback?: LocaleFallback;
1455
1072
  fields?: SelectFields<H>;
1456
1073
  } & LocaleOption<H>;
1457
- /**
1458
- * Result of `neighbors()` and `useContentNeighbors()`.
1459
- */
1460
1074
  interface NeighborsResult<T = ParsedContentMeta> {
1461
1075
  prev: ContentTreeItem<T> | null;
1462
1076
  next: ContentTreeItem<T> | null;
@@ -1791,6 +1405,12 @@ interface ContentRevalidateOptions {
1791
1405
  */
1792
1406
  allowUnsigned?: boolean;
1793
1407
  }
1408
+ interface ContentAgentRouteOptions {
1409
+ routes?: boolean;
1410
+ linkHeaders?: boolean;
1411
+ markdownNegotiation?: boolean;
1412
+ prerender?: boolean;
1413
+ }
1794
1414
  interface ModuleOptions {
1795
1415
  api: {
1796
1416
  /**
@@ -1834,6 +1454,10 @@ interface ModuleOptions {
1834
1454
  * `x-ginko-revalidate-token` or `authorization: Bearer <token>`.
1835
1455
  */
1836
1456
  revalidate?: false | ContentRevalidateOptions;
1457
+ /**
1458
+ * First-class agent markdown and LLM route features.
1459
+ */
1460
+ agent?: false | ContentAgentRouteOptions;
1837
1461
  /**
1838
1462
  * Optional server-side cache adapter module.
1839
1463
  *
@@ -1847,9 +1471,7 @@ interface ModuleOptions {
1847
1471
  *
1848
1472
  * @default true
1849
1473
  */
1850
- watch: false | {
1851
- ws: Partial<ListenOptions>;
1852
- };
1474
+ watch: boolean;
1853
1475
  /**
1854
1476
  * Contents can be located in multiple places, in multiple directories or even in remote git repositories.
1855
1477
  * Using sources option you can tell Content module where to look for contents.
@@ -1985,6 +1607,9 @@ interface ContentContext extends ModuleOptions {
1985
1607
  translatedSlugs: boolean;
1986
1608
  strictTranslatedSlugs: boolean;
1987
1609
  }
1610
+ type ResolvedContentContext = Omit<ContentContext, 'markdown'> & {
1611
+ markdown: MarkdownOptions;
1612
+ };
1988
1613
 
1989
1614
  interface ContentCacheArtifact<T = ParsedContent> {
1990
1615
  parsed: T;
@@ -2013,7 +1638,7 @@ interface ParseContentOptions {
2013
1638
  validate?: boolean;
2014
1639
  csv?: ModuleOptions['csv'];
2015
1640
  yaml?: ModuleOptions['yaml'];
2016
- markdown?: ModuleOptions['markdown'];
1641
+ markdown?: ModuleOptions['markdown'] | MarkdownOptions;
2017
1642
  transformers?: ContentTransformer[];
2018
1643
  pathMeta?: {
2019
1644
  locales?: ContentContext['locales'];
@@ -2029,12 +1654,6 @@ type TransformContentSource = string | StorageValue;
2029
1654
 
2030
1655
  declare function createSearchRuntimeConfig(search: Exclude<ModuleOptions$1['search'], false>, apiBaseURL: string): ContentSearchPublicRuntimeConfig$1;
2031
1656
 
2032
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions$1, ModuleOptions$1, false>;
2033
-
2034
- interface ModuleHooks {
2035
- 'content:providers'(providers: Record<string, string>): void | Promise<void>;
2036
- 'content:context'(ctx: ContentContext$1): void | Promise<void>;
2037
- }
2038
1657
  interface ModulePublicRuntimeConfig {
2039
1658
  experimental: {
2040
1659
  stripQueryParameters: boolean;
@@ -2065,7 +1684,6 @@ interface ModulePublicRuntimeConfig {
2065
1684
  translatedSlugs: ContentContext$1['translatedSlugs'];
2066
1685
  strictTranslatedSlugs: ContentContext$1['strictTranslatedSlugs'];
2067
1686
  markdown: MarkdownOptions$1;
2068
- wsUrl?: string;
2069
1687
  navigation: ModuleOptions$1['navigation'];
2070
1688
  search: ReturnType<typeof createSearchRuntimeConfig> | false;
2071
1689
  contentHead: ModuleOptions$1['contentHead'];
@@ -2100,5 +1718,12 @@ declare module 'nitropack' {
2100
1718
  }
2101
1719
  }
2102
1720
 
1721
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions$1, ModuleOptions$1, false>;
1722
+
1723
+ interface ModuleHooks {
1724
+ 'content:providers'(providers: Record<string, string>): void | Promise<void>;
1725
+ 'content:context'(ctx: ContentContext$1): void | Promise<void>;
1726
+ }
1727
+
2103
1728
  export { _default as default, normalizeContentConfigCollectionNames };
2104
- export type { BacklinkFields, BacklinkSource, BacklinksOptions, BacklinksResult, CollectionQueryBuilder, CollectionQueryOperator, CollectionQueryValue, CollectionSchema, ContentCacheArtifact, ContentCmsCollectionConfig, ContentCmsFieldConfig, ContentCmsFieldType, ContentCmsRelationConfig, ContentCollectionConfig, ContentCollectionHandle, ContentCollectionI18nConfig, ContentCollectionI18nMap, ContentCollectionItem, ContentCollectionItemSurroundingsOptions, ContentCollectionKind, ContentCollectionMap, ContentCollectionName, ContentCollectionNavigationOptions, ContentCollectionPageOptions, ContentCollectionRouteConfig, ContentCollectionRouteMetaOptions, ContentCollectionSearchSectionsOptions, ContentCollectionSource, ContentCollectionSourceObject, ContentCollectionStringName, ContentCollectionTarget, ContentConfig, ContentContext, ContentI18nOptions, ContentLocaleEntry, ContentLocaleRoute, ContentManifest, ContentMiniSearchOptions, ContentNavigationItem, ContentPageResult, ContentPreviewOptions, ContentProviderName, ContentProviderSearchRequest, ContentQueryBuilder, ContentQueryBuilderParams, ContentQueryBuilderWhere, ContentQueryFetcher, ContentQueryRequest, ContentQuerySortFields, ContentQuerySortOptions, ContentQuerySortParams, ContentReferenceSchema, ContentResolvedMeta, ContentRevalidateOptions, ContentRouteMeta, ContentSearchEngine, ContentSearchIndexRecord, ContentSearchOptions, ContentSearchPublicRuntimeConfig, ContentSearchResult, ContentSearchSection, ContentSelector, ContentSeoImage, ContentSeoMeta, ContentSitemapAlternative, ContentSitemapAssertOptions, ContentSitemapAssertSitemapOptions, ContentSitemapEntry, ContentSitemapImage, ContentSitemapOptions, ContentTransformer, ContentTreeItem, ContentVariant, DefineCollectionObject, DefineCollectionOptions, DocumentFromHandle, LocaleFallback, LocalePathEntry, LocalizedDoc, ManifestVariant, ManyOptions, MarkdownNode, MarkdownOptions, MarkdownParsedContent, MarkdownPluginDescriptor, MarkdownPluginOptions, MarkdownRoot, ModuleHooks, ModuleOptions, MountOptions, NavItem, NeighborsOptions, NeighborsResult, OneOptions, PaginationOptions, PaginationResult, ParseContentOptions, ParsedContent, ParsedContentInternalMeta, ParsedContentMeta, PopulateFromOptions, PopulateSpec, PopulatedDocument, QueryGroupBuilder, QueryGroupFunction, QueryMatchOperator, QueryOperators, QueryOrderDirection, QueryOrderOptions, QueryWhere, ResolutionEnvelope, ResolveContentReferenceOptions, ResolveOneOptions, ResolveOneResult, ResolvedContentI18nOptions, ResolvedMarkdownPlugin, ResolvedVariant, SortDirection, SortSpec, StrictParsedContent, StrictParsedContentMeta, Toc, TocLink, TransformContentOptions, TransformContentSource, TreeOptions, VariantsOptions };
1729
+ export type { AgentMetadataField, AgentMetadataFieldList, BacklinkFields, BacklinkSource, BacklinksOptions, BacklinksResult, CollectionQueryBuilder, CollectionQueryField, CollectionQueryFieldValue, CollectionQueryKey, CollectionQueryOperator, CollectionQueryValue, CollectionSchema, ContentAgentAppPageConfig, ContentAgentAppPageContext, ContentAgentCollectionConfig, ContentAgentConfig, ContentAgentLocalizedValue, ContentAgentMarkdownMetadataConfig, ContentAgentMarkdownOptions, ContentAgentMarkdownPolicyConfig, ContentAgentRouteOptions, ContentAgentSectionConfig, ContentAgentSiteConfig, ContentCacheArtifact, ContentCmsCollectionConfig, ContentCmsFieldConfig, ContentCmsFieldType, ContentCmsRelationConfig, ContentCollectionConfig, ContentCollectionHandle, ContentCollectionI18nConfig, ContentCollectionI18nMap, ContentCollectionItem, ContentCollectionItemSurroundingsOptions, ContentCollectionKind, ContentCollectionMap, ContentCollectionName, ContentCollectionNavigationOptions, ContentCollectionPageOptions, ContentCollectionRouteConfig, ContentCollectionRouteMetaOptions, ContentCollectionSearchSectionsOptions, ContentCollectionSource, ContentCollectionSourceObject, ContentCollectionStringName, ContentCollectionTarget, ContentConfig, ContentContext, ContentI18nOptions, ContentLocaleEntry, ContentLocaleRoute, ContentManifest, ContentMiniSearchOptions, ContentNavigationItem, ContentPageResult, ContentPreviewOptions, ContentProviderName, ContentProviderSearchRequest, ContentQueryBuilder, ContentQueryBuilderParams, ContentQueryBuilderWhere, ContentQueryFetcher, ContentQueryRequest, ContentQuerySortFields, ContentQuerySortOptions, ContentQuerySortParams, ContentReferenceSchema, ContentResolvedMeta, ContentRevalidateOptions, ContentRouteMeta, ContentSearchEngine, ContentSearchIndexRecord, ContentSearchOptions, ContentSearchPublicRuntimeConfig, ContentSearchResult, ContentSearchSection, ContentSelector, ContentSeoImage, ContentSeoMeta, ContentSitemapAlternative, ContentSitemapAssertOptions, ContentSitemapAssertSitemapOptions, ContentSitemapEntry, ContentSitemapImage, ContentSitemapOptions, ContentTransformer, ContentTreeItem, ContentVariant, DefineCollectionObject, DefineCollectionOptions, DocumentFromHandle, LocaleFallback, LocalePathEntry, LocalizedContentDocument, LocalizedDoc, ManifestVariant, ManyOptions, MarkdownNode, MarkdownOptions, MarkdownParsedContent, MarkdownPluginDescriptor, MarkdownPluginOptions, MarkdownRoot, ModuleHooks, ModuleOptions, MountOptions, NavItem, NeighborsOptions, NeighborsResult, OneOptions, PaginationOptions, PaginationResult, ParseContentOptions, ParsedContent, ParsedContentInternalMeta, ParsedContentMeta, PopulateFromOptions, PopulateSpec, PopulatedDocument, QueryGroupBuilder, QueryGroupFunction, QueryMatchOperator, QueryOperators, QueryOrderDirection, QueryOrderOptions, QueryWhere, ResolutionEnvelope, ResolveContentReferenceOptions, ResolveOneOptions, ResolveOneResult, ResolvedContentContext, ResolvedContentI18nOptions, ResolvedMarkdownPlugin, ResolvedVariant, SortDirection, SortSpec, StrictParsedContent, StrictParsedContentMeta, Toc, TocLink, TransformContentOptions, TransformContentSource, TreeOptions, VariantsOptions };