nextpress-core 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acf-functions/core/acf-builder.d.ts +1 -0
- package/dist/acf-functions/core/acf-field-group-autoloader.d.ts +1 -0
- package/dist/acf-functions/field-props.d.ts +196 -0
- package/dist/acf-functions/field-props.js +1 -0
- package/dist/acf-functions/services/define-field-group.d.ts +1 -0
- package/dist/acf-functions/services/define-layout.d.ts +1 -0
- package/dist/acf-functions/services/map-fields/helpers/map-choice-object.d.ts +1 -1
- package/dist/acf-functions/services/map-fields/map-fields.d.ts +3 -0
- package/dist/acf-functions/types/acf-field-group.d.ts +99 -0
- package/dist/acf-functions/types/acf-field-group.js +1 -0
- package/dist/acf-functions/types/acf-field.d.ts +2813 -0
- package/dist/acf-functions/types/acf-field.js +1 -0
- package/dist/acf-functions/types/acf-layout.d.ts +19 -0
- package/dist/acf-functions/types/acf-layout.js +1 -0
- package/dist/acf-functions/types/acf-values.d.ts +4 -0
- package/dist/acf-functions/types/acf-values.js +1 -0
- package/dist/acf-functions/types/components/field-props.d.ts +196 -0
- package/dist/acf-functions/types/components/field-props.js +1 -0
- package/dist/acf-functions/types/components/nextpress-component.d.ts +11 -0
- package/dist/acf-functions/types/components/nextpress-component.js +1 -0
- package/dist/entities/common.d.ts +28 -0
- package/dist/entities/common.js +1 -0
- package/dist/entities/option/option.interface.d.ts +7 -0
- package/dist/entities/option/option.interface.js +2 -0
- package/dist/entities/post/post.interface.d.ts +67 -0
- package/dist/entities/post/post.interface.js +2 -0
- package/dist/entities/term/term.interface.d.ts +8 -0
- package/dist/entities/term/term.interface.js +1 -0
- package/dist/entities/user/user.interface.d.ts +9 -0
- package/dist/entities/user/user.interface.js +1 -0
- package/dist/globals/entity-loader/entity-loader-base.d.ts +1 -1
- package/dist/globals/entity-loader/entity-loader.interface.d.ts +52 -0
- package/dist/globals/entity-loader/entity-loader.interface.js +1 -0
- package/dist/globals/entity-loader/option-loader.d.ts +1 -1
- package/dist/globals/entity-loader/post-loader.d.ts +1 -1
- package/dist/globals/entity-loader/term-loader.d.ts +1 -1
- package/dist/globals/entity-loader/user-loader.d.ts +1 -1
- package/dist/globals/get-field/get-field.d.ts +2 -1
- package/dist/globals/nextpress-config/nextpress-config.interface.d.ts +14 -0
- package/dist/globals/nextpress-config/nextpress-config.interface.js +1 -0
- package/dist/repository/optionquery/option-query-args.d.ts +19 -0
- package/dist/repository/optionquery/option-query-args.js +1 -0
- package/dist/repository/optionquery/option-query.d.ts +1 -1
- package/dist/repository/postquery/post-query-args.d.ts +104 -0
- package/dist/repository/postquery/post-query-args.js +1 -0
- package/dist/repository/postquery/post-query.d.ts +1 -1
- package/dist/repository/termquery/term-query-args.d.ts +51 -0
- package/dist/repository/termquery/term-query-args.js +1 -0
- package/dist/repository/termquery/term-query.d.ts +1 -1
- package/dist/repository/userquery/user-query-args.d.ts +63 -0
- package/dist/repository/userquery/user-query-args.js +1 -0
- package/dist/repository/userquery/user-query.d.ts +1 -1
- package/dist/router/types.d.ts +8 -0
- package/dist/router/types.js +1 -0
- package/dist/ui/render-components.d.ts +1 -1
- package/dist/wpdb/wpdb.interface.d.ts +152 -0
- package/dist/wpdb/wpdb.interface.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ACFField, NextpressField } from "./acf-field";
|
|
2
|
+
type TransformACFLayout<T> = T extends any ? Omit<T, 'key' | 'sub_fields'> & ('sub_fields' extends keyof T ? {
|
|
3
|
+
sub_fields: NextpressField[];
|
|
4
|
+
} : []) : never;
|
|
5
|
+
/** ACF Layout without key constraints to allow key generation */
|
|
6
|
+
export type NextpressLayout = TransformACFLayout<ACFLayout>;
|
|
7
|
+
/**
|
|
8
|
+
* Represents a layout within an ACF Flexible Content field.
|
|
9
|
+
*/
|
|
10
|
+
export type ACFLayout = {
|
|
11
|
+
key: string;
|
|
12
|
+
name: string;
|
|
13
|
+
label: string;
|
|
14
|
+
display: 'table' | 'block' | 'row';
|
|
15
|
+
sub_fields: ACFField[];
|
|
16
|
+
min?: string;
|
|
17
|
+
max?: string;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { IPost } from "@/entities/post/post.interface";
|
|
2
|
+
import { ITerm } from "@/entities/term/term.interface";
|
|
3
|
+
import { IUser } from "@/entities/user/user.interface";
|
|
4
|
+
import { JSX } from "react";
|
|
5
|
+
type GetFields<T> = T extends {
|
|
6
|
+
fields: readonly any[];
|
|
7
|
+
} ? T['fields'] : T extends {
|
|
8
|
+
sub_fields: readonly any[];
|
|
9
|
+
} ? T['sub_fields'] : never;
|
|
10
|
+
/**
|
|
11
|
+
* Represents the properties passed to a Nextpress ACF component.
|
|
12
|
+
*
|
|
13
|
+
* @template T - The expected type of the mapped ACF fields.
|
|
14
|
+
*/
|
|
15
|
+
export type FieldProps<LayoutT> = LayoutT extends {
|
|
16
|
+
fields: readonly any[];
|
|
17
|
+
} | {
|
|
18
|
+
sub_fields: readonly any[];
|
|
19
|
+
} ? ResolvedFields<GetFields<LayoutT>> : never;
|
|
20
|
+
/**
|
|
21
|
+
* An array of ACF field configurations to a strongly-typed object representing the resolved data structure.
|
|
22
|
+
* It iterates over the array, using the `name` property of each field as the object key, and determines the expected value type using the `MapFieldType` utility.
|
|
23
|
+
*
|
|
24
|
+
* @template Fields - A readonly array of ACF field configuration objects.
|
|
25
|
+
*/
|
|
26
|
+
export type ResolvedFields<Fields extends readonly any[]> = {
|
|
27
|
+
[F in Fields[number] as F['name']]: MapFieldType<F>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Maps an array of ACF Flexible Content layouts to a union type representing the resolved layout blocks.
|
|
31
|
+
* For each layout, it checks for the presence of `fields` or `sub_fields`, and resolves to a specific object
|
|
32
|
+
* structure containing the layout's React component and its deeply resolved field content.
|
|
33
|
+
*
|
|
34
|
+
* @template Layouts - A readonly array of ACF Flexible Content layout configuration objects.
|
|
35
|
+
*/
|
|
36
|
+
export type ResolvedFlexibleContent<Layouts extends readonly any[]> = {
|
|
37
|
+
[L in Layouts[number] as L['name']]: L extends {
|
|
38
|
+
name: infer Name;
|
|
39
|
+
} & ({
|
|
40
|
+
fields: readonly any[];
|
|
41
|
+
} | {
|
|
42
|
+
sub_fields: readonly any[];
|
|
43
|
+
}) ? {
|
|
44
|
+
Component: () => Promise<JSX.Element>;
|
|
45
|
+
content: ResolvedFields<GetFields<L>>;
|
|
46
|
+
}[] : never;
|
|
47
|
+
}[Layouts[number]['name']];
|
|
48
|
+
type MapFieldType<Field> = Field extends {
|
|
49
|
+
type: 'color_picker';
|
|
50
|
+
} ? string | null : Field extends {
|
|
51
|
+
type: 'date_picker';
|
|
52
|
+
} ? string | null : Field extends {
|
|
53
|
+
type: 'date_time_picker';
|
|
54
|
+
} ? string | null : Field extends {
|
|
55
|
+
type: 'google_map';
|
|
56
|
+
} ? ACFGoogleMapsObject | null : Field extends {
|
|
57
|
+
type: 'icon_picker';
|
|
58
|
+
} ? Field extends {
|
|
59
|
+
return_format: 'string';
|
|
60
|
+
} ? string | null : Field extends {
|
|
61
|
+
return_format: 'array';
|
|
62
|
+
} ? ACFIconObject | null : ACFIconObject | null : Field extends {
|
|
63
|
+
type: 'time_picker';
|
|
64
|
+
} ? string | null : Field extends {
|
|
65
|
+
type: 'email';
|
|
66
|
+
} ? string | null : Field extends {
|
|
67
|
+
type: 'number';
|
|
68
|
+
} ? number | null : Field extends {
|
|
69
|
+
type: 'password';
|
|
70
|
+
} ? string | null : Field extends {
|
|
71
|
+
type: 'range';
|
|
72
|
+
} ? number | null : Field extends {
|
|
73
|
+
type: 'text';
|
|
74
|
+
} ? string | null : Field extends {
|
|
75
|
+
type: 'textarea';
|
|
76
|
+
} ? string | null : Field extends {
|
|
77
|
+
type: 'button_group';
|
|
78
|
+
} ? Field extends {
|
|
79
|
+
return_format: 'array';
|
|
80
|
+
} ? ACFChoiceObject | null : string | null : Field extends {
|
|
81
|
+
type: 'checkbox';
|
|
82
|
+
} ? Field extends {
|
|
83
|
+
return_format: 'array';
|
|
84
|
+
} ? ACFChoiceObject[] : string[] : Field extends {
|
|
85
|
+
type: 'radio';
|
|
86
|
+
} ? Field extends {
|
|
87
|
+
return_format: 'array';
|
|
88
|
+
} ? ACFChoiceObject | null : string | null : Field extends {
|
|
89
|
+
type: 'select';
|
|
90
|
+
} ? Field extends {
|
|
91
|
+
multiple: 1;
|
|
92
|
+
} ? Field extends {
|
|
93
|
+
return_format: 'array';
|
|
94
|
+
} ? ACFChoiceObject[] : string[] : Field extends {
|
|
95
|
+
return_format: 'array';
|
|
96
|
+
} ? ACFChoiceObject | null : string | null : Field extends {
|
|
97
|
+
type: 'true_false';
|
|
98
|
+
} ? boolean : Field extends {
|
|
99
|
+
type: 'file';
|
|
100
|
+
} ? number | null : Field extends {
|
|
101
|
+
type: 'gallery';
|
|
102
|
+
} ? number[] : Field extends {
|
|
103
|
+
type: 'image';
|
|
104
|
+
} ? number | null : Field extends {
|
|
105
|
+
type: 'oembed';
|
|
106
|
+
} ? string | null : Field extends {
|
|
107
|
+
type: 'wysiwyg';
|
|
108
|
+
} ? string | null : Field extends {
|
|
109
|
+
type: 'link';
|
|
110
|
+
} ? Field extends {
|
|
111
|
+
return_format: 'url';
|
|
112
|
+
} ? string | null : Field extends {
|
|
113
|
+
return_format: 'array';
|
|
114
|
+
} ? ACFLinkObject | null : ACFLinkObject : Field extends {
|
|
115
|
+
type: 'page_link';
|
|
116
|
+
} ? Field extends {
|
|
117
|
+
multiple: 1;
|
|
118
|
+
} ? string[] : string | null : Field extends {
|
|
119
|
+
type: 'post_object';
|
|
120
|
+
} ? Field extends {
|
|
121
|
+
multiple: 1;
|
|
122
|
+
} ? Field extends {
|
|
123
|
+
return_format: 'object';
|
|
124
|
+
} ? IPost[] : number[] : Field extends {
|
|
125
|
+
return_format: 'object';
|
|
126
|
+
} ? IPost | null : number | null : Field extends {
|
|
127
|
+
type: 'relationship';
|
|
128
|
+
} ? Field extends {
|
|
129
|
+
return_format: 'object';
|
|
130
|
+
} ? IPost[] | null : number[] | null : Field extends {
|
|
131
|
+
type: 'taxonomy';
|
|
132
|
+
} ? Field extends {
|
|
133
|
+
multiple: 1;
|
|
134
|
+
} ? Field extends {
|
|
135
|
+
return_format: 'object';
|
|
136
|
+
} ? ITerm[] : number[] : Field extends {
|
|
137
|
+
return_format: 'object';
|
|
138
|
+
} ? ITerm | null : number | null : Field extends {
|
|
139
|
+
type: 'user';
|
|
140
|
+
} ? Field extends {
|
|
141
|
+
multiple: 1;
|
|
142
|
+
} ? Field extends {
|
|
143
|
+
return_format: 'object';
|
|
144
|
+
} ? IUser[] : number[] : Field extends {
|
|
145
|
+
return_format: 'object';
|
|
146
|
+
} ? IUser | null : number | null : Field extends {
|
|
147
|
+
type: 'group';
|
|
148
|
+
} & ({
|
|
149
|
+
fields: readonly any[];
|
|
150
|
+
} | {
|
|
151
|
+
sub_fields: readonly any[];
|
|
152
|
+
}) ? ResolvedFields<GetFields<Field>> | null : Field extends {
|
|
153
|
+
type: 'repeater';
|
|
154
|
+
} & ({
|
|
155
|
+
fields: readonly any[];
|
|
156
|
+
} | {
|
|
157
|
+
sub_fields: readonly any[];
|
|
158
|
+
}) ? ResolvedFields<GetFields<Field>>[] | null : Field extends {
|
|
159
|
+
type: 'flexible_content';
|
|
160
|
+
layouts: readonly any[];
|
|
161
|
+
} ? ResolvedFlexibleContent<Field['layouts']> | null : Field extends {
|
|
162
|
+
fields: readonly any[];
|
|
163
|
+
} | {
|
|
164
|
+
sub_fields: readonly any[];
|
|
165
|
+
} ? ResolvedFields<GetFields<Field>> : never;
|
|
166
|
+
export type ACFIconObject = {
|
|
167
|
+
type: string;
|
|
168
|
+
value: string;
|
|
169
|
+
};
|
|
170
|
+
export type ACFLinkObject = {
|
|
171
|
+
title: string;
|
|
172
|
+
url: string;
|
|
173
|
+
target: string;
|
|
174
|
+
};
|
|
175
|
+
export type ACFChoiceObject = {
|
|
176
|
+
label?: string;
|
|
177
|
+
value?: string;
|
|
178
|
+
};
|
|
179
|
+
export type ACFGoogleMapsObject = {
|
|
180
|
+
address: string;
|
|
181
|
+
lat: string | number;
|
|
182
|
+
lng: string | number;
|
|
183
|
+
zoom: string | number;
|
|
184
|
+
place_id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
street_number: string | number;
|
|
187
|
+
street_name: string;
|
|
188
|
+
street_name_short: string;
|
|
189
|
+
city: string;
|
|
190
|
+
state: string;
|
|
191
|
+
state_short: string;
|
|
192
|
+
post_code: string | number;
|
|
193
|
+
country: string;
|
|
194
|
+
country_short: string;
|
|
195
|
+
};
|
|
196
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { NextpressLayout } from '../acf-layout';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Next.js React component that consumes Nextpress ACF fields.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The expected type of the mapped ACF fields.
|
|
7
|
+
*/
|
|
8
|
+
export type NextpressComponent = {
|
|
9
|
+
layout: NextpressLayout;
|
|
10
|
+
Component: () => Promise<JSX.Element>;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents entity with a path.
|
|
3
|
+
*/
|
|
4
|
+
export interface IPath {
|
|
5
|
+
/** Nextpress path to entity. */
|
|
6
|
+
path: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Array of field key-value pairs.
|
|
10
|
+
*/
|
|
11
|
+
export type Fields = {
|
|
12
|
+
/** Field key. */
|
|
13
|
+
key: string;
|
|
14
|
+
/** Field value. */
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
/**
|
|
18
|
+
* Represents entity that can provide ACF fields.
|
|
19
|
+
*/
|
|
20
|
+
export interface IFieldLocation {
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves fields matching a name prefix.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} name - Field name prefix to search for.
|
|
25
|
+
* @returns {Promise<Fields>} Promise resolving to array of fields.
|
|
26
|
+
*/
|
|
27
|
+
getFields: (name: string) => Promise<Fields>;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Selectable } from "kysely";
|
|
2
|
+
import { WpPost } from "../../wpdb/wpdb.interface";
|
|
3
|
+
import { IFieldLocation, IPath } from "../common";
|
|
4
|
+
/**
|
|
5
|
+
* Attributes for post attachment images.
|
|
6
|
+
*/
|
|
7
|
+
export type PostImageAttributes = {
|
|
8
|
+
/** Image source URL. */
|
|
9
|
+
src?: string;
|
|
10
|
+
/** Image alternative text. */
|
|
11
|
+
alt?: string;
|
|
12
|
+
/** Image height. */
|
|
13
|
+
height?: number;
|
|
14
|
+
/** Image width. */
|
|
15
|
+
width?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Attributes for nav menu items.
|
|
19
|
+
*/
|
|
20
|
+
export type MenuItemAttributes = {
|
|
21
|
+
/** Menu item label. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** Menu item type. */
|
|
24
|
+
type: 'custom' | 'post_type' | 'taxonomy';
|
|
25
|
+
/** Parent menu item ID. */
|
|
26
|
+
parentId: number;
|
|
27
|
+
/** Target object ID. */
|
|
28
|
+
objectId: number;
|
|
29
|
+
/** Menu item URL. */
|
|
30
|
+
url: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Base post properties.
|
|
34
|
+
*/
|
|
35
|
+
export interface IBasePost extends Selectable<WpPost> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Page post properties.
|
|
39
|
+
*/
|
|
40
|
+
export interface IPagePost extends IBasePost, IPath {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Standard post properties.
|
|
44
|
+
*/
|
|
45
|
+
export interface IPostPost extends IBasePost, IPath {
|
|
46
|
+
/** Featured image attachment ID. */
|
|
47
|
+
thumbnailId: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Attachment post properties.
|
|
51
|
+
*/
|
|
52
|
+
export interface IAttachmentPost extends IBasePost {
|
|
53
|
+
/** Image attributes. */
|
|
54
|
+
imageAttributes: PostImageAttributes;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Menu item properties.
|
|
58
|
+
*/
|
|
59
|
+
export interface IMenuItem extends IBasePost {
|
|
60
|
+
/** Menu item attributes. */
|
|
61
|
+
menuItemAttributes: MenuItemAttributes | null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Comprehensive post entity encompassing all post types.
|
|
65
|
+
*/
|
|
66
|
+
export interface IPost extends IBasePost, IPagePost, IPostPost, IAttachmentPost, IMenuItem, IFieldLocation {
|
|
67
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Selectable } from "kysely";
|
|
2
|
+
import { WpTerm, WpTermTaxonomy } from "../../wpdb/wpdb.interface";
|
|
3
|
+
import { IPath } from "../common";
|
|
4
|
+
/**
|
|
5
|
+
* Represents term entity.
|
|
6
|
+
*/
|
|
7
|
+
export interface ITerm extends Selectable<WpTerm>, Selectable<WpTermTaxonomy>, IPath {
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the contract for an entity loader.
|
|
3
|
+
*
|
|
4
|
+
* @template EntityT The type of entity being loaded.
|
|
5
|
+
* @template QueryArgsT The type of arguments used for querying the entity.
|
|
6
|
+
*/
|
|
7
|
+
export interface EntityLoader<EntityT, QueryArgsT> {
|
|
8
|
+
/**
|
|
9
|
+
* Queues entity IDs for loading.
|
|
10
|
+
*
|
|
11
|
+
* @param {number[]} ids Array of entity IDs.
|
|
12
|
+
*/
|
|
13
|
+
prime: (ids: number[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Finds entity IDs based on query arguments and queues them for loading.
|
|
16
|
+
*
|
|
17
|
+
* @param {QueryArgsT} args Query arguments.
|
|
18
|
+
* @returns {Promise<{ids: number[], count: number}>} Array of found IDs and the total count.
|
|
19
|
+
* @throws {Error} If the query fails.
|
|
20
|
+
*/
|
|
21
|
+
findAndPrime: (args: QueryArgsT) => Promise<{
|
|
22
|
+
ids: number[];
|
|
23
|
+
count: number;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves entities by their IDs.
|
|
27
|
+
*
|
|
28
|
+
* @param {number[]} ids Array of entity IDs.
|
|
29
|
+
* @returns {Promise<EntityT[]>} Array of entities.
|
|
30
|
+
* @throws {Error} If retrieval fails.
|
|
31
|
+
*/
|
|
32
|
+
get: (ids: number[]) => Promise<EntityT[]>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Defines the contract for an entity query.
|
|
36
|
+
*
|
|
37
|
+
* @template TArgs The type of query arguments.
|
|
38
|
+
*/
|
|
39
|
+
export interface EntityQuery<TArgs> {
|
|
40
|
+
/**
|
|
41
|
+
* Executes the query and returns the matching entity IDs.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Promise<number[]>} Array of entity IDs.
|
|
44
|
+
* @throws {Error} If the query fails.
|
|
45
|
+
*/
|
|
46
|
+
getIds(): Promise<number[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the total count of entities matching the query.
|
|
49
|
+
* @returns {number | undefined} Total count, or undefined if not computed.
|
|
50
|
+
*/
|
|
51
|
+
getCount(): number | undefined;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IOption } from "../../entities/option/option.interface";
|
|
2
2
|
import { OptionQueryArgs } from "../../repository/optionquery/option-query-args";
|
|
3
|
-
import { EntityLoader } from "./entity-loader";
|
|
3
|
+
import { EntityLoader } from "./entity-loader.interface";
|
|
4
4
|
declare global {
|
|
5
5
|
/** Global instance of the OptionLoader. */
|
|
6
6
|
var optionLoader: EntityLoader<IOption, OptionQueryArgs>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPost } from "../../entities/post/post.interface";
|
|
2
|
-
import { EntityLoader } from "./entity-loader";
|
|
2
|
+
import { EntityLoader } from "./entity-loader.interface";
|
|
3
3
|
declare global {
|
|
4
4
|
/** Global instance of the PostLoader. */
|
|
5
5
|
var postLoader: EntityLoader<IPost, PostQueryArgs>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITerm } from "../../entities/term/term.interface";
|
|
2
|
-
import { EntityLoader } from "./entity-loader";
|
|
2
|
+
import { EntityLoader } from "./entity-loader.interface";
|
|
3
3
|
declare global {
|
|
4
4
|
/** Global instance of the TermLoader. */
|
|
5
5
|
var termLoader: EntityLoader<ITerm, TermQueryArgs>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IUser } from "../../entities/user/user.interface";
|
|
2
|
-
import { EntityLoader } from "./entity-loader";
|
|
2
|
+
import { EntityLoader } from "./entity-loader.interface";
|
|
3
3
|
declare global {
|
|
4
4
|
/** Global instance of the UserLoader. */
|
|
5
5
|
var userLoader: EntityLoader<IUser, UserQueryArgs>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { NextpressFieldGroup } from "@/acf-functions/types/acf-field-group";
|
|
2
|
+
import { FieldProps } from "@/acf-functions/types/components/field-props";
|
|
1
3
|
import { IFieldLocation } from "../../entities/common";
|
|
2
|
-
import { FieldProps } from "../../acf-functions/types/components/field-props";
|
|
3
4
|
/** Specifies location to retrieve fields from. */
|
|
4
5
|
type Location = IFieldLocation | 'options';
|
|
5
6
|
declare global {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type NextpressConfig = {
|
|
2
|
+
/** Custom taxonomies used to categorize and group content (like categories or tags). Expects the taxonomy's URL prefix, so tag instead of post_tag */
|
|
3
|
+
readonly publicTaxonomies?: string[];
|
|
4
|
+
/** Custom post types registered for public consumption (like posts, pages, or portfolio). */
|
|
5
|
+
readonly publicPostTypes?: string[];
|
|
6
|
+
/** Post types that should display archive pages on the frontend. */
|
|
7
|
+
readonly archivedPostTypes?: string[];
|
|
8
|
+
/** The word/character count limit for automatically generated post teasers. */
|
|
9
|
+
readonly excerptLength?: number;
|
|
10
|
+
/** Database option keys (from wp_options) to fetch early for performance optimization. */
|
|
11
|
+
readonly preLoadOptions?: string[];
|
|
12
|
+
} & {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DB } from "@/wpdb/wpdb.interface";
|
|
2
|
+
import { ComparisonOperatorExpression, ReferenceExpression } from "kysely";
|
|
3
|
+
/**
|
|
4
|
+
* Defines the arguments for querying options.
|
|
5
|
+
*/
|
|
6
|
+
export interface OptionQueryArgs {
|
|
7
|
+
/**
|
|
8
|
+
* Database column reference to query against.
|
|
9
|
+
*/
|
|
10
|
+
column: ReferenceExpression<DB, "wpOptions">;
|
|
11
|
+
/**
|
|
12
|
+
* Comparison operator for the query.
|
|
13
|
+
*/
|
|
14
|
+
operand?: ComparisonOperatorExpression;
|
|
15
|
+
/**
|
|
16
|
+
* Value or array of values to compare.
|
|
17
|
+
*/
|
|
18
|
+
value: string | string[];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityQuery } from "../../globals/entity-loader/entity-loader";
|
|
1
|
+
import { EntityQuery } from "../../globals/entity-loader/entity-loader.interface";
|
|
2
2
|
import { OptionQueryArgs } from "./option-query-args";
|
|
3
3
|
import { IOption } from "../../entities/option/option.interface";
|
|
4
4
|
/**
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
type WPQueryOrderByParam = 'none' | 'id' | 'author' | 'title' | 'name' | 'date' | 'modified' | 'parent' | 'menuOrder' | 'commentCount' | 'rand' | `RAND(${number})` | (string & {});
|
|
2
|
+
/**
|
|
3
|
+
* Defines the arguments for querying posts.
|
|
4
|
+
* Maps standard WordPress WP_Query parameters.
|
|
5
|
+
*/
|
|
6
|
+
interface PostQueryArgs {
|
|
7
|
+
/** Post ID. */
|
|
8
|
+
postId?: number;
|
|
9
|
+
/** An array of post IDs to retrieve, sticky posts will be included. */
|
|
10
|
+
postIn?: number[];
|
|
11
|
+
/** An array of post IDs not to retrieve. */
|
|
12
|
+
postNotIn?: number[];
|
|
13
|
+
/** Path to post */
|
|
14
|
+
path?: string;
|
|
15
|
+
/** A post type slug (string) or array of post type slugs. */
|
|
16
|
+
postType?: string | string[];
|
|
17
|
+
/** A post type slug (string) or array of post type slugs to NOT include. */
|
|
18
|
+
postTypeNot?: string | string[];
|
|
19
|
+
/** A post status (string) or array of post statuses. */
|
|
20
|
+
postStatus?: string | string[];
|
|
21
|
+
/** A post slug (string) or array of post slugs. */
|
|
22
|
+
postSlug?: string | string[];
|
|
23
|
+
/** A post id to retrieve anscestry tree off */
|
|
24
|
+
postAncestryOf?: string;
|
|
25
|
+
/** Post title. */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** The mime type of the post. Used for 'attachment' post_type. */
|
|
28
|
+
postMimeType?: string;
|
|
29
|
+
/** Page ID to retrieve child pages for. Use 0 to only retrieve top-level pages. */
|
|
30
|
+
postParent?: number;
|
|
31
|
+
/** An array containing parent page IDs to query child pages from. */
|
|
32
|
+
postParentIn?: number[];
|
|
33
|
+
/** An array containing parent page IDs not to query child pages from. */
|
|
34
|
+
postParentNotIn?: number[];
|
|
35
|
+
/** Term ID. */
|
|
36
|
+
termId?: number;
|
|
37
|
+
/** An array of term IDs (AND in). */
|
|
38
|
+
termAnd?: number[];
|
|
39
|
+
/** An array of term IDs (OR in). */
|
|
40
|
+
termIn?: number[];
|
|
41
|
+
/** An array of term IDs (NOT in). */
|
|
42
|
+
termNotIn?: number[];
|
|
43
|
+
/** Use term slug (not name, this or any children). */
|
|
44
|
+
termSlug?: string;
|
|
45
|
+
/** An array of term slugs (AND in). */
|
|
46
|
+
termSlugAnd?: string[];
|
|
47
|
+
/** An array of term slugs (OR in). */
|
|
48
|
+
termSlugIn?: string[];
|
|
49
|
+
/** Author ID. */
|
|
50
|
+
authorId?: number;
|
|
51
|
+
/** User 'user_nicename'. */
|
|
52
|
+
authorName?: string;
|
|
53
|
+
/** An array of author IDs to query from. */
|
|
54
|
+
authorIn?: number[];
|
|
55
|
+
/** An array of author IDs not to query from. */
|
|
56
|
+
authorNotIn?: number[];
|
|
57
|
+
/** search keyword(s). */
|
|
58
|
+
search?: string;
|
|
59
|
+
/** Whether to search by exact keyword. Default false. */
|
|
60
|
+
exact?: boolean;
|
|
61
|
+
/** array of column names to be searched. accepts 'postTitle', 'postExcerpt' and 'postContent'. */
|
|
62
|
+
searchColumns?: ('postTitle' | 'postExcerpt' | 'postContent')[];
|
|
63
|
+
/** Combination YearMonth. Accepts any four-digit year and month numbers 01-12. */
|
|
64
|
+
yyyymm?: number;
|
|
65
|
+
/** The four-digit year. Default empty. Accepts any four-digit year. */
|
|
66
|
+
year?: number;
|
|
67
|
+
/** The two-digit month. Default empty. Accepts numbers 1-12. */
|
|
68
|
+
monthnum?: number;
|
|
69
|
+
/** The week number of the year. Default empty. Accepts numbers 0-53. */
|
|
70
|
+
w?: number;
|
|
71
|
+
/** Day of the month. Default empty. Accepts numbers 1-31. */
|
|
72
|
+
day?: number;
|
|
73
|
+
/** Hour of the day. Default empty. Accepts numbers 0-23. */
|
|
74
|
+
hour?: number;
|
|
75
|
+
/** Minute of the hour. Default empty. Accepts numbers 0-59. */
|
|
76
|
+
minute?: number;
|
|
77
|
+
/** Second of the minute. Default empty. Accepts numbers 0-59. */
|
|
78
|
+
second?: number;
|
|
79
|
+
/** Whether to ignore sticky posts or not. Default false. */
|
|
80
|
+
ignoreStickyPosts?: boolean;
|
|
81
|
+
/** Designates ascending or descending order of posts. Default 'DESC'. */
|
|
82
|
+
order?: 'ASC' | 'DESC';
|
|
83
|
+
/** Sort retrieved posts by parameter. */
|
|
84
|
+
orderBy?: WPQueryOrderByParam;
|
|
85
|
+
/** Show posts that would show up on page X of a static front page. */
|
|
86
|
+
page?: number;
|
|
87
|
+
/** Show all posts (true) or paginate (false). Default false. */
|
|
88
|
+
noPaging?: boolean;
|
|
89
|
+
/** The number of posts to offset before retrieval. */
|
|
90
|
+
offset?: number;
|
|
91
|
+
/** The number of posts to query for. Use -1 to request all posts. */
|
|
92
|
+
postsPerPage?: number;
|
|
93
|
+
/** Whether to skip counting the total rows found. Default false. */
|
|
94
|
+
noFoundRows?: boolean;
|
|
95
|
+
/** Meta query */
|
|
96
|
+
metaQuery?: {
|
|
97
|
+
/** Meta key */
|
|
98
|
+
metaKey: string;
|
|
99
|
+
/** Variable name to save result to */
|
|
100
|
+
as: string;
|
|
101
|
+
}[];
|
|
102
|
+
/** Whether to get multiple, default true */
|
|
103
|
+
multiple?: boolean;
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityQuery } from "../../globals/entity-loader/entity-loader";
|
|
1
|
+
import { EntityQuery } from "../../globals/entity-loader/entity-loader.interface";
|
|
2
2
|
import { IPost } from "../../entities/post/post.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Executes database queries to retrieve post IDs and counts based on provided arguments.
|