@studiocms/devapps 0.2.1 → 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.
|
@@ -8,12 +8,12 @@ declare const WordPressAPIConverters_base: Effect.Service.Class<WordPressAPIConv
|
|
|
8
8
|
readonly effect: Effect.Effect<{
|
|
9
9
|
convertToPageData: Effect.Effect<{
|
|
10
10
|
readonly title: string;
|
|
11
|
+
readonly description: string;
|
|
11
12
|
readonly draft: boolean;
|
|
12
13
|
readonly id: string;
|
|
13
14
|
readonly slug: string;
|
|
14
15
|
readonly categories: string;
|
|
15
16
|
readonly tags: string;
|
|
16
|
-
readonly description: string;
|
|
17
17
|
readonly package: string;
|
|
18
18
|
readonly showOnNav: boolean;
|
|
19
19
|
readonly publishedAt: string;
|
|
@@ -30,12 +30,12 @@ declare const WordPressAPIConverters_base: Effect.Service.Class<WordPressAPIConv
|
|
|
30
30
|
convertToPageContent: Effect.Effect<CombinedInsertContent, boolean | WPAPIError | import("effect/ConfigError").ConfigError | import("astro/errors").AstroError | import("effect/Cause").UnknownException | import("effect/ParseResult").ParseError, RawPageData | FullPageData>;
|
|
31
31
|
convertToPostData: Effect.Effect<{
|
|
32
32
|
readonly title: string;
|
|
33
|
+
readonly description: string;
|
|
33
34
|
readonly draft: boolean;
|
|
34
35
|
readonly id: string;
|
|
35
36
|
readonly slug: string;
|
|
36
37
|
readonly categories: string;
|
|
37
38
|
readonly tags: string;
|
|
38
|
-
readonly description: string;
|
|
39
39
|
readonly package: string;
|
|
40
40
|
readonly showOnNav: boolean;
|
|
41
41
|
readonly publishedAt: string;
|
|
@@ -9,8 +9,8 @@ declare const WordPressAPI_base: Effect.Service.Class<WordPressAPI, "WordPressAP
|
|
|
9
9
|
readonly dependencies: readonly [import("effect/Layer").Layer<WordPressAPIUtils, never, never>, import("effect/Layer").Layer<WordPressAPIConverters, import("effect/ConfigError").ConfigError | import("studiocms/sdk/base").DBClientInitializationError | import("studiocms/sdk/base").SDKInitializationError, never>];
|
|
10
10
|
readonly effect: Effect.Effect<{
|
|
11
11
|
importSettingsFromWPAPI: Effect.Effect<void, boolean | import("effect/ConfigError").ConfigError | import("astro/errors").AstroError | import("effect/Cause").UnknownException | import("effect/ParseResult").ParseError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError, ImportEndpointConfig>;
|
|
12
|
-
importPagesFromWPAPI: Effect.Effect<void, boolean | import("./errors.
|
|
13
|
-
importPostsFromWPAPI: Effect.Effect<void, boolean | import("./errors.
|
|
12
|
+
importPagesFromWPAPI: Effect.Effect<void, boolean | import("./errors.ts").WPAPIError | import("effect/ConfigError").ConfigError | import("astro/errors").AstroError | import("effect/Cause").UnknownException | import("effect/ParseResult").ParseError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError, ImportEndpointConfig>;
|
|
13
|
+
importPostsFromWPAPI: Effect.Effect<void, boolean | import("./errors.ts").WPAPIError | import("effect/ConfigError").ConfigError | import("astro/errors").AstroError | import("effect/Cause").UnknownException | import("effect/ParseResult").ParseError | import("@withstudiocms/kysely/client").DBCallbackFailure | import("@withstudiocms/kysely/core/errors").DatabaseError, ImportPostsEndpointConfig>;
|
|
14
14
|
}, import("effect/ConfigError").ConfigError | import("studiocms/sdk/base").DBClientInitializationError | import("studiocms/sdk/base").SDKInitializationError, WordPressAPIUtils | WordPressAPIConverters>;
|
|
15
15
|
}>;
|
|
16
16
|
export declare class WordPressAPI extends WordPressAPI_base {
|
|
@@ -74,21 +74,21 @@ declare const Page_base: Schema.Class<Page, {
|
|
|
74
74
|
template: typeof Schema.String;
|
|
75
75
|
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
76
76
|
}>, never, {
|
|
77
|
-
readonly
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} & {
|
|
81
|
-
readonly date: Date;
|
|
77
|
+
readonly title: {
|
|
78
|
+
readonly rendered: string;
|
|
79
|
+
};
|
|
82
80
|
} & {
|
|
83
81
|
readonly meta: readonly any[];
|
|
84
82
|
} & {
|
|
85
83
|
readonly template: string;
|
|
86
84
|
} & {
|
|
87
|
-
readonly
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
readonly type: string;
|
|
86
|
+
} & {
|
|
87
|
+
readonly status: "publish" | "future" | "draft" | "pending" | "private";
|
|
90
88
|
} & {
|
|
91
89
|
readonly id: number;
|
|
90
|
+
} & {
|
|
91
|
+
readonly date: Date;
|
|
92
92
|
} & {
|
|
93
93
|
readonly date_gmt: Date;
|
|
94
94
|
} & {
|
|
@@ -232,21 +232,21 @@ declare const Post_base: Schema.Class<Post, {
|
|
|
232
232
|
template: typeof Schema.String;
|
|
233
233
|
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
234
234
|
}>, never, {
|
|
235
|
-
readonly
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
} & {
|
|
239
|
-
readonly date: Date;
|
|
235
|
+
readonly title: {
|
|
236
|
+
readonly rendered: string;
|
|
237
|
+
};
|
|
240
238
|
} & {
|
|
241
239
|
readonly meta: readonly any[];
|
|
242
240
|
} & {
|
|
243
241
|
readonly template: string;
|
|
244
242
|
} & {
|
|
245
|
-
readonly
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
readonly type: string;
|
|
244
|
+
} & {
|
|
245
|
+
readonly status: "publish" | "future" | "draft" | "pending" | "private";
|
|
248
246
|
} & {
|
|
249
247
|
readonly id: number;
|
|
248
|
+
} & {
|
|
249
|
+
readonly date: Date;
|
|
250
250
|
} & {
|
|
251
251
|
readonly date_gmt: Date;
|
|
252
252
|
} & {
|
|
@@ -282,7 +282,7 @@ declare const Post_base: Schema.Class<Post, {
|
|
|
282
282
|
} & {
|
|
283
283
|
readonly ping_status: "" | "open" | "closed";
|
|
284
284
|
} & {
|
|
285
|
-
readonly format: "" | "
|
|
285
|
+
readonly format: "" | "image" | "aside" | "audio" | "link" | "video" | "standard" | "chat" | "gallery" | "quote" | "status";
|
|
286
286
|
} & {
|
|
287
287
|
readonly categories: readonly number[];
|
|
288
288
|
} & {
|
|
@@ -337,6 +337,8 @@ declare const Tag_base: Schema.Class<Tag, {
|
|
|
337
337
|
taxonomy: typeof Schema.String;
|
|
338
338
|
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
339
339
|
}>, never, {
|
|
340
|
+
readonly description: string;
|
|
341
|
+
} & {
|
|
340
342
|
readonly link: string;
|
|
341
343
|
} & {
|
|
342
344
|
readonly meta: readonly any[];
|
|
@@ -346,8 +348,6 @@ declare const Tag_base: Schema.Class<Tag, {
|
|
|
346
348
|
readonly slug: string;
|
|
347
349
|
} & {
|
|
348
350
|
readonly count: number;
|
|
349
|
-
} & {
|
|
350
|
-
readonly description: string;
|
|
351
351
|
} & {
|
|
352
352
|
readonly name: string;
|
|
353
353
|
} & {
|
|
@@ -400,6 +400,8 @@ declare const Category_base: Schema.Class<Category, {
|
|
|
400
400
|
taxonomy: typeof Schema.String;
|
|
401
401
|
meta: Schema.Array$<Schema.Union<[typeof Schema.Any, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
|
|
402
402
|
}>, never, {
|
|
403
|
+
readonly description: string;
|
|
404
|
+
} & {
|
|
403
405
|
readonly link: string;
|
|
404
406
|
} & {
|
|
405
407
|
readonly meta: readonly any[];
|
|
@@ -411,8 +413,6 @@ declare const Category_base: Schema.Class<Category, {
|
|
|
411
413
|
readonly parent: number;
|
|
412
414
|
} & {
|
|
413
415
|
readonly count: number;
|
|
414
|
-
} & {
|
|
415
|
-
readonly description: string;
|
|
416
416
|
} & {
|
|
417
417
|
readonly name: string;
|
|
418
418
|
} & {
|
|
@@ -455,9 +455,9 @@ declare const SiteSettings_base: Schema.Class<SiteSettings, {
|
|
|
455
455
|
site_icon: Schema.optional<typeof Schema.Number>;
|
|
456
456
|
site_icon_url: Schema.optional<typeof Schema.String>;
|
|
457
457
|
}>, never, {
|
|
458
|
-
readonly url: string;
|
|
459
|
-
} & {
|
|
460
458
|
readonly description: string;
|
|
459
|
+
} & {
|
|
460
|
+
readonly url: string;
|
|
461
461
|
} & {
|
|
462
462
|
readonly name: string;
|
|
463
463
|
} & {
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { addVirtualImports, createResolver, injectDevRoute } from "astro-integration-kit";
|
|
2
|
+
import { Schema } from "effect";
|
|
2
3
|
import { StudioCMSDevAppsSchema } from "./schema/index.js";
|
|
3
4
|
import { pathGenerator } from "./utils/pathGenerator.js";
|
|
4
|
-
function studioCMSDevApps(opts) {
|
|
5
|
-
const options =
|
|
5
|
+
function studioCMSDevApps(opts = {}) {
|
|
6
|
+
const options = Schema.decodeSync(StudioCMSDevAppsSchema)(opts);
|
|
6
7
|
const { resolve } = createResolver(import.meta.url);
|
|
7
8
|
let makeEndpointPath;
|
|
8
9
|
return {
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,128 +1,78 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* This schema defines the configuration options for the following applications:
|
|
6
|
-
*
|
|
7
|
-
* - **Astro DB LibSQL Viewer App**: Controlled by the `libSQLViewer` property.
|
|
8
|
-
* - **StudioCMS WP API Importer App**: Controlled by the `wpImporter` property.
|
|
9
|
-
*
|
|
10
|
-
* The schema provides default values and transformation logic to ensure the configuration
|
|
11
|
-
* is in the expected format.
|
|
12
|
-
*
|
|
13
|
-
* @property libSQLViewer - Configuration for the Astro DB LibSQL Viewer App.
|
|
14
|
-
* - `boolean` - Indicates whether the app is enabled. Defaults to `true`.
|
|
15
|
-
*
|
|
16
|
-
* @property wpImporter - Configuration for the StudioCMS WP API Importer App.
|
|
17
|
-
* - `boolean` - Indicates whether the app is enabled.
|
|
18
|
-
* - `object` - Contains additional configuration options:
|
|
19
|
-
* - `endpoint` - The API endpoint for the importer. Defaults to `'wp-api-importer'`.
|
|
20
|
-
*
|
|
21
|
-
* @returns An object with the transformed configuration:
|
|
22
|
-
* - `libSQLViewer` - An object with an `enabled` property indicating the app's status.
|
|
23
|
-
* - `wpImporter` - An object with `enabled` and `endpoint` properties for the app's configuration.
|
|
3
|
+
* Represents the input configuration for the WP Importer application within StudioCMS.
|
|
24
4
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
wpImporter: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
30
|
-
endpoint: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
31
|
-
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
endpoint: string;
|
|
33
|
-
}, {
|
|
34
|
-
endpoint?: string | undefined;
|
|
35
|
-
}>]>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
wpImporter: boolean | {
|
|
38
|
-
endpoint: string;
|
|
39
|
-
};
|
|
40
|
-
}, {
|
|
41
|
-
wpImporter: boolean | {
|
|
42
|
-
endpoint?: string | undefined;
|
|
43
|
-
};
|
|
44
|
-
}>>>, {
|
|
45
|
-
wpImporter: {
|
|
46
|
-
enabled: boolean;
|
|
47
|
-
endpoint: string;
|
|
48
|
-
};
|
|
49
|
-
}, {
|
|
50
|
-
wpImporter: boolean | {
|
|
51
|
-
endpoint?: string | undefined;
|
|
52
|
-
};
|
|
53
|
-
} | undefined>;
|
|
5
|
+
export declare const WPImporterInputSchema: Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
6
|
+
endpoint: typeof Schema.String;
|
|
7
|
+
}>]>;
|
|
54
8
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* This schema defines the structure of the configuration object for StudioCMS
|
|
58
|
-
* development applications. It includes the following properties:
|
|
59
|
-
*
|
|
60
|
-
* - `endpoint` (optional): A string representing the endpoint for the dev apps.
|
|
61
|
-
* Defaults to '_studiocms-devapps'.
|
|
62
|
-
* - `verbose` (optional): A boolean indicating whether verbose logging is enabled.
|
|
63
|
-
* Defaults to `false`.
|
|
64
|
-
* - `appsConfig`: The configuration schema for the applications.
|
|
65
|
-
*
|
|
66
|
-
* The entire schema is optional and defaults to an empty object if not provided.
|
|
9
|
+
* Represents the configuration for the WP Importer application within StudioCMS.
|
|
67
10
|
*/
|
|
68
|
-
export declare const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
enabled: boolean;
|
|
93
|
-
endpoint: string;
|
|
94
|
-
};
|
|
95
|
-
}, {
|
|
96
|
-
wpImporter: boolean | {
|
|
97
|
-
endpoint?: string | undefined;
|
|
98
|
-
};
|
|
99
|
-
} | undefined>;
|
|
100
|
-
}, "strip", z.ZodTypeAny, {
|
|
101
|
-
endpoint: string;
|
|
102
|
-
verbose: boolean;
|
|
103
|
-
appsConfig: {
|
|
104
|
-
wpImporter: {
|
|
11
|
+
export declare const WPImporterOutputSchema: Schema.Struct<{
|
|
12
|
+
enabled: typeof Schema.Boolean;
|
|
13
|
+
endpoint: typeof Schema.String;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* A schema for validating the configuration of the WP Importer application within StudioCMS.
|
|
17
|
+
*/
|
|
18
|
+
export declare const WPImporterSchema: Schema.transformOrFail<Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
19
|
+
endpoint: typeof Schema.String;
|
|
20
|
+
}>]>, Schema.Struct<{
|
|
21
|
+
enabled: typeof Schema.Boolean;
|
|
22
|
+
endpoint: typeof Schema.String;
|
|
23
|
+
}>, never>;
|
|
24
|
+
/**
|
|
25
|
+
* Represents the configuration for the WP Importer application within StudioCMS.
|
|
26
|
+
*/
|
|
27
|
+
export declare const AppsConfigSchema: Schema.Struct<{
|
|
28
|
+
wpImporter: Schema.optionalWith<Schema.transformOrFail<Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
29
|
+
endpoint: typeof Schema.String;
|
|
30
|
+
}>]>, Schema.Struct<{
|
|
31
|
+
enabled: typeof Schema.Boolean;
|
|
32
|
+
endpoint: typeof Schema.String;
|
|
33
|
+
}>, never>, {
|
|
34
|
+
default: () => {
|
|
105
35
|
enabled: boolean;
|
|
106
36
|
endpoint: string;
|
|
107
37
|
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Represents the configuration for StudioCMS development applications.
|
|
42
|
+
*/
|
|
43
|
+
export declare const StudioCMSDevAppsSchema: Schema.Struct<{
|
|
44
|
+
endpoint: Schema.optionalWith<typeof Schema.String, {
|
|
45
|
+
default: () => string;
|
|
46
|
+
}>;
|
|
47
|
+
verbose: Schema.optionalWith<typeof Schema.Boolean, {
|
|
48
|
+
default: () => false;
|
|
49
|
+
}>;
|
|
50
|
+
appsConfig: Schema.optionalWith<Schema.Struct<{
|
|
51
|
+
wpImporter: Schema.optionalWith<Schema.transformOrFail<Schema.Union<[typeof Schema.Boolean, Schema.Struct<{
|
|
52
|
+
endpoint: typeof Schema.String;
|
|
53
|
+
}>]>, Schema.Struct<{
|
|
54
|
+
enabled: typeof Schema.Boolean;
|
|
55
|
+
endpoint: typeof Schema.String;
|
|
56
|
+
}>, never>, {
|
|
57
|
+
default: () => {
|
|
58
|
+
enabled: boolean;
|
|
59
|
+
endpoint: string;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
}>, {
|
|
63
|
+
default: () => {
|
|
64
|
+
readonly wpImporter: {
|
|
65
|
+
readonly endpoint: string;
|
|
66
|
+
readonly enabled: boolean;
|
|
67
|
+
};
|
|
115
68
|
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
69
|
+
}>;
|
|
70
|
+
}>;
|
|
118
71
|
/**
|
|
119
|
-
* Represents the
|
|
120
|
-
*
|
|
121
|
-
* This type is derived from the `_input` property of the `StudioCMSDevAppsSchema` object.
|
|
72
|
+
* Represents the input configuration for StudioCMS development applications.
|
|
122
73
|
*/
|
|
123
|
-
export type StudioCMSDevAppsOptions = typeof StudioCMSDevAppsSchema.
|
|
74
|
+
export type StudioCMSDevAppsOptions = typeof StudioCMSDevAppsSchema.Encoded;
|
|
124
75
|
/**
|
|
125
|
-
* Represents the configuration
|
|
126
|
-
* This type is derived from the output of the `StudioCMSDevAppsSchema`.
|
|
76
|
+
* Represents the fully parsed configuration for StudioCMS development applications.
|
|
127
77
|
*/
|
|
128
|
-
export type StudioCMSDevAppsConfig =
|
|
78
|
+
export type StudioCMSDevAppsConfig = typeof StudioCMSDevAppsSchema.Type;
|
package/dist/schema/index.js
CHANGED
|
@@ -1,33 +1,110 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { ParseResult, Schema } from "effect";
|
|
2
|
+
const WPImporterInputSchema = Schema.Union(
|
|
3
|
+
Schema.Boolean,
|
|
4
|
+
Schema.Struct({
|
|
5
|
+
endpoint: Schema.String
|
|
6
|
+
})
|
|
7
|
+
).annotations({
|
|
8
|
+
title: "WP Importer Input Configuration",
|
|
9
|
+
identifier: "WPImporterInputConfig",
|
|
10
|
+
description: "The input configuration for the StudioCMS WP API Importer App. Can be a boolean to enable/disable or an object to specify the endpoint."
|
|
11
|
+
});
|
|
12
|
+
const WPImporterOutputSchema = Schema.Struct({
|
|
13
|
+
enabled: Schema.Boolean,
|
|
14
|
+
endpoint: Schema.String
|
|
15
|
+
}).annotations({
|
|
16
|
+
title: "WP Importer Output Configuration",
|
|
17
|
+
identifier: "WPImporterOutputConfig",
|
|
18
|
+
description: "The output configuration for the StudioCMS WP API Importer App, including enabled status and endpoint."
|
|
19
|
+
});
|
|
20
|
+
const wpImporterDefaults = {
|
|
21
|
+
enabled: true,
|
|
22
|
+
endpoint: "wp-api-importer"
|
|
23
|
+
};
|
|
24
|
+
const WPImporterSchema = Schema.transformOrFail(
|
|
25
|
+
WPImporterInputSchema,
|
|
26
|
+
WPImporterOutputSchema,
|
|
27
|
+
{
|
|
28
|
+
strict: true,
|
|
29
|
+
decode: (input, _options, ast) => {
|
|
30
|
+
if (typeof input !== "boolean" && typeof input !== "object") {
|
|
31
|
+
return ParseResult.fail(
|
|
32
|
+
new ParseResult.Type(
|
|
33
|
+
ast,
|
|
34
|
+
input,
|
|
35
|
+
"Expected boolean or object for WP Importer configuration"
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (typeof input === "boolean") {
|
|
40
|
+
return ParseResult.succeed({
|
|
41
|
+
...wpImporterDefaults,
|
|
42
|
+
enabled: input
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (typeof input === "object" && typeof input.endpoint === "string") {
|
|
46
|
+
return ParseResult.succeed({
|
|
47
|
+
...wpImporterDefaults,
|
|
48
|
+
endpoint: input.endpoint
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return ParseResult.fail(
|
|
52
|
+
new ParseResult.Type(ast, input, "Invalid type for WP Importer configuration")
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
encode: (input) => {
|
|
56
|
+
if (input.enabled === false) {
|
|
57
|
+
return ParseResult.succeed(false);
|
|
58
|
+
}
|
|
59
|
+
if (input.endpoint !== wpImporterDefaults.endpoint) {
|
|
60
|
+
return ParseResult.succeed({
|
|
61
|
+
endpoint: input.endpoint
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return ParseResult.succeed(true);
|
|
65
|
+
}
|
|
20
66
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
67
|
+
).annotations({
|
|
68
|
+
title: "WP Importer Configuration",
|
|
69
|
+
identifier: "WPImporterConfig",
|
|
70
|
+
description: "Configuration for the StudioCMS WP API Importer App. Can be a boolean to enable/disable or a string to specify the endpoint."
|
|
71
|
+
});
|
|
72
|
+
const AppsConfigSchema = Schema.Struct({
|
|
73
|
+
wpImporter: Schema.optionalWith(WPImporterSchema, {
|
|
74
|
+
default: () => wpImporterDefaults
|
|
75
|
+
}).annotations({
|
|
76
|
+
description: "Configuration for the StudioCMS WP API Importer App. Can be a boolean to enable/disable or a string to specify the endpoint."
|
|
77
|
+
})
|
|
78
|
+
}).annotations({
|
|
79
|
+
title: "StudioCMS Apps Configuration",
|
|
80
|
+
identifier: "StudioCMSAppsConfig",
|
|
81
|
+
description: "Configuration for the StudioCMS development applications."
|
|
82
|
+
});
|
|
83
|
+
const StudioCMSDevAppsSchema = Schema.Struct({
|
|
84
|
+
endpoint: Schema.optionalWith(Schema.String, {
|
|
85
|
+
default: () => "_studiocms-devapps"
|
|
86
|
+
}).annotations({
|
|
87
|
+
description: "The endpoint for the StudioCMS development applications."
|
|
88
|
+
}),
|
|
89
|
+
verbose: Schema.optionalWith(Schema.Boolean, {
|
|
90
|
+
default: () => false
|
|
91
|
+
}).annotations({
|
|
92
|
+
description: "Enable verbose logging for StudioCMS development applications."
|
|
93
|
+
}),
|
|
94
|
+
appsConfig: Schema.optionalWith(AppsConfigSchema, {
|
|
95
|
+
default: () => AppsConfigSchema.make({})
|
|
96
|
+
}).annotations({
|
|
97
|
+
description: "Configuration for the StudioCMS development applications."
|
|
98
|
+
})
|
|
99
|
+
}).annotations({
|
|
100
|
+
title: "StudioCMS DevApps Configuration",
|
|
101
|
+
identifier: "StudioCMSDevAppsConfig",
|
|
102
|
+
description: "Configuration schema for StudioCMS development applications, including endpoint settings and individual app configurations."
|
|
24
103
|
});
|
|
25
|
-
const StudioCMSDevAppsSchema = z.object({
|
|
26
|
-
endpoint: z.string().optional().default("_studiocms-devapps"),
|
|
27
|
-
verbose: z.boolean().optional().default(false),
|
|
28
|
-
appsConfig: AppsConfigSchema
|
|
29
|
-
}).optional().default({});
|
|
30
104
|
export {
|
|
31
105
|
AppsConfigSchema,
|
|
32
|
-
StudioCMSDevAppsSchema
|
|
106
|
+
StudioCMSDevAppsSchema,
|
|
107
|
+
WPImporterInputSchema,
|
|
108
|
+
WPImporterOutputSchema,
|
|
109
|
+
WPImporterSchema
|
|
33
110
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/devapps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Devapps for StudioCMS Astro projects, including a WordPress importer.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "withstudiocms",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"astro-integration-kit": "^0.19.1",
|
|
52
52
|
"cheerio": "^1.2.0",
|
|
53
53
|
"turndown": "^7.2.2",
|
|
54
|
-
"sanitize-html": "^2.17.
|
|
54
|
+
"sanitize-html": "^2.17.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/turndown": "^5.0.6",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"astro": "^5.12.9",
|
|
60
60
|
"typescript": "^5.9.3",
|
|
61
61
|
"vite": "^6.3.4",
|
|
62
|
-
"@withstudiocms/sdk": "^0.
|
|
63
|
-
"studiocms": "^0.
|
|
62
|
+
"@withstudiocms/sdk": "^0.3.0",
|
|
63
|
+
"studiocms": "^0.4.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"effect": "^3.19.
|
|
66
|
+
"effect": "^3.19.19"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png,d.ts}'",
|