content-query 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/{build-DfoncKL8.d.mts → build-Aoi7Unm0.d.mts} +3 -3
- package/dist/{build-DWpB69_c.mjs → build-CIw4yWs9.mjs} +2 -1
- package/dist/build.d.mts +1 -1
- package/dist/build.mjs +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/{collection-types-CsQtGw7_.d.mts → collection-types-DhIxnCSM.d.mts} +2 -2
- package/dist/computed.d.mts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/internal.d.mts +4 -4
- package/dist/next.d.mts +1 -1
- package/dist/next.mjs +1 -1
- package/dist/query.d.mts +1 -1
- package/dist/{relational-types-CTcalUNW.d.mts → relational-types-PtrzENt0.d.mts} +8 -6
- package/dist/{revision-DBwU-aC9.d.mts → revision-aqGUf6YV.d.mts} +3 -3
- package/dist/runtime.d.mts +1 -1
- package/dist/{types-Dz1vTXa2.d.mts → types-WOsFmNnN.d.mts} +18 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,6 +100,17 @@ import type { ContentPost } from "#content-query/posts";
|
|
|
100
100
|
type PostLink = ContentPost<"id" | "title">; // What select("id", "title") returns.
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
To describe a field, write a JSDoc comment above it in the schema or above a computed field's name. Editors show the comment when you hover that field on `ContentPost`, on `ContentPost<"id" | "title">`, and on query results:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
schema: schema.object({
|
|
107
|
+
/** The headline, also used as the page title. */
|
|
108
|
+
title: schema.string(),
|
|
109
|
+
}),
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Zod's `.describe()` and `.meta()` store descriptions at runtime only, so they don't show up in types.
|
|
113
|
+
|
|
103
114
|
Type names are `Content` plus the export name, capitalized and made singular by dropping one trailing `s` (`jobs` gives `ContentJob`, `coding` gives `ContentCoding`). Set `typeName: "Category"` in `defineCollection()` for irregular plurals. Declared payloads are typed as `ContentPostPayload<"detail">`. Collection names that are not identifiers are converted for the export and import path, such as `blog-posts` to `blogPosts`; two collections that would share an export or type name fail the build.
|
|
104
115
|
|
|
105
116
|
Paginate root queries in one call. `paginate({ page: 2, size: 10 })` returns `items`, `total`, `page`, `pageCount`, `hasNextPage`, and `hasPreviousPage` for numbered archive pages. `paginate({ size: 10, after: previous.endCursor })` returns cursor pages with `startCursor` and `endCursor` for "load more" lists. Both work in fluent queries and in `posts.paginate()`; see [pagination](https://github.com/yangshun/content-query/blob/main/docs/API.md#pagination).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as InvalidRelationships, r as CollectionHandles, s as ContentError } from "./collection-types-
|
|
2
|
-
import { i as CollectionRegistry } from "./types-
|
|
1
|
+
import { a as InvalidRelationships, r as CollectionHandles, s as ContentError } from "./collection-types-DhIxnCSM.mjs";
|
|
2
|
+
import { i as CollectionRegistry } from "./types-WOsFmNnN.mjs";
|
|
3
3
|
import { n as QueryStyle } from "./query-style-C2FcT1f9.mjs";
|
|
4
|
-
import "./revision-
|
|
4
|
+
import "./revision-aqGUf6YV.mjs";
|
|
5
5
|
//#region src/preparation/session.d.ts
|
|
6
6
|
/** A local source captured by a successfully prepared content revision. */
|
|
7
7
|
type ContentSourceEntry = Readonly<{
|
|
@@ -193,6 +193,7 @@ function configTypes(directory, config) {
|
|
|
193
193
|
* The entry type, such as `ContentJob`, is the full entry. `ContentJob<Field>` is the shape a
|
|
194
194
|
* query returns when it selects `Field`: every selected key is present, and optional fields read
|
|
195
195
|
* as `undefined` when missing, so query results and the type are assignable in both directions.
|
|
196
|
+
* Both forms keep JSDoc comments written on schema fields and computed field names.
|
|
196
197
|
*
|
|
197
198
|
* @param directory - Directory that will contain the declaration file.
|
|
198
199
|
* @param config - Absolute path of content-query.config.
|
|
@@ -209,7 +210,7 @@ function collectionDeclarations(directory, config, name, { exportName, typeName,
|
|
|
209
210
|
`/** The ${exportName} collection. Start queries here, or pass it to another collection's \`using()\` to follow relationships into it. */`,
|
|
210
211
|
`export declare const ${exportName}: import("content-query/runtime").Collection<Registry, ${key}, ConfiguredQueryStyle>;`,
|
|
211
212
|
`/** A ${exportName} entry: its ID, validated metadata, and computed fields. Pass field names, such as \`${typeName}<"id">\`, for the shape a query returns when it selects them. */`,
|
|
212
|
-
`export type ${typeName}<Field extends keyof ${data} = keyof ${data}> = keyof ${data} extends Field ? ${data} : {
|
|
213
|
+
`export type ${typeName}<Field extends keyof ${data} = keyof ${data}> = keyof ${data} extends Field ? ${data} : import("content-query").SelectedData<${data}, Field>;`,
|
|
213
214
|
`/** The value of one payload that the ${exportName} collection declares. */`,
|
|
214
215
|
`export type ${payloadTypeName}<Payload extends keyof import("content-query").PayloadsOf<${definition}>> = import("content-query").PayloadData<${definition}, Payload>;`,
|
|
215
216
|
``
|
package/dist/build.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ContentSourceEvent, i as ContentSourceEntry, n as buildContent, o as ContentSourceSnapshot, r as ContentSession, t as BuildContentOptions } from "./build-
|
|
1
|
+
import { a as ContentSourceEvent, i as ContentSourceEntry, n as buildContent, o as ContentSourceSnapshot, r as ContentSession, t as BuildContentOptions } from "./build-Aoi7Unm0.mjs";
|
|
2
2
|
export { type BuildContentOptions, type ContentSession, type ContentSourceEntry, type ContentSourceEvent, type ContentSourceSnapshot, buildContent };
|
package/dist/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as buildContent } from "./build-
|
|
1
|
+
export { n as buildContent } from "./build-CIw4yWs9.mjs";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { o as payloadIdentity, t as ContentError } from "./errors-Bfd0R4_P.mjs";
|
|
3
|
-
import { t as buildAtRoot } from "./build-
|
|
3
|
+
import { t as buildAtRoot } from "./build-CIw4yWs9.mjs";
|
|
4
4
|
import { cac } from "cac";
|
|
5
5
|
//#region package.json
|
|
6
|
-
var version = "0.5.
|
|
6
|
+
var version = "0.5.1";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/integrations/cli/arguments.ts
|
|
9
9
|
/** Validates one path option after CAC's automatic numeric conversion. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as Relationship, g as QueryData, i as CollectionRegistry, u as LoadedMarker, v as RelationshipsOf } from "./types-
|
|
2
|
-
import { n as RelationalCountOptions, t as RelationalCollectionQueries, v as Query } from "./relational-types-
|
|
1
|
+
import { _ as Relationship, g as QueryData, i as CollectionRegistry, u as LoadedMarker, v as RelationshipsOf } from "./types-WOsFmNnN.mjs";
|
|
2
|
+
import { n as RelationalCountOptions, t as RelationalCollectionQueries, v as Query } from "./relational-types-PtrzENt0.mjs";
|
|
3
3
|
import { i as QueryStyleMember, n as QueryStyle, r as QueryStyleDisabled, t as MembersOf } from "./query-style-C2FcT1f9.mjs";
|
|
4
4
|
//#region src/shared/errors.d.ts
|
|
5
5
|
type ContentErrorCode = "variant-not-found" | "not-renderable" | "source-error" | "validation-error" | "duplicate-id" | "invalid-reference" | "invalid-query" | "invalid-cursor" | "artifact-error" | "render-error";
|
package/dist/computed.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as MaybePromise } from "./descriptor-bcPa6XLk.mjs";
|
|
2
|
-
import { a as ComputedContext } from "./types-
|
|
2
|
+
import { a as ComputedContext } from "./types-WOsFmNnN.mjs";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
//#region src/computed/text.d.ts
|
|
5
5
|
/** The syntax removed before computing text-derived fields; literal text preserves all characters. */
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as DataStore, c as Loader, d as LoaderLogger, f as LoaderSource, g as MaybePromise, h as RecordLoader, i as DataEntry, l as LoaderConfig, m as MetaStore, n as GlobOptions, o as FileEntrySource, p as LoaderWatcher, r as BodyLoader, s as FileSource, u as LoaderContext } from "./descriptor-bcPa6XLk.mjs";
|
|
2
2
|
import { n as ContentRenderResult, r as RenderedContent, t as ContentHeading } from "./types-Dh-Sydyw.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { D as VariantValues, E as VariantOf, T as VariantField, _ as Relationship, a as ComputedContext, b as SchemaOutput, c as EntryFiles, d as PayloadContext, f as PayloadData, g as QueryData, h as PayloadsOf, i as CollectionRegistry, l as FileEntry, m as PayloadDefinition, n as BuiltinPayloads, o as CustomPayload, p as PayloadDeclaration, r as CollectionDefinition, s as CustomPayloadMarker, t as BuiltinPayloadMarker, w as VariantContext, x as SelectedData, y as Schema } from "./types-WOsFmNnN.mjs";
|
|
4
4
|
import { n as QueryStyle } from "./query-style-C2FcT1f9.mjs";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
6
|
//#region src/collection/source.d.ts
|
|
@@ -134,4 +134,4 @@ export declare function defineCollection<const SourceSchema extends StandardSche
|
|
|
134
134
|
*/
|
|
135
135
|
export declare function defineCollection<const SourceSchema extends StandardSchemaV1<unknown, Record<string, unknown>> | undefined = undefined, const ComputedSchemas extends Record<string, Schema> = {}, const Relationships extends Record<string, Relationship> = {}, const PayloadSchemas extends Record<string, Schema> = {}, const PayloadVariants extends Record<string, unknown> = {}, const ContentLoader extends Loader = Loader>(definition: Definition<SourceSchema, ComputedSchemas, Relationships, PayloadSchemas, PayloadVariants, ContentLoader>): Defined<SourceSchema, ComputedSchemas, Relationships, PayloadSchemas, PayloadVariants, ContentLoader> & BuiltinPayloadMarker<[ContentLoader] extends [RecordLoader] ? never : [ContentLoader] extends [BodyLoader] ? "_body" : keyof BuiltinPayloads>;
|
|
136
136
|
//#endregion
|
|
137
|
-
export type { BodyLoader, BuiltinPayloads, CollectionDefinition, CollectionRegistry, CollectionSource, ComputedContext, ContentHeading, ContentRenderResult, DataEntry, DataStore, EntryFiles, FileEntry, FileEntrySource, FileSource, Loader, LoaderConfig, LoaderContext, LoaderLogger, LoaderSource, LoaderWatcher, MaybePromise, MetaStore, PayloadContext, PayloadData, PayloadDeclaration, PayloadDefinition, PayloadsOf, QueryData, QueryStyle, RecordLoader, Relationship, RenderedContent, VariantContext, VariantField, VariantOf, VariantValues };
|
|
137
|
+
export type { BodyLoader, BuiltinPayloads, CollectionDefinition, CollectionRegistry, CollectionSource, ComputedContext, ContentHeading, ContentRenderResult, DataEntry, DataStore, EntryFiles, FileEntry, FileEntrySource, FileSource, Loader, LoaderConfig, LoaderContext, LoaderLogger, LoaderSource, LoaderWatcher, MaybePromise, MetaStore, PayloadContext, PayloadData, PayloadDeclaration, PayloadDefinition, PayloadsOf, QueryData, QueryStyle, RecordLoader, Relationship, RenderedContent, SelectedData, VariantContext, VariantField, VariantOf, VariantValues };
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as Collection, r as CollectionHandles, s as ContentError } from "./collection-types-
|
|
1
|
+
import { n as Collection, r as CollectionHandles, s as ContentError } from "./collection-types-DhIxnCSM.mjs";
|
|
2
2
|
import { n as ContentRenderResult } from "./types-Dh-Sydyw.mjs";
|
|
3
|
-
import { i as CollectionRegistry } from "./types-
|
|
4
|
-
import { O as QueryRegistry } from "./relational-types-
|
|
3
|
+
import { i as CollectionRegistry } from "./types-WOsFmNnN.mjs";
|
|
4
|
+
import { O as QueryRegistry } from "./relational-types-PtrzENt0.mjs";
|
|
5
5
|
import { n as QueryStyle } from "./query-style-C2FcT1f9.mjs";
|
|
6
|
-
import { n as PreparedRevision, t as ContentState } from "./revision-
|
|
6
|
+
import { n as PreparedRevision, t as ContentState } from "./revision-aqGUf6YV.mjs";
|
|
7
7
|
//#region src/artifacts/types.d.ts
|
|
8
8
|
type ArtifactManifest = {
|
|
9
9
|
version: number;
|
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BuildContentOptions } from "./build-
|
|
1
|
+
import { t as BuildContentOptions } from "./build-Aoi7Unm0.mjs";
|
|
2
2
|
import { NextConfig } from "next";
|
|
3
3
|
//#region src/integrations/next/plugin.d.ts
|
|
4
4
|
/** Content locations for Next.js; the adapter chooses generated storage and the watch lifecycle. */
|
package/dist/next.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { I as collectionNames } from "./operators-D-w1-gDg.mjs";
|
|
2
|
-
import { c as collectionDeclarations, i as resolveConfigPath, t as buildAtRoot } from "./build-
|
|
2
|
+
import { c as collectionDeclarations, i as resolveConfigPath, t as buildAtRoot } from "./build-CIw4yWs9.mjs";
|
|
3
3
|
import { n as serializeContentError } from "./diagnostics-DmUZtrJ6.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
package/dist/query.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Selection, E as Expression, S as ScalarField, T as Where, _ as PaginateResult, a as RelationalQueryOptions, b as RelationField, c as Adjacent, d as Field, f as Fields, g as PaginateOptions, h as PageOptions, i as RelationalQueries, l as CursorOptions, m as Ordered, n as RelationalCountOptions, o as RelationalQueryResult, p as NumberedPage, r as RelationalPaginateOptions, s as RelationalWhere, u as CursorPage, w as SelectionResult, x as Scalar, y as QueryFields } from "./relational-types-
|
|
1
|
+
import { C as Selection, E as Expression, S as ScalarField, T as Where, _ as PaginateResult, a as RelationalQueryOptions, b as RelationField, c as Adjacent, d as Field, f as Fields, g as PaginateOptions, h as PageOptions, i as RelationalQueries, l as CursorOptions, m as Ordered, n as RelationalCountOptions, o as RelationalQueryResult, p as NumberedPage, r as RelationalPaginateOptions, s as RelationalWhere, u as CursorPage, w as SelectionResult, x as Scalar, y as QueryFields } from "./relational-types-PtrzENt0.mjs";
|
|
2
2
|
//#region src/query/operators.d.ts
|
|
3
3
|
/** Matches a scalar using strict value/date equality. */
|
|
4
4
|
export declare function eq<Value>(field: ScalarField<Value>, value: NoInfer<Value>): Expression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as UnavailableRelationshipsOf, E as VariantOf, S as UnavailableRelationship, _ as Relationship, g as QueryData, h as PayloadsOf, i as CollectionRegistry, v as RelationshipsOf, x as SelectedData } from "./types-WOsFmNnN.mjs";
|
|
2
2
|
//#region src/query/plan.d.ts
|
|
3
3
|
type PredicateOperator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in-array" | "not-in-array" | "contains" | "starts-with" | "ends-with" | "like" | "ilike" | "array-contains" | "array-contains-any" | "array-contains-all" | "array-contained" | "is-null" | "is-undefined" | "is-missing";
|
|
4
4
|
type Expression = {
|
|
@@ -142,7 +142,7 @@ type RelatedName$1<Registry extends CollectionRegistry, Relation extends Relatio
|
|
|
142
142
|
type RelationshipResult<Definition, Relation extends Relationship, Result, Filtered extends boolean = false> = Relation["type"] extends "many" ? Result[] : Result | (Filtered extends true ? null : Relation["referenceSide"] extends "from" ? Relation["from"] extends keyof QueryData<Definition> ? null extends QueryData<Definition>[Relation["from"]] ? null : undefined extends QueryData<Definition>[Relation["from"]] ? null : never : null : null);
|
|
143
143
|
type RelationValue<Definition, Relation extends Relationship, Configured> = RelationshipResult<Definition, Relation, ResultOf<Configured>, FilteredOf<Configured>>;
|
|
144
144
|
type Query<Registry extends CollectionRegistry, Name extends keyof Registry & string, Result = {}, Selected extends boolean = false, Many extends boolean = true, Root extends boolean = true, Filtered extends boolean = false, AllowAdjacent extends boolean = true, Pagination extends boolean = true, Paged extends boolean = false> = QueryInfo<Result, Selected, Filtered> & {
|
|
145
|
-
select<const Keys extends readonly [keyof QueryData<Registry[Name]> & string, ...(keyof QueryData<Registry[Name]> & string)[]]>(...keys: Keys): Query<Registry, Name, { [Key in Exclude<keyof Result, keyof QueryData<Registry[Name]>>
|
|
145
|
+
select<const Keys extends readonly [keyof QueryData<Registry[Name]> & string, ...(keyof QueryData<Registry[Name]> & string)[]]>(...keys: Keys): Query<Registry, Name, Simplify$1<{ [Key in Exclude<keyof Result, keyof QueryData<Registry[Name]>>]: Result[Key]; } & SelectedData<QueryData<Registry[Name]>, Keys[number]>>, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
146
146
|
where(configure: (fields: QueryFields<Registry, Name>) => Expression): Query<Registry, Name, Result, Selected, Many, Root, true, AllowAdjacent, Pagination, Paged>;
|
|
147
147
|
with<Key extends keyof RelationshipsOf<Registry[Name]> & string, Configured extends QueryInfo<unknown, true>>(name: Key, configure: (query: Query<Registry, RelatedName$1<Registry, RelationOf<Registry, Name, Key>>, {}, false, RelationOf<Registry, Name, Key>["type"] extends "many" ? true : false, false, false, AllowAdjacent>) => Configured): Query<Registry, Name, Result & { [Property in Key]: RelationValue<Registry[Name], RelationOf<Registry, Name, Key>, Configured>; }, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
148
148
|
/** A relationship into a collection the query has not loaded reports which one to supply. */
|
|
@@ -157,7 +157,7 @@ type Query<Registry extends CollectionRegistry, Name extends keyof Registry & st
|
|
|
157
157
|
withPayload<Key extends keyof PayloadsOf<Registry[Name]> & string>(name: Key, ...variant: keyof VariantOf<Registry[Name], Key> extends never ? [] : [variant: Readonly<VariantOf<Registry[Name], Key>>]): Query<Registry, Name, WithPayload<Result, Key, PayloadsOf<Registry[Name]>[Key]>, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
158
158
|
/** Selects neighbor fields within this scope's filtered and ordered results. */
|
|
159
159
|
selectAdjacent<const Keys extends readonly [keyof QueryData<Registry[Name]> & string, ...(keyof QueryData<Registry[Name]> & string)[]]>(...fields: Keys): Query<Registry, Name, Result & {
|
|
160
|
-
_adjacent: Adjacent<
|
|
160
|
+
_adjacent: Adjacent<SelectedData<QueryData<Registry[Name]>, Keys[number]>>;
|
|
161
161
|
}, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
162
162
|
selectAdjacent<Configured extends QueryInfo<unknown, true>>(configure: (siblings: Query<Registry, Name, {}, false, true, false, false, false, false>) => Configured): Query<Registry, Name, Result & {
|
|
163
163
|
_adjacent: Adjacent<ResultOf<Configured>>;
|
|
@@ -304,9 +304,11 @@ type Selection<Registry extends CollectionRegistry, Name extends keyof Registry
|
|
|
304
304
|
type ObjectRelationValue<Registry extends CollectionRegistry, Name extends keyof Registry & string, Key extends keyof RelationshipsOf<Registry[Name]>, Options> = Options extends {
|
|
305
305
|
select: infer Projection;
|
|
306
306
|
} ? RelationValue<Registry[Name], RelationOf<Registry, Name, Key>, QueryInfo<SelectionResult<Registry, RelatedName$1<Registry, RelationOf<Registry, Name, Key>>, Projection>, true, "where" extends keyof Options ? true : false>> : never;
|
|
307
|
-
|
|
307
|
+
/** Data fields an object projection requests, excluding relationships and `_adjacent`. */
|
|
308
|
+
type ProjectedFields<Registry extends CollectionRegistry, Name extends keyof Registry & string, Projection> = Exclude<{ [Key in keyof Projection]-?: Projection[Key] extends false | undefined ? never : Key; }[keyof Projection], "_adjacent" | keyof RelationshipsOf<Registry[Name]>> & keyof QueryData<Registry[Name]>;
|
|
309
|
+
type SelectionResult<Registry extends CollectionRegistry, Name extends keyof Registry & string, Projection> = Simplify$1<{ -readonly [Key in keyof Projection as Projection[Key] extends false | undefined ? never : Key extends ProjectedFields<Registry, Name, Projection> ? never : Key]-?: Key extends "_adjacent" ? Projection[Key] extends {
|
|
308
310
|
select: infer Neighbors;
|
|
309
|
-
} ? Adjacent<SelectionResult<Registry, Name, Neighbors>> : never : Key extends keyof RelationshipsOf<Registry[Name]> ? ObjectRelationValue<Registry, Name, Key, Projection[Key]> :
|
|
311
|
+
} ? Adjacent<SelectionResult<Registry, Name, Neighbors>> : never : Key extends keyof RelationshipsOf<Registry[Name]> ? ObjectRelationValue<Registry, Name, Key, Projection[Key]> : never; } & SelectedData<QueryData<Registry[Name]>, ProjectedFields<Registry, Name, Projection>>>;
|
|
310
312
|
type CheckedField<Value, Filter> = Filter extends Scalar ? Filter : { [Operator in keyof Filter]: Operator extends keyof FieldFilter$1<Value> ? Operator extends "not" ? CheckedField<Value, Filter[Operator]> : Filter[Operator] : never; };
|
|
311
313
|
type CheckedWhereList$1<Data, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedWhere$1<Data, Filters[Index]>; };
|
|
312
314
|
type CheckedWhere$1<Data, Filter> = Filter extends ((...arguments_: never[]) => unknown) ? Filter : { [Key in keyof Filter]: Key extends "AND" | "OR" | "NOT" ? Filter[Key] extends readonly unknown[] ? CheckedWhereList$1<Data, Filter[Key]> : CheckedWhere$1<Data, Filter[Key]> : Key extends keyof Data ? CheckedField<Data[Key], Filter[Key]> : never; };
|
|
@@ -402,7 +404,7 @@ type RelationalPaginateOptions<Registry extends CollectionRegistry, Name extends
|
|
|
402
404
|
type RelationalCountOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string> = Pick<RelationalQueryOptions<Registry, Name>, "where" | "orderBy" | "offset" | "limit">;
|
|
403
405
|
type ColumnResult<Data, Options> = Options extends {
|
|
404
406
|
columns: infer Columns;
|
|
405
|
-
} ? {
|
|
407
|
+
} ? SelectedData<Data, { [Key in keyof Columns]-?: Columns[Key] extends true ? Key : never; }[keyof Columns] & keyof Data> : {};
|
|
406
408
|
/** Keys whose option values request something, as opposed to `false` or `undefined`. */
|
|
407
409
|
type Requested<Map> = keyof { [Key in keyof Map as Map[Key] extends false | undefined ? never : Key]: unknown; };
|
|
408
410
|
/** Whether options select fields, include relationships, request payloads, or select adjacency. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as ContentError } from "./collection-types-
|
|
1
|
+
import { s as ContentError } from "./collection-types-DhIxnCSM.mjs";
|
|
2
2
|
import { n as ContentRenderResult } from "./types-Dh-Sydyw.mjs";
|
|
3
|
-
import { _ as Relationship } from "./types-
|
|
4
|
-
import { D as QueryPlan, O as QueryRegistry, k as QueryTerminal } from "./relational-types-
|
|
3
|
+
import { _ as Relationship } from "./types-WOsFmNnN.mjs";
|
|
4
|
+
import { D as QueryPlan, O as QueryRegistry, k as QueryTerminal } from "./relational-types-PtrzENt0.mjs";
|
|
5
5
|
import { n as QueryStyle } from "./query-style-C2FcT1f9.mjs";
|
|
6
6
|
//#region src/runtime/revision.d.ts
|
|
7
7
|
type QueryRecord = Record<string, unknown> & {
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ContentErrorCode, i as LoadedRegistry, n as Collection, o as ContentDiagnostic, r as CollectionHandles, s as ContentError, t as AnyCollection } from "./collection-types-
|
|
1
|
+
import { c as ContentErrorCode, i as LoadedRegistry, n as Collection, o as ContentDiagnostic, r as CollectionHandles, s as ContentError, t as AnyCollection } from "./collection-types-DhIxnCSM.mjs";
|
|
2
2
|
import { n as ContentRenderResult, t as ContentHeading } from "./types-Dh-Sydyw.mjs";
|
|
3
3
|
import { n as QueryStyle, r as QueryStyleDisabled } from "./query-style-C2FcT1f9.mjs";
|
|
4
4
|
export { type AnyCollection, type Collection, type CollectionHandles, type ContentDiagnostic, ContentError, type ContentErrorCode, type ContentHeading, type ContentRenderResult, type LoadedRegistry, type QueryStyle, type QueryStyleDisabled };
|
|
@@ -143,9 +143,26 @@ type ComputedData<Definition> = Definition extends {
|
|
|
143
143
|
} ? { [Name in keyof Computed]: Computed[Name] extends {
|
|
144
144
|
schema: infer ResultSchema;
|
|
145
145
|
} ? SchemaOutput<ResultSchema> : never; } : {};
|
|
146
|
+
/**
|
|
147
|
+
* An entry's ID, validated metadata, and computed fields. JSDoc comments on schema fields and
|
|
148
|
+
* computed field names carry through, so editors show them when hovering a field.
|
|
149
|
+
*/
|
|
146
150
|
type QueryData<Definition> = {
|
|
151
|
+
/** The entry's ID, unique within its collection. */
|
|
147
152
|
id: string;
|
|
148
153
|
} & EntryData<Definition> & ComputedData<Definition>;
|
|
154
|
+
/** Maps `Field` without reading `Data`'s modifiers, so every key is required. */
|
|
155
|
+
type PresentFields<Data, Field extends PropertyKey> = { [Key in Field]: Key extends keyof Data ? Data[Key] : never; };
|
|
156
|
+
/** Flattens an intersection into one mutable object type, keeping each property's declaration. */
|
|
157
|
+
type MutableObject<Value> = { -readonly [Key in keyof Value]: Value[Key]; };
|
|
158
|
+
/**
|
|
159
|
+
* The shape of `Data` when a query selects `Field`. Every selected key is present and mutable,
|
|
160
|
+
* and an optional field's value includes `undefined` instead of the key being optional.
|
|
161
|
+
*
|
|
162
|
+
* Each property stays linked to its declaration in `Data`, so JSDoc comments written on schema
|
|
163
|
+
* fields show when hovering a selected field, and go to definition opens the schema.
|
|
164
|
+
*/
|
|
165
|
+
type SelectedData<Data, Field extends keyof Data> = MutableObject<PresentFields<Data, Field> & Pick<Data, Field>>;
|
|
149
166
|
/**
|
|
150
167
|
* Type-only marker recording which collections a query scope loaded. A marked definition offers
|
|
151
168
|
* only the relationships whose target is loaded; an unmarked one offers every relationship.
|
|
@@ -211,4 +228,4 @@ type PayloadData<Definition, Name extends keyof PayloadsOf<Definition>> = Payloa
|
|
|
211
228
|
/** The variant keys a payload request must supply; empty for built-in and single-value payloads. */
|
|
212
229
|
type VariantOf<Definition, Name> = Name extends keyof CustomPayloadsOf<Definition> ? CustomPayloadsOf<Definition>[Name] extends CustomPayload<unknown, infer Variant> ? Variant : {} : {};
|
|
213
230
|
//#endregion
|
|
214
|
-
export {
|
|
231
|
+
export { UnavailableRelationshipsOf as C, VariantValues as D, VariantOf as E, UnavailableRelationship as S, VariantField as T, Relationship as _, ComputedContext as a, SchemaOutput as b, EntryFiles as c, PayloadContext as d, PayloadData as f, QueryData as g, PayloadsOf as h, CollectionRegistry as i, FileEntry as l, PayloadDefinition as m, BuiltinPayloads as n, CustomPayload as o, PayloadDeclaration as p, CollectionDefinition as r, CustomPayloadMarker as s, BuiltinPayloadMarker as t, LoadedMarker as u, RelationshipsOf as v, VariantContext as w, SelectedData as x, Schema as y };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ContentSourceEvent, o as ContentSourceSnapshot, t as BuildContentOptions } from "./build-
|
|
1
|
+
import { a as ContentSourceEvent, o as ContentSourceSnapshot, t as BuildContentOptions } from "./build-Aoi7Unm0.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/integrations/vite/plugin.d.ts
|
|
4
4
|
/** Public, format-neutral hooks for integrations sharing this plugin's preparation session. */
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { I as collectionNames } from "./operators-D-w1-gDg.mjs";
|
|
2
|
-
import { a as sessionInternals, i as resolveConfigPath, l as virtualDeclarations, o as withinDirectory, r as configCandidates, s as writeChanged, t as buildAtRoot, u as revisionModules } from "./build-
|
|
2
|
+
import { a as sessionInternals, i as resolveConfigPath, l as virtualDeclarations, o as withinDirectory, r as configCandidates, s as writeChanged, t as buildAtRoot, u as revisionModules } from "./build-CIw4yWs9.mjs";
|
|
3
3
|
import { n as serializeContentError } from "./diagnostics-DmUZtrJ6.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import path from "node:path";
|
package/package.json
CHANGED