@lupinum/ginko-content 0.1.1 → 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.
- package/README.md +34 -4
- package/compatibility.json +2 -2
- package/dist/cli.mjs +373 -278
- package/dist/cms-import/index.js +5 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/core/cache-hints.d.ts +9 -1
- package/dist/core/content/collection.js +1 -1
- package/dist/core/content/path.js +1 -1
- package/dist/core/errors.js +5 -1
- package/dist/core/provider-errors +1 -0
- package/dist/core/provider-errors.d.ts +10 -0
- package/dist/core/provider-errors.js +27 -0
- package/dist/core/query/execute.js +12 -3
- package/dist/core/query/filter.js +2 -2
- package/dist/core/query/lower.js +5 -4
- package/dist/core/references/schema.d.ts +1 -0
- package/dist/core/references/schema.js +33 -10
- package/dist/features/navigation/build.js +14 -6
- package/dist/features/navigation/canonical.js +1 -1
- package/dist/features/sitemap/query.js +2 -2
- package/dist/integrations/nitro/ingest.d.ts +3 -3
- package/dist/integrations/nitro/ingest.js +3 -3
- package/dist/integrations/nitro/storage.js +3 -1
- package/dist/module.d.mts +216 -532
- package/dist/module.json +1 -1
- package/dist/module.mjs +1250 -718
- package/dist/parsers/csv.js +4 -3
- package/dist/parsers/index.d.ts +2 -5
- package/dist/parsers/index.js +2 -2
- package/dist/parsers/markdown-plugins.d.ts +1 -0
- package/dist/parsers/markdown-plugins.js +83 -1
- package/dist/parsers/markdown.js +1 -1
- package/dist/public/client.d.ts +5 -2
- package/dist/public/client.js +4 -2
- package/dist/public/provider-errors.d.ts +2 -1
- package/dist/public/provider-errors.js +1 -18
- package/dist/public/provider.d.ts +3 -10
- package/dist/public/server.d.ts +6 -1
- package/dist/public/server.js +33 -0
- package/dist/runtime/agent-paths +1 -0
- package/dist/runtime/agent-paths.d.ts +6 -0
- package/dist/runtime/agent-paths.js +41 -0
- package/dist/runtime/app/components/ContentRenderer.vue +9 -5
- package/dist/runtime/app/components/internal/MarkdownRenderer.d.ts +1 -1
- package/dist/runtime/app/composables/head.d.ts +30 -3
- package/dist/runtime/app/composables/head.js +83 -78
- package/dist/runtime/app/composables/hot-reload +1 -0
- package/dist/runtime/app/composables/hot-reload.d.ts +5 -0
- package/dist/runtime/app/composables/hot-reload.js +15 -0
- package/dist/runtime/app/composables/locale-context.d.ts +1 -1
- package/dist/runtime/app/composables/locale-context.js +2 -1
- package/dist/runtime/app/composables/locale.js +2 -2
- package/dist/runtime/app/composables/query-api.d.ts +9 -10
- package/dist/runtime/app/composables/search.d.ts +4 -4
- package/dist/runtime/app/composables/search.js +19 -9
- package/dist/runtime/app/composables/use-content-document +1 -0
- package/dist/runtime/app/composables/use-content-document.d.ts +29 -0
- package/dist/runtime/app/composables/use-content-document.js +44 -0
- package/dist/runtime/app/composables/use-content-list +1 -0
- package/dist/runtime/app/composables/use-content-list.d.ts +43 -0
- package/dist/runtime/app/composables/use-content-list.js +98 -0
- package/dist/runtime/app/composables/use-content-navigation +1 -0
- package/dist/runtime/app/composables/use-content-navigation.d.ts +40 -0
- package/dist/runtime/app/composables/use-content-navigation.js +102 -0
- package/dist/runtime/app/composables/use-content-page +1 -0
- package/dist/runtime/app/composables/use-content-page.d.ts +47 -0
- package/dist/runtime/app/composables/use-content-page.js +142 -0
- package/dist/runtime/app/composables/use-content-shared +1 -0
- package/dist/runtime/app/composables/use-content-shared.d.ts +13 -0
- package/dist/runtime/app/composables/use-content-shared.js +29 -0
- package/dist/runtime/app/composables/use-content.d.ts +11 -186
- package/dist/runtime/app/composables/use-content.js +4 -307
- package/dist/runtime/app/plugins/hot-reload +1 -0
- package/dist/runtime/app/plugins/hot-reload.js +6 -0
- package/dist/runtime/query/backlinks +1 -0
- package/dist/runtime/query/backlinks.d.ts +8 -0
- package/dist/runtime/query/backlinks.js +90 -0
- package/dist/runtime/query/context +1 -0
- package/dist/runtime/query/context.d.ts +20 -0
- package/dist/runtime/query/context.js +0 -0
- package/dist/runtime/query/documents +1 -0
- package/dist/runtime/query/documents.d.ts +6 -0
- package/dist/runtime/query/documents.js +98 -0
- package/dist/runtime/query/errors +1 -0
- package/dist/runtime/query/errors.d.ts +1 -0
- package/dist/runtime/query/errors.js +4 -0
- package/dist/runtime/query/handles +1 -0
- package/dist/runtime/query/handles.d.ts +2 -0
- package/dist/runtime/query/handles.js +7 -0
- package/dist/runtime/query/locale-options +1 -0
- package/dist/runtime/query/locale-options.d.ts +5 -0
- package/dist/runtime/query/locale-options.js +14 -0
- package/dist/runtime/query/localized-docs +1 -0
- package/dist/runtime/query/localized-docs.d.ts +17 -0
- package/dist/runtime/query/localized-docs.js +44 -0
- package/dist/runtime/query/navigation +1 -0
- package/dist/runtime/query/navigation.d.ts +22 -0
- package/dist/runtime/query/navigation.js +73 -0
- package/dist/runtime/query/pagination +1 -0
- package/dist/runtime/query/pagination.d.ts +7 -0
- package/dist/runtime/query/pagination.js +78 -0
- package/dist/runtime/query/populate +1 -0
- package/dist/runtime/query/populate.d.ts +9 -0
- package/dist/runtime/query/populate.js +106 -0
- package/dist/runtime/query/responses +1 -0
- package/dist/runtime/query/responses.d.ts +10 -0
- package/dist/runtime/query/responses.js +47 -0
- package/dist/runtime/query/unified.d.ts +4 -19
- package/dist/runtime/query/unified.js +14 -457
- package/dist/runtime/query/variants +1 -0
- package/dist/runtime/query/variants.d.ts +11 -0
- package/dist/runtime/query/variants.js +36 -0
- package/dist/runtime/server/agent-http +1 -0
- package/dist/runtime/server/agent-http.d.ts +7 -0
- package/dist/runtime/server/agent-http.js +36 -0
- package/dist/runtime/server/agent-markdown +1 -0
- package/dist/runtime/server/agent-markdown.d.ts +83 -0
- package/dist/runtime/server/agent-markdown.js +449 -0
- package/dist/runtime/server/agent-site +1 -0
- package/dist/runtime/server/agent-site.d.ts +38 -0
- package/dist/runtime/server/agent-site.js +273 -0
- package/dist/runtime/server/api/agent-llms +1 -0
- package/dist/runtime/server/api/agent-llms-full +1 -0
- package/dist/runtime/server/api/agent-llms-full.d.ts +2 -0
- package/dist/runtime/server/api/agent-llms-full.js +13 -0
- package/dist/runtime/server/api/agent-llms.d.ts +2 -0
- package/dist/runtime/server/api/agent-llms.js +14 -0
- package/dist/runtime/server/api/agent-raw +1 -0
- package/dist/runtime/server/api/agent-raw.d.ts +2 -0
- package/dist/runtime/server/api/agent-raw.js +17 -0
- package/dist/runtime/server/api/locales.d.ts +2 -2
- package/dist/runtime/server/api/locales.js +4 -2
- package/dist/runtime/server/api/navigation.d.ts +1 -1
- package/dist/runtime/server/api/query.d.ts +1 -1
- package/dist/runtime/server/api/query.js +4 -1
- package/dist/runtime/server/api/revalidate.js +2 -2
- package/dist/runtime/server/api/search.d.ts +2 -1
- package/dist/runtime/server/api/search.js +6 -2
- package/dist/runtime/server/api/site-data.d.ts +1 -1
- package/dist/runtime/server/collection-helpers.js +2 -1
- package/dist/runtime/server/middleware/agent-link-headers +1 -0
- package/dist/runtime/server/middleware/agent-link-headers.d.ts +2 -0
- package/dist/runtime/server/middleware/agent-link-headers.js +42 -0
- package/dist/runtime/server/middleware/agent-markdown +1 -0
- package/dist/runtime/server/middleware/agent-markdown.d.ts +2 -0
- package/dist/runtime/server/middleware/agent-markdown.js +43 -0
- package/dist/runtime/server/pagefind.js +1 -0
- package/dist/runtime/server/plugins/sitemap.js +1 -0
- package/dist/runtime/server/provider-query.d.ts +8 -5
- package/dist/runtime/server/provider-query.js +50 -8
- package/dist/runtime/server/provider-result.d.ts +19 -2
- package/dist/runtime/server/providers/filesystem.js +4 -1
- package/dist/runtime/server/providers/index.d.ts +3 -1
- package/dist/runtime/server/providers/index.js +2 -2
- package/dist/runtime/server/query-api.js +2 -1
- package/dist/runtime/server/query-executor.d.ts +3 -2
- package/dist/runtime/server/query-executor.js +13 -5
- package/dist/runtime/server/search.d.ts +11 -0
- package/dist/runtime/server/search.js +24 -7
- package/dist/runtime/server/sitemap-provider.js +40 -1
- package/dist/runtime/server/sitemap.js +3 -2
- package/dist/runtime/shared/search.js +3 -2
- package/dist/runtime/transformers/component-resolver.js +2 -1
- package/dist/runtime/utils/content-components.d.ts +0 -5
- package/dist/storage/content.d.ts +2 -9
- package/dist/storage/references.d.ts +1 -8
- package/dist/storage/references.js +9 -4
- package/dist/testing/provider-contract.js +3 -4
- package/dist/testing/provider-fixture.d.ts +3 -1
- package/dist/testing/provider-fixture.js +28 -14
- package/dist/types/config.d.ts +104 -7
- package/dist/types/config.js +49 -2
- package/dist/types/module.d.ts +50 -8
- package/dist/types/query-parts/collections +1 -0
- package/dist/types/query-parts/collections.d.ts +15 -0
- package/dist/types/query-parts/collections.js +0 -0
- package/dist/types/query-parts/public +1 -0
- package/dist/types/query-parts/public.d.ts +202 -0
- package/dist/types/query-parts/public.js +0 -0
- package/dist/types/query-parts/results +1 -0
- package/dist/types/query-parts/results.d.ts +95 -0
- package/dist/types/query-parts/results.js +0 -0
- package/dist/types/query-parts/transport +1 -0
- package/dist/types/query-parts/transport.d.ts +103 -0
- package/dist/types/query-parts/transport.js +0 -0
- package/dist/types/query.d.ts +4 -862
- package/dist/types/query.js +4 -0
- package/dist/types/runtime.d.ts +2 -2
- package/dist/types/search.d.ts +3 -1
- package/dist/types/virtual.d.ts +54 -0
- package/dist/types.d.mts +3 -3
- package/dist/web-types.json +1 -1
- package/package.json +8 -8
- package/dist/runtime/app/composables/web-socket +0 -1
- package/dist/runtime/app/composables/web-socket.d.ts +0 -3
- package/dist/runtime/app/composables/web-socket.js +0 -65
- package/dist/runtime/app/plugins/ws +0 -1
- package/dist/runtime/app/plugins/ws.js +0 -7
- /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';
|
|
7
|
-
import { ContentSearchPublicRuntimeConfig as ContentSearchPublicRuntimeConfig$1 } from '../dist/types/search';
|
|
6
|
+
export { agentMetadataFields, defineAgentAppPage, defineAgentMarkdownPolicy, defineAgentMetadataFields, defineAgentSection, defineCollection, defineContentConfig, reference } from '../dist/types/config';
|
|
8
7
|
import { ZodType, z } from 'zod';
|
|
9
|
-
import {
|
|
8
|
+
import { ContentSearchPublicRuntimeConfig as ContentSearchPublicRuntimeConfig$1 } from '../dist/types/search';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Locale settings for a collection that ships translated variants.
|
|
@@ -29,6 +28,7 @@ type ContentCollectionSource = string | string[];
|
|
|
29
28
|
* express roots such as `{ en: '/docs', de: '/dokumentation' }`.
|
|
30
29
|
*/
|
|
31
30
|
type ContentCollectionRouteConfig = string | Record<string, string>;
|
|
31
|
+
type ContentCollectionKind = 'page' | 'data';
|
|
32
32
|
type ContentCmsFieldType = 'text' | 'textarea' | 'richtext' | 'slug' | 'email' | 'url' | 'number' | 'range' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'toggle' | 'date' | 'datetime' | 'time' | 'json' | 'object' | 'array' | 'blocks' | 'relation' | 'relations' | 'image' | 'images' | 'file' | 'icon' | 'code' | 'color' | 'divider' | 'section';
|
|
33
33
|
interface ContentCmsRelationConfig {
|
|
34
34
|
collectionId: string;
|
|
@@ -71,6 +71,67 @@ interface ContentCmsCollectionConfig {
|
|
|
71
71
|
fields?: Record<string, ContentCmsFieldConfig>;
|
|
72
72
|
settings?: unknown;
|
|
73
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
|
+
}
|
|
74
135
|
/**
|
|
75
136
|
* Object source shape accepted for Nuxt Content v3 migration.
|
|
76
137
|
*/
|
|
@@ -88,6 +149,11 @@ interface ContentCollectionSourceObject {
|
|
|
88
149
|
* Declarative collection definition used by `content.config.ts`.
|
|
89
150
|
*/
|
|
90
151
|
interface ContentCollectionConfig<TSchema extends ZodType | undefined = ZodType | undefined> {
|
|
152
|
+
/**
|
|
153
|
+
* Collection kind declared in `defineCollection`. Page collections are public
|
|
154
|
+
* content routes by default; data collections are app-owned records.
|
|
155
|
+
*/
|
|
156
|
+
type?: ContentCollectionKind;
|
|
91
157
|
/**
|
|
92
158
|
* Source glob or source descriptor understood by the filesystem ingestion
|
|
93
159
|
* layer. CMS-backed projects do not need a runtime source; filesystem
|
|
@@ -139,14 +205,20 @@ interface ContentCollectionConfig<TSchema extends ZodType | undefined = ZodType
|
|
|
139
205
|
* source, i18n, and schema information.
|
|
140
206
|
*/
|
|
141
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;
|
|
142
214
|
}
|
|
143
|
-
type ContentCollectionKind = 'page' | 'data';
|
|
144
215
|
type ContentProviderName = 'filesystem' | (string & {});
|
|
145
216
|
type DefineCollectionOptions<TSchema extends ZodType | undefined = ZodType | undefined> = Omit<ContentCollectionConfig<TSchema>, 'source' | 'exclude'>;
|
|
146
217
|
interface DefineCollectionObject<TSchema extends ZodType | undefined = ZodType | undefined> extends DefineCollectionOptions<TSchema> {
|
|
147
218
|
/**
|
|
148
219
|
* Nuxt Content v3-compatible collection kind. Ginko does not keep separate
|
|
149
|
-
* page/data
|
|
220
|
+
* page/data query builders, but the kind remains canonical metadata at runtime.
|
|
221
|
+
* `data` collections default to `sitemap: false`.
|
|
150
222
|
*/
|
|
151
223
|
type: ContentCollectionKind;
|
|
152
224
|
/**
|
|
@@ -170,6 +242,12 @@ interface ContentConfig<TCollections extends Record<string, ContentCollectionCon
|
|
|
170
242
|
* modules register themselves, so app configs usually do not need this.
|
|
171
243
|
*/
|
|
172
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;
|
|
173
251
|
/**
|
|
174
252
|
* Named content collections keyed by the identifier used at query time.
|
|
175
253
|
*/
|
|
@@ -219,6 +297,17 @@ interface ContentCollectionHandle<Name extends string = string, TSchema extends
|
|
|
219
297
|
*/
|
|
220
298
|
readonly __schema: TSchema;
|
|
221
299
|
}
|
|
300
|
+
type IsI18nConfig<TConfig> = TConfig extends {
|
|
301
|
+
i18n: true | ContentCollectionI18nConfig;
|
|
302
|
+
} ? TConfig['i18n'] extends false ? false : true : false;
|
|
303
|
+
type CollectionNameFromConfigKey<Key extends string, TCollection> = TCollection extends ContentCollectionHandle<infer Name, ZodType | undefined, boolean> ? [Name] extends [never] ? Key : Name : Key;
|
|
304
|
+
type NamedContentCollection<Key extends string, TCollection> = TCollection extends ContentCollectionHandle<infer Name, infer TSchema, infer TI18n> ? Omit<TCollection, 'name' | '__schema' | '__i18n'> & ContentCollectionHandle<[
|
|
305
|
+
Name
|
|
306
|
+
] extends [never] ? Key : Name, TSchema, TI18n> : TCollection extends ContentCollectionConfig<infer TSchema> ? Omit<TCollection, 'name' | '__schema' | '__i18n'> & ContentCollectionHandle<CollectionNameFromConfigKey<Key, TCollection>, TSchema, IsI18nConfig<TCollection>> : TCollection;
|
|
307
|
+
type NamedContentCollections<TCollections extends Record<string, ContentCollectionConfig>> = {
|
|
308
|
+
[Key in keyof TCollections]: Key extends string ? NamedContentCollection<Key, TCollections[Key]> : TCollections[Key];
|
|
309
|
+
};
|
|
310
|
+
declare function normalizeContentConfigCollectionNames<TCollections extends Record<string, ContentCollectionConfig>>(collections: TCollections): NamedContentCollections<TCollections>;
|
|
222
311
|
|
|
223
312
|
type LayoutKey = string;
|
|
224
313
|
interface ContentSeoImage {
|
|
@@ -577,123 +666,36 @@ interface ContentQueryCountResponse {
|
|
|
577
666
|
*/
|
|
578
667
|
type ContentQueryResponse<T> = ContentQueryFindResponse<T> | ContentQueryFindOneResponse<T> | ContentQueryCountResponse;
|
|
579
668
|
|
|
580
|
-
/**
|
|
581
|
-
* Query
|
|
582
|
-
*/
|
|
583
669
|
interface ContentQuerySortParams {
|
|
584
|
-
/**
|
|
585
|
-
* Locale specifier for sorting
|
|
586
|
-
* A string with a BCP 47 language tag
|
|
587
|
-
*
|
|
588
|
-
* @default undefined
|
|
589
|
-
*/
|
|
590
670
|
$locale?: string;
|
|
591
|
-
/**
|
|
592
|
-
* Whether numeric collation should be used, such that "1" < "2" < "10".
|
|
593
|
-
* Possible values are `true` and `false`;
|
|
594
|
-
*
|
|
595
|
-
* @default false
|
|
596
|
-
*/
|
|
597
671
|
$numeric?: boolean;
|
|
598
|
-
/**
|
|
599
|
-
* Whether upper case or lower case should sort first.
|
|
600
|
-
* Possible values are `"upper"`, `"lower"`, or `"false"`
|
|
601
|
-
*
|
|
602
|
-
* @default "depends on locale"
|
|
603
|
-
*/
|
|
604
672
|
$caseFirst?: 'upper' | 'lower' | 'false';
|
|
605
|
-
/**
|
|
606
|
-
* Which differences in the strings should lead to non-zero result values. Possible values are:
|
|
607
|
-
* - "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A.
|
|
608
|
-
* - "accent": Only strings that differ in base letters or accents and other diacritic marks compare as unequal. Examples: a ≠ b, a ≠ á, a = A.
|
|
609
|
-
* - "case": Only strings that differ in base letters or case compare as unequal. Examples: a ≠ b, a = á, a ≠ A.
|
|
610
|
-
* - "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.
|
|
611
|
-
*
|
|
612
|
-
* @default "variant"
|
|
613
|
-
*/
|
|
614
673
|
$sensitivity?: 'base' | 'accent' | 'case' | 'variant';
|
|
615
674
|
}
|
|
616
675
|
interface ContentQuerySortFields {
|
|
617
676
|
[field: string]: -1 | 1;
|
|
618
677
|
}
|
|
619
678
|
type ContentQuerySortOptions = ContentQuerySortParams | ContentQuerySortFields;
|
|
620
|
-
/**
|
|
621
|
-
* @internal
|
|
622
|
-
*/
|
|
623
679
|
interface ContentQueryBuilderWhere extends Partial<Record<keyof ParsedContentInternalMeta, string | number | boolean | RegExp | ContentQueryBuilderWhere>> {
|
|
624
|
-
/**
|
|
625
|
-
* Match only if all nested conditions are true.
|
|
626
|
-
**/
|
|
627
680
|
$and?: ContentQueryBuilderWhere[];
|
|
628
|
-
/**
|
|
629
|
-
* Match if any nested condition is true.
|
|
630
|
-
**/
|
|
631
681
|
$or?: ContentQueryBuilderWhere[];
|
|
632
|
-
/**
|
|
633
|
-
* Match when the nested condition is false.
|
|
634
|
-
**/
|
|
635
682
|
$not?: string | number | boolean | RegExp | ContentQueryBuilderWhere;
|
|
636
|
-
/**
|
|
637
|
-
* Match if item equals condition.
|
|
638
|
-
**/
|
|
639
683
|
$eq?: string | number | boolean | RegExp;
|
|
640
|
-
/**
|
|
641
|
-
* Match if item does not equal condition.
|
|
642
|
-
**/
|
|
643
684
|
$ne?: string | number | boolean | RegExp;
|
|
644
|
-
/**
|
|
645
|
-
* Check if item is greater than condition.
|
|
646
|
-
*/
|
|
647
685
|
$gt?: number | string;
|
|
648
|
-
/**
|
|
649
|
-
* Check if item is greater than or equal to condition.
|
|
650
|
-
*/
|
|
651
686
|
$gte?: number | string;
|
|
652
|
-
/**
|
|
653
|
-
* Check if item is less than condition.
|
|
654
|
-
*/
|
|
655
687
|
$lt?: number | string;
|
|
656
|
-
/**
|
|
657
|
-
* Check if item is less than or equal to condition.
|
|
658
|
-
*/
|
|
659
688
|
$lte?: number | string;
|
|
660
|
-
/**
|
|
661
|
-
* Provides regular expression capabilities for pattern matching strings.
|
|
662
|
-
*/
|
|
663
689
|
$regex?: RegExp | string;
|
|
664
|
-
/**
|
|
665
|
-
* Match when a string field starts with the given prefix.
|
|
666
|
-
*/
|
|
667
690
|
$prefix?: string;
|
|
668
|
-
/**
|
|
669
|
-
* Match if type of item equals condition.
|
|
670
|
-
*/
|
|
671
691
|
$type?: string;
|
|
672
|
-
/**
|
|
673
|
-
* Check key existence.
|
|
674
|
-
*/
|
|
675
692
|
$exists?: boolean;
|
|
676
|
-
/**
|
|
677
|
-
* Match if item contains every condition or every rule in the condition array.
|
|
678
|
-
**/
|
|
679
693
|
$contains?: Array<string | number | boolean> | string | number | boolean;
|
|
680
|
-
/**
|
|
681
|
-
* Match if item contains at least one rule from the condition array.
|
|
682
|
-
*/
|
|
683
694
|
$containsAny?: Array<string | number | boolean>;
|
|
684
|
-
/**
|
|
685
|
-
* Ignore case when checking string containment.
|
|
686
|
-
**/
|
|
687
695
|
$icontains?: string;
|
|
688
|
-
/**
|
|
689
|
-
* Match if item is in condition array.
|
|
690
|
-
**/
|
|
691
696
|
$in?: Array<string | number | boolean>;
|
|
692
697
|
[key: string]: string | number | boolean | RegExp | ContentQueryBuilderWhere | Array<string | number | boolean | ContentQueryBuilderWhere> | undefined;
|
|
693
698
|
}
|
|
694
|
-
/**
|
|
695
|
-
* @internal
|
|
696
|
-
*/
|
|
697
699
|
interface ContentQueryBuilderParams {
|
|
698
700
|
collection?: string;
|
|
699
701
|
first?: boolean;
|
|
@@ -729,284 +731,135 @@ type CollectionQueryOperator<T> = '=' | '!=' | 'EXISTS' | 'TYPE' | (ComparableVa
|
|
|
729
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;
|
|
730
732
|
type QueryOrderDirection = 'ASC' | 'DESC';
|
|
731
733
|
interface QueryOrderOptions {
|
|
732
|
-
/**
|
|
733
|
-
* BCP 47 locale passed to `Intl.Collator` for string ordering.
|
|
734
|
-
*/
|
|
735
734
|
locale?: string;
|
|
736
|
-
/**
|
|
737
|
-
* Enable numeric ordering so `"2"` sorts before `"10"`.
|
|
738
|
-
*/
|
|
739
735
|
numeric?: boolean;
|
|
740
|
-
/**
|
|
741
|
-
* Control whether upper- or lower-case letters sort first.
|
|
742
|
-
*/
|
|
743
736
|
caseFirst?: ContentQuerySortParams['$caseFirst'];
|
|
744
|
-
/**
|
|
745
|
-
* Collation sensitivity used by string comparison.
|
|
746
|
-
*/
|
|
747
737
|
sensitivity?: ContentQuerySortParams['$sensitivity'];
|
|
748
738
|
}
|
|
749
|
-
/**
|
|
750
|
-
* Builder passed to grouped `andWhere` / `orWhere` callbacks.
|
|
751
|
-
*/
|
|
752
739
|
interface QueryGroupBuilder<T = ParsedContentMeta> {
|
|
753
740
|
where<K extends CollectionQueryField<T>, O extends CollectionQueryOperator<CollectionQueryFieldValue<T, K>>>(field: K, operator: O, value?: CollectionQueryValue<CollectionQueryFieldValue<T, K>, O>): QueryGroupBuilder<T>;
|
|
754
741
|
andWhere(groupFactory: QueryGroupFunction<T>): QueryGroupBuilder<T>;
|
|
755
742
|
orWhere(groupFactory: QueryGroupFunction<T>): QueryGroupBuilder<T>;
|
|
756
743
|
}
|
|
757
|
-
/**
|
|
758
|
-
* Factory used to build grouped nested conditions.
|
|
759
|
-
*/
|
|
760
744
|
type QueryGroupFunction<T = ParsedContentMeta> = (group: QueryGroupBuilder<T>) => QueryGroupBuilder<T>;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
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
|
+
|
|
764
785
|
interface ContentCollectionNavigationOptions<TField extends string = string> {
|
|
765
|
-
/**
|
|
766
|
-
* Extra document fields to merge onto each returned navigation item.
|
|
767
|
-
*/
|
|
768
786
|
fields?: TField[];
|
|
769
|
-
/**
|
|
770
|
-
* Locale to resolve against for translated collections.
|
|
771
|
-
*/
|
|
772
787
|
locale?: string;
|
|
773
|
-
/**
|
|
774
|
-
* When `true`, keep canonical paths instead of locale-prefixed paths.
|
|
775
|
-
*/
|
|
776
788
|
canonical?: boolean;
|
|
777
789
|
}
|
|
778
|
-
/**
|
|
779
|
-
* Options for previous/next navigation helpers.
|
|
780
|
-
*/
|
|
781
790
|
type ContentCollectionItemSurroundingsOptions<TField extends string = string> = ContentCollectionNavigationOptions<TField>;
|
|
782
|
-
/**
|
|
783
|
-
* Options for extracting searchable sections from collection pages.
|
|
784
|
-
*/
|
|
785
791
|
interface ContentCollectionSearchSectionsOptions {
|
|
786
|
-
/**
|
|
787
|
-
* Tags ignored while flattening page content into search text.
|
|
788
|
-
*/
|
|
789
792
|
ignoredTags?: string[];
|
|
790
|
-
/**
|
|
791
|
-
* Extra top-level fields copied from each page onto every emitted section.
|
|
792
|
-
*/
|
|
793
793
|
extraFields?: string[];
|
|
794
|
-
/**
|
|
795
|
-
* Query predicate applied before extracting searchable sections.
|
|
796
|
-
*/
|
|
797
794
|
filterQuery?: ContentQueryBuilderWhere;
|
|
798
|
-
/**
|
|
799
|
-
* Lowest heading level that starts a new section.
|
|
800
|
-
*/
|
|
801
795
|
minHeading?: `h${1 | 2 | 3 | 4 | 5 | 6}`;
|
|
802
|
-
/**
|
|
803
|
-
* Highest heading level that starts a new section.
|
|
804
|
-
*/
|
|
805
796
|
maxHeading?: `h${1 | 2 | 3 | 4 | 5 | 6}`;
|
|
806
|
-
/**
|
|
807
|
-
* Locale to resolve against for translated collections.
|
|
808
|
-
*/
|
|
809
797
|
locale?: string;
|
|
810
|
-
/**
|
|
811
|
-
* When `true`, keep canonical paths instead of locale-prefixed paths.
|
|
812
|
-
*/
|
|
813
798
|
canonical?: boolean;
|
|
814
799
|
}
|
|
815
|
-
/**
|
|
816
|
-
* Options for locale-aware page resolution.
|
|
817
|
-
*/
|
|
818
800
|
interface ContentCollectionPageOptions {
|
|
819
|
-
/**
|
|
820
|
-
* Preferred locale to resolve.
|
|
821
|
-
*/
|
|
822
801
|
locale?: string;
|
|
823
|
-
/**
|
|
824
|
-
* Enable or customize locale fallback resolution.
|
|
825
|
-
*
|
|
826
|
-
* Pass `true` to use configured fallbacks, or an explicit locale list to
|
|
827
|
-
* override the configured chain for this query.
|
|
828
|
-
*/
|
|
829
802
|
fallback?: string[] | boolean;
|
|
830
|
-
|
|
831
|
-
* When `true`, keep canonical paths in the returned route metadata.
|
|
832
|
-
*/
|
|
803
|
+
exact?: boolean;
|
|
833
804
|
canonical?: boolean;
|
|
834
805
|
}
|
|
835
|
-
/**
|
|
836
|
-
* Options for route metadata resolution without loading full page content.
|
|
837
|
-
*/
|
|
838
806
|
interface ContentCollectionRouteMetaOptions {
|
|
839
|
-
/**
|
|
840
|
-
* Preferred locale to resolve.
|
|
841
|
-
*/
|
|
842
807
|
locale?: string;
|
|
843
|
-
/**
|
|
844
|
-
* Enable or customize locale fallback resolution.
|
|
845
|
-
*/
|
|
846
808
|
fallback?: string[] | boolean;
|
|
809
|
+
exact?: boolean;
|
|
847
810
|
}
|
|
848
|
-
/**
|
|
849
|
-
* Options for resolving an authored reference value into a document.
|
|
850
|
-
*/
|
|
851
811
|
interface ResolveContentReferenceOptions {
|
|
852
|
-
/**
|
|
853
|
-
* Preferred locale to resolve.
|
|
854
|
-
*/
|
|
855
812
|
locale?: string;
|
|
856
|
-
/**
|
|
857
|
-
* Enable or customize locale fallback resolution.
|
|
858
|
-
*/
|
|
859
813
|
fallback?: string[] | boolean;
|
|
860
|
-
/**
|
|
861
|
-
* When `true`, require an exact locale match and skip fallback lookup.
|
|
862
|
-
*/
|
|
863
814
|
exact?: boolean;
|
|
864
|
-
/**
|
|
865
|
-
* Restrict resolution to a single collection.
|
|
866
|
-
*/
|
|
867
815
|
collection?: string;
|
|
868
816
|
}
|
|
869
|
-
/**
|
|
870
|
-
* Locale variant entry returned by the internal locale-variant endpoint.
|
|
871
|
-
*/
|
|
872
817
|
interface ContentLocaleEntry {
|
|
873
|
-
/**
|
|
874
|
-
* Stable locale-agnostic identity shared by every translated variant.
|
|
875
|
-
*/
|
|
876
818
|
canonicalKey: string;
|
|
877
|
-
/**
|
|
878
|
-
* Locale code for the matching variant.
|
|
879
|
-
*/
|
|
880
819
|
locale: string;
|
|
881
|
-
/**
|
|
882
|
-
* Resolved route path for the variant, when the variant is routable.
|
|
883
|
-
*/
|
|
884
820
|
path?: string;
|
|
885
821
|
}
|
|
886
|
-
/**
|
|
887
|
-
* Route metadata for a single locale variant of a page.
|
|
888
|
-
*/
|
|
889
822
|
interface ContentLocaleRoute {
|
|
890
823
|
locale: string;
|
|
891
824
|
path: string;
|
|
892
825
|
canonicalPath: string;
|
|
893
826
|
}
|
|
894
|
-
/**
|
|
895
|
-
* One entry in the per-locale path map attached to a localized document.
|
|
896
|
-
*
|
|
897
|
-
* `translated` is `true` when a concrete variant exists in that locale, `false`
|
|
898
|
-
* when the resolver fell back to another locale's path. `fallback` names the
|
|
899
|
-
* locale that supplied the path when `translated` is false.
|
|
900
|
-
*/
|
|
901
827
|
interface LocalePathEntry {
|
|
902
|
-
/**
|
|
903
|
-
* Locale-prefixed route path (the URL the user navigates to).
|
|
904
|
-
*/
|
|
905
828
|
path: string;
|
|
906
|
-
/**
|
|
907
|
-
* `true` when this locale has its own variant; `false` when the path was
|
|
908
|
-
* supplied by a fallback locale.
|
|
909
|
-
*/
|
|
910
829
|
translated: boolean;
|
|
911
|
-
/**
|
|
912
|
-
* Locale that backed this entry when `translated` is `false`.
|
|
913
|
-
*/
|
|
914
830
|
fallback?: string;
|
|
915
831
|
}
|
|
916
|
-
/**
|
|
917
|
-
* Public resolution metadata attached to localized content results.
|
|
918
|
-
*
|
|
919
|
-
* Internal `_requestedLocale`, `_resolvedLocale`, and `_fallback` fields remain
|
|
920
|
-
* storage/query implementation details. UI code should read this object.
|
|
921
|
-
*/
|
|
922
832
|
interface ContentResolvedMeta {
|
|
923
|
-
/**
|
|
924
|
-
* Locale of the concrete content variant that backed this result.
|
|
925
|
-
*/
|
|
926
833
|
locale: string;
|
|
927
|
-
/**
|
|
928
|
-
* Locale requested by the caller, when locale resolution was part of the
|
|
929
|
-
* query.
|
|
930
|
-
*/
|
|
931
834
|
requestedLocale?: string;
|
|
932
|
-
/**
|
|
933
|
-
* `true` when the concrete content variant came from a different locale than
|
|
934
|
-
* the requested locale.
|
|
935
|
-
*/
|
|
936
835
|
fallback: boolean;
|
|
937
|
-
/**
|
|
938
|
-
* Locale that supplied the content when `fallback` is true.
|
|
939
|
-
*/
|
|
940
836
|
fallbackLocale?: string;
|
|
941
|
-
/**
|
|
942
|
-
* Public route path returned to the user.
|
|
943
|
-
*/
|
|
944
837
|
path: string;
|
|
945
|
-
/**
|
|
946
|
-
* Requested route path before locale fallback, when known.
|
|
947
|
-
*/
|
|
948
838
|
requestedPath?: string;
|
|
949
|
-
/**
|
|
950
|
-
* Requested public route before locale fallback, when known.
|
|
951
|
-
*/
|
|
952
839
|
requestedRoute?: string;
|
|
953
|
-
/**
|
|
954
|
-
* Requested authored ref before locale fallback, when known.
|
|
955
|
-
*/
|
|
956
840
|
requestedRef?: string;
|
|
957
|
-
/**
|
|
958
|
-
* Locales that have concrete variants for this content identity.
|
|
959
|
-
*/
|
|
960
841
|
availableLocales: string[];
|
|
961
842
|
}
|
|
962
|
-
/**
|
|
963
|
-
* Locale-aware routing metadata attached to route-backed page payloads.
|
|
964
|
-
*/
|
|
965
843
|
interface ContentRouteMeta {
|
|
966
844
|
locale: string;
|
|
967
845
|
defaultLocale: string;
|
|
968
846
|
path: string;
|
|
969
847
|
canonicalPath: string;
|
|
970
848
|
variants: ContentLocaleRoute[];
|
|
971
|
-
/**
|
|
972
|
-
* Map of every configured locale to its localized path. Includes a
|
|
973
|
-
* `translated` flag and a `fallback` source when a locale has no variant.
|
|
974
|
-
*/
|
|
975
849
|
localePaths: Record<string, LocalePathEntry>;
|
|
976
|
-
/**
|
|
977
|
-
* Public explanation of the locale/path resolution used for this result.
|
|
978
|
-
*/
|
|
979
850
|
resolved: ContentResolvedMeta;
|
|
980
851
|
}
|
|
981
|
-
/**
|
|
982
|
-
* Full page payload returned by route-aware unified query helpers and internal route helpers.
|
|
983
|
-
*/
|
|
984
852
|
type ContentPageResult<T = ParsedContentMeta> = T & ContentRouteMeta & {
|
|
985
|
-
/**
|
|
986
|
-
* Locale-agnostic path stem derived from the source file.
|
|
987
|
-
*/
|
|
988
853
|
stem: string;
|
|
989
|
-
/**
|
|
990
|
-
* Source file extension when it can be inferred.
|
|
991
|
-
*/
|
|
992
854
|
extension?: string;
|
|
993
855
|
};
|
|
994
|
-
/**
|
|
995
|
-
* Alternate locale entry used in sitemap output.
|
|
996
|
-
*/
|
|
997
856
|
interface ContentSitemapAlternative {
|
|
998
857
|
hreflang: string;
|
|
999
858
|
href: string;
|
|
1000
859
|
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Sitemap image entry discovered from page content or metadata.
|
|
1003
|
-
*/
|
|
1004
860
|
interface ContentSitemapImage {
|
|
1005
861
|
loc: string;
|
|
1006
862
|
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Sitemap entry produced by `queryCollectionsSitemapEntries`.
|
|
1009
|
-
*/
|
|
1010
863
|
interface ContentSitemapEntry {
|
|
1011
864
|
loc: string;
|
|
1012
865
|
_sitemap?: string;
|
|
@@ -1014,124 +867,15 @@ interface ContentSitemapEntry {
|
|
|
1014
867
|
alternatives?: ContentSitemapAlternative[];
|
|
1015
868
|
images?: ContentSitemapImage[];
|
|
1016
869
|
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Searchable document section produced by the internal search-section builder.
|
|
1019
|
-
*/
|
|
1020
870
|
interface ContentSearchSection {
|
|
1021
|
-
/**
|
|
1022
|
-
* Stable section id, usually the page path or path plus anchor hash.
|
|
1023
|
-
*/
|
|
1024
871
|
id: string;
|
|
1025
|
-
/**
|
|
1026
|
-
* Heading or page title for the section.
|
|
1027
|
-
*/
|
|
1028
872
|
title: string;
|
|
1029
|
-
/**
|
|
1030
|
-
* Ancestor heading trail leading to this section.
|
|
1031
|
-
*/
|
|
1032
873
|
titles: string[];
|
|
1033
|
-
/**
|
|
1034
|
-
* Heading depth that opened the section.
|
|
1035
|
-
*/
|
|
1036
874
|
level: number;
|
|
1037
|
-
/**
|
|
1038
|
-
* Flattened text content used by the search index.
|
|
1039
|
-
*/
|
|
1040
875
|
content: string;
|
|
1041
876
|
[key: string]: unknown;
|
|
1042
877
|
}
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* Filter results with an explicit field/operator/value clause.
|
|
1046
|
-
*/
|
|
1047
|
-
where<K extends CollectionQueryField<T>, O extends CollectionQueryOperator<CollectionQueryFieldValue<T, K>>>(field: K, operator: O, value?: CollectionQueryValue<CollectionQueryFieldValue<T, K>, O>): ContentQueryBuilder<T>;
|
|
1048
|
-
/**
|
|
1049
|
-
* Add a grouped AND clause.
|
|
1050
|
-
*/
|
|
1051
|
-
andWhere(groupFactory: QueryGroupFunction<T>): ContentQueryBuilder<T>;
|
|
1052
|
-
/**
|
|
1053
|
-
* Add a grouped OR clause.
|
|
1054
|
-
*/
|
|
1055
|
-
orWhere(groupFactory: QueryGroupFunction<T>): ContentQueryBuilder<T>;
|
|
1056
|
-
/**
|
|
1057
|
-
* Select a subset of fields.
|
|
1058
|
-
*/
|
|
1059
|
-
select<const K extends readonly Extract<keyof T, string>[]>(...fields: K): ContentQueryBuilder<Pick<T, K[number]>>;
|
|
1060
|
-
/**
|
|
1061
|
-
* Order the result set by a field.
|
|
1062
|
-
*/
|
|
1063
|
-
order<K extends CollectionQueryField<T>>(field: K, direction: QueryOrderDirection, options?: QueryOrderOptions): ContentQueryBuilder<T>;
|
|
1064
|
-
/**
|
|
1065
|
-
* Limit number of results.
|
|
1066
|
-
*/
|
|
1067
|
-
limit(count: number): ContentQueryBuilder<T>;
|
|
1068
|
-
/**
|
|
1069
|
-
* Skip number of results.
|
|
1070
|
-
*/
|
|
1071
|
-
skip(count: number): ContentQueryBuilder<T>;
|
|
1072
|
-
/**
|
|
1073
|
-
* Retrieve query builder params.
|
|
1074
|
-
* @internal
|
|
1075
|
-
*/
|
|
1076
|
-
params: () => ContentQueryBuilderParams;
|
|
1077
|
-
/**
|
|
1078
|
-
* Filter contents based on locale.
|
|
1079
|
-
*/
|
|
1080
|
-
locale(locale: string, options?: {
|
|
1081
|
-
fallback?: boolean | string[];
|
|
1082
|
-
}): ContentQueryBuilder<T>;
|
|
1083
|
-
/**
|
|
1084
|
-
* Fetch list of contents.
|
|
1085
|
-
*/
|
|
1086
|
-
all(): Promise<Array<T>>;
|
|
1087
|
-
/**
|
|
1088
|
-
* Fetch the first matched content.
|
|
1089
|
-
*/
|
|
1090
|
-
first(): Promise<T | undefined>;
|
|
1091
|
-
/**
|
|
1092
|
-
* Count matched contents.
|
|
1093
|
-
*/
|
|
1094
|
-
count(): Promise<number>;
|
|
1095
|
-
}
|
|
1096
|
-
interface CollectionQueryBuilder<T = ParsedContentMeta> extends ContentQueryBuilder<T> {
|
|
1097
|
-
select<const K extends readonly Extract<keyof T, string>[]>(...fields: K): CollectionQueryBuilder<Pick<T, K[number]>>;
|
|
1098
|
-
}
|
|
1099
|
-
/**
|
|
1100
|
-
* Minimal request shape consumed by the query transport.
|
|
1101
|
-
*/
|
|
1102
|
-
interface ContentQueryRequest {
|
|
1103
|
-
params(): ContentQueryBuilderParams;
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Internal transport used by the immutable query builder.
|
|
1107
|
-
*/
|
|
1108
|
-
type ContentQueryFetcher<T> = (query: ContentQueryRequest) => Promise<ContentQueryResponse<T>>;
|
|
1109
|
-
type QueryMatchOperator = (item: unknown, condition: unknown) => boolean;
|
|
1110
|
-
interface ContentCollectionMap {
|
|
1111
|
-
}
|
|
1112
|
-
interface ContentCollectionI18nMap {
|
|
1113
|
-
}
|
|
1114
|
-
type ContentCollectionName = keyof ContentCollectionMap & string;
|
|
1115
|
-
type ContentCollectionItem<K extends ContentCollectionName> = ContentCollectionMap[K];
|
|
1116
|
-
/**
|
|
1117
|
-
* ============================================================================
|
|
1118
|
-
* Unified Query API — public surface (ADR-0016)
|
|
1119
|
-
* ============================================================================
|
|
1120
|
-
*
|
|
1121
|
-
* The types below back the unified query API exposed via `one`, `many`,
|
|
1122
|
-
* `resolveOne`, `variants`, `tree`, `neighbors` and their `useContent*`
|
|
1123
|
-
* composable mirrors. The public vocabulary is deliberately split:
|
|
1124
|
-
*
|
|
1125
|
-
* - `by` identifies exactly one document by route path or authored ref.
|
|
1126
|
-
* - `where` filters a result set by document fields.
|
|
1127
|
-
* - `resolveOne` returns diagnostics; `one` is the ergonomic doc-only view.
|
|
1128
|
-
*/
|
|
1129
|
-
/**
|
|
1130
|
-
* MongoDB-style operator object applied to a single field. Mirrors the subset
|
|
1131
|
-
* of `ContentQueryBuilderWhere` operators that are safe for public use.
|
|
1132
|
-
*
|
|
1133
|
-
* @template TValue Concrete field value type (used to narrow operator operands).
|
|
1134
|
-
*/
|
|
878
|
+
|
|
1135
879
|
interface QueryOperators<TValue = unknown> {
|
|
1136
880
|
$eq?: TValue;
|
|
1137
881
|
$ne?: TValue;
|
|
@@ -1149,11 +893,6 @@ interface QueryOperators<TValue = unknown> {
|
|
|
1149
893
|
$prefix?: TValue extends string ? string : never;
|
|
1150
894
|
$not?: TValue | QueryOperators<TValue>;
|
|
1151
895
|
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Identify exactly one document. `path` is stored content `_path`, `route` is
|
|
1154
|
-
* public app URL, and `ref` is authored stable identity. They are mutually
|
|
1155
|
-
* exclusive at the type level.
|
|
1156
|
-
*/
|
|
1157
896
|
type ContentSelector = {
|
|
1158
897
|
path: string;
|
|
1159
898
|
route?: never;
|
|
@@ -1169,10 +908,6 @@ type ContentSelector = {
|
|
|
1169
908
|
};
|
|
1170
909
|
type WhereValue<T> = T | QueryOperators<T>;
|
|
1171
910
|
type PathWhere = string | QueryOperators<string>;
|
|
1172
|
-
/**
|
|
1173
|
-
* MongoDB-style filter object generic on the document shape. `where.path` is a
|
|
1174
|
-
* documented route-path filter and compiles to the internal `_path` field.
|
|
1175
|
-
*/
|
|
1176
911
|
type QueryWhere<T = ParsedContentMeta> = {
|
|
1177
912
|
path?: PathWhere;
|
|
1178
913
|
$and?: QueryWhere<T>[];
|
|
@@ -1181,43 +916,24 @@ type QueryWhere<T = ParsedContentMeta> = {
|
|
|
1181
916
|
} & {
|
|
1182
917
|
[K in Exclude<keyof T, 'path'>]?: WhereValue<NonNullable<T[K]>>;
|
|
1183
918
|
};
|
|
1184
|
-
/**
|
|
1185
|
-
* Sort spec: `asc` / `desc` are preferred; `1` / `-1` remain accepted because
|
|
1186
|
-
* they map directly to the transport shape.
|
|
1187
|
-
*/
|
|
1188
919
|
type SortDirection = 'asc' | 'desc' | 1 | -1;
|
|
1189
920
|
type SortSpec<T = ParsedContentMeta> = string extends keyof T ? {
|
|
1190
921
|
[key: string]: SortDirection | undefined;
|
|
1191
922
|
} : {
|
|
1192
923
|
[K in keyof T]?: SortDirection;
|
|
1193
924
|
};
|
|
1194
|
-
/**
|
|
1195
|
-
* Schema of a collection handle (recovered from its `__schema` phantom).
|
|
1196
|
-
*
|
|
1197
|
-
* Uses `StrictParsedContentMeta` (no `[key: string]: unknown` index signature)
|
|
1198
|
-
* as the base so `keyof HandleSchema<H>` is a finite union of the user's
|
|
1199
|
-
* declared schema fields plus the internal `_*` meta fields. This is what
|
|
1200
|
-
* makes `QueryWhere<HandleSchema<H>>` reject typo'd field names at compile time.
|
|
1201
|
-
*/
|
|
1202
925
|
type HandleSchema<H> = H extends {
|
|
1203
926
|
__schema: infer S;
|
|
1204
927
|
} ? S extends {
|
|
1205
928
|
_output: infer O;
|
|
1206
|
-
} ? O & StrictParsedContentMeta : StrictParsedContentMeta : StrictParsedContentMeta;
|
|
1207
|
-
type SelectFields<H> =
|
|
1208
|
-
/**
|
|
1209
|
-
* Runtime document shape inferred from a collection handle.
|
|
1210
|
-
*/
|
|
929
|
+
} ? O & StrictParsedContentMeta : StrictParsedContentMeta : H extends ContentCollectionName ? ContentCollectionMap[H] & StrictParsedContentMeta : StrictParsedContentMeta;
|
|
930
|
+
type SelectFields<H> = string extends H ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof HandleSchema<H>, string>>;
|
|
1211
931
|
type DocumentFromHandle<H> = H extends {
|
|
1212
932
|
__schema: {
|
|
1213
933
|
_output: infer O;
|
|
1214
934
|
};
|
|
1215
|
-
} ? O &
|
|
1216
|
-
|
|
1217
|
-
* Explicit reference population map. Keys are fields on the source document;
|
|
1218
|
-
* values are target collection handles.
|
|
1219
|
-
*/
|
|
1220
|
-
type PopulateSpec = Record<string, ContentCollectionHandle | string>;
|
|
935
|
+
} ? O & StrictParsedContent : H extends ContentCollectionName ? ContentCollectionMap[H] : ParsedContent;
|
|
936
|
+
type PopulateSpec = Record<string, ContentCollectionTarget>;
|
|
1221
937
|
type PopulatedDocument<T, P> = P extends undefined ? T : P extends PopulateSpec ? string extends keyof P ? T : Omit<T, keyof P> & {
|
|
1222
938
|
[K in keyof P & keyof T]: T[K] extends ReadonlyArray<unknown> ? Array<LocalizedDoc<DocumentFromHandle<P[K]>>> : LocalizedDoc<DocumentFromHandle<P[K]>> | null;
|
|
1223
939
|
} : T;
|
|
@@ -1227,15 +943,9 @@ type PopulateFromOptions<O> = O extends {
|
|
|
1227
943
|
type PopulateOption<P extends PopulateSpec | undefined = undefined> = {
|
|
1228
944
|
populate?: P;
|
|
1229
945
|
};
|
|
1230
|
-
/**
|
|
1231
|
-
* Whether a collection handle declares i18n at the type level.
|
|
1232
|
-
*/
|
|
1233
946
|
type HandleIsI18n<H> = H extends {
|
|
1234
947
|
__i18n: infer I;
|
|
1235
|
-
} ? I extends true ? true : false : false;
|
|
1236
|
-
/**
|
|
1237
|
-
* Locale option made required when the handle is i18n.
|
|
1238
|
-
*/
|
|
948
|
+
} ? I extends true ? true : false : H extends keyof ContentCollectionI18nMap ? true : false;
|
|
1239
949
|
type LocaleOption<H, OptKey extends string = 'locale'> = HandleIsI18n<H> extends true ? {
|
|
1240
950
|
[K in OptKey]: string;
|
|
1241
951
|
} : {
|
|
@@ -1250,24 +960,15 @@ type BacklinksLocaleOption<Target, Source> = HandleIsI18n<Target> extends true ?
|
|
|
1250
960
|
locale?: string;
|
|
1251
961
|
};
|
|
1252
962
|
type LocaleFallback = false | true | 'default' | string | string[];
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
type LocalizedDoc<T = ParsedContentMeta> = T & ContentRouteMeta & {
|
|
1259
|
-
/**
|
|
1260
|
-
* Locale-agnostic path stem derived from the source file.
|
|
1261
|
-
*/
|
|
963
|
+
type LocalizedContentDocument<T = ParsedContentMeta> = T & ContentRouteMeta & {
|
|
964
|
+
locale: string;
|
|
965
|
+
path: string;
|
|
966
|
+
canonicalPath: string;
|
|
967
|
+
localePaths: Record<string, LocalePathEntry>;
|
|
1262
968
|
stem?: string;
|
|
1263
|
-
/**
|
|
1264
|
-
* Source file extension when it can be inferred.
|
|
1265
|
-
*/
|
|
1266
969
|
extension?: string;
|
|
1267
970
|
};
|
|
1268
|
-
|
|
1269
|
-
* Explain how `resolveOne` interpreted the request and what it matched.
|
|
1270
|
-
*/
|
|
971
|
+
type LocalizedDoc<T = ParsedContentMeta> = LocalizedContentDocument<T>;
|
|
1271
972
|
interface ResolutionEnvelope {
|
|
1272
973
|
requested: {
|
|
1273
974
|
collection: string;
|
|
@@ -1291,25 +992,16 @@ interface ResolutionEnvelope {
|
|
|
1291
992
|
locale?: string;
|
|
1292
993
|
};
|
|
1293
994
|
}
|
|
1294
|
-
/**
|
|
1295
|
-
* Result returned by `resolveOne`.
|
|
1296
|
-
*/
|
|
1297
995
|
interface ResolveOneResult<T = ParsedContentMeta> {
|
|
1298
996
|
doc: LocalizedDoc<T> | null;
|
|
1299
997
|
explain: ResolutionEnvelope;
|
|
1300
998
|
}
|
|
1301
|
-
/**
|
|
1302
|
-
* Options accepted by `resolveOne(handle, options)` and `one(handle, options)`.
|
|
1303
|
-
*/
|
|
1304
999
|
type ResolveOneOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = {
|
|
1305
1000
|
by: ContentSelector;
|
|
1306
1001
|
fallback?: LocaleFallback;
|
|
1307
1002
|
select?: SelectFields<H>;
|
|
1308
1003
|
} & LocaleOption<H> & PopulateOption<P>;
|
|
1309
1004
|
type OneOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = ResolveOneOptions<H, P>;
|
|
1310
|
-
/**
|
|
1311
|
-
* Options accepted by `many(handle, options)`.
|
|
1312
|
-
*/
|
|
1313
1005
|
type ManyOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = {
|
|
1314
1006
|
where?: QueryWhere<HandleSchema<H>>;
|
|
1315
1007
|
sort?: SortSpec<HandleSchema<H>>;
|
|
@@ -1318,26 +1010,10 @@ type ManyOptions<H = unknown, P extends PopulateSpec | undefined = undefined> =
|
|
|
1318
1010
|
fallback?: LocaleFallback;
|
|
1319
1011
|
select?: SelectFields<H>;
|
|
1320
1012
|
} & LocaleOption<H> & PopulateOption<P>;
|
|
1321
|
-
/**
|
|
1322
|
-
* Options accepted by `paginate(handle, options)`.
|
|
1323
|
-
*/
|
|
1324
1013
|
type PaginationOptions<H = unknown, P extends PopulateSpec | undefined = undefined> = Omit<ManyOptions<H, P>, 'skip' | 'limit'> & {
|
|
1325
|
-
/**
|
|
1326
|
-
* One-based page number.
|
|
1327
|
-
*
|
|
1328
|
-
* @default 1
|
|
1329
|
-
*/
|
|
1330
1014
|
page?: number;
|
|
1331
|
-
/**
|
|
1332
|
-
* Number of documents per page.
|
|
1333
|
-
*
|
|
1334
|
-
* @default 10
|
|
1335
|
-
*/
|
|
1336
1015
|
limit?: number;
|
|
1337
1016
|
};
|
|
1338
|
-
/**
|
|
1339
|
-
* Result returned by `paginate()` and `useContentPagination()`.
|
|
1340
|
-
*/
|
|
1341
1017
|
interface PaginationResult<T = ParsedContentMeta> {
|
|
1342
1018
|
data: Array<LocalizedDoc<T>>;
|
|
1343
1019
|
page: number;
|
|
@@ -1349,68 +1025,40 @@ interface PaginationResult<T = ParsedContentMeta> {
|
|
|
1349
1025
|
nextPage: number | null;
|
|
1350
1026
|
prevPage: number | null;
|
|
1351
1027
|
}
|
|
1352
|
-
type BacklinkSource =
|
|
1028
|
+
type BacklinkSource = ContentCollectionTarget;
|
|
1353
1029
|
type SourceName<S> = S extends string ? S : S extends {
|
|
1354
1030
|
name: infer N;
|
|
1355
1031
|
} ? Extract<N, string> : string;
|
|
1356
1032
|
type BacklinkFields<S = BacklinkSource | ReadonlyArray<BacklinkSource>> = ReadonlyArray<string> | Partial<Record<SourceName<S extends ReadonlyArray<infer I> ? I : S>, ReadonlyArray<string>>>;
|
|
1357
1033
|
type DocumentFromSource<S> = S extends ReadonlyArray<infer I> ? DocumentFromHandle<I> : DocumentFromHandle<S>;
|
|
1358
|
-
/**
|
|
1359
|
-
* Options accepted by `backlinks(targetHandle, options)`.
|
|
1360
|
-
*/
|
|
1361
1034
|
type BacklinksOptions<Target = unknown, Source extends BacklinkSource | ReadonlyArray<BacklinkSource> = BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined> = {
|
|
1362
|
-
/**
|
|
1363
|
-
* Target document to find incoming references for.
|
|
1364
|
-
*/
|
|
1365
1035
|
by: ContentSelector;
|
|
1366
|
-
/**
|
|
1367
|
-
* Source collection handle(s) to scan for references.
|
|
1368
|
-
*/
|
|
1369
1036
|
from: Source;
|
|
1370
|
-
/**
|
|
1371
|
-
* Explicit reference fields on the source collection(s). When omitted,
|
|
1372
|
-
* fields are inferred from source handles that use `reference()`.
|
|
1373
|
-
*/
|
|
1374
1037
|
fields?: BacklinkFields<Source>;
|
|
1375
1038
|
sort?: SortSpec<DocumentFromSource<Source>>;
|
|
1376
1039
|
limit?: number;
|
|
1377
1040
|
skip?: number;
|
|
1378
1041
|
fallback?: LocaleFallback;
|
|
1379
|
-
select?:
|
|
1042
|
+
select?: string extends Source ? ReadonlyArray<string> : ReadonlyArray<Extract<keyof DocumentFromSource<Source>, string>>;
|
|
1380
1043
|
} & BacklinksLocaleOption<Target, Source> & PopulateOption<P>;
|
|
1381
1044
|
type BacklinksResult<Source extends BacklinkSource | ReadonlyArray<BacklinkSource> = BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined> = Array<LocalizedDoc<PopulatedDocument<DocumentFromSource<Source>, P>>>;
|
|
1382
|
-
/**
|
|
1383
|
-
* Options accepted by `variants(handle, options)`.
|
|
1384
|
-
*/
|
|
1385
1045
|
type VariantsOptions<H = unknown> = {
|
|
1386
1046
|
by: ContentSelector;
|
|
1387
|
-
/**
|
|
1388
|
-
* Restrict to a subset of locales. Defaults to all configured locales.
|
|
1389
|
-
*/
|
|
1390
1047
|
locales?: string[];
|
|
1391
1048
|
} & LocaleOption<H>;
|
|
1392
|
-
/**
|
|
1393
|
-
* Variant entry returned by `variants()` and `useContentVariants()`.
|
|
1394
|
-
*/
|
|
1395
1049
|
interface ContentVariant<_T = ParsedContentMeta> {
|
|
1396
1050
|
locale: string;
|
|
1397
1051
|
path: string;
|
|
1398
1052
|
translated: boolean;
|
|
1399
1053
|
fallback?: string;
|
|
1400
1054
|
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Options accepted by `tree(handle, options)`.
|
|
1403
|
-
*/
|
|
1404
1055
|
type TreeOptions<H = unknown, Fields extends ReadonlyArray<keyof HandleSchema<H> | string> | undefined = undefined> = {
|
|
1405
1056
|
where?: QueryWhere<HandleSchema<H>>;
|
|
1406
1057
|
sort?: SortSpec<HandleSchema<H>>;
|
|
1407
1058
|
fields?: Fields;
|
|
1408
1059
|
fallback?: LocaleFallback;
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
* Typed navigation item. Requested `fields` are preserved in the return type
|
|
1412
|
-
* without keeping the old open index signature.
|
|
1413
|
-
*/
|
|
1060
|
+
locale?: string;
|
|
1061
|
+
};
|
|
1414
1062
|
type ContentTreeItem<T = ParsedContentMeta, Fields extends ReadonlyArray<keyof T | string> | undefined = undefined> = {
|
|
1415
1063
|
title: string;
|
|
1416
1064
|
path: string;
|
|
@@ -1418,20 +1066,11 @@ type ContentTreeItem<T = ParsedContentMeta, Fields extends ReadonlyArray<keyof T
|
|
|
1418
1066
|
children?: Array<ContentTreeItem<T, Fields>>;
|
|
1419
1067
|
} & (Fields extends ReadonlyArray<infer K> ? Pick<T, Extract<K, keyof T>> : Record<never, never>);
|
|
1420
1068
|
|
|
1421
|
-
/**
|
|
1422
|
-
* Options accepted by `neighbors(handle, options)`.
|
|
1423
|
-
*
|
|
1424
|
-
* Identifying the anchor document lives in `filter`, same as every other
|
|
1425
|
-
* verb. Only the reserved selectors `path` and `ref` are accepted.
|
|
1426
|
-
*/
|
|
1427
1069
|
type NeighborsOptions<H = unknown> = {
|
|
1428
1070
|
by: ContentSelector;
|
|
1429
1071
|
fallback?: LocaleFallback;
|
|
1430
1072
|
fields?: SelectFields<H>;
|
|
1431
1073
|
} & LocaleOption<H>;
|
|
1432
|
-
/**
|
|
1433
|
-
* Result of `neighbors()` and `useContentNeighbors()`.
|
|
1434
|
-
*/
|
|
1435
1074
|
interface NeighborsResult<T = ParsedContentMeta> {
|
|
1436
1075
|
prev: ContentTreeItem<T> | null;
|
|
1437
1076
|
next: ContentTreeItem<T> | null;
|
|
@@ -1448,7 +1087,7 @@ interface ContentMiniSearchOptions {
|
|
|
1448
1087
|
/**
|
|
1449
1088
|
* Fields copied into search result payloads.
|
|
1450
1089
|
*
|
|
1451
|
-
* @default ['path', 'title', 'excerpt', 'anchor', 'locale']
|
|
1090
|
+
* @default ['path', 'title', 'excerpt', 'anchor', 'locale', 'collection']
|
|
1452
1091
|
*/
|
|
1453
1092
|
storeFields: string[];
|
|
1454
1093
|
/**
|
|
@@ -1478,6 +1117,7 @@ interface ContentSearchPublicRuntimeConfig {
|
|
|
1478
1117
|
}
|
|
1479
1118
|
interface ContentSearchIndexRecord {
|
|
1480
1119
|
id: string;
|
|
1120
|
+
collection: string;
|
|
1481
1121
|
path: string;
|
|
1482
1122
|
title: string;
|
|
1483
1123
|
excerpt: string;
|
|
@@ -1488,6 +1128,7 @@ interface ContentSearchIndexRecord {
|
|
|
1488
1128
|
[field: string]: unknown;
|
|
1489
1129
|
}
|
|
1490
1130
|
interface ContentSearchResult {
|
|
1131
|
+
collection: string;
|
|
1491
1132
|
path: string;
|
|
1492
1133
|
title: string;
|
|
1493
1134
|
excerpt: string;
|
|
@@ -1659,6 +1300,36 @@ interface ContentSitemapAssertOptions {
|
|
|
1659
1300
|
* @default []
|
|
1660
1301
|
*/
|
|
1661
1302
|
requiredCollections?: string[];
|
|
1303
|
+
/**
|
|
1304
|
+
* Public URL paths that must appear in generated sitemap loc values.
|
|
1305
|
+
*
|
|
1306
|
+
* Values are compared by URL pathname, so absolute sitemap URLs are
|
|
1307
|
+
* normalized before assertion. Use this for release QA of important route
|
|
1308
|
+
* identities; keep `requiredCollections` for the broader content invariant.
|
|
1309
|
+
*
|
|
1310
|
+
* @default []
|
|
1311
|
+
*/
|
|
1312
|
+
requiredPaths?: string[];
|
|
1313
|
+
/**
|
|
1314
|
+
* Public URL path prefixes that must not appear in generated sitemap loc
|
|
1315
|
+
* values.
|
|
1316
|
+
*
|
|
1317
|
+
* Use this to guard against internal/generated routes such as `/_payload`,
|
|
1318
|
+
* `/_nuxt`, API routes, or auth-only sections.
|
|
1319
|
+
*
|
|
1320
|
+
* @default []
|
|
1321
|
+
*/
|
|
1322
|
+
forbiddenPathPrefixes?: string[];
|
|
1323
|
+
/**
|
|
1324
|
+
* Fail when generated sitemap URLs use placeholder or local hosts such as
|
|
1325
|
+
* `example.com`, `localhost`, `127.0.0.1`, or `.localhost`.
|
|
1326
|
+
*
|
|
1327
|
+
* Enable this for production-like release checks. It is disabled by default
|
|
1328
|
+
* so local examples and template builds can still generate static output.
|
|
1329
|
+
*
|
|
1330
|
+
* @default false
|
|
1331
|
+
*/
|
|
1332
|
+
requireProductionSiteUrl?: boolean;
|
|
1662
1333
|
/**
|
|
1663
1334
|
* Optional per-sitemap overrides keyed by sitemap name, for example `en-US`.
|
|
1664
1335
|
*
|
|
@@ -1694,7 +1365,8 @@ interface ContentSearchOptions {
|
|
|
1694
1365
|
/**
|
|
1695
1366
|
* Collections included in the built-in index.
|
|
1696
1367
|
*
|
|
1697
|
-
* When omitted,
|
|
1368
|
+
* When omitted, Ginko indexes route-backed public collections only. Data-only
|
|
1369
|
+
* collections are excluded unless listed explicitly.
|
|
1698
1370
|
*/
|
|
1699
1371
|
collections?: string[];
|
|
1700
1372
|
/**
|
|
@@ -1733,6 +1405,12 @@ interface ContentRevalidateOptions {
|
|
|
1733
1405
|
*/
|
|
1734
1406
|
allowUnsigned?: boolean;
|
|
1735
1407
|
}
|
|
1408
|
+
interface ContentAgentRouteOptions {
|
|
1409
|
+
routes?: boolean;
|
|
1410
|
+
linkHeaders?: boolean;
|
|
1411
|
+
markdownNegotiation?: boolean;
|
|
1412
|
+
prerender?: boolean;
|
|
1413
|
+
}
|
|
1736
1414
|
interface ModuleOptions {
|
|
1737
1415
|
api: {
|
|
1738
1416
|
/**
|
|
@@ -1757,8 +1435,9 @@ interface ModuleOptions {
|
|
|
1757
1435
|
* Built-in full-text search configuration.
|
|
1758
1436
|
*
|
|
1759
1437
|
* When enabled, Ginko exposes JSON/Pagefind search endpoints under
|
|
1760
|
-
* the content api base route.
|
|
1761
|
-
*
|
|
1438
|
+
* the content api base route. `useContentSearchData()` and
|
|
1439
|
+
* `useContentSearchResults()` are auto-imported; import the headless
|
|
1440
|
+
* `useContentSearch()` helper from `@lupinum/ginko-content/client`.
|
|
1762
1441
|
*/
|
|
1763
1442
|
search: false | ContentSearchOptions;
|
|
1764
1443
|
/**
|
|
@@ -1775,6 +1454,10 @@ interface ModuleOptions {
|
|
|
1775
1454
|
* `x-ginko-revalidate-token` or `authorization: Bearer <token>`.
|
|
1776
1455
|
*/
|
|
1777
1456
|
revalidate?: false | ContentRevalidateOptions;
|
|
1457
|
+
/**
|
|
1458
|
+
* First-class agent markdown and LLM route features.
|
|
1459
|
+
*/
|
|
1460
|
+
agent?: false | ContentAgentRouteOptions;
|
|
1778
1461
|
/**
|
|
1779
1462
|
* Optional server-side cache adapter module.
|
|
1780
1463
|
*
|
|
@@ -1788,9 +1471,7 @@ interface ModuleOptions {
|
|
|
1788
1471
|
*
|
|
1789
1472
|
* @default true
|
|
1790
1473
|
*/
|
|
1791
|
-
watch:
|
|
1792
|
-
ws: Partial<ListenOptions>;
|
|
1793
|
-
};
|
|
1474
|
+
watch: boolean;
|
|
1794
1475
|
/**
|
|
1795
1476
|
* Contents can be located in multiple places, in multiple directories or even in remote git repositories.
|
|
1796
1477
|
* Using sources option you can tell Content module where to look for contents.
|
|
@@ -1926,6 +1607,9 @@ interface ContentContext extends ModuleOptions {
|
|
|
1926
1607
|
translatedSlugs: boolean;
|
|
1927
1608
|
strictTranslatedSlugs: boolean;
|
|
1928
1609
|
}
|
|
1610
|
+
type ResolvedContentContext = Omit<ContentContext, 'markdown'> & {
|
|
1611
|
+
markdown: MarkdownOptions;
|
|
1612
|
+
};
|
|
1929
1613
|
|
|
1930
1614
|
interface ContentCacheArtifact<T = ParsedContent> {
|
|
1931
1615
|
parsed: T;
|
|
@@ -1954,7 +1638,7 @@ interface ParseContentOptions {
|
|
|
1954
1638
|
validate?: boolean;
|
|
1955
1639
|
csv?: ModuleOptions['csv'];
|
|
1956
1640
|
yaml?: ModuleOptions['yaml'];
|
|
1957
|
-
markdown?: ModuleOptions['markdown'];
|
|
1641
|
+
markdown?: ModuleOptions['markdown'] | MarkdownOptions;
|
|
1958
1642
|
transformers?: ContentTransformer[];
|
|
1959
1643
|
pathMeta?: {
|
|
1960
1644
|
locales?: ContentContext['locales'];
|
|
@@ -1970,12 +1654,6 @@ type TransformContentSource = string | StorageValue;
|
|
|
1970
1654
|
|
|
1971
1655
|
declare function createSearchRuntimeConfig(search: Exclude<ModuleOptions$1['search'], false>, apiBaseURL: string): ContentSearchPublicRuntimeConfig$1;
|
|
1972
1656
|
|
|
1973
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions$1, ModuleOptions$1, false>;
|
|
1974
|
-
|
|
1975
|
-
interface ModuleHooks {
|
|
1976
|
-
'content:providers'(providers: Record<string, string>): void | Promise<void>;
|
|
1977
|
-
'content:context'(ctx: ContentContext$1): void | Promise<void>;
|
|
1978
|
-
}
|
|
1979
1657
|
interface ModulePublicRuntimeConfig {
|
|
1980
1658
|
experimental: {
|
|
1981
1659
|
stripQueryParameters: boolean;
|
|
@@ -2006,7 +1684,6 @@ interface ModulePublicRuntimeConfig {
|
|
|
2006
1684
|
translatedSlugs: ContentContext$1['translatedSlugs'];
|
|
2007
1685
|
strictTranslatedSlugs: ContentContext$1['strictTranslatedSlugs'];
|
|
2008
1686
|
markdown: MarkdownOptions$1;
|
|
2009
|
-
wsUrl?: string;
|
|
2010
1687
|
navigation: ModuleOptions$1['navigation'];
|
|
2011
1688
|
search: ReturnType<typeof createSearchRuntimeConfig> | false;
|
|
2012
1689
|
contentHead: ModuleOptions$1['contentHead'];
|
|
@@ -2041,5 +1718,12 @@ declare module 'nitropack' {
|
|
|
2041
1718
|
}
|
|
2042
1719
|
}
|
|
2043
1720
|
|
|
2044
|
-
|
|
2045
|
-
|
|
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
|
+
|
|
1728
|
+
export { _default as default, normalizeContentConfigCollectionNames };
|
|
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 };
|