@studiocms/devapps 0.1.0-beta.23 → 0.1.0-beta.24
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect } from 'studiocms/effect';
|
|
2
|
+
import type { CombinedInsertContent } from 'studiocms/sdk/types';
|
|
2
3
|
import { FullPageData, ImportEndpointConfig, RawPageData, UseBlogPkgConfig } from './configs.js';
|
|
3
4
|
import { WordPressAPIUtils } from './utils.js';
|
|
4
5
|
declare const WordPressAPIConverters_base: Effect.Service.Class<WordPressAPIConverters, "WordPressAPIConverters", {
|
|
@@ -8,18 +9,44 @@ declare const WordPressAPIConverters_base: Effect.Service.Class<WordPressAPIConv
|
|
|
8
9
|
title: string;
|
|
9
10
|
slug: string;
|
|
10
11
|
description: string;
|
|
12
|
+
draft?: boolean | null | undefined;
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
categories?: unknown;
|
|
15
|
+
tags?: unknown;
|
|
16
|
+
package?: string | undefined;
|
|
17
|
+
showOnNav?: boolean | undefined;
|
|
18
|
+
publishedAt?: Date | undefined;
|
|
19
|
+
updatedAt?: Date | null | undefined;
|
|
20
|
+
contentLang?: string | undefined;
|
|
21
|
+
heroImage?: string | undefined;
|
|
22
|
+
authorId?: string | null | undefined;
|
|
23
|
+
contributorIds?: unknown;
|
|
24
|
+
showAuthor?: boolean | null | undefined;
|
|
25
|
+
showContributors?: boolean | null | undefined;
|
|
26
|
+
parentFolder?: string | null | undefined;
|
|
11
27
|
}, boolean | Error | import("effect/ParseResult").ParseError, ImportEndpointConfig | RawPageData>;
|
|
12
|
-
convertToPageContent: Effect.Effect<
|
|
13
|
-
contentId: string;
|
|
14
|
-
}, boolean | Error | import("effect/ParseResult").ParseError, RawPageData | FullPageData>;
|
|
28
|
+
convertToPageContent: Effect.Effect<CombinedInsertContent, boolean | Error | import("effect/ParseResult").ParseError, RawPageData | FullPageData>;
|
|
15
29
|
convertToPostData: Effect.Effect<{
|
|
16
30
|
title: string;
|
|
17
31
|
slug: string;
|
|
18
32
|
description: string;
|
|
33
|
+
draft?: boolean | null | undefined;
|
|
34
|
+
id?: string | undefined;
|
|
35
|
+
categories?: unknown;
|
|
36
|
+
tags?: unknown;
|
|
37
|
+
package?: string | undefined;
|
|
38
|
+
showOnNav?: boolean | undefined;
|
|
39
|
+
publishedAt?: Date | undefined;
|
|
40
|
+
updatedAt?: Date | null | undefined;
|
|
41
|
+
contentLang?: string | undefined;
|
|
42
|
+
heroImage?: string | undefined;
|
|
43
|
+
authorId?: string | null | undefined;
|
|
44
|
+
contributorIds?: unknown;
|
|
45
|
+
showAuthor?: boolean | null | undefined;
|
|
46
|
+
showContributors?: boolean | null | undefined;
|
|
47
|
+
parentFolder?: string | null | undefined;
|
|
19
48
|
}, boolean | import("astro/errors").AstroError | import("effect/Cause").UnknownException | import("effect/ParseResult").ParseError | import("studiocms/sdk/effect/db").LibSQLDatabaseError, ImportEndpointConfig | RawPageData | UseBlogPkgConfig>;
|
|
20
|
-
convertToPostContent: Effect.Effect<
|
|
21
|
-
contentId: string;
|
|
22
|
-
}, boolean | Error | import("effect/ParseResult").ParseError, RawPageData | FullPageData>;
|
|
49
|
+
convertToPostContent: Effect.Effect<CombinedInsertContent, boolean | Error | import("effect/ParseResult").ParseError, RawPageData | FullPageData>;
|
|
23
50
|
}, never, WordPressAPIUtils>;
|
|
24
51
|
}>;
|
|
25
52
|
export declare class WordPressAPIConverters extends WordPressAPIConverters_base {
|
|
@@ -51,7 +51,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
51
51
|
if (!titleImageId || titleImageId === 0) {
|
|
52
52
|
yield* Console.log("No featured media for:", data.title.rendered);
|
|
53
53
|
const pageData2 = {
|
|
54
|
-
// @ts-expect-error - Drizzle broke this
|
|
55
54
|
id: crypto.randomUUID(),
|
|
56
55
|
title: data.title.rendered,
|
|
57
56
|
description: decode(cleanHTML),
|
|
@@ -73,7 +72,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
73
72
|
DownloadPostImageConfig.makeProvide(titleImageJson.source_url, pagesImagesFolder)
|
|
74
73
|
);
|
|
75
74
|
const pageData = {
|
|
76
|
-
// @ts-expect-error - Drizzle broke this
|
|
77
75
|
id: crypto.randomUUID(),
|
|
78
76
|
title: data.title.rendered,
|
|
79
77
|
description: decode(cleanHTML),
|
|
@@ -90,10 +88,15 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
90
88
|
const convertToPageContent = genLogger(
|
|
91
89
|
"@studiocms/devapps/effects/WordPressAPI/converters.effect.convertToPageContent"
|
|
92
90
|
)(function* () {
|
|
93
|
-
const [
|
|
91
|
+
const [
|
|
92
|
+
{ page },
|
|
93
|
+
{
|
|
94
|
+
pageData: { id: pageId }
|
|
95
|
+
}
|
|
96
|
+
] = yield* Effect.all([RawPageData, FullPageData]);
|
|
94
97
|
const data = yield* Schema.decodeUnknown(Page)(page);
|
|
95
|
-
if (
|
|
96
|
-
yield* Effect.fail(new Error("pageData is missing id"));
|
|
98
|
+
if (!pageId) {
|
|
99
|
+
return yield* Effect.fail(new Error("pageData is missing id"));
|
|
97
100
|
}
|
|
98
101
|
const cleanUpContent = yield* cleanUpHtml.pipe(
|
|
99
102
|
StringConfig.makeProvide(data.content.rendered)
|
|
@@ -103,10 +106,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
103
106
|
);
|
|
104
107
|
const content = yield* turndown.pipe(StringConfig.makeProvide(htmlWithImages));
|
|
105
108
|
const pageContent = {
|
|
106
|
-
// @ts-expect-error - Drizzle broke this
|
|
107
|
-
id: crypto.randomUUID(),
|
|
108
|
-
// @ts-expect-error - Drizzle broke this
|
|
109
|
-
contentId: pageData.id,
|
|
110
109
|
contentLang: "default",
|
|
111
110
|
content
|
|
112
111
|
};
|
|
@@ -149,7 +148,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
149
148
|
case "categories": {
|
|
150
149
|
const data = newItems.map((category) => {
|
|
151
150
|
const data2 = {
|
|
152
|
-
// @ts-expect-error - Drizzle broke this
|
|
153
151
|
id: category.id,
|
|
154
152
|
name: category.name,
|
|
155
153
|
slug: category.slug,
|
|
@@ -174,7 +172,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
174
172
|
case "tags": {
|
|
175
173
|
const tagData = newItems.map((tag) => {
|
|
176
174
|
const data = {
|
|
177
|
-
// @ts-expect-error - Drizzle broke this
|
|
178
175
|
id: tag.id,
|
|
179
176
|
name: tag.name,
|
|
180
177
|
slug: tag.slug,
|
|
@@ -211,7 +208,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
211
208
|
if (!titleImageId || titleImageId === 0) {
|
|
212
209
|
yield* Console.log("No featured media for:", data.title.rendered);
|
|
213
210
|
const pageData2 = {
|
|
214
|
-
// @ts-expect-error - Drizzle broke this
|
|
215
211
|
id: crypto.randomUUID(),
|
|
216
212
|
title: data.title.rendered,
|
|
217
213
|
description: decode(cleanedHTML),
|
|
@@ -243,7 +239,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
243
239
|
CategoryOrTagConfig.makeProvide(data.tags)
|
|
244
240
|
);
|
|
245
241
|
const pageData = {
|
|
246
|
-
// @ts-expect-error - Drizzle broke this
|
|
247
242
|
id: crypto.randomUUID(),
|
|
248
243
|
title: data.title.rendered,
|
|
249
244
|
description: decode(cleanedHTML),
|
|
@@ -262,10 +257,15 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
262
257
|
const convertToPostContent = genLogger(
|
|
263
258
|
"@studiocms/devapps/effects/WordPressAPI/converters.effect.convertToPostContent"
|
|
264
259
|
)(function* () {
|
|
265
|
-
const [
|
|
260
|
+
const [
|
|
261
|
+
{
|
|
262
|
+
pageData: { id: pageId }
|
|
263
|
+
},
|
|
264
|
+
{ page: post }
|
|
265
|
+
] = yield* Effect.all([FullPageData, RawPageData]);
|
|
266
266
|
const data = yield* Schema.decodeUnknown(Post)(post);
|
|
267
|
-
if (
|
|
268
|
-
yield* Effect.fail(new Error("pageData is missing id"));
|
|
267
|
+
if (!pageId) {
|
|
268
|
+
return yield* Effect.fail(new Error("pageData is missing id"));
|
|
269
269
|
}
|
|
270
270
|
const cleanupContent = yield* cleanUpHtml.pipe(
|
|
271
271
|
StringConfig.makeProvide(data.content.rendered)
|
|
@@ -275,10 +275,6 @@ class WordPressAPIConverters extends Effect.Service()(
|
|
|
275
275
|
);
|
|
276
276
|
const content = yield* turndown.pipe(StringConfig.makeProvide(htmlWithImages));
|
|
277
277
|
const pageContent = {
|
|
278
|
-
// @ts-expect-error - Drizzle broke this
|
|
279
|
-
id: crypto.randomUUID(),
|
|
280
|
-
// @ts-expect-error - Drizzle broke this
|
|
281
|
-
contentId: pageData.id,
|
|
282
278
|
contentLang: "default",
|
|
283
279
|
content
|
|
284
280
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/devapps",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.24",
|
|
4
4
|
"description": "A dedicated CMS for Astro DB. Built from the ground up by the Astro community.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "withstudiocms",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/turndown": "^5.0.5",
|
|
64
64
|
"@types/sanitize-html": "^2.16.0",
|
|
65
|
-
"typescript": "^5.
|
|
65
|
+
"typescript": "^5.9.2"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@astrojs/db": "^0.
|
|
69
|
-
"astro": "^5.12.
|
|
70
|
-
"effect": "^3.17.
|
|
68
|
+
"@astrojs/db": "^0.17.1",
|
|
69
|
+
"astro": "^5.12.8",
|
|
70
|
+
"effect": "^3.17.7",
|
|
71
71
|
"vite": "^6.3.4",
|
|
72
|
-
"studiocms": "0.1.0-beta.
|
|
72
|
+
"studiocms": "0.1.0-beta.24"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"studiocms": {
|