content-query 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-DYw3z9ju.mjs → build-CfxMqm_9.mjs} +1 -1
- package/dist/{build-DE4ZKHZR.d.mts → build-MlsJ12d8.d.mts} +3 -3
- package/dist/build.d.mts +1 -1
- package/dist/build.mjs +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/{collection-txOFpidL.mjs → collection-DYeLLOXP.mjs} +48 -19
- package/dist/{collection-types-Ch4YLG8t.d.mts → collection-types-BjSEeKN-.d.mts} +5 -7
- package/dist/computed.d.mts +2 -2
- package/dist/{descriptor-bcPa6XLk.d.mts → descriptor-BseHJvUB.d.mts} +7 -1
- package/dist/index.d.mts +3 -3
- package/dist/internal.d.mts +4 -4
- package/dist/internal.mjs +1 -1
- package/dist/loaders.d.mts +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.mjs +1 -1
- package/dist/query.d.mts +1 -1
- package/dist/{relational-types-DnI9wR5r.d.mts → relational-types-Bh34u01H.d.mts} +40 -25
- package/dist/{revision-vhe9gRyk.d.mts → revision-C7GpzihD.d.mts} +3 -3
- package/dist/runtime.d.mts +3 -2
- package/dist/{types-WOsFmNnN.d.mts → types-B_p8k_g6.d.mts} +8 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { i as detach, l as valuePath, o as encode } from "./values-BbTV4QT-.mjs"
|
|
|
4
4
|
import { t as assertServerOnly } from "./server-only-CIJUlyL-.mjs";
|
|
5
5
|
import { n as loadFile } from "./file-DSOcdFj0.mjs";
|
|
6
6
|
import { I as collectionNames } from "./operators-D-w1-gDg.mjs";
|
|
7
|
-
import { a as variantKey, c as CODEC_VERSION, i as isQueryStyle, n as createCollections, o as isRelationship, s as prepareRelationships } from "./collection-
|
|
7
|
+
import { a as variantKey, c as CODEC_VERSION, i as isQueryStyle, n as createCollections, o as isRelationship, s as prepareRelationships } from "./collection-DYeLLOXP.mjs";
|
|
8
8
|
import { t as renderMarkdown } from "./markdown-CHvBBJNa.mjs";
|
|
9
9
|
import { access, link, mkdir, readFile, readdir, realpath, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
@@ -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-BjSEeKN-.mjs";
|
|
2
|
+
import { i as CollectionRegistry } from "./types-B_p8k_g6.mjs";
|
|
3
3
|
import { n as QueryStyle } from "./query-style-k8Qd7wh5.mjs";
|
|
4
|
-
import "./revision-
|
|
4
|
+
import "./revision-C7GpzihD.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<{
|
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-MlsJ12d8.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-CfxMqm_9.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-CfxMqm_9.mjs";
|
|
4
4
|
import { cac } from "cac";
|
|
5
5
|
//#region package.json
|
|
6
|
-
var version = "0.6.
|
|
6
|
+
var version = "0.6.1";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/integrations/cli/arguments.ts
|
|
9
9
|
/** Validates one path option after CAC's automatic numeric conversion. */
|
|
@@ -320,8 +320,28 @@ function checkedPayload(registry, collection, name, request) {
|
|
|
320
320
|
return { variant: {} };
|
|
321
321
|
}
|
|
322
322
|
const variant = request;
|
|
323
|
-
if (!variant || typeof variant !== "object" || Array.isArray(variant) || Object.keys(variant).length !== variants.length || variants.some((key) => !Object.hasOwn(variant, key) ||
|
|
324
|
-
|
|
323
|
+
if (!variant || typeof variant !== "object" || Array.isArray(variant) || Object.keys(variant).length !== variants.length || variants.some((key) => !Object.hasOwn(variant, key) || !isVariantValue(variant[key]))) invalidQuery(`Payload "${name}" requires exactly these variant keys, each a string or a nonempty array of strings: ${variants.join(", ") || "none"}.`);
|
|
324
|
+
let combinations = [{}];
|
|
325
|
+
for (const key of Object.keys(variant)) {
|
|
326
|
+
const values = [variant[key]].flat();
|
|
327
|
+
combinations = combinations.flatMap((partial) => values.map((value) => ({
|
|
328
|
+
...partial,
|
|
329
|
+
[key]: value
|
|
330
|
+
})));
|
|
331
|
+
}
|
|
332
|
+
const sorted = [...variants].sort();
|
|
333
|
+
const [first, ...fallbacks] = new Map(combinations.map((combination) => {
|
|
334
|
+
const canonical = Object.fromEntries(sorted.map((key) => [key, combination[key]]));
|
|
335
|
+
return [JSON.stringify(canonical), canonical];
|
|
336
|
+
})).values();
|
|
337
|
+
return fallbacks.length ? {
|
|
338
|
+
variant: first,
|
|
339
|
+
fallbacks
|
|
340
|
+
} : { variant: first };
|
|
341
|
+
}
|
|
342
|
+
/** Checks one variant key's request: a value, or a nonempty list of values to try in order. */
|
|
343
|
+
function isVariantValue(value) {
|
|
344
|
+
return typeof value === "string" || Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string");
|
|
325
345
|
}
|
|
326
346
|
/** Compiles a payloads option into plan requests, omitting payloads set to false. */
|
|
327
347
|
function checkedPayloads(registry, collection, payloads) {
|
|
@@ -1319,20 +1339,29 @@ async function renderedPayload(revision, collection, id) {
|
|
|
1319
1339
|
}
|
|
1320
1340
|
return rendered;
|
|
1321
1341
|
}
|
|
1322
|
-
/**
|
|
1323
|
-
|
|
1342
|
+
/**
|
|
1343
|
+
* Lazily loads one custom payload variant once per revision, retrying after failures. The request's
|
|
1344
|
+
* combinations are tried in order, and only the first one the entry has is loaded.
|
|
1345
|
+
*/
|
|
1346
|
+
function loadCustom(revision, collection, id, name, request) {
|
|
1324
1347
|
const entries = revision.collections[collection].payloads?.get(name);
|
|
1325
1348
|
if (!entries) invalidQuery(`Payload "${name}" no longer matches the prepared collection.`);
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1349
|
+
const candidates = [request.variant, ...request.fallbacks ?? []];
|
|
1350
|
+
const variants = entries.get(id);
|
|
1351
|
+
const variant = candidates.find((candidate) => variants?.has(variantKey(candidate)));
|
|
1352
|
+
const load = variant && variants.get(variantKey(variant));
|
|
1353
|
+
if (!variant || !load) {
|
|
1354
|
+
const tried = candidates.map((candidate) => payloadIdentity(name, candidate));
|
|
1355
|
+
return Promise.reject(new ContentError({
|
|
1356
|
+
code: "variant-not-found",
|
|
1357
|
+
operation: "query",
|
|
1358
|
+
collection,
|
|
1359
|
+
id,
|
|
1360
|
+
payload: name,
|
|
1361
|
+
variant: request.variant,
|
|
1362
|
+
message: tried.length === 1 ? `Entry "${id}" has no ${tried[0]} payload.` : `Entry "${id}" has none of the ${tried.join(", ")} payloads.`
|
|
1363
|
+
}));
|
|
1364
|
+
}
|
|
1336
1365
|
const key = JSON.stringify([
|
|
1337
1366
|
collection,
|
|
1338
1367
|
id,
|
|
@@ -1357,10 +1386,10 @@ function loadCustom(revision, collection, id, name, variant) {
|
|
|
1357
1386
|
return loaded;
|
|
1358
1387
|
}
|
|
1359
1388
|
/** Loads one requested payload value from the pinned revision. */
|
|
1360
|
-
async function loadPayload(revision, collection, id, name,
|
|
1389
|
+
async function loadPayload(revision, collection, id, name, request) {
|
|
1361
1390
|
if (name === "_body") return (await loadBuiltin(revision, collection, id)).body;
|
|
1362
1391
|
if (name === "_rendered") return renderedPayload(revision, collection, id);
|
|
1363
|
-
return loadCustom(revision, collection, id, name,
|
|
1392
|
+
return loadCustom(revision, collection, id, name, request);
|
|
1364
1393
|
}
|
|
1365
1394
|
/**
|
|
1366
1395
|
* Loads every requested payload with bounded concurrency, then attaches detached copies under
|
|
@@ -1380,13 +1409,13 @@ async function attachPayloads(revision, requests) {
|
|
|
1380
1409
|
collection: request.collection,
|
|
1381
1410
|
id: request.id,
|
|
1382
1411
|
name,
|
|
1383
|
-
|
|
1412
|
+
request: request.payloads[name]
|
|
1384
1413
|
});
|
|
1385
1414
|
}
|
|
1386
1415
|
const keys = [...loads.keys()];
|
|
1387
1416
|
const values = await mapConcurrent(keys, PAYLOAD_CONCURRENCY, (key) => {
|
|
1388
|
-
const { collection, id, name,
|
|
1389
|
-
return loadPayload(revision, collection, id, name,
|
|
1417
|
+
const { collection, id, name, request } = loads.get(key);
|
|
1418
|
+
return loadPayload(revision, collection, id, name, request);
|
|
1390
1419
|
});
|
|
1391
1420
|
const loaded = new Map(keys.map((key, index) => [key, values[index]]));
|
|
1392
1421
|
for (const request of requests) request.target._payloads = Object.fromEntries(Object.keys(request.payloads).map((name) => [name, detach(loaded.get(JSON.stringify([
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import {
|
|
1
|
+
import { _ as Unavailable } from "./descriptor-BseHJvUB.mjs";
|
|
2
|
+
import { _ as Relationship, g as QueryData, i as CollectionRegistry, u as LoadedMarker, v as RelationshipsOf } from "./types-B_p8k_g6.mjs";
|
|
3
|
+
import { n as RelationalCountOptions, t as RelationalCollectionQueries, v as Query } from "./relational-types-Bh34u01H.mjs";
|
|
3
4
|
import { i as QueryStyleMember, n as QueryStyle, r as QueryStyleDisabled, t as MembersOf } from "./query-style-k8Qd7wh5.mjs";
|
|
4
5
|
//#region src/shared/errors.d.ts
|
|
5
6
|
type ContentErrorCode = "variant-not-found" | "not-renderable" | "source-error" | "validation-error" | "duplicate-id" | "invalid-reference" | "invalid-query" | "invalid-cursor" | "artifact-error" | "render-error";
|
|
@@ -73,11 +74,8 @@ type HandleStarters<Registry extends CollectionRegistry, Name extends keyof Regi
|
|
|
73
74
|
};
|
|
74
75
|
/** Every member before `queryStyle` gating. */
|
|
75
76
|
type CollectionMethods<Registry extends CollectionRegistry, Name extends keyof Registry & string> = Pick<Query<Registry, Name>, FluentMember & keyof Query<Registry, Name>> & HandleStarters<Registry, Name> & RelationalCollectionQueries<Registry, Name>;
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
* whatever arguments they pass.
|
|
79
|
-
*/
|
|
80
|
-
type DisabledMembers<Name extends string, Style extends QueryStyle> = { readonly [Member in Exclude<FluentMember | RelationalMember, MembersOf<Style>>]: (this: QueryStyleDisabled<Name, Member & QueryStyleMember, Style>, ...arguments_: readonly unknown[]) => never; };
|
|
77
|
+
/** Members outside the allowed style. They are not callable, and their type gives the message. */
|
|
78
|
+
type DisabledMembers<Name extends string, Style extends QueryStyle> = { readonly [Member in Exclude<FluentMember | RelationalMember, MembersOf<Style>>]: Unavailable<QueryStyleDisabled<Name, Member & QueryStyleMember, Style>>; };
|
|
81
79
|
/** `count()` counts every entry in both styles; options take relational filters. */
|
|
82
80
|
type CountMember<Registry extends CollectionRegistry, Name extends keyof Registry & string, Style extends QueryStyle> = [Style] extends ["fluent"] ? {
|
|
83
81
|
/** Counts every entry. Count filtered entries with `where(...).count()`. */
|
package/dist/computed.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as MaybePromise } from "./descriptor-
|
|
2
|
-
import { a as ComputedContext } from "./types-
|
|
1
|
+
import { g as MaybePromise } from "./descriptor-BseHJvUB.mjs";
|
|
2
|
+
import { a as ComputedContext } from "./types-B_p8k_g6.mjs";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
//#region src/computed/fields.d.ts
|
|
5
5
|
/** Result schemas for computed fields that one resolver call fills, keyed by field name. */
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { r as RenderedContent } from "./types-Dh-Sydyw.mjs";
|
|
2
2
|
//#region src/shared/types.d.ts
|
|
3
3
|
type MaybePromise<Value> = Value | Promise<Value>;
|
|
4
|
+
/**
|
|
5
|
+
* The type of a member that a query or configuration does not allow. It has no call signatures,
|
|
6
|
+
* so calling the member fails with the reason near the start of the error:
|
|
7
|
+
* `This expression is not callable. Type 'Unavailable<"…">' has no call signatures.`
|
|
8
|
+
*/
|
|
9
|
+
type Unavailable<Reason extends string> = { readonly [Key in Reason]: never; };
|
|
4
10
|
//#endregion
|
|
5
11
|
//#region src/loaders/types.d.ts
|
|
6
12
|
declare const loaderSourceType: unique symbol;
|
|
@@ -165,4 +171,4 @@ type FileOptions = {
|
|
|
165
171
|
parser?: (text: string) => MaybePromise<unknown>;
|
|
166
172
|
};
|
|
167
173
|
//#endregion
|
|
168
|
-
export { DataStore as a, Loader as c, LoaderLogger as d, LoaderSource as f, MaybePromise as g, RecordLoader as h, DataEntry as i, LoaderConfig as l, MetaStore as m, GlobOptions as n, FileEntrySource as o, LoaderWatcher as p, BodyLoader as r, FileSource as s, FileOptions as t, LoaderContext as u };
|
|
174
|
+
export { Unavailable as _, DataStore as a, Loader as c, LoaderLogger as d, LoaderSource as f, MaybePromise as g, RecordLoader as h, DataEntry as i, LoaderConfig as l, MetaStore as m, GlobOptions as n, FileEntrySource as o, LoaderWatcher as p, BodyLoader as r, FileSource as s, FileOptions as t, LoaderContext as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-BseHJvUB.mjs";
|
|
2
2
|
import { n as ContentRenderResult, r as RenderedContent, t as ContentHeading } from "./types-Dh-Sydyw.mjs";
|
|
3
|
-
import { D as
|
|
3
|
+
import { D as VariantRequest, E as VariantOf, O as VariantValues, 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-B_p8k_g6.mjs";
|
|
4
4
|
import { n as QueryStyle } from "./query-style-k8Qd7wh5.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, SelectedData, 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, VariantRequest, 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-BjSEeKN-.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-B_p8k_g6.mjs";
|
|
4
|
+
import { O as QueryRegistry } from "./relational-types-Bh34u01H.mjs";
|
|
5
5
|
import { n as QueryStyle } from "./query-style-k8Qd7wh5.mjs";
|
|
6
|
-
import { n as PreparedRevision, t as ContentState } from "./revision-
|
|
6
|
+
import { n as PreparedRevision, t as ContentState } from "./revision-C7GpzihD.mjs";
|
|
7
7
|
//#region src/artifacts/types.d.ts
|
|
8
8
|
type ArtifactManifest = {
|
|
9
9
|
version: number;
|
package/dist/internal.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ContentError } from "./errors-Bfd0R4_P.mjs";
|
|
2
2
|
import { r as decode } from "./values-BbTV4QT-.mjs";
|
|
3
|
-
import { i as isQueryStyle, n as createCollections, r as createLiveCollection, t as createCollection } from "./collection-
|
|
3
|
+
import { i as isQueryStyle, n as createCollections, r as createLiveCollection, t as createCollection } from "./collection-DYeLLOXP.mjs";
|
|
4
4
|
import { t as restoreContentError } from "./diagnostics-DmUZtrJ6.mjs";
|
|
5
5
|
//#region src/artifacts/runtime.ts
|
|
6
6
|
/** Checks that a value is a plain record before reading generated payload tables from it. */
|
package/dist/loaders.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DataStore, c as Loader, d as LoaderLogger, f as LoaderSource, 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, t as FileOptions, u as LoaderContext } from "./descriptor-
|
|
1
|
+
import { a as DataStore, c as Loader, d as LoaderLogger, f as LoaderSource, 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, t as FileOptions, u as LoaderContext } from "./descriptor-BseHJvUB.mjs";
|
|
2
2
|
//#region src/loaders/file.d.ts
|
|
3
3
|
/** Declares a multi-entry data file with typed source paths and record keys, plus an optional parser. */
|
|
4
4
|
export declare function file(filename: string, options?: FileOptions): RecordLoader<FileEntrySource>;
|
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BuildContentOptions } from "./build-
|
|
1
|
+
import { t as BuildContentOptions } from "./build-MlsJ12d8.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-CfxMqm_9.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-Bh34u01H.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,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as Unavailable } from "./descriptor-BseHJvUB.mjs";
|
|
2
|
+
import { C as UnavailableRelationshipsOf, D as VariantRequest, 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-B_p8k_g6.mjs";
|
|
2
3
|
//#region src/query/plan.d.ts
|
|
3
4
|
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
5
|
type Expression = {
|
|
@@ -67,9 +68,13 @@ type AdjacentPlan = {
|
|
|
67
68
|
scope: "results" | "collection";
|
|
68
69
|
plan: QueryPlan;
|
|
69
70
|
};
|
|
70
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* One requested payload; variant keys are empty for payloads without variants. `fallbacks` lists
|
|
73
|
+
* further combinations to try, in order, when the entry lacks `variant`.
|
|
74
|
+
*/
|
|
71
75
|
type PlanPayload = {
|
|
72
76
|
variant: Readonly<Record<string, string>>;
|
|
77
|
+
fallbacks?: readonly Readonly<Record<string, string>>[];
|
|
73
78
|
};
|
|
74
79
|
/** How a plan returns its results; `paginate` requires the plan's `paginate` request. */
|
|
75
80
|
type QueryTerminal = "all" | "first" | "count" | "paginate";
|
|
@@ -96,8 +101,6 @@ declare const PAGINATE_AFTER_LIMIT_MESSAGE: "paginate() sets the limit and offse
|
|
|
96
101
|
//#endregion
|
|
97
102
|
//#region src/query/types.d.ts
|
|
98
103
|
declare const queryType: unique symbol;
|
|
99
|
-
/** Running an unselected query reports the explicit-selection rule as its required `this` type. */
|
|
100
|
-
type UnselectedTerminal = (this: typeof NO_SELECTION_MESSAGE, ...arguments_: readonly unknown[]) => never;
|
|
101
104
|
/** A `then` that cannot resolve a value, so awaiting an unselected query fails to compile. */
|
|
102
105
|
type UnselectedThen = (selectBeforeAwaiting: typeof NO_SELECTION_MESSAGE) => never;
|
|
103
106
|
declare const fieldType: unique symbol;
|
|
@@ -127,12 +130,23 @@ type QueryInfo<Result = unknown, Selected extends boolean = boolean, Filtered ex
|
|
|
127
130
|
filtered: Filtered;
|
|
128
131
|
};
|
|
129
132
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
type
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Flattens an intersection into one object type, keeping each property's declaration. The
|
|
135
|
+
* conditional resolves to a mapped type that no alias owns, so TypeScript compares two rows by
|
|
136
|
+
* their properties instead of by the collection definitions in their type arguments. Comparing
|
|
137
|
+
* those definitions computes variances deep inside schema libraries such as Zod, which can exceed
|
|
138
|
+
* the instantiation limit when `Promise.all()` or `Awaited` infers a query's result.
|
|
139
|
+
*/
|
|
140
|
+
type Simplify$1<Value> = Value extends (infer Shape) ? { [Key in keyof Shape]: Shape[Key]; } : never;
|
|
141
|
+
/** One returned entry: the accumulated result, flattened, with its `_payloads` flattened too. */
|
|
142
|
+
type Row<Result> = Result extends (infer Shape) ? { [Key in keyof Shape]: Key extends "_payloads" ? Simplify$1<Shape[Key]> : Shape[Key]; } : never;
|
|
143
|
+
/**
|
|
144
|
+
* Adds one requested payload under `_payloads`. Intersecting with earlier requests merges their
|
|
145
|
+
* `_payloads` objects; {@link Row} flattens them when the query returns. Unlike `Omit`, this adds
|
|
146
|
+
* no type that later calls must re-evaluate, so long chains stay cheap to check.
|
|
147
|
+
*/
|
|
148
|
+
type WithPayload<Result, Key extends PropertyKey, Value> = Result & {
|
|
149
|
+
_payloads: { [Name in Key]: Value; };
|
|
136
150
|
};
|
|
137
151
|
type ResultOf<Configured> = Configured extends QueryInfo<infer Result> ? Result : never;
|
|
138
152
|
type FilteredOf<Configured> = Configured extends QueryInfo<unknown, boolean, infer Filtered> ? Filtered : false;
|
|
@@ -140,7 +154,7 @@ type RelationOf<Registry extends CollectionRegistry, Name extends keyof Registry
|
|
|
140
154
|
type RelatedName$1<Registry extends CollectionRegistry, Relation extends Relationship> = Relation["collection"] & keyof Registry & string;
|
|
141
155
|
/** Applies declared relationship cardinality, optional reference fields, and filtering to a result. */
|
|
142
156
|
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
|
-
type RelationValue<Definition, Relation extends Relationship, Configured> = RelationshipResult<Definition, Relation, ResultOf<Configured
|
|
157
|
+
type RelationValue<Definition, Relation extends Relationship, Configured> = RelationshipResult<Definition, Relation, Row<ResultOf<Configured>>, FilteredOf<Configured>>;
|
|
144
158
|
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
159
|
/** Selects fields, adding to fields that earlier `select()` calls on this scope selected. */
|
|
146
160
|
select<const Keys extends readonly [keyof QueryData<Registry[Name]> & string, ...(keyof QueryData<Registry[Name]> & string)[]]>(...keys: Keys): Query<Registry, Name, Simplify$1<Result & SelectedData<QueryData<Registry[Name]>, Keys[number]>>, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
@@ -160,7 +174,7 @@ type Query<Registry extends CollectionRegistry, Name extends keyof Registry & st
|
|
|
160
174
|
}, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
161
175
|
} : {}) & (AllowAdjacent extends true ? {
|
|
162
176
|
/** Attaches a payload under `_payloads` after filtering, ordering, and pagination. */
|
|
163
|
-
withPayload<Key extends keyof PayloadsOf<Registry[Name]> & string>(name: Key, ...variant: keyof VariantOf<Registry[Name], Key> extends never ? [] : [variant:
|
|
177
|
+
withPayload<Key extends keyof PayloadsOf<Registry[Name]> & string>(name: Key, ...variant: keyof VariantOf<Registry[Name], Key> extends never ? [] : [variant: VariantRequest<VariantOf<Registry[Name], Key>>]): Query<Registry, Name, WithPayload<Result, Key, PayloadsOf<Registry[Name]>[Key]>, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
164
178
|
/** Selects neighbors from an independent sibling scope. */
|
|
165
179
|
selectAdjacent<Configured extends QueryInfo<unknown, true>>(configure: (siblings: Query<Registry, Name, {}, false, true, false, false, false, false>) => Configured): Query<Registry, Name, Result & {
|
|
166
180
|
_adjacent: Adjacent<ResultOf<Configured>>;
|
|
@@ -169,28 +183,26 @@ type Query<Registry extends CollectionRegistry, Name extends keyof Registry & st
|
|
|
169
183
|
_adjacent: Adjacent<SelectionResult<Registry, Name, Options["select"]>>;
|
|
170
184
|
}, true, Many, Root, Filtered, AllowAdjacent, Pagination, Paged>;
|
|
171
185
|
} : {}) & (Root extends true ? (Many extends true ? {
|
|
172
|
-
all: Selected extends true ? () => Promise<
|
|
173
|
-
execute: Selected extends true ? () => Promise<
|
|
174
|
-
then: Selected extends true ? Promise<
|
|
186
|
+
all: Selected extends true ? () => Promise<Row<Result>[]> : Unavailable<typeof NO_SELECTION_MESSAGE>;
|
|
187
|
+
execute: Selected extends true ? () => Promise<Row<Result>[]> : Unavailable<typeof NO_SELECTION_MESSAGE>;
|
|
188
|
+
then: Selected extends true ? Promise<Row<Result>[]>["then"] : UnselectedThen;
|
|
175
189
|
/**
|
|
176
190
|
* Returns one page from one revision: `{ page, size }` for page numbers, or
|
|
177
191
|
* `{ size, after?, before?, total? }` for cursors. Unavailable after `limit()` or
|
|
178
192
|
* `offset()`.
|
|
179
193
|
*/
|
|
180
|
-
paginate: Selected extends true ? [Paged] extends [true] ?
|
|
194
|
+
paginate: Selected extends true ? [Paged] extends [true] ? Unavailable<typeof PAGINATE_AFTER_LIMIT_MESSAGE> : Paginate<Row<Result>> : Unavailable<typeof NO_SELECTION_MESSAGE>;
|
|
181
195
|
} : {
|
|
182
196
|
/** Runs a `byId()` query, matching direct await: the entry, or `undefined`. */
|
|
183
|
-
execute: Selected extends true ? () => Promise<
|
|
184
|
-
then: Selected extends true ? Promise<
|
|
197
|
+
execute: Selected extends true ? () => Promise<Row<Result> | undefined> : Unavailable<typeof NO_SELECTION_MESSAGE>;
|
|
198
|
+
then: Selected extends true ? Promise<Row<Result> | undefined>["then"] : UnselectedThen;
|
|
185
199
|
}) & {
|
|
186
|
-
first: Selected extends true ? () => Promise<
|
|
200
|
+
first: Selected extends true ? () => Promise<Row<Result> | undefined> : Unavailable<typeof NO_SELECTION_MESSAGE>;
|
|
187
201
|
/** Counts matching entries without a selection; unavailable once payloads are requested. */
|
|
188
202
|
count: [Result] extends [never] ? () => Promise<number> : [Result] extends [{
|
|
189
203
|
_payloads: unknown;
|
|
190
|
-
}] ?
|
|
204
|
+
}] ? Unavailable<"Counts cannot request payloads; count without withPayload()."> : () => Promise<number>;
|
|
191
205
|
} : {});
|
|
192
|
-
/** `paginate()` after `limit()` or `offset()` reports why as its required `this` type. */
|
|
193
|
-
type PaginateAfterLimit = (this: typeof PAGINATE_AFTER_LIMIT_MESSAGE, ...arguments_: readonly unknown[]) => never;
|
|
194
206
|
/** The `paginate()` overloads for one item type. */
|
|
195
207
|
type Paginate<Item> = {
|
|
196
208
|
(options: PageOptions): Promise<NumberedPage<Item>>;
|
|
@@ -373,12 +385,15 @@ type RelationalWhere<Registry extends CollectionRegistry, Name extends keyof Reg
|
|
|
373
385
|
NOT?: RelationalWhere<Registry, Name> | readonly RelationalWhere<Registry, Name>[];
|
|
374
386
|
RAW?: (fields: Fields<QueryData<Registry[Name]>>) => Expression;
|
|
375
387
|
};
|
|
376
|
-
/**
|
|
377
|
-
|
|
388
|
+
/**
|
|
389
|
+
* Requests one payload: `true` without variants, or a record giving every variant key a value or
|
|
390
|
+
* a nonempty list of values to try in order.
|
|
391
|
+
*/
|
|
392
|
+
type PayloadRequest<Variant> = keyof Variant extends never ? true : VariantRequest<Variant>;
|
|
378
393
|
/** Payloads to attach under `_payloads`; payloads set to false are omitted. */
|
|
379
394
|
type PayloadOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string> = { [Key in keyof PayloadsOf<Registry[Name]>]?: false | PayloadRequest<VariantOf<Registry[Name], Key>>; };
|
|
380
395
|
/** Rejects variant keys a payload does not declare, including through inferred variables. */
|
|
381
|
-
type CheckedPayloadRequest<Request, Variant> = Request extends boolean ? Request : { [Key in keyof Request]: Key extends keyof Variant ? string : never; };
|
|
396
|
+
type CheckedPayloadRequest<Request, Variant> = Request extends boolean ? Request : { [Key in keyof Request]: Key extends keyof Variant ? string | readonly [string, ...string[]] : never; };
|
|
382
397
|
/**
|
|
383
398
|
* Collection-scoped metadata queries with Drizzle-style columns, relationships, and filters.
|
|
384
399
|
* Nothing is selected implicitly, not even `id`: list fields in `columns`, include relationships
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as ContentError } from "./collection-types-
|
|
1
|
+
import { s as ContentError } from "./collection-types-BjSEeKN-.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-B_p8k_g6.mjs";
|
|
4
|
+
import { D as QueryPlan, O as QueryRegistry, k as QueryTerminal } from "./relational-types-Bh34u01H.mjs";
|
|
5
5
|
import { n as QueryStyle } from "./query-style-k8Qd7wh5.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,5 @@
|
|
|
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-BjSEeKN-.mjs";
|
|
2
|
+
import { _ as Unavailable } from "./descriptor-BseHJvUB.mjs";
|
|
2
3
|
import { n as ContentRenderResult, t as ContentHeading } from "./types-Dh-Sydyw.mjs";
|
|
3
4
|
import { n as QueryStyle, r as QueryStyleDisabled } from "./query-style-k8Qd7wh5.mjs";
|
|
4
|
-
export { type AnyCollection, type Collection, type CollectionHandles, type ContentDiagnostic, ContentError, type ContentErrorCode, type ContentHeading, type ContentRenderResult, type LoadedRegistry, type QueryStyle, type QueryStyleDisabled };
|
|
5
|
+
export { type AnyCollection, type Collection, type CollectionHandles, type ContentDiagnostic, ContentError, type ContentErrorCode, type ContentHeading, type ContentRenderResult, type LoadedRegistry, type QueryStyle, type QueryStyleDisabled, type Unavailable };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Loader, n as GlobOptions, t as FileOptions } from "./descriptor-
|
|
1
|
+
import { c as Loader, n as GlobOptions, t as FileOptions } from "./descriptor-BseHJvUB.mjs";
|
|
2
2
|
import { n as ContentRenderResult, r as RenderedContent } from "./types-Dh-Sydyw.mjs";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
//#region src/collection/types.d.ts
|
|
@@ -227,5 +227,11 @@ type PayloadsOf<Definition> = (Definition extends {
|
|
|
227
227
|
type PayloadData<Definition, Name extends keyof PayloadsOf<Definition>> = PayloadsOf<Definition>[Name];
|
|
228
228
|
/** The variant keys a payload request must supply; empty for built-in and single-value payloads. */
|
|
229
229
|
type VariantOf<Definition, Name> = Name extends keyof CustomPayloadsOf<Definition> ? CustomPayloadsOf<Definition>[Name] extends CustomPayload<unknown, infer Variant> ? Variant : {} : {};
|
|
230
|
+
/**
|
|
231
|
+
* How a query requests a payload variant: each key gives one value, or a nonempty list of values
|
|
232
|
+
* to try in order, such as `{ locale: ["fr-FR", "en-US"] }`. The query returns the first
|
|
233
|
+
* combination the entry has; with lists for several keys, earlier keys change slowest.
|
|
234
|
+
*/
|
|
235
|
+
type VariantRequest<Variant> = { readonly [Key in keyof Variant]: Variant[Key] | readonly [Variant[Key], ...Variant[Key][]]; };
|
|
230
236
|
//#endregion
|
|
231
|
-
export { UnavailableRelationshipsOf as C,
|
|
237
|
+
export { UnavailableRelationshipsOf as C, VariantRequest as D, VariantOf as E, VariantValues as O, 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-MlsJ12d8.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-CfxMqm_9.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