@studiocms/devapps 0.1.0-beta.9 → 0.1.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/LICENSE +1 -1
- package/README.md +3 -23
- package/dist/effects/WordPressAPI/configs.d.ts +87 -0
- package/dist/effects/WordPressAPI/configs.js +88 -0
- package/dist/effects/WordPressAPI/converters.d.ts +57 -0
- package/dist/effects/WordPressAPI/converters.js +331 -0
- package/dist/effects/WordPressAPI/errors.d.ts +12 -0
- package/dist/effects/WordPressAPI/errors.js +6 -0
- package/dist/effects/WordPressAPI/importers.d.ts +19 -0
- package/dist/effects/WordPressAPI/importers.js +122 -0
- package/dist/effects/WordPressAPI/schema.d.ts +478 -0
- package/dist/effects/WordPressAPI/schema.js +127 -0
- package/dist/effects/WordPressAPI/utils.d.ts +17 -0
- package/dist/effects/WordPressAPI/utils.js +239 -0
- package/dist/effects/wpImporter.d.ts +14 -0
- package/dist/effects/wpImporter.js +88 -0
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -16
- package/dist/routes/wp-importer.d.ts +0 -25
- package/dist/routes/wp-importer.js +9 -54
- package/dist/schema/index.d.ts +0 -24
- package/dist/schema/index.js +1 -13
- package/dist/utils/pathGenerator.js +3 -1
- package/dist/virt.d.ts +1 -5
- package/package.json +25 -31
- package/dist/apps/libsql-viewer.d.ts +0 -46
- package/dist/apps/libsql-viewer.js +0 -95
- package/dist/schema/wp-api.d.ts +0 -439
- package/dist/schema/wp-api.js +0 -72
- package/dist/utils/wp-api/converters.d.ts +0 -74
- package/dist/utils/wp-api/converters.js +0 -181
- package/dist/utils/wp-api/index.d.ts +0 -6
- package/dist/utils/wp-api/index.js +0 -3
- package/dist/utils/wp-api/pages.d.ts +0 -13
- package/dist/utils/wp-api/pages.js +0 -38
- package/dist/utils/wp-api/posts.d.ts +0 -10
- package/dist/utils/wp-api/posts.js +0 -38
- package/dist/utils/wp-api/settings.d.ts +0 -18
- package/dist/utils/wp-api/settings.js +0 -45
- package/dist/utils/wp-api/utils.d.ts +0 -66
- package/dist/utils/wp-api/utils.js +0 -138
- package/dist/virt.d.js +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { SDKCore } from "studiocms:sdk";
|
|
3
|
+
import { userProjectRoot } from "virtual:studiocms-devapps/config";
|
|
4
|
+
import { Console, Effect, genLogger, Schema } from "studiocms/effect";
|
|
5
|
+
import {
|
|
6
|
+
APIEndpointConfig,
|
|
7
|
+
DownloadPostImageConfig,
|
|
8
|
+
FullPageData,
|
|
9
|
+
ImportEndpointConfig,
|
|
10
|
+
ImportPostsEndpointConfig,
|
|
11
|
+
RawPageData,
|
|
12
|
+
UseBlogPkgConfig
|
|
13
|
+
} from "./configs.js";
|
|
14
|
+
import { WordPressAPIConverters } from "./converters.js";
|
|
15
|
+
import { PagesSchema, PostsSchema, SiteSettings } from "./schema.js";
|
|
16
|
+
import { WordPressAPIUtils } from "./utils.js";
|
|
17
|
+
const ASTRO_PUBLIC_FOLDER = path.resolve(userProjectRoot, "public");
|
|
18
|
+
class WordPressAPI extends Effect.Service()("WordPressAPI", {
|
|
19
|
+
dependencies: [WordPressAPIUtils.Default, WordPressAPIConverters.Default],
|
|
20
|
+
effect: genLogger("@studiocms/devapps/effects/WordPressAPI.effect")(function* () {
|
|
21
|
+
const sdk = yield* SDKCore;
|
|
22
|
+
const { apiEndpoint, downloadPostImage, fetchAll } = yield* WordPressAPIUtils;
|
|
23
|
+
const { convertToPageContent, convertToPageData, convertToPostContent, convertToPostData } = yield* WordPressAPIConverters;
|
|
24
|
+
const importSettingsFromWPAPI = genLogger(
|
|
25
|
+
"@studiocms/devapps/effects/WordPressAPI.effect.importSettingsFromWPAPI"
|
|
26
|
+
)(function* () {
|
|
27
|
+
const { endpoint } = yield* ImportEndpointConfig;
|
|
28
|
+
const url = yield* apiEndpoint.pipe(APIEndpointConfig.makeProvide(endpoint, "settings"));
|
|
29
|
+
yield* Console.log("Fetching site settings from: ", url.origin);
|
|
30
|
+
const response = yield* Effect.tryPromise(() => fetch(url));
|
|
31
|
+
const rawSettings = yield* Effect.tryPromise(() => response.json());
|
|
32
|
+
const settings = yield* Schema.decodeUnknown(SiteSettings)(rawSettings);
|
|
33
|
+
yield* Console.log("Importing site settings: ", settings);
|
|
34
|
+
let siteIcon;
|
|
35
|
+
if (settings.site_icon_url) {
|
|
36
|
+
siteIcon = yield* downloadPostImage.pipe(
|
|
37
|
+
DownloadPostImageConfig.makeProvide(settings.site_icon_url, ASTRO_PUBLIC_FOLDER)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (!settings.site_icon_url && settings.site_logo) {
|
|
41
|
+
const siteLogoUrl = yield* apiEndpoint.pipe(
|
|
42
|
+
APIEndpointConfig.makeProvide(endpoint, "media", String(settings.site_logo))
|
|
43
|
+
);
|
|
44
|
+
const siteLogoResponse = yield* Effect.tryPromise(() => fetch(siteLogoUrl));
|
|
45
|
+
const siteLogoData = yield* Effect.tryPromise(() => siteLogoResponse.json());
|
|
46
|
+
siteIcon = yield* downloadPostImage.pipe(
|
|
47
|
+
DownloadPostImageConfig.makeProvide(siteLogoData.source_url, ASTRO_PUBLIC_FOLDER)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const siteConfig = {
|
|
51
|
+
title: settings.name,
|
|
52
|
+
description: settings.description
|
|
53
|
+
};
|
|
54
|
+
if (siteIcon) {
|
|
55
|
+
siteConfig.siteIcon = siteIcon;
|
|
56
|
+
}
|
|
57
|
+
const insert = yield* sdk.UPDATE.siteConfig(siteConfig);
|
|
58
|
+
if (insert) {
|
|
59
|
+
yield* Console.log("Updated site settings");
|
|
60
|
+
} else {
|
|
61
|
+
yield* Console.error("Failed to update site settings");
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const importPagesFromWPAPI = genLogger(
|
|
65
|
+
"@studiocms/devapps/effects/WordPressAPI.effect.importPagesFromWPAPI"
|
|
66
|
+
)(function* () {
|
|
67
|
+
const { endpoint } = yield* ImportEndpointConfig;
|
|
68
|
+
const url = yield* apiEndpoint.pipe(APIEndpointConfig.makeProvide(endpoint, "pages"));
|
|
69
|
+
yield* Console.log("fetching pages from: ", url.origin);
|
|
70
|
+
const rawPages = yield* fetchAll(url);
|
|
71
|
+
const { pages } = yield* Schema.decodeUnknown(PagesSchema)({ pages: rawPages });
|
|
72
|
+
yield* Console.log("Total pages: ", pages.length);
|
|
73
|
+
for (const page of pages) {
|
|
74
|
+
yield* Console.log("importing page:", page.title.rendered);
|
|
75
|
+
const pageData = yield* convertToPageData.pipe(
|
|
76
|
+
ImportEndpointConfig.makeProvide(endpoint),
|
|
77
|
+
RawPageData.makeProvide(page)
|
|
78
|
+
);
|
|
79
|
+
const pageContent = yield* convertToPageContent.pipe(
|
|
80
|
+
RawPageData.makeProvide(page),
|
|
81
|
+
FullPageData.makeProvide(pageData)
|
|
82
|
+
);
|
|
83
|
+
yield* sdk.POST.databaseEntry.pages(pageData, pageContent);
|
|
84
|
+
yield* Console.log("- Imported new page from WP-API: ", page.title.rendered);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const importPostsFromWPAPI = genLogger(
|
|
88
|
+
"@studiocms/devapps/effects/WordPressAPI.effect.importPostsFromWPAPI"
|
|
89
|
+
)(function* () {
|
|
90
|
+
const { endpoint, useBlogPkg } = yield* ImportPostsEndpointConfig;
|
|
91
|
+
const url = yield* apiEndpoint.pipe(APIEndpointConfig.makeProvide(endpoint, "posts"));
|
|
92
|
+
yield* Console.log("fetching posts from: ", url.origin);
|
|
93
|
+
const rawPages = yield* fetchAll(url);
|
|
94
|
+
const { posts: pages } = yield* Schema.decodeUnknown(PostsSchema)({ posts: rawPages });
|
|
95
|
+
yield* Console.log("Total posts: ", pages.length);
|
|
96
|
+
for (const page of pages) {
|
|
97
|
+
yield* Console.log("importing post:", page.title.rendered);
|
|
98
|
+
const pageData = yield* convertToPostData.pipe(
|
|
99
|
+
ImportEndpointConfig.makeProvide(endpoint),
|
|
100
|
+
RawPageData.makeProvide(page),
|
|
101
|
+
UseBlogPkgConfig.makeProvide(useBlogPkg)
|
|
102
|
+
);
|
|
103
|
+
const pageContent = yield* convertToPostContent.pipe(
|
|
104
|
+
RawPageData.makeProvide(page),
|
|
105
|
+
FullPageData.makeProvide(pageData)
|
|
106
|
+
);
|
|
107
|
+
yield* sdk.POST.databaseEntry.pages(pageData, pageContent);
|
|
108
|
+
yield* Console.log("- Imported new post from WP-API: ", page.title.rendered);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
importSettingsFromWPAPI,
|
|
113
|
+
importPagesFromWPAPI,
|
|
114
|
+
importPostsFromWPAPI
|
|
115
|
+
};
|
|
116
|
+
})
|
|
117
|
+
}) {
|
|
118
|
+
static Provide = Effect.provide(this.Default);
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
WordPressAPI
|
|
122
|
+
};
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { Schema } from 'studiocms/effect';
|
|
2
|
+
export declare const OpenClosedSchema: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
3
|
+
export declare const StatusSchema: Schema.Union<[Schema.Literal<["publish"]>, Schema.Literal<["future"]>, Schema.Literal<["draft"]>, Schema.Literal<["pending"]>, Schema.Literal<["private"]>]>;
|
|
4
|
+
export declare const PostFormatSchema: Schema.Union<[Schema.Literal<["standard"]>, Schema.Literal<["aside"]>, Schema.Literal<["chat"]>, Schema.Literal<["gallery"]>, Schema.Literal<["link"]>, Schema.Literal<["image"]>, Schema.Literal<["quote"]>, Schema.Literal<["status"]>, Schema.Literal<["video"]>, Schema.Literal<["audio"]>, Schema.Literal<[""]>]>;
|
|
5
|
+
export declare const MetaDataSchema: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
6
|
+
export declare const RenderedData: Schema.Struct<{
|
|
7
|
+
rendered: typeof Schema.String;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const RenderedProtectData: Schema.Struct<{
|
|
10
|
+
protected: typeof Schema.Boolean;
|
|
11
|
+
rendered: typeof Schema.String;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const NumberArray: Schema.Array$<typeof Schema.Number>;
|
|
14
|
+
declare const Page_base: Schema.Class<Page, {
|
|
15
|
+
id: typeof Schema.Number;
|
|
16
|
+
date: typeof Schema.Date;
|
|
17
|
+
date_gmt: typeof Schema.Date;
|
|
18
|
+
guid: Schema.Struct<{
|
|
19
|
+
rendered: typeof Schema.String;
|
|
20
|
+
}>;
|
|
21
|
+
modified: typeof Schema.Date;
|
|
22
|
+
modified_gmt: typeof Schema.Date;
|
|
23
|
+
slug: typeof Schema.String;
|
|
24
|
+
status: Schema.Union<[Schema.Literal<["publish"]>, Schema.Literal<["future"]>, Schema.Literal<["draft"]>, Schema.Literal<["pending"]>, Schema.Literal<["private"]>]>;
|
|
25
|
+
type: typeof Schema.String;
|
|
26
|
+
title: Schema.Struct<{
|
|
27
|
+
rendered: typeof Schema.String;
|
|
28
|
+
}>;
|
|
29
|
+
content: Schema.Struct<{
|
|
30
|
+
protected: typeof Schema.Boolean;
|
|
31
|
+
rendered: typeof Schema.String;
|
|
32
|
+
}>;
|
|
33
|
+
excerpt: Schema.Struct<{
|
|
34
|
+
protected: typeof Schema.Boolean;
|
|
35
|
+
rendered: typeof Schema.String;
|
|
36
|
+
}>;
|
|
37
|
+
author: typeof Schema.Number;
|
|
38
|
+
featured_media: typeof Schema.Number;
|
|
39
|
+
parent: typeof Schema.Number;
|
|
40
|
+
menu_order: typeof Schema.Number;
|
|
41
|
+
comment_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
42
|
+
ping_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
43
|
+
template: typeof Schema.String;
|
|
44
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
45
|
+
}, Schema.Struct.Encoded<{
|
|
46
|
+
id: typeof Schema.Number;
|
|
47
|
+
date: typeof Schema.Date;
|
|
48
|
+
date_gmt: typeof Schema.Date;
|
|
49
|
+
guid: Schema.Struct<{
|
|
50
|
+
rendered: typeof Schema.String;
|
|
51
|
+
}>;
|
|
52
|
+
modified: typeof Schema.Date;
|
|
53
|
+
modified_gmt: typeof Schema.Date;
|
|
54
|
+
slug: typeof Schema.String;
|
|
55
|
+
status: Schema.Union<[Schema.Literal<["publish"]>, Schema.Literal<["future"]>, Schema.Literal<["draft"]>, Schema.Literal<["pending"]>, Schema.Literal<["private"]>]>;
|
|
56
|
+
type: typeof Schema.String;
|
|
57
|
+
title: Schema.Struct<{
|
|
58
|
+
rendered: typeof Schema.String;
|
|
59
|
+
}>;
|
|
60
|
+
content: Schema.Struct<{
|
|
61
|
+
protected: typeof Schema.Boolean;
|
|
62
|
+
rendered: typeof Schema.String;
|
|
63
|
+
}>;
|
|
64
|
+
excerpt: Schema.Struct<{
|
|
65
|
+
protected: typeof Schema.Boolean;
|
|
66
|
+
rendered: typeof Schema.String;
|
|
67
|
+
}>;
|
|
68
|
+
author: typeof Schema.Number;
|
|
69
|
+
featured_media: typeof Schema.Number;
|
|
70
|
+
parent: typeof Schema.Number;
|
|
71
|
+
menu_order: typeof Schema.Number;
|
|
72
|
+
comment_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
73
|
+
ping_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
74
|
+
template: typeof Schema.String;
|
|
75
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
76
|
+
}>, never, {
|
|
77
|
+
readonly status: "publish" | "future" | "draft" | "pending" | "private";
|
|
78
|
+
} & {
|
|
79
|
+
readonly type: string;
|
|
80
|
+
} & {
|
|
81
|
+
readonly date: Date;
|
|
82
|
+
} & {
|
|
83
|
+
readonly meta: readonly any[];
|
|
84
|
+
} & {
|
|
85
|
+
readonly template: string;
|
|
86
|
+
} & {
|
|
87
|
+
readonly title: {
|
|
88
|
+
readonly rendered: string;
|
|
89
|
+
};
|
|
90
|
+
} & {
|
|
91
|
+
readonly id: number;
|
|
92
|
+
} & {
|
|
93
|
+
readonly date_gmt: Date;
|
|
94
|
+
} & {
|
|
95
|
+
readonly guid: {
|
|
96
|
+
readonly rendered: string;
|
|
97
|
+
};
|
|
98
|
+
} & {
|
|
99
|
+
readonly modified: Date;
|
|
100
|
+
} & {
|
|
101
|
+
readonly modified_gmt: Date;
|
|
102
|
+
} & {
|
|
103
|
+
readonly slug: string;
|
|
104
|
+
} & {
|
|
105
|
+
readonly content: {
|
|
106
|
+
readonly rendered: string;
|
|
107
|
+
readonly protected: boolean;
|
|
108
|
+
};
|
|
109
|
+
} & {
|
|
110
|
+
readonly excerpt: {
|
|
111
|
+
readonly rendered: string;
|
|
112
|
+
readonly protected: boolean;
|
|
113
|
+
};
|
|
114
|
+
} & {
|
|
115
|
+
readonly author: number;
|
|
116
|
+
} & {
|
|
117
|
+
readonly featured_media: number;
|
|
118
|
+
} & {
|
|
119
|
+
readonly parent: number;
|
|
120
|
+
} & {
|
|
121
|
+
readonly menu_order: number;
|
|
122
|
+
} & {
|
|
123
|
+
readonly comment_status: "" | "open" | "closed";
|
|
124
|
+
} & {
|
|
125
|
+
readonly ping_status: "" | "open" | "closed";
|
|
126
|
+
}, {}, {}>;
|
|
127
|
+
/**
|
|
128
|
+
* Schema definition for a WordPress Page object.
|
|
129
|
+
*
|
|
130
|
+
* This schema validates the structure of a WordPress Page object, ensuring that
|
|
131
|
+
* all required fields are present and have the correct types.
|
|
132
|
+
*
|
|
133
|
+
* Properties:
|
|
134
|
+
* - `id`: The unique identifier for the page (number).
|
|
135
|
+
* - `date`: The date the page was created (Date).
|
|
136
|
+
* - `date_gmt`: The date the page was created in GMT (Date).
|
|
137
|
+
* - `guid`: The globally unique identifier for the page, containing a rendered string.
|
|
138
|
+
* - `modified`: The date the page was last modified (Date).
|
|
139
|
+
* - `modified_gmt`: The date the page was last modified in GMT (Date).
|
|
140
|
+
* - `slug`: The URL-friendly slug for the page (string).
|
|
141
|
+
* - `status`: The status of the page, which can be 'publish', 'future', 'draft', 'pending', or 'private'.
|
|
142
|
+
* - `type`: The type of the page (string).
|
|
143
|
+
* - `title`: The title of the page, containing a rendered string.
|
|
144
|
+
* - `content`: The content of the page, containing a rendered string and a boolean indicating if it is protected.
|
|
145
|
+
* - `excerpt`: The excerpt of the page, containing a rendered string and a boolean indicating if it is protected.
|
|
146
|
+
* - `author`: The ID of the author of the page (number).
|
|
147
|
+
* - `featured_media`: The ID of the featured media for the page (number).
|
|
148
|
+
* - `parent`: The ID of the parent page (number).
|
|
149
|
+
* - `menu_order`: The order of the page in the menu (number).
|
|
150
|
+
* - `comment_status`: The comment status of the page, which can be 'open' or 'closed'.
|
|
151
|
+
* - `ping_status`: The ping status of the page, which can be 'open' or 'closed'.
|
|
152
|
+
* - `template`: The template used for the page (string).
|
|
153
|
+
* - `meta`: An array of metadata associated with the page, which can be any type or a record of any type.
|
|
154
|
+
*/
|
|
155
|
+
export declare class Page extends Page_base {
|
|
156
|
+
}
|
|
157
|
+
declare const PagesSchema_base: Schema.Class<PagesSchema, {
|
|
158
|
+
pages: Schema.Array$<typeof Page>;
|
|
159
|
+
}, Schema.Struct.Encoded<{
|
|
160
|
+
pages: Schema.Array$<typeof Page>;
|
|
161
|
+
}>, never, {
|
|
162
|
+
readonly pages: readonly Page[];
|
|
163
|
+
}, {}, {}>;
|
|
164
|
+
export declare class PagesSchema extends PagesSchema_base {
|
|
165
|
+
}
|
|
166
|
+
declare const Post_base: Schema.Class<Post, {
|
|
167
|
+
format: Schema.Union<[Schema.Literal<["standard"]>, Schema.Literal<["aside"]>, Schema.Literal<["chat"]>, Schema.Literal<["gallery"]>, Schema.Literal<["link"]>, Schema.Literal<["image"]>, Schema.Literal<["quote"]>, Schema.Literal<["status"]>, Schema.Literal<["video"]>, Schema.Literal<["audio"]>, Schema.Literal<[""]>]>;
|
|
168
|
+
categories: Schema.Array$<typeof Schema.Number>;
|
|
169
|
+
tags: Schema.Array$<typeof Schema.Number>;
|
|
170
|
+
id: typeof Schema.Number;
|
|
171
|
+
date: typeof Schema.Date;
|
|
172
|
+
date_gmt: typeof Schema.Date;
|
|
173
|
+
guid: Schema.Struct<{
|
|
174
|
+
rendered: typeof Schema.String;
|
|
175
|
+
}>;
|
|
176
|
+
modified: typeof Schema.Date;
|
|
177
|
+
modified_gmt: typeof Schema.Date;
|
|
178
|
+
slug: typeof Schema.String;
|
|
179
|
+
status: Schema.Union<[Schema.Literal<["publish"]>, Schema.Literal<["future"]>, Schema.Literal<["draft"]>, Schema.Literal<["pending"]>, Schema.Literal<["private"]>]>;
|
|
180
|
+
type: typeof Schema.String;
|
|
181
|
+
title: Schema.Struct<{
|
|
182
|
+
rendered: typeof Schema.String;
|
|
183
|
+
}>;
|
|
184
|
+
content: Schema.Struct<{
|
|
185
|
+
protected: typeof Schema.Boolean;
|
|
186
|
+
rendered: typeof Schema.String;
|
|
187
|
+
}>;
|
|
188
|
+
excerpt: Schema.Struct<{
|
|
189
|
+
protected: typeof Schema.Boolean;
|
|
190
|
+
rendered: typeof Schema.String;
|
|
191
|
+
}>;
|
|
192
|
+
author: typeof Schema.Number;
|
|
193
|
+
featured_media: typeof Schema.Number;
|
|
194
|
+
parent: typeof Schema.Number;
|
|
195
|
+
menu_order: typeof Schema.Number;
|
|
196
|
+
comment_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
197
|
+
ping_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
198
|
+
template: typeof Schema.String;
|
|
199
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
200
|
+
}, Schema.Struct.Encoded<{
|
|
201
|
+
format: Schema.Union<[Schema.Literal<["standard"]>, Schema.Literal<["aside"]>, Schema.Literal<["chat"]>, Schema.Literal<["gallery"]>, Schema.Literal<["link"]>, Schema.Literal<["image"]>, Schema.Literal<["quote"]>, Schema.Literal<["status"]>, Schema.Literal<["video"]>, Schema.Literal<["audio"]>, Schema.Literal<[""]>]>;
|
|
202
|
+
categories: Schema.Array$<typeof Schema.Number>;
|
|
203
|
+
tags: Schema.Array$<typeof Schema.Number>;
|
|
204
|
+
id: typeof Schema.Number;
|
|
205
|
+
date: typeof Schema.Date;
|
|
206
|
+
date_gmt: typeof Schema.Date;
|
|
207
|
+
guid: Schema.Struct<{
|
|
208
|
+
rendered: typeof Schema.String;
|
|
209
|
+
}>;
|
|
210
|
+
modified: typeof Schema.Date;
|
|
211
|
+
modified_gmt: typeof Schema.Date;
|
|
212
|
+
slug: typeof Schema.String;
|
|
213
|
+
status: Schema.Union<[Schema.Literal<["publish"]>, Schema.Literal<["future"]>, Schema.Literal<["draft"]>, Schema.Literal<["pending"]>, Schema.Literal<["private"]>]>;
|
|
214
|
+
type: typeof Schema.String;
|
|
215
|
+
title: Schema.Struct<{
|
|
216
|
+
rendered: typeof Schema.String;
|
|
217
|
+
}>;
|
|
218
|
+
content: Schema.Struct<{
|
|
219
|
+
protected: typeof Schema.Boolean;
|
|
220
|
+
rendered: typeof Schema.String;
|
|
221
|
+
}>;
|
|
222
|
+
excerpt: Schema.Struct<{
|
|
223
|
+
protected: typeof Schema.Boolean;
|
|
224
|
+
rendered: typeof Schema.String;
|
|
225
|
+
}>;
|
|
226
|
+
author: typeof Schema.Number;
|
|
227
|
+
featured_media: typeof Schema.Number;
|
|
228
|
+
parent: typeof Schema.Number;
|
|
229
|
+
menu_order: typeof Schema.Number;
|
|
230
|
+
comment_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
231
|
+
ping_status: Schema.Union<[Schema.Literal<["open"]>, Schema.Literal<["closed"]>, Schema.Literal<[""]>]>;
|
|
232
|
+
template: typeof Schema.String;
|
|
233
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
234
|
+
}>, never, {
|
|
235
|
+
readonly status: "publish" | "future" | "draft" | "pending" | "private";
|
|
236
|
+
} & {
|
|
237
|
+
readonly type: string;
|
|
238
|
+
} & {
|
|
239
|
+
readonly date: Date;
|
|
240
|
+
} & {
|
|
241
|
+
readonly meta: readonly any[];
|
|
242
|
+
} & {
|
|
243
|
+
readonly template: string;
|
|
244
|
+
} & {
|
|
245
|
+
readonly title: {
|
|
246
|
+
readonly rendered: string;
|
|
247
|
+
};
|
|
248
|
+
} & {
|
|
249
|
+
readonly id: number;
|
|
250
|
+
} & {
|
|
251
|
+
readonly date_gmt: Date;
|
|
252
|
+
} & {
|
|
253
|
+
readonly guid: {
|
|
254
|
+
readonly rendered: string;
|
|
255
|
+
};
|
|
256
|
+
} & {
|
|
257
|
+
readonly modified: Date;
|
|
258
|
+
} & {
|
|
259
|
+
readonly modified_gmt: Date;
|
|
260
|
+
} & {
|
|
261
|
+
readonly slug: string;
|
|
262
|
+
} & {
|
|
263
|
+
readonly content: {
|
|
264
|
+
readonly rendered: string;
|
|
265
|
+
readonly protected: boolean;
|
|
266
|
+
};
|
|
267
|
+
} & {
|
|
268
|
+
readonly excerpt: {
|
|
269
|
+
readonly rendered: string;
|
|
270
|
+
readonly protected: boolean;
|
|
271
|
+
};
|
|
272
|
+
} & {
|
|
273
|
+
readonly author: number;
|
|
274
|
+
} & {
|
|
275
|
+
readonly featured_media: number;
|
|
276
|
+
} & {
|
|
277
|
+
readonly parent: number;
|
|
278
|
+
} & {
|
|
279
|
+
readonly menu_order: number;
|
|
280
|
+
} & {
|
|
281
|
+
readonly comment_status: "" | "open" | "closed";
|
|
282
|
+
} & {
|
|
283
|
+
readonly ping_status: "" | "open" | "closed";
|
|
284
|
+
} & {
|
|
285
|
+
readonly format: "" | "status" | "image" | "aside" | "audio" | "link" | "video" | "standard" | "chat" | "gallery" | "quote";
|
|
286
|
+
} & {
|
|
287
|
+
readonly categories: readonly number[];
|
|
288
|
+
} & {
|
|
289
|
+
readonly tags: readonly number[];
|
|
290
|
+
}, {}, {}>;
|
|
291
|
+
/**
|
|
292
|
+
* Extends the PageSchema to define the schema for a WordPress Post.
|
|
293
|
+
*
|
|
294
|
+
* Properties:
|
|
295
|
+
* - `format`: Enum representing the format of the post. Possible values are:
|
|
296
|
+
* - 'standard'
|
|
297
|
+
* - 'aside'
|
|
298
|
+
* - 'chat'
|
|
299
|
+
* - 'gallery'
|
|
300
|
+
* - 'link'
|
|
301
|
+
* - 'image'
|
|
302
|
+
* - 'quote'
|
|
303
|
+
* - 'status'
|
|
304
|
+
* - 'video'
|
|
305
|
+
* - 'audio'
|
|
306
|
+
* - ''
|
|
307
|
+
* - `categories`: Array of numbers representing the categories assigned to the post.
|
|
308
|
+
* - `tags`: Array of numbers representing the tags assigned to the post.
|
|
309
|
+
*/
|
|
310
|
+
export declare class Post extends Post_base {
|
|
311
|
+
}
|
|
312
|
+
declare const PostsSchema_base: Schema.Class<PostsSchema, {
|
|
313
|
+
posts: Schema.Array$<typeof Post>;
|
|
314
|
+
}, Schema.Struct.Encoded<{
|
|
315
|
+
posts: Schema.Array$<typeof Post>;
|
|
316
|
+
}>, never, {
|
|
317
|
+
readonly posts: readonly Post[];
|
|
318
|
+
}, {}, {}>;
|
|
319
|
+
export declare class PostsSchema extends PostsSchema_base {
|
|
320
|
+
}
|
|
321
|
+
declare const Tag_base: Schema.Class<Tag, {
|
|
322
|
+
id: typeof Schema.Number;
|
|
323
|
+
count: typeof Schema.Number;
|
|
324
|
+
description: typeof Schema.String;
|
|
325
|
+
link: typeof Schema.String;
|
|
326
|
+
name: typeof Schema.String;
|
|
327
|
+
slug: typeof Schema.String;
|
|
328
|
+
taxonomy: typeof Schema.String;
|
|
329
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
330
|
+
}, Schema.Struct.Encoded<{
|
|
331
|
+
id: typeof Schema.Number;
|
|
332
|
+
count: typeof Schema.Number;
|
|
333
|
+
description: typeof Schema.String;
|
|
334
|
+
link: typeof Schema.String;
|
|
335
|
+
name: typeof Schema.String;
|
|
336
|
+
slug: typeof Schema.String;
|
|
337
|
+
taxonomy: typeof Schema.String;
|
|
338
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
339
|
+
}>, never, {
|
|
340
|
+
readonly link: string;
|
|
341
|
+
} & {
|
|
342
|
+
readonly meta: readonly any[];
|
|
343
|
+
} & {
|
|
344
|
+
readonly id: number;
|
|
345
|
+
} & {
|
|
346
|
+
readonly slug: string;
|
|
347
|
+
} & {
|
|
348
|
+
readonly count: number;
|
|
349
|
+
} & {
|
|
350
|
+
readonly description: string;
|
|
351
|
+
} & {
|
|
352
|
+
readonly name: string;
|
|
353
|
+
} & {
|
|
354
|
+
readonly taxonomy: string;
|
|
355
|
+
}, {}, {}>;
|
|
356
|
+
/**
|
|
357
|
+
* Schema for a WordPress Tag object.
|
|
358
|
+
*
|
|
359
|
+
* This schema validates the structure of a WordPress Tag object, ensuring that
|
|
360
|
+
* it contains the following properties:
|
|
361
|
+
*
|
|
362
|
+
* - `id`: A numeric identifier for the tag.
|
|
363
|
+
* - `count`: A numeric count of the number of posts associated with the tag.
|
|
364
|
+
* - `description`: A string description of the tag.
|
|
365
|
+
* - `link`: A URL string linking to the tag.
|
|
366
|
+
* - `name`: A string name of the tag.
|
|
367
|
+
* - `slug`: A string slug for the tag.
|
|
368
|
+
* - `taxonomy`: A string representing the taxonomy type.
|
|
369
|
+
* - `meta`: An array or record of any additional metadata associated with the tag.
|
|
370
|
+
*/
|
|
371
|
+
export declare class Tag extends Tag_base {
|
|
372
|
+
}
|
|
373
|
+
declare const TagsSchema_base: Schema.Class<TagsSchema, {
|
|
374
|
+
tags: Schema.Array$<typeof Tag>;
|
|
375
|
+
}, Schema.Struct.Encoded<{
|
|
376
|
+
tags: Schema.Array$<typeof Tag>;
|
|
377
|
+
}>, never, {
|
|
378
|
+
readonly tags: readonly Tag[];
|
|
379
|
+
}, {}, {}>;
|
|
380
|
+
export declare class TagsSchema extends TagsSchema_base {
|
|
381
|
+
}
|
|
382
|
+
declare const Category_base: Schema.Class<Category, {
|
|
383
|
+
parent: typeof Schema.Number;
|
|
384
|
+
id: typeof Schema.Number;
|
|
385
|
+
count: typeof Schema.Number;
|
|
386
|
+
description: typeof Schema.String;
|
|
387
|
+
link: typeof Schema.String;
|
|
388
|
+
name: typeof Schema.String;
|
|
389
|
+
slug: typeof Schema.String;
|
|
390
|
+
taxonomy: typeof Schema.String;
|
|
391
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
392
|
+
}, Schema.Struct.Encoded<{
|
|
393
|
+
parent: typeof Schema.Number;
|
|
394
|
+
id: typeof Schema.Number;
|
|
395
|
+
count: typeof Schema.Number;
|
|
396
|
+
description: typeof Schema.String;
|
|
397
|
+
link: typeof Schema.String;
|
|
398
|
+
name: typeof Schema.String;
|
|
399
|
+
slug: typeof Schema.String;
|
|
400
|
+
taxonomy: typeof Schema.String;
|
|
401
|
+
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
402
|
+
}>, never, {
|
|
403
|
+
readonly link: string;
|
|
404
|
+
} & {
|
|
405
|
+
readonly meta: readonly any[];
|
|
406
|
+
} & {
|
|
407
|
+
readonly id: number;
|
|
408
|
+
} & {
|
|
409
|
+
readonly slug: string;
|
|
410
|
+
} & {
|
|
411
|
+
readonly parent: number;
|
|
412
|
+
} & {
|
|
413
|
+
readonly count: number;
|
|
414
|
+
} & {
|
|
415
|
+
readonly description: string;
|
|
416
|
+
} & {
|
|
417
|
+
readonly name: string;
|
|
418
|
+
} & {
|
|
419
|
+
readonly taxonomy: string;
|
|
420
|
+
}, {}, {}>;
|
|
421
|
+
/**
|
|
422
|
+
* Extends the TagSchema to create a CategorySchema.
|
|
423
|
+
*
|
|
424
|
+
* @property {number} parent - The ID of the parent category.
|
|
425
|
+
*/
|
|
426
|
+
export declare class Category extends Category_base {
|
|
427
|
+
}
|
|
428
|
+
declare const CategoriesSchema_base: Schema.Class<CategoriesSchema, {
|
|
429
|
+
categories: Schema.Array$<typeof Category>;
|
|
430
|
+
}, Schema.Struct.Encoded<{
|
|
431
|
+
categories: Schema.Array$<typeof Category>;
|
|
432
|
+
}>, never, {
|
|
433
|
+
readonly categories: readonly Category[];
|
|
434
|
+
}, {}, {}>;
|
|
435
|
+
export declare class CategoriesSchema extends CategoriesSchema_base {
|
|
436
|
+
}
|
|
437
|
+
declare const SiteSettings_base: Schema.Class<SiteSettings, {
|
|
438
|
+
name: typeof Schema.String;
|
|
439
|
+
description: typeof Schema.String;
|
|
440
|
+
url: typeof Schema.String;
|
|
441
|
+
home: typeof Schema.String;
|
|
442
|
+
gmt_offset: typeof Schema.Number;
|
|
443
|
+
timezone_string: typeof Schema.String;
|
|
444
|
+
site_logo: Schema.optional<typeof Schema.Number>;
|
|
445
|
+
site_icon: Schema.optional<typeof Schema.Number>;
|
|
446
|
+
site_icon_url: Schema.optional<typeof Schema.String>;
|
|
447
|
+
}, Schema.Struct.Encoded<{
|
|
448
|
+
name: typeof Schema.String;
|
|
449
|
+
description: typeof Schema.String;
|
|
450
|
+
url: typeof Schema.String;
|
|
451
|
+
home: typeof Schema.String;
|
|
452
|
+
gmt_offset: typeof Schema.Number;
|
|
453
|
+
timezone_string: typeof Schema.String;
|
|
454
|
+
site_logo: Schema.optional<typeof Schema.Number>;
|
|
455
|
+
site_icon: Schema.optional<typeof Schema.Number>;
|
|
456
|
+
site_icon_url: Schema.optional<typeof Schema.String>;
|
|
457
|
+
}>, never, {
|
|
458
|
+
readonly url: string;
|
|
459
|
+
} & {
|
|
460
|
+
readonly description: string;
|
|
461
|
+
} & {
|
|
462
|
+
readonly name: string;
|
|
463
|
+
} & {
|
|
464
|
+
readonly home: string;
|
|
465
|
+
} & {
|
|
466
|
+
readonly gmt_offset: number;
|
|
467
|
+
} & {
|
|
468
|
+
readonly timezone_string: string;
|
|
469
|
+
} & {
|
|
470
|
+
readonly site_logo?: number | undefined;
|
|
471
|
+
} & {
|
|
472
|
+
readonly site_icon?: number | undefined;
|
|
473
|
+
} & {
|
|
474
|
+
readonly site_icon_url?: string | undefined;
|
|
475
|
+
}, {}, {}>;
|
|
476
|
+
export declare class SiteSettings extends SiteSettings_base {
|
|
477
|
+
}
|
|
478
|
+
export {};
|