content-query 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/dist/{build-C5ef0kkR.mjs → build-CI4s0oFP.mjs} +122 -30
- package/dist/build-jKnjDjQE.d.mts +48 -0
- package/dist/build.d.mts +2 -2
- package/dist/build.mjs +1 -2
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/computed.d.mts +19 -13
- package/dist/computed.mjs +6 -5
- package/dist/{content-Dj2fQCJ5.mjs → content-N1gYshjg.mjs} +203 -77
- package/dist/{content-Crag1Uch.d.mts → content-lwPxE9Yu.d.mts} +40 -30
- package/dist/{descriptor-Xbo9u5eR.d.mts → descriptor-BUPT2J7X.d.mts} +1 -2
- package/dist/{diagnostics-Dol6ANtq.mjs → diagnostics-Cu94mZhl.mjs} +16 -15
- package/dist/{dist-BQGVLZyl.mjs → dist-C7_FOzY_.mjs} +21 -12
- package/dist/{glob-DJmebCMM.mjs → glob-Bv0dpvCQ.mjs} +3 -3
- package/dist/index.d.mts +35 -16
- package/dist/index.mjs +7 -4
- package/dist/internal/markdown.d.mts +3 -5
- package/dist/internal/markdown.mjs +1 -2
- package/dist/internal.d.mts +12 -12
- package/dist/internal.mjs +7 -7
- package/dist/loaders.d.mts +5 -6
- package/dist/loaders.mjs +6 -5
- package/dist/{markdown-CZBL4Ux_.mjs → markdown-CHvBBJNa.mjs} +2 -2
- package/dist/next.d.mts +3 -4
- package/dist/next.mjs +2 -2
- package/dist/{operators-BQpLfJlx.mjs → operators-UqWUhKQJ.mjs} +2 -2
- package/dist/query.d.mts +22 -23
- package/dist/query.mjs +1 -2
- package/dist/{relational-types-DLniKi5S.d.mts → relational-types-B45zM34W.d.mts} +62 -29
- package/dist/{chunk-CJs4Fogs.mjs → rolldown-runtime-Bg1v5YCA.mjs} +2 -2
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.mjs +3 -4
- package/dist/{schema-CnCbMosm.mjs → schema-C5Str-E8.mjs} +1 -1
- package/dist/schema.d.mts +0 -2
- package/dist/schema.mjs +1 -2
- package/dist/{types-BPh2cBPs.d.mts → types-BC8gVJ6u.d.mts} +27 -6
- package/dist/{types-hmDOw87q.d.mts → types-FmUJ3cH1.d.mts} +23 -6
- package/dist/{validation-BvvjSUFc.mjs → validation-D_XdE1pF.mjs} +2 -2
- package/dist/{values-B7lo_2_x.mjs → values-BbTV4QT-.mjs} +109 -108
- package/dist/vite.d.mts +14 -4
- package/dist/vite.mjs +28 -5
- package/package.json +7 -5
- package/dist/build-DSyoRxkZ.d.mts +0 -24
- /package/dist/{errors-C8lWyiy2.mjs → errors-C2iuBM0G.mjs} +0 -0
- /package/dist/{github-slugger-BCAkwEOL.mjs → github-slugger-BMgR_Q0I.mjs} +0 -0
- /package/dist/{server-only-CIE-FHx0.mjs → server-only-CIJUlyL-.mjs} +0 -0
- /package/dist/{types-DcvHRmxO.d.mts → types-Dh-Sydyw.d.mts} +0 -0
package/dist/query.d.mts
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
import { a as RelationalWhere, c as Fields, d as Scalar, f as ScalarField, g as Expression, h as Where, i as RelationalQueryResult, l as Ordered, m as SelectionResult, n as RelationalQueries, o as Adjacent, p as Selection, r as RelationalQueryOptions, s as Field, t as RelationalCountOptions } from "./relational-types-
|
|
2
|
-
|
|
1
|
+
import { a as RelationalWhere, c as Fields, d as Scalar, f as ScalarField, g as Expression, h as Where, i as RelationalQueryResult, l as Ordered, m as SelectionResult, n as RelationalQueries, o as Adjacent, p as Selection, r as RelationalQueryOptions, s as Field, t as RelationalCountOptions } from "./relational-types-B45zM34W.mjs";
|
|
3
2
|
//#region src/query/operators.d.ts
|
|
4
3
|
/** Matches a scalar using strict value/date equality. */
|
|
5
|
-
declare function eq<Value>(field: ScalarField<Value>, value: NoInfer<Value>): Expression;
|
|
4
|
+
export declare function eq<Value>(field: ScalarField<Value>, value: NoInfer<Value>): Expression;
|
|
6
5
|
/** Negates scalar equality. */
|
|
7
|
-
declare function ne<Value>(field: ScalarField<Value>, value: NoInfer<Value>): Expression;
|
|
6
|
+
export declare function ne<Value>(field: ScalarField<Value>, value: NoInfer<Value>): Expression;
|
|
8
7
|
/** Matches values greater than the supplied scalar. */
|
|
9
|
-
declare function gt<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
8
|
+
export declare function gt<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
10
9
|
/** Matches values greater than or equal to the supplied scalar. */
|
|
11
|
-
declare function gte<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
10
|
+
export declare function gte<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
12
11
|
/** Matches values less than the supplied scalar. */
|
|
13
|
-
declare function lt<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
12
|
+
export declare function lt<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
14
13
|
/** Matches values less than or equal to the supplied scalar. */
|
|
15
|
-
declare function lte<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
14
|
+
export declare function lte<Value>(field: Field<Value> & Ordered<Value>, value: NoInfer<NonNullable<Value>>): Expression;
|
|
16
15
|
/** Matches one of a list of scalar choices. */
|
|
17
|
-
declare function inArray<Value>(field: ScalarField<Value>, values: readonly NoInfer<Value>[]): Expression;
|
|
16
|
+
export declare function inArray<Value>(field: ScalarField<Value>, values: readonly NoInfer<Value>[]): Expression;
|
|
18
17
|
/** Matches none of a list of scalar choices. */
|
|
19
|
-
declare function notInArray<Value>(field: ScalarField<Value>, values: readonly NoInfer<Value>[]): Expression;
|
|
18
|
+
export declare function notInArray<Value>(field: ScalarField<Value>, values: readonly NoInfer<Value>[]): Expression;
|
|
20
19
|
/** Matches a literal substring, without SQL wildcard interpretation. */
|
|
21
|
-
declare function contains<Value>(field: Field<Value> & (NonNullable<Value> extends string ? unknown : never), value: string): Expression;
|
|
20
|
+
export declare function contains<Value>(field: Field<Value> & (NonNullable<Value> extends string ? unknown : never), value: string): Expression;
|
|
22
21
|
/** Matches a literal string prefix. */
|
|
23
|
-
declare function startsWith<Value>(field: Field<Value> & (NonNullable<Value> extends string ? unknown : never), value: string): Expression;
|
|
22
|
+
export declare function startsWith<Value>(field: Field<Value> & (NonNullable<Value> extends string ? unknown : never), value: string): Expression;
|
|
24
23
|
/** Matches a literal string suffix. */
|
|
25
|
-
declare function endsWith<Value>(field: Field<Value> & (NonNullable<Value> extends string ? unknown : never), value: string): Expression;
|
|
24
|
+
export declare function endsWith<Value>(field: Field<Value> & (NonNullable<Value> extends string ? unknown : never), value: string): Expression;
|
|
26
25
|
/** Tests scalar membership in an array, ignoring holes. */
|
|
27
|
-
declare function arrayContains<Value extends Scalar>(field: Field<readonly Value[] | null | undefined>, value: NoInfer<Value>): Expression;
|
|
26
|
+
export declare function arrayContains<Value extends Scalar>(field: Field<readonly Value[] | null | undefined>, value: NoInfer<Value>): Expression;
|
|
28
27
|
/** Tests whether any candidate belongs to an existing scalar array. */
|
|
29
|
-
declare function arrayContainsAny<Value extends Scalar>(field: Field<readonly Value[] | null | undefined>, values: readonly NoInfer<Value>[]): Expression;
|
|
28
|
+
export declare function arrayContainsAny<Value extends Scalar>(field: Field<readonly Value[] | null | undefined>, values: readonly NoInfer<Value>[]): Expression;
|
|
30
29
|
/** Tests whether every candidate belongs to an existing scalar array. */
|
|
31
|
-
declare function arrayContainsAll<Value extends Scalar>(field: Field<readonly Value[] | null | undefined>, values: readonly NoInfer<Value>[]): Expression;
|
|
30
|
+
export declare function arrayContainsAll<Value extends Scalar>(field: Field<readonly Value[] | null | undefined>, values: readonly NoInfer<Value>[]): Expression;
|
|
32
31
|
/** Checks explicit null independently from undefined and absence. */
|
|
33
|
-
declare function isNull<Value>(field: Field<Value>): Expression;
|
|
32
|
+
export declare function isNull<Value>(field: Field<Value>): Expression;
|
|
34
33
|
/** Checks undefined, including a missing property. */
|
|
35
|
-
declare function isUndefined<Value>(field: Field<Value>): Expression;
|
|
34
|
+
export declare function isUndefined<Value>(field: Field<Value>): Expression;
|
|
36
35
|
/** Checks own-property absence before projection. */
|
|
37
|
-
declare function isMissing<Value>(field: Field<Value>): Expression;
|
|
36
|
+
export declare function isMissing<Value>(field: Field<Value>): Expression;
|
|
38
37
|
/** Requires all child predicates; an empty conjunction is true. */
|
|
39
|
-
declare function and(...expressions: Expression[]): Expression;
|
|
38
|
+
export declare function and(...expressions: Expression[]): Expression;
|
|
40
39
|
/** Requires any child predicate; an empty disjunction is false. */
|
|
41
|
-
declare function or(...expressions: Expression[]): Expression;
|
|
40
|
+
export declare function or(...expressions: Expression[]): Expression;
|
|
42
41
|
/** Negates a predicate's boolean result. */
|
|
43
|
-
declare function not(expression: Expression): Expression;
|
|
42
|
+
export declare function not(expression: Expression): Expression;
|
|
44
43
|
//#endregion
|
|
45
|
-
export {
|
|
44
|
+
export type { Adjacent, RelationalCountOptions as CountOptions, Expression, Field, Fields, RelationalQueryOptions as QueryOptions, RelationalQueryOptions, RelationalQueries, RelationalQueryResult, RelationalWhere, Selection, SelectionResult, Where };
|
package/dist/query.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { and, arrayContains, arrayContainsAll, arrayContainsAny, contains, endsWith, eq, gt, gte, inArray, isMissing, isNull, isUndefined, lt, lte, ne, not, notInArray, or, startsWith };
|
|
1
|
+
export { t as and, n as arrayContains, r as arrayContainsAll, i as arrayContainsAny, a as contains, o as endsWith, s as eq, c as gt, l as gte, u as inArray, d as isMissing, f as isNull, p as isUndefined, m as lt, h as lte, g as ne, _ as not, v as notInArray, y as or, b as startsWith } from "./operators-UqWUhKQJ.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { c as Relationship, i as CollectionRegistry, l as RelationshipsOf, o as PayloadsOf, s as QueryData } from "./types-BC8gVJ6u.mjs";
|
|
3
2
|
//#region src/query/plan.d.ts
|
|
4
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";
|
|
5
4
|
type Expression = {
|
|
@@ -31,9 +30,21 @@ type QueryPlan = {
|
|
|
31
30
|
offset?: number;
|
|
32
31
|
with: Readonly<Record<string, QueryPlan>>;
|
|
33
32
|
adjacent?: true | QueryPlan;
|
|
33
|
+
/** Payloads to attach under `_payloads` after filtering, ordering, and pagination. */
|
|
34
|
+
payloads?: Readonly<Record<string, PlanPayload>>;
|
|
35
|
+
};
|
|
36
|
+
/** One requested payload; variant keys are empty for payloads without variants. */
|
|
37
|
+
type PlanPayload = {
|
|
38
|
+
variant: Readonly<Record<string, string>>;
|
|
39
|
+
};
|
|
40
|
+
/** Describes a payload that queries may request, without its resolver or schema. */
|
|
41
|
+
type PayloadDescriptor = {
|
|
42
|
+
variants: readonly string[];
|
|
34
43
|
};
|
|
35
44
|
type QueryRegistry = Record<string, {
|
|
36
45
|
relationships: Record<string, Relationship>;
|
|
46
|
+
/** Payload names available to queries; omitted when the collection has none. */
|
|
47
|
+
payloads?: Record<string, PayloadDescriptor>;
|
|
37
48
|
}>;
|
|
38
49
|
//#endregion
|
|
39
50
|
//#region src/query/types.d.ts
|
|
@@ -43,11 +54,11 @@ type Field$1<Value> = {
|
|
|
43
54
|
readonly name: string;
|
|
44
55
|
readonly [fieldType]: Value;
|
|
45
56
|
};
|
|
46
|
-
type Fields<Data> = { readonly [Name in keyof Data]-?: Field$1<Data[Name]
|
|
57
|
+
type Fields<Data> = { readonly [Name in keyof Data]-?: Field$1<Data[Name]>; };
|
|
47
58
|
type Scalar = string | number | bigint | boolean | Date | null | undefined;
|
|
48
59
|
type ScalarField<Value> = Field$1<Value> & ([Value] extends [Scalar] ? unknown : never);
|
|
49
60
|
type Ordered<Value> = NonNullable<Value> extends string ? unknown : NonNullable<Value> extends number ? unknown : NonNullable<Value> extends bigint ? unknown : NonNullable<Value> extends Date ? unknown : never;
|
|
50
|
-
type SortKey<Data> = { [Name in keyof Data]-?: Ordered<Data[Name]> extends never ? NonNullable<Data[Name]> extends boolean ? Name : never : Name }[keyof Data] & string;
|
|
61
|
+
type SortKey<Data> = { [Name in keyof Data]-?: Ordered<Data[Name]> extends never ? NonNullable<Data[Name]> extends boolean ? Name : never : Name; }[keyof Data] & string;
|
|
51
62
|
type QueryInfo<Result = unknown, Selected extends boolean = boolean, Filtered extends boolean = boolean> = {
|
|
52
63
|
readonly [queryType]: {
|
|
53
64
|
result: Result;
|
|
@@ -55,7 +66,13 @@ type QueryInfo<Result = unknown, Selected extends boolean = boolean, Filtered ex
|
|
|
55
66
|
filtered: Filtered;
|
|
56
67
|
};
|
|
57
68
|
};
|
|
58
|
-
type Simplify$1<Value> = { [Key in keyof Value]: Value[Key] };
|
|
69
|
+
type Simplify$1<Value> = { [Key in keyof Value]: Value[Key]; };
|
|
70
|
+
/** Adds one requested payload to a result's `_payloads`, keeping earlier requests. */
|
|
71
|
+
type WithPayload<Result, Key extends PropertyKey, Value> = Omit<Result, "_payloads"> & {
|
|
72
|
+
_payloads: Simplify$1<(Result extends {
|
|
73
|
+
_payloads: infer Existing;
|
|
74
|
+
} ? Existing : {}) & { [Name in Key]: Value; }>;
|
|
75
|
+
};
|
|
59
76
|
type ResultOf<Configured> = Configured extends QueryInfo<infer Result> ? Result : never;
|
|
60
77
|
type FilteredOf<Configured> = Configured extends QueryInfo<unknown, boolean, infer Filtered> ? Filtered : false;
|
|
61
78
|
type RelationOf<Registry extends CollectionRegistry, Name extends keyof Registry, Key extends keyof RelationshipsOf<Registry[Name]>> = RelationshipsOf<Registry[Name]>[Key] & Relationship;
|
|
@@ -64,15 +81,17 @@ type RelatedName$1<Registry extends CollectionRegistry, Relation extends Relatio
|
|
|
64
81
|
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);
|
|
65
82
|
type RelationValue<Definition, Relation extends Relationship, Configured> = RelationshipResult<Definition, Relation, ResultOf<Configured>, FilteredOf<Configured>>;
|
|
66
83
|
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> = QueryInfo<Result, Selected, Filtered> & {
|
|
67
|
-
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]>> | Keys[number]]: Key extends Keys[number] ? QueryData<Registry[Name]>[Key & keyof QueryData<Registry[Name]>] : Key extends keyof Result ? Result[Key] : never }, true, Many, Root, Filtered, AllowAdjacent, Pagination>;
|
|
84
|
+
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]>> | Keys[number]]: Key extends Keys[number] ? QueryData<Registry[Name]>[Key & keyof QueryData<Registry[Name]>] : Key extends keyof Result ? Result[Key] : never; }, true, Many, Root, Filtered, AllowAdjacent, Pagination>;
|
|
68
85
|
where(configure: (fields: Fields<QueryData<Registry[Name]>>) => Expression): Query<Registry, Name, Result, Selected, Many, Root, true, AllowAdjacent, Pagination>;
|
|
69
|
-
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
|
|
86
|
+
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>;
|
|
70
87
|
} & (Many extends true ? {
|
|
71
88
|
orderBy(field: SortKey<QueryData<Registry[Name]>>, direction?: "asc" | "desc"): Query<Registry, Name, Result, Selected, Many, Root, Filtered, AllowAdjacent, Pagination>;
|
|
72
89
|
} : {}) & (Many extends true ? Pagination extends true ? {
|
|
73
90
|
limit(value: number): Query<Registry, Name, Result, Selected, Many, Root, Filtered, AllowAdjacent, Pagination>;
|
|
74
91
|
offset(value: number): Query<Registry, Name, Result, Selected, Many, Root, Filtered, AllowAdjacent, Pagination>;
|
|
75
92
|
} : {} : {}) & (AllowAdjacent extends true ? {
|
|
93
|
+
/** Attaches a payload under `_payloads` after filtering, ordering, and pagination. */
|
|
94
|
+
withPayload<Key extends keyof PayloadsOf<Registry[Name]> & string>(name: Key): Query<Registry, Name, WithPayload<Result, Key, PayloadsOf<Registry[Name]>[Key]>, Selected, Many, Root, Filtered, AllowAdjacent, Pagination>;
|
|
76
95
|
selectAdjacent(): Query<Registry, Name, Result & {
|
|
77
96
|
_adjacent: Adjacent<{
|
|
78
97
|
id: string;
|
|
@@ -89,7 +108,10 @@ type Query<Registry extends CollectionRegistry, Name extends keyof Registry & st
|
|
|
89
108
|
execute: Selected extends true ? () => Promise<Simplify$1<Result>[]> : never;
|
|
90
109
|
then: Selected extends true ? Promise<Simplify$1<Result>[]>["then"] : never;
|
|
91
110
|
first: Selected extends true ? () => Promise<Simplify$1<Result> | undefined> : never;
|
|
92
|
-
|
|
111
|
+
/** Counts matching entries; unavailable once payloads are requested. */
|
|
112
|
+
count: [Result] extends [never] ? () => Promise<number> : [Result] extends [{
|
|
113
|
+
_payloads: unknown;
|
|
114
|
+
}] ? never : () => Promise<number>;
|
|
93
115
|
} : {});
|
|
94
116
|
type Adjacent<Entry> = {
|
|
95
117
|
previous: Entry | null;
|
|
@@ -120,7 +142,7 @@ type FieldFilter$1<Value> = PresenceFilter & (NonNullable<Value> extends readonl
|
|
|
120
142
|
hasSome?: readonly Item[];
|
|
121
143
|
hasEvery?: readonly Item[];
|
|
122
144
|
} : {} : [Value] extends [Scalar] ? ScalarFilter<Value> : {});
|
|
123
|
-
type Where<Data> = { [Name in keyof Data]?: [Data[Name]] extends [Scalar] ? Data[Name] | FieldFilter$1<Data[Name]> : FieldFilter$1<Data[Name]
|
|
145
|
+
type Where<Data> = { [Name in keyof Data]?: [Data[Name]] extends [Scalar] ? Data[Name] | FieldFilter$1<Data[Name]> : FieldFilter$1<Data[Name]>; } & {
|
|
124
146
|
AND?: Where<Data> | readonly Where<Data>[];
|
|
125
147
|
OR?: readonly Where<Data>[];
|
|
126
148
|
NOT?: Where<Data> | readonly Where<Data>[];
|
|
@@ -137,7 +159,7 @@ type QueryOptions<Registry extends CollectionRegistry, Name extends keyof Regist
|
|
|
137
159
|
select: Selection<Registry, Name, AllowAdjacent>;
|
|
138
160
|
};
|
|
139
161
|
type AdjacentOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string> = Omit<QueryOptions<Registry, Name, true, false>, "limit" | "offset">;
|
|
140
|
-
type Selection<Registry extends CollectionRegistry, Name extends keyof Registry & string, AllowAdjacent extends boolean = true> = { [Field in keyof QueryData<Registry[Name]>]?: boolean } & { [Key in keyof RelationshipsOf<Registry[Name]>]?: QueryOptions<Registry, RelatedName$1<Registry, RelationOf<Registry, Name, Key>>, RelationOf<Registry, Name, Key>["type"] extends "many" ? true : false, AllowAdjacent> | false } & (AllowAdjacent extends true ? {
|
|
162
|
+
type Selection<Registry extends CollectionRegistry, Name extends keyof Registry & string, AllowAdjacent extends boolean = true> = { [Field in keyof QueryData<Registry[Name]>]?: boolean; } & { [Key in keyof RelationshipsOf<Registry[Name]>]?: QueryOptions<Registry, RelatedName$1<Registry, RelationOf<Registry, Name, Key>>, RelationOf<Registry, Name, Key>["type"] extends "many" ? true : false, AllowAdjacent> | false; } & (AllowAdjacent extends true ? {
|
|
141
163
|
_adjacent?: true | AdjacentOptions<Registry, Name>;
|
|
142
164
|
} : {});
|
|
143
165
|
type ObjectRelationValue<Registry extends CollectionRegistry, Name extends keyof Registry & string, Key extends keyof RelationshipsOf<Registry[Name]>, Options> = Options extends {
|
|
@@ -147,13 +169,13 @@ type SelectionResult<Registry extends CollectionRegistry, Name extends keyof Reg
|
|
|
147
169
|
id: string;
|
|
148
170
|
}> : Projection[Key] extends {
|
|
149
171
|
select: infer Neighbors;
|
|
150
|
-
} ? Adjacent<SelectionResult<Registry, Name, Neighbors>> : never : Key extends keyof RelationshipsOf<Registry[Name]> ? ObjectRelationValue<Registry, Name, Key, Projection[Key]> : Key extends keyof QueryData<Registry[Name]> ? QueryData<Registry[Name]>[Key] : never };
|
|
151
|
-
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 };
|
|
152
|
-
type CheckedWhereList$1<Data, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedWhere$1<Data, Filters[Index]
|
|
153
|
-
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 };
|
|
154
|
-
type CheckedSelection<Registry extends CollectionRegistry, Name extends keyof Registry & string, Projection, AllowAdjacent extends boolean> = { [Key in keyof Projection]: Key extends "_adjacent" ? AllowAdjacent extends true ? Projection[Key] extends true ? true : CheckedOptions<Registry, Name, Projection[Key], true, false, false> : never : Key extends keyof RelationshipsOf<Registry[Name]> ? Projection[Key] extends false ? false : CheckedOptions<Registry, RelatedName$1<Registry, RelationOf<Registry, Name, Key>>, Projection[Key], RelationOf<Registry, Name, Key>["type"] extends "many" ? true : false, AllowAdjacent> : Key extends keyof QueryData<Registry[Name]> ? Projection[Key] : never };
|
|
172
|
+
} ? Adjacent<SelectionResult<Registry, Name, Neighbors>> : never : Key extends keyof RelationshipsOf<Registry[Name]> ? ObjectRelationValue<Registry, Name, Key, Projection[Key]> : Key extends keyof QueryData<Registry[Name]> ? QueryData<Registry[Name]>[Key] : never; };
|
|
173
|
+
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; };
|
|
174
|
+
type CheckedWhereList$1<Data, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedWhere$1<Data, Filters[Index]>; };
|
|
175
|
+
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; };
|
|
176
|
+
type CheckedSelection<Registry extends CollectionRegistry, Name extends keyof Registry & string, Projection, AllowAdjacent extends boolean> = { [Key in keyof Projection]: Key extends "_adjacent" ? AllowAdjacent extends true ? Projection[Key] extends true ? true : CheckedOptions<Registry, Name, Projection[Key], true, false, false> : never : Key extends keyof RelationshipsOf<Registry[Name]> ? Projection[Key] extends false ? false : CheckedOptions<Registry, RelatedName$1<Registry, RelationOf<Registry, Name, Key>>, Projection[Key], RelationOf<Registry, Name, Key>["type"] extends "many" ? true : false, AllowAdjacent> : Key extends keyof QueryData<Registry[Name]> ? Projection[Key] : never; };
|
|
155
177
|
/** Rejects extra properties throughout inferred options, including recursive neighbor projections. */
|
|
156
|
-
type CheckedOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options, Many extends boolean = true, AllowAdjacent extends boolean = true, Pagination extends boolean = true> = { [Key in keyof Options]: Key extends "select" ? CheckedSelection<Registry, Name, Options[Key], AllowAdjacent> : Key extends "where" ? CheckedWhere$1<QueryData<Registry[Name]>, Options[Key]> : Key extends "limit" | "offset" ? Pagination extends true ? Many extends true ? Options[Key] : never : never : Key extends keyof ObjectScope<Registry, Name, Many> ? Options[Key] : never };
|
|
178
|
+
type CheckedOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options, Many extends boolean = true, AllowAdjacent extends boolean = true, Pagination extends boolean = true> = { [Key in keyof Options]: Key extends "select" ? CheckedSelection<Registry, Name, Options[Key], AllowAdjacent> : Key extends "where" ? CheckedWhere$1<QueryData<Registry[Name]>, Options[Key]> : Key extends "limit" | "offset" ? Pagination extends true ? Many extends true ? Options[Key] : never : never : Key extends keyof ObjectScope<Registry, Name, Many> ? Options[Key] : never; };
|
|
157
179
|
//#endregion
|
|
158
180
|
//#region src/query/relational-types.d.ts
|
|
159
181
|
type RelatedName<Registry extends CollectionRegistry, Name extends keyof Registry, Key extends keyof RelationshipsOf<Registry[Name]>> = (RelationshipsOf<Registry[Name]>[Key] & Relationship)["collection"] & keyof Registry & string;
|
|
@@ -193,17 +215,19 @@ type FieldFilter<Value> = {
|
|
|
193
215
|
arrayContained?: readonly Item[];
|
|
194
216
|
} : {} : {});
|
|
195
217
|
/** Object predicates over prepared fields and existential filters over related entries. */
|
|
196
|
-
type RelationalWhere<Registry extends CollectionRegistry, Name extends keyof Registry & string> = { [Key in keyof QueryData<Registry[Name]>]?: Condition<QueryData<Registry[Name]>[Key]
|
|
218
|
+
type RelationalWhere<Registry extends CollectionRegistry, Name extends keyof Registry & string> = { [Key in keyof QueryData<Registry[Name]>]?: Condition<QueryData<Registry[Name]>[Key]>; } & { [Key in keyof RelationshipsOf<Registry[Name]>]?: boolean | RelationalWhere<Registry, RelatedName<Registry, Name, Key>>; } & {
|
|
197
219
|
AND?: RelationalWhere<Registry, Name> | readonly RelationalWhere<Registry, Name>[];
|
|
198
220
|
OR?: readonly RelationalWhere<Registry, Name>[];
|
|
199
221
|
NOT?: RelationalWhere<Registry, Name> | readonly RelationalWhere<Registry, Name>[];
|
|
200
222
|
RAW?: (fields: Fields<QueryData<Registry[Name]>>) => Expression;
|
|
201
223
|
};
|
|
224
|
+
/** Payloads to attach under `_payloads`; payloads set to false are omitted. */
|
|
225
|
+
type PayloadOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string> = { [Key in keyof PayloadsOf<Registry[Name]>]?: boolean; };
|
|
202
226
|
/** Collection-scoped metadata queries with Drizzle-style columns, relationships, and filters. */
|
|
203
227
|
type RelationalQueryOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string, Many extends boolean = true, AllowAdjacent extends boolean = true, Pagination extends boolean = true> = {
|
|
204
228
|
columns?: Partial<Record<keyof QueryData<Registry[Name]>, boolean>>;
|
|
205
229
|
where?: RelationalWhere<Registry, Name>;
|
|
206
|
-
with?: { [Key in keyof RelationshipsOf<Registry[Name]>]?: boolean | RelationalQueryOptions<Registry, RelatedName<Registry, Name, Key>, IsMany<Registry, Name, Key>, AllowAdjacent
|
|
230
|
+
with?: { [Key in keyof RelationshipsOf<Registry[Name]>]?: boolean | RelationalQueryOptions<Registry, RelatedName<Registry, Name, Key>, IsMany<Registry, Name, Key>, AllowAdjacent>; };
|
|
207
231
|
} & (Many extends true ? {
|
|
208
232
|
orderBy?: OrderBy<QueryData<Registry[Name]>>;
|
|
209
233
|
} : {}) & (Many extends true ? (Pagination extends true ? {
|
|
@@ -211,15 +235,16 @@ type RelationalQueryOptions<Registry extends CollectionRegistry, Name extends ke
|
|
|
211
235
|
offset?: number;
|
|
212
236
|
} : {}) : {}) & (AllowAdjacent extends true ? {
|
|
213
237
|
adjacent?: true | RelationalQueryOptions<Registry, Name, true, false, false>;
|
|
238
|
+
payloads?: PayloadOptions<Registry, Name>;
|
|
214
239
|
} : {});
|
|
215
240
|
/** Options accepted by the root count helper, whose result ignores sorting and pagination. */
|
|
216
241
|
type RelationalCountOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string> = Pick<RelationalQueryOptions<Registry, Name>, "where" | "orderBy" | "offset" | "limit">;
|
|
217
242
|
type ColumnResult<Data, Options> = Options extends {
|
|
218
243
|
columns: infer Columns;
|
|
219
|
-
} ? keyof Columns extends never ? {} : true extends Columns[keyof Columns] ? { -readonly [Key in keyof Columns as Columns[Key] extends false | undefined ? never : Key]-?: Key extends keyof Data ? Data[Key] : never } : Omit<Data, { [Key in keyof Columns]: Columns[Key] extends false ? Key : never }[keyof Columns]> : Data;
|
|
244
|
+
} ? keyof Columns extends never ? {} : true extends Columns[keyof Columns] ? { -readonly [Key in keyof Columns as Columns[Key] extends false | undefined ? never : Key]-?: Key extends keyof Data ? Data[Key] : never; } : Omit<Data, { [Key in keyof Columns]: Columns[Key] extends false ? Key : never; }[keyof Columns]> : Data;
|
|
220
245
|
type IncludedResult<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options> = Options extends {
|
|
221
246
|
with: infer Related;
|
|
222
|
-
} ? { -readonly [Key in keyof Related as Related[Key] extends false | undefined ? never : Key]-?: Key extends keyof RelationshipsOf<Registry[Name]> ? RelationshipResult<Registry[Name], RelationshipsOf<Registry[Name]>[Key] & Relationship, RelationalQueryResult<Registry, RelatedName<Registry, Name, Key>, Related[Key] extends true ? {} : Related[Key]>, "where" extends keyof Related[Key] ? true : false> : never } : {};
|
|
247
|
+
} ? { -readonly [Key in keyof Related as Related[Key] extends false | undefined ? never : Key]-?: Key extends keyof RelationshipsOf<Registry[Name]> ? RelationshipResult<Registry[Name], RelationshipsOf<Registry[Name]>[Key] & Relationship, RelationalQueryResult<Registry, RelatedName<Registry, Name, Key>, Related[Key] extends true ? {} : Related[Key]>, "where" extends keyof Related[Key] ? true : false> : never; } : {};
|
|
223
248
|
type AdjacentResult<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options> = Options extends {
|
|
224
249
|
adjacent: infer Neighbors;
|
|
225
250
|
} ? {
|
|
@@ -227,19 +252,27 @@ type AdjacentResult<Registry extends CollectionRegistry, Name extends keyof Regi
|
|
|
227
252
|
id: string;
|
|
228
253
|
}> : Adjacent<RelationalQueryResult<Registry, Name, Neighbors>>;
|
|
229
254
|
} : {};
|
|
230
|
-
type Simplify<Value> = { [Key in keyof Value]: Value[Key] };
|
|
255
|
+
type Simplify<Value> = { [Key in keyof Value]: Value[Key]; };
|
|
256
|
+
type RequestedPayloads<Payloads, Requested> = { -readonly [Key in keyof Requested as Requested[Key] extends false | undefined ? never : Key]-?: Key extends keyof Payloads ? Payloads[Key] : never; };
|
|
257
|
+
type PayloadResult<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options> = Options extends {
|
|
258
|
+
payloads: infer Requested;
|
|
259
|
+
} ? keyof RequestedPayloads<PayloadsOf<Registry[Name]>, Requested> extends never ? {} : {
|
|
260
|
+
_payloads: Simplify<RequestedPayloads<PayloadsOf<Registry[Name]>, Requested>>;
|
|
261
|
+
} : {};
|
|
231
262
|
/** Infers selected columns and relationships, preserving optional metadata in default projections. */
|
|
232
|
-
type RelationalQueryResult<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options> = Options extends unknown ? Simplify<ColumnResult<QueryData<Registry[Name]>, Options> & IncludedResult<Registry, Name, Options> & AdjacentResult<Registry, Name, Options>> : never;
|
|
233
|
-
type CheckedConditions<Value, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedCondition<Value, Filters[Index]
|
|
234
|
-
type CheckedCondition<Value, Filter> = Filter extends Scalar ? Filter : { [Key in keyof Filter]: Key extends "AND" | "OR" ? Filter[Key] extends readonly unknown[] ? CheckedConditions<Value, Filter[Key]> : never : Key extends "NOT" ? CheckedCondition<Value, Filter[Key]> : Key extends keyof FieldFilter<Value> ? Filter[Key] : never };
|
|
235
|
-
type CheckedWhereList<Registry extends CollectionRegistry, Name extends keyof Registry & string, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedWhere<Registry, Name, Filters[Index]
|
|
236
|
-
type CheckedWhere<Registry extends CollectionRegistry, Name extends keyof Registry & string, Filter> = { [Key in keyof Filter]: Key extends "AND" | "OR" | "NOT" ? Filter[Key] extends readonly unknown[] ? CheckedWhereList<Registry, Name, Filter[Key]> : CheckedWhere<Registry, Name, Filter[Key]> : Key extends "RAW" ? Filter[Key] : Key extends keyof RelationshipsOf<Registry[Name]> ? Filter[Key] extends boolean ? Filter[Key] : CheckedWhere<Registry, RelatedName<Registry, Name, Key>, Filter[Key]> : Key extends keyof QueryData<Registry[Name]> ? CheckedCondition<QueryData<Registry[Name]>[Key], Filter[Key]> : never };
|
|
263
|
+
type RelationalQueryResult<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options> = Options extends unknown ? Simplify<ColumnResult<QueryData<Registry[Name]>, Options> & IncludedResult<Registry, Name, Options> & AdjacentResult<Registry, Name, Options> & PayloadResult<Registry, Name, Options>> : never;
|
|
264
|
+
type CheckedConditions<Value, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedCondition<Value, Filters[Index]>; };
|
|
265
|
+
type CheckedCondition<Value, Filter> = Filter extends Scalar ? Filter : { [Key in keyof Filter]: Key extends "AND" | "OR" ? Filter[Key] extends readonly unknown[] ? CheckedConditions<Value, Filter[Key]> : never : Key extends "NOT" ? CheckedCondition<Value, Filter[Key]> : Key extends keyof FieldFilter<Value> ? Filter[Key] : never; };
|
|
266
|
+
type CheckedWhereList<Registry extends CollectionRegistry, Name extends keyof Registry & string, Filters extends readonly unknown[]> = { [Index in keyof Filters]: CheckedWhere<Registry, Name, Filters[Index]>; };
|
|
267
|
+
type CheckedWhere<Registry extends CollectionRegistry, Name extends keyof Registry & string, Filter> = { [Key in keyof Filter]: Key extends "AND" | "OR" | "NOT" ? Filter[Key] extends readonly unknown[] ? CheckedWhereList<Registry, Name, Filter[Key]> : CheckedWhere<Registry, Name, Filter[Key]> : Key extends "RAW" ? Filter[Key] : Key extends keyof RelationshipsOf<Registry[Name]> ? Filter[Key] extends boolean ? Filter[Key] : CheckedWhere<Registry, RelatedName<Registry, Name, Key>, Filter[Key]> : Key extends keyof QueryData<Registry[Name]> ? CheckedCondition<QueryData<Registry[Name]>[Key], Filter[Key]> : never; };
|
|
237
268
|
/** Rejects unknown options recursively, including options supplied through inferred variables. */
|
|
238
|
-
type CheckedRelationalOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options, Many extends boolean = true, AllowAdjacent extends boolean = true, Pagination extends boolean = true> = { [Key in keyof Options]: Key extends "columns" ? { [Column in keyof Options[Key]]: Column extends keyof QueryData<Registry[Name]> ? Options[Key][Column] : never } : Key extends "where" ? CheckedWhere<Registry, Name, Options[Key]> : Key extends "with" ? { [Related in keyof Options[Key]]: Related extends keyof RelationshipsOf<Registry[Name]> ? Options[Key][Related] extends boolean ? Options[Key][Related] : CheckedRelationalOptions<Registry, RelatedName<Registry, Name, Related>, Options[Key][Related], IsMany<Registry, Name, Related>, AllowAdjacent> : never } : Key extends "adjacent" ? AllowAdjacent extends true ? Options[Key] extends true ? true : CheckedRelationalOptions<Registry, Name, Options[Key], true, false, false> : never : Key extends "orderBy" ? Key extends keyof RelationalQueryOptions<Registry, Name, Many, AllowAdjacent, Pagination> ? { [Field in keyof Options[Key]]: Field extends keyof OrderBy<QueryData<Registry[Name]>> ? Options[Key][Field] : never } : never : Key extends keyof RelationalQueryOptions<Registry, Name, Many, AllowAdjacent, Pagination> ? Options[Key] : never };
|
|
269
|
+
type CheckedRelationalOptions<Registry extends CollectionRegistry, Name extends keyof Registry & string, Options, Many extends boolean = true, AllowAdjacent extends boolean = true, Pagination extends boolean = true> = { [Key in keyof Options]: Key extends "columns" ? { [Column in keyof Options[Key]]: Column extends keyof QueryData<Registry[Name]> ? Options[Key][Column] : never; } : Key extends "where" ? CheckedWhere<Registry, Name, Options[Key]> : Key extends "with" ? { [Related in keyof Options[Key]]: Related extends keyof RelationshipsOf<Registry[Name]> ? Options[Key][Related] extends boolean ? Options[Key][Related] : CheckedRelationalOptions<Registry, RelatedName<Registry, Name, Related>, Options[Key][Related], IsMany<Registry, Name, Related>, AllowAdjacent> : never; } : Key extends "adjacent" ? AllowAdjacent extends true ? Options[Key] extends true ? true : CheckedRelationalOptions<Registry, Name, Options[Key], true, false, false> : never : Key extends "payloads" ? AllowAdjacent extends true ? { [Payload in keyof Options[Key]]: Payload extends keyof PayloadsOf<Registry[Name]> ? Options[Key][Payload] : never; } : never : Key extends "orderBy" ? Key extends keyof RelationalQueryOptions<Registry, Name, Many, AllowAdjacent, Pagination> ? { [Field in keyof Options[Key]]: Field extends keyof OrderBy<QueryData<Registry[Name]>> ? Options[Key][Field] : never; } : never : Key extends keyof RelationalQueryOptions<Registry, Name, Many, AllowAdjacent, Pagination> ? Options[Key] : never; };
|
|
239
270
|
/** Typed per-collection query entry points that never expose source configuration at runtime. */
|
|
240
271
|
type RelationalQueries<Registry extends CollectionRegistry> = string extends keyof Registry ? {} : { readonly [Name in keyof Registry & string]: {
|
|
241
|
-
/** Returns matching metadata rows and requested relationships. */
|
|
272
|
+
/** Returns matching metadata rows and requested relationships. */
|
|
273
|
+
findMany<const Options extends RelationalQueryOptions<Registry, Name> = {}>(options?: Options & CheckedRelationalOptions<Registry, Name, NoInfer<Options>>): Promise<RelationalQueryResult<Registry, Name, Options>[]>;
|
|
274
|
+
/** Returns the first matching entry, or undefined when none matches. */
|
|
242
275
|
findFirst<const Options extends RelationalQueryOptions<Registry, Name> = {}>(options?: Options & CheckedRelationalOptions<Registry, Name, NoInfer<Options>>): Promise<RelationalQueryResult<Registry, Name, Options> | undefined>;
|
|
243
|
-
} };
|
|
276
|
+
}; };
|
|
244
277
|
//#endregion
|
|
245
278
|
export { QueryPlan as _, RelationalWhere as a, Fields as c, Scalar as d, ScalarField as f, Expression as g, Where as h, RelationalQueryResult as i, Ordered as l, SelectionResult as m, RelationalQueries as n, Adjacent as o, Selection as p, RelationalQueryOptions as r, Field$1 as s, RelationalCountOptions as t, Query as u, QueryRegistry as v };
|
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
10
|
var __exportAll = (all, no_symbols) => {
|
|
11
11
|
let target = {};
|
|
12
12
|
for (var name in all) __defProp(target, name, {
|
|
@@ -26,7 +26,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
}
|
|
27
27
|
return to;
|
|
28
28
|
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
30
|
value: mod,
|
|
31
31
|
enumerable: true
|
|
32
32
|
}) : target, mod));
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as ContentDiagnostic, o as ContentError, s as ContentErrorCode, t as Content } from "./content-lwPxE9Yu.mjs";
|
|
2
|
+
import { n as ContentRenderResult, t as ContentHeading } from "./types-Dh-Sydyw.mjs";
|
|
3
3
|
export { type Content, type ContentDiagnostic, ContentError, type ContentErrorCode, type ContentHeading, type ContentRenderResult };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#endregion
|
|
2
|
+
export { t as ContentError } from "./errors-C2iuBM0G.mjs";
|
|
3
|
+
import { t as assertServerOnly } from "./server-only-CIJUlyL-.mjs";
|
|
3
4
|
//#region src/runtime.ts
|
|
4
5
|
assertServerOnly();
|
|
5
|
-
//#endregion
|
|
6
|
-
export { ContentError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __exportAll } from "./
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-Bg1v5YCA.mjs";
|
|
2
2
|
import { array, bigint, boolean, coerce, date, enum as enum$1, literal, number, object, record, string, union, unknown } from "zod";
|
|
3
3
|
//#region src/schema/builders.ts
|
|
4
4
|
var builders_exports = /* @__PURE__ */ __exportAll({
|
package/dist/schema.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { array, bigint, boolean, coerce, date, enum as enum$1, literal, number, object, record, string, union, unknown } from "zod";
|
|
2
2
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
-
|
|
4
|
-
//#region src/schema/builders.d.ts
|
|
5
3
|
declare namespace builders_d_exports {
|
|
6
4
|
export { array, bigint, boolean, coerce, date, enum$1 as enum, output as infer, input, literal, number, object, output, record, string, union, unknown };
|
|
7
5
|
}
|
package/dist/schema.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { builders_exports as schema };
|
|
1
|
+
export { t as schema } from "./schema-C5Str-E8.mjs";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as Loader } from "./types-FmUJ3cH1.mjs";
|
|
2
|
+
import { n as ContentRenderResult } from "./types-Dh-Sydyw.mjs";
|
|
2
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
-
|
|
4
4
|
//#region src/collection/types.d.ts
|
|
5
|
+
declare const builtinPayloadsType: unique symbol;
|
|
5
6
|
type Schema = StandardSchemaV1;
|
|
6
7
|
type SchemaOutput<Value> = Value extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Value> : Record<string, unknown>;
|
|
7
8
|
type ComputedContext<Data, Source = unknown> = {
|
|
8
|
-
/** The collection's key in the configured registry. */
|
|
9
|
-
|
|
9
|
+
/** The collection's key in the configured registry. */
|
|
10
|
+
collection: string;
|
|
11
|
+
id: string;
|
|
12
|
+
/** Loader-provided source metadata, detached from stored entries for this resolver. */
|
|
10
13
|
source?: Source extends object ? Readonly<Source> : Source;
|
|
11
14
|
data: Readonly<Data>;
|
|
12
15
|
readBody(this: void): Promise<string | undefined>;
|
|
@@ -37,12 +40,30 @@ type ComputedData<Definition> = Definition extends {
|
|
|
37
40
|
computed: infer Computed;
|
|
38
41
|
} ? { [Name in keyof Computed]: Computed[Name] extends {
|
|
39
42
|
schema: infer ResultSchema;
|
|
40
|
-
} ? SchemaOutput<ResultSchema> : never } : {};
|
|
43
|
+
} ? SchemaOutput<ResultSchema> : never; } : {};
|
|
41
44
|
type QueryData<Definition> = {
|
|
42
45
|
id: string;
|
|
43
46
|
} & EntryData<Definition> & ComputedData<Definition>;
|
|
44
47
|
type RelationshipsOf<Definition> = Definition extends {
|
|
45
48
|
relationships: infer Relationships;
|
|
46
49
|
} ? Relationships : {};
|
|
50
|
+
/**
|
|
51
|
+
* Payloads that Markdown sources, `glob()`, and custom loaders provide for every entry.
|
|
52
|
+
* Built-in names start with an underscore, so they never collide with custom payloads.
|
|
53
|
+
*/
|
|
54
|
+
type BuiltinPayloads = {
|
|
55
|
+
/** The retained raw body, or undefined when the entry has none or retention is disabled. */
|
|
56
|
+
_body: string | undefined;
|
|
57
|
+
/** HTML and headings; entries without a rendering path reject with `not-renderable`. */
|
|
58
|
+
_rendered: ContentRenderResult;
|
|
59
|
+
};
|
|
60
|
+
/** Type-only marker recording which built-in payloads a defined collection carries. */
|
|
61
|
+
type BuiltinPayloadMarker<Available extends keyof BuiltinPayloads> = {
|
|
62
|
+
readonly [builtinPayloadsType]?: Available;
|
|
63
|
+
};
|
|
64
|
+
/** Payload names and value types that queries can request for a collection definition. */
|
|
65
|
+
type PayloadsOf<Definition> = Definition extends {
|
|
66
|
+
readonly [builtinPayloadsType]?: infer Available;
|
|
67
|
+
} ? Pick<BuiltinPayloads, Available & keyof BuiltinPayloads> : BuiltinPayloads;
|
|
47
68
|
//#endregion
|
|
48
|
-
export {
|
|
69
|
+
export { ComputedContext as a, Relationship as c, SchemaOutput as d, CollectionRegistry as i, RelationshipsOf as l, BuiltinPayloads as n, PayloadsOf as o, CollectionDefinition as r, QueryData as s, BuiltinPayloadMarker as t, Schema as u };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { r as RenderedContent } from "./types-
|
|
2
|
-
|
|
1
|
+
import { r as RenderedContent } from "./types-Dh-Sydyw.mjs";
|
|
3
2
|
//#region src/shared/types.d.ts
|
|
4
3
|
type MaybePromise<Value> = Value | Promise<Value>;
|
|
5
4
|
//#endregion
|
|
6
5
|
//#region src/loaders/types.d.ts
|
|
7
6
|
declare const loaderSourceType: unique symbol;
|
|
7
|
+
declare const recordLoaderType: unique symbol;
|
|
8
|
+
declare const bodyLoaderType: unique symbol;
|
|
8
9
|
/** A stored content record, following Astro's build-time DataEntry contract. */
|
|
9
10
|
type DataEntry<Data extends Record<string, unknown> = Record<string, unknown>, Source = unknown> = {
|
|
10
11
|
id: string;
|
|
@@ -15,7 +16,8 @@ type DataEntry<Data extends Record<string, unknown> = Record<string, unknown>, S
|
|
|
15
16
|
digest?: string | number;
|
|
16
17
|
deferredRender?: boolean;
|
|
17
18
|
assetImports?: string[];
|
|
18
|
-
imageImports?: (string | number)[][];
|
|
19
|
+
imageImports?: (string | number)[][];
|
|
20
|
+
/** Optional ContentQuery metadata; Astro stores do not retain this extension. */
|
|
19
21
|
source?: Source;
|
|
20
22
|
};
|
|
21
23
|
/** Source metadata supplied by loaders of individual local files. */
|
|
@@ -103,7 +105,8 @@ type LoaderContext<in Source = unknown> = {
|
|
|
103
105
|
meta: MetaStore;
|
|
104
106
|
config: LoaderConfig;
|
|
105
107
|
logger: LoaderLogger;
|
|
106
|
-
watcher?: LoaderWatcher;
|
|
108
|
+
watcher?: LoaderWatcher;
|
|
109
|
+
/** ContentQuery extension: cancellation for this load attempt. */
|
|
107
110
|
signal?: AbortSignal;
|
|
108
111
|
parseData<Data extends Record<string, unknown>>(options: {
|
|
109
112
|
id: string;
|
|
@@ -118,7 +121,8 @@ type LoaderContext<in Source = unknown> = {
|
|
|
118
121
|
};
|
|
119
122
|
/** An Astro-compatible, named build-time content loader. */
|
|
120
123
|
type Loader<out Source = unknown> = {
|
|
121
|
-
/** Type-only marker preserving metadata inference without changing Astro's load signature. */
|
|
124
|
+
/** Type-only marker preserving metadata inference without changing Astro's load signature. */
|
|
125
|
+
readonly [loaderSourceType]?: Source;
|
|
122
126
|
name: string;
|
|
123
127
|
schema?: unknown;
|
|
124
128
|
createSchema?(): MaybePromise<{
|
|
@@ -127,9 +131,22 @@ type Loader<out Source = unknown> = {
|
|
|
127
131
|
}>;
|
|
128
132
|
load(context: LoaderContext<Source>): Promise<void>;
|
|
129
133
|
};
|
|
134
|
+
/** A loader whose entries are data records without bodies or rendered output, such as `file()`. */
|
|
135
|
+
type RecordLoader<Source = unknown> = Loader<Source> & {
|
|
136
|
+
/** Type-only marker: entries never carry built-in `_body` or `_rendered` payloads. */
|
|
137
|
+
readonly [recordLoaderType]: true;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* A loader whose entries carry raw bodies but never rendered output, such as a loader for a
|
|
141
|
+
* format that the host application compiles itself.
|
|
142
|
+
*/
|
|
143
|
+
type BodyLoader<Source = unknown> = Loader<Source> & {
|
|
144
|
+
/** Type-only marker: entries offer the built-in `_body` payload but never `_rendered`. */
|
|
145
|
+
readonly [bodyLoaderType]: true;
|
|
146
|
+
};
|
|
130
147
|
/** Infers the source metadata a typed loader supplies to computed resolvers. */
|
|
131
148
|
type LoaderSource<Value> = Value extends {
|
|
132
149
|
readonly [loaderSourceType]?: infer Source;
|
|
133
150
|
} ? Source : unknown;
|
|
134
151
|
//#endregion
|
|
135
|
-
export {
|
|
152
|
+
export { FileSource as a, LoaderContext as c, LoaderWatcher as d, MetaStore as f, FileEntrySource as i, LoaderLogger as l, MaybePromise as m, DataEntry as n, Loader as o, RecordLoader as p, DataStore as r, LoaderConfig as s, BodyLoader as t, LoaderSource as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as contentError, t as ContentError } from "./errors-
|
|
2
|
-
import { i as detach } from "./values-
|
|
1
|
+
import { n as contentError, t as ContentError } from "./errors-C2iuBM0G.mjs";
|
|
2
|
+
import { i as detach } from "./values-BbTV4QT-.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
//#region src/loaders/descriptor.ts
|