payload-wordpress-migrator 0.0.22
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 +21 -0
- package/README.md +586 -0
- package/dist/components/BeforeDashboardClient.d.ts +14 -0
- package/dist/components/BeforeDashboardClient.js +225 -0
- package/dist/components/BeforeDashboardClient.js.map +1 -0
- package/dist/components/BeforeDashboardClient.module.css +175 -0
- package/dist/components/BeforeDashboardServer.d.ts +1 -0
- package/dist/components/BeforeDashboardServer.js +29 -0
- package/dist/components/BeforeDashboardServer.js.map +1 -0
- package/dist/components/ContentTypeSelect.d.ts +4 -0
- package/dist/components/ContentTypeSelect.js +147 -0
- package/dist/components/ContentTypeSelect.js.map +1 -0
- package/dist/components/FieldMappingConfiguration.d.ts +5 -0
- package/dist/components/FieldMappingConfiguration.js +361 -0
- package/dist/components/FieldMappingConfiguration.js.map +1 -0
- package/dist/components/FieldMappingConfiguration.module.css +75 -0
- package/dist/components/MigrationDashboardClient.d.ts +6 -0
- package/dist/components/MigrationDashboardClient.js +49 -0
- package/dist/components/MigrationDashboardClient.js.map +1 -0
- package/dist/components/MigrationDashboardClient.module.css +749 -0
- package/dist/components/SimpleFieldMapping.d.ts +5 -0
- package/dist/components/SimpleFieldMapping.js +437 -0
- package/dist/components/SimpleFieldMapping.js.map +1 -0
- package/dist/components/dashboard/JobActionButtons.d.ts +8 -0
- package/dist/components/dashboard/JobActionButtons.js +91 -0
- package/dist/components/dashboard/JobActionButtons.js.map +1 -0
- package/dist/components/dashboard/JobsTable.d.ts +6 -0
- package/dist/components/dashboard/JobsTable.js +86 -0
- package/dist/components/dashboard/JobsTable.js.map +1 -0
- package/dist/components/dashboard/LogViewer.d.ts +3 -0
- package/dist/components/dashboard/LogViewer.js +35 -0
- package/dist/components/dashboard/LogViewer.js.map +1 -0
- package/dist/components/dashboard/SiteConfigPanel.d.ts +12 -0
- package/dist/components/dashboard/SiteConfigPanel.js +205 -0
- package/dist/components/dashboard/SiteConfigPanel.js.map +1 -0
- package/dist/components/dashboard/StatsOverview.d.ts +5 -0
- package/dist/components/dashboard/StatsOverview.js +72 -0
- package/dist/components/dashboard/StatsOverview.js.map +1 -0
- package/dist/components/dashboard/index.d.ts +7 -0
- package/dist/components/dashboard/index.js +7 -0
- package/dist/components/dashboard/index.js.map +1 -0
- package/dist/components/dashboard/types.d.ts +46 -0
- package/dist/components/dashboard/types.js +2 -0
- package/dist/components/dashboard/types.js.map +1 -0
- package/dist/components/dashboard/useMigrationDashboard.d.ts +15 -0
- package/dist/components/dashboard/useMigrationDashboard.js +584 -0
- package/dist/components/dashboard/useMigrationDashboard.js.map +1 -0
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.js +5 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +2 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +443 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/content/blocks.d.ts +6 -0
- package/dist/utils/content/blocks.js +93 -0
- package/dist/utils/content/blocks.js.map +1 -0
- package/dist/utils/content/fieldMapping.d.ts +9 -0
- package/dist/utils/content/fieldMapping.js +218 -0
- package/dist/utils/content/fieldMapping.js.map +1 -0
- package/dist/utils/content/index.d.ts +4 -0
- package/dist/utils/content/index.js +4 -0
- package/dist/utils/content/index.js.map +1 -0
- package/dist/utils/content/transformer.d.ts +5 -0
- package/dist/utils/content/transformer.js +323 -0
- package/dist/utils/content/transformer.js.map +1 -0
- package/dist/utils/endpoints/handlers.d.ts +9 -0
- package/dist/utils/endpoints/handlers.js +201 -0
- package/dist/utils/endpoints/handlers.js.map +1 -0
- package/dist/utils/endpoints/index.d.ts +2 -0
- package/dist/utils/endpoints/index.js +2 -0
- package/dist/utils/endpoints/index.js.map +1 -0
- package/dist/utils/fields/analyzer.d.ts +7 -0
- package/dist/utils/fields/analyzer.js +502 -0
- package/dist/utils/fields/analyzer.js.map +1 -0
- package/dist/utils/fields/index.d.ts +2 -0
- package/dist/utils/fields/index.js +2 -0
- package/dist/utils/fields/index.js.map +1 -0
- package/dist/utils/helpers/auth.d.ts +9 -0
- package/dist/utils/helpers/auth.js +50 -0
- package/dist/utils/helpers/auth.js.map +1 -0
- package/dist/utils/helpers/cache.d.ts +11 -0
- package/dist/utils/helpers/cache.js +47 -0
- package/dist/utils/helpers/cache.js.map +1 -0
- package/dist/utils/helpers/concurrency.d.ts +2 -0
- package/dist/utils/helpers/concurrency.js +26 -0
- package/dist/utils/helpers/concurrency.js.map +1 -0
- package/dist/utils/helpers/index.d.ts +8 -0
- package/dist/utils/helpers/index.js +8 -0
- package/dist/utils/helpers/index.js.map +1 -0
- package/dist/utils/helpers/objectHelpers.d.ts +3 -0
- package/dist/utils/helpers/objectHelpers.js +22 -0
- package/dist/utils/helpers/objectHelpers.js.map +1 -0
- package/dist/utils/helpers/rateLimiter.d.ts +10 -0
- package/dist/utils/helpers/rateLimiter.js +29 -0
- package/dist/utils/helpers/rateLimiter.js.map +1 -0
- package/dist/utils/helpers/responses.d.ts +3 -0
- package/dist/utils/helpers/responses.js +23 -0
- package/dist/utils/helpers/responses.js.map +1 -0
- package/dist/utils/helpers/wpHelpers.d.ts +6 -0
- package/dist/utils/helpers/wpHelpers.js +29 -0
- package/dist/utils/helpers/wpHelpers.js.map +1 -0
- package/dist/utils/lexical/constants.d.ts +37 -0
- package/dist/utils/lexical/constants.js +58 -0
- package/dist/utils/lexical/constants.js.map +1 -0
- package/dist/utils/lexical/htmlParser.d.ts +20 -0
- package/dist/utils/lexical/htmlParser.js +253 -0
- package/dist/utils/lexical/htmlParser.js.map +1 -0
- package/dist/utils/lexical/htmlToLexicalConverter.d.ts +55 -0
- package/dist/utils/lexical/htmlToLexicalConverter.js +999 -0
- package/dist/utils/lexical/htmlToLexicalConverter.js.map +1 -0
- package/dist/utils/lexical/index.d.ts +5 -0
- package/dist/utils/lexical/index.js +4 -0
- package/dist/utils/lexical/index.js.map +1 -0
- package/dist/utils/lexical/nodeFactories.d.ts +21 -0
- package/dist/utils/lexical/nodeFactories.js +91 -0
- package/dist/utils/lexical/nodeFactories.js.map +1 -0
- package/dist/utils/lexical/preprocessor.d.ts +4 -0
- package/dist/utils/lexical/preprocessor.js +302 -0
- package/dist/utils/lexical/preprocessor.js.map +1 -0
- package/dist/utils/media/download.d.ts +7 -0
- package/dist/utils/media/download.js +85 -0
- package/dist/utils/media/download.js.map +1 -0
- package/dist/utils/media/extraction.d.ts +12 -0
- package/dist/utils/media/extraction.js +58 -0
- package/dist/utils/media/extraction.js.map +1 -0
- package/dist/utils/media/import.d.ts +7 -0
- package/dist/utils/media/import.js +146 -0
- package/dist/utils/media/import.js.map +1 -0
- package/dist/utils/media/index.d.ts +6 -0
- package/dist/utils/media/index.js +6 -0
- package/dist/utils/media/index.js.map +1 -0
- package/dist/utils/media/upload.d.ts +4 -0
- package/dist/utils/media/upload.js +46 -0
- package/dist/utils/media/upload.js.map +1 -0
- package/dist/utils/media/validation.d.ts +8 -0
- package/dist/utils/media/validation.js +60 -0
- package/dist/utils/media/validation.js.map +1 -0
- package/dist/utils/migration/index.d.ts +3 -0
- package/dist/utils/migration/index.js +3 -0
- package/dist/utils/migration/index.js.map +1 -0
- package/dist/utils/migration/jobCrud.d.ts +4 -0
- package/dist/utils/migration/jobCrud.js +380 -0
- package/dist/utils/migration/jobCrud.js.map +1 -0
- package/dist/utils/migration/orchestrator.d.ts +5 -0
- package/dist/utils/migration/orchestrator.js +756 -0
- package/dist/utils/migration/orchestrator.js.map +1 -0
- package/dist/utils/types.d.ts +201 -0
- package/dist/utils/types.js +14 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/wordpress/client.d.ts +61 -0
- package/dist/utils/wordpress/client.js +365 -0
- package/dist/utils/wordpress/client.js.map +1 -0
- package/dist/utils/wordpress/index.d.ts +2 -0
- package/dist/utils/wordpress/index.js +2 -0
- package/dist/utils/wordpress/index.js.map +1 -0
- package/dist/utils/wordpressApi.d.ts +11 -0
- package/dist/utils/wordpressApi.js +25 -0
- package/dist/utils/wordpressApi.js.map +1 -0
- package/package.json +155 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { CollectionSlug, Config, PayloadRequest } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Configures how a WordPress content type maps to a PayloadCMS collection.
|
|
4
|
+
*/
|
|
5
|
+
export type WordPressCollectionMapping = {
|
|
6
|
+
/** ACF field names to include in the migration (e.g., `['hero_image', 'subtitle']`). */
|
|
7
|
+
customFields?: string[];
|
|
8
|
+
/** Disable HTML-to-Lexical conversion for this collection. Useful for debugging content issues. @default false */
|
|
9
|
+
disableHtmlConversion?: boolean;
|
|
10
|
+
/** Convert Gutenberg blocks to PayloadCMS Lexical block nodes. @default false */
|
|
11
|
+
enableBlocks?: boolean;
|
|
12
|
+
/** Custom field mapping from WordPress field paths to Payload field paths (dot-notation supported). */
|
|
13
|
+
fieldMapping?: Record<string, string>;
|
|
14
|
+
/** Auto-import images found in post/page HTML content. Requires `enableMediaDownload` on the plugin. @default true */
|
|
15
|
+
importContentMedia?: boolean;
|
|
16
|
+
/** WordPress content type slug (e.g., `'post'`, `'page'`, `'product'`, or any custom post type registered with `show_in_rest`). */
|
|
17
|
+
wpPostType: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for the WordPress migrator plugin.
|
|
21
|
+
*
|
|
22
|
+
* WordPress credentials can be provided here or entered per-job in the migration dashboard.
|
|
23
|
+
*/
|
|
24
|
+
export type PayloadWordPressMigratorConfig = {
|
|
25
|
+
/**
|
|
26
|
+
* Custom access control for migration endpoints. When provided, checked after authentication
|
|
27
|
+
* — returning `false` results in a 403 response. Without this, any authenticated user can migrate.
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* access: ({ req }) => req.user?.role === 'admin'
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
access?: (args: {
|
|
34
|
+
req: PayloadRequest;
|
|
35
|
+
}) => boolean | Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Allowed MIME types for media import. Supports exact types and wildcards.
|
|
38
|
+
* @default ['image/*', 'application/pdf', 'video/mp4', 'audio/mpeg']
|
|
39
|
+
*/
|
|
40
|
+
allowedMediaTypes?: string[];
|
|
41
|
+
/** Allow connections to WordPress sites with self-signed or invalid SSL certificates. **Development only** — logs a warning in production. @default false */
|
|
42
|
+
allowSelfSignedCerts?: boolean;
|
|
43
|
+
/** Map of PayloadCMS collection slugs to WordPress post type mappings. Each entry configures how a WordPress content type maps to a Payload collection. */
|
|
44
|
+
collections?: Partial<Record<CollectionSlug, WordPressCollectionMapping>>;
|
|
45
|
+
/** Disable the plugin entirely. Collections and metadata fields are still added (for schema consistency) but endpoints are not registered. */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** Hide the migration dashboard in the Payload admin panel. */
|
|
48
|
+
disableDashboard?: boolean;
|
|
49
|
+
/** Enable downloading media files from WordPress and uploading them to PayloadCMS. When `false`, only metadata is migrated. @default false */
|
|
50
|
+
enableMediaDownload?: boolean;
|
|
51
|
+
/** Maximum media file size in bytes. Files exceeding this limit are skipped. @default 10485760 (10 MB) */
|
|
52
|
+
maxMediaFileSize?: number;
|
|
53
|
+
/** Custom upload directory for downloaded media files. Falls back to Payload's default upload path. */
|
|
54
|
+
mediaUploadPath?: string;
|
|
55
|
+
/** Number of WordPress items to fetch and process per batch. Lower values reduce memory usage and improve crash recovery granularity (at most batchSize-1 items may be re-processed after a crash). @default 10 */
|
|
56
|
+
migrationBatchSize?: number;
|
|
57
|
+
/** Number of items to process in parallel within each batch. Higher values speed up migration but increase memory and API load. @default 1 */
|
|
58
|
+
migrationConcurrency?: number;
|
|
59
|
+
/**
|
|
60
|
+
* WordPress Application Password for REST API authentication.
|
|
61
|
+
* Generate one at WordPress Admin > Users > Profile > Application Passwords.
|
|
62
|
+
* **Not** the regular WordPress login password.
|
|
63
|
+
*/
|
|
64
|
+
wpPassword?: string;
|
|
65
|
+
/** Delay in milliseconds between WordPress REST API page requests. Useful for rate-limited hosts. @default 0 */
|
|
66
|
+
wpRequestDelay?: number;
|
|
67
|
+
/** WordPress site base URL (e.g., `'https://example.com'`). Used to construct REST API endpoints (`/wp-json/wp/v2/...`). */
|
|
68
|
+
wpSiteUrl?: string;
|
|
69
|
+
/** WordPress username for REST API authentication. Must have read access to the content types being migrated. */
|
|
70
|
+
wpUsername?: string;
|
|
71
|
+
};
|
|
72
|
+
/** Returns the frozen plugin options set during initialization, or `null` if the plugin has not been initialized yet. Useful for accessing config in custom hooks or endpoints. */
|
|
73
|
+
export declare const getPluginOptions: () => PayloadWordPressMigratorConfig | null;
|
|
74
|
+
/** Returns the timestamp (ms since epoch) of the last migration job change. Used by the dashboard to decide when to refetch summary data. */
|
|
75
|
+
export declare const getLastCacheInvalidation: () => number;
|
|
76
|
+
/**
|
|
77
|
+
* PayloadCMS plugin that adds WordPress content migration capabilities.
|
|
78
|
+
*
|
|
79
|
+
* Registers a `wordpress-migration` collection for job management, REST endpoints
|
|
80
|
+
* for the migration dashboard, and `migratedFromWordPress` metadata fields
|
|
81
|
+
* on configured target collections.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { payloadWordPressMigrator } from 'payload-wordpress-migrator'
|
|
86
|
+
*
|
|
87
|
+
* export default buildConfig({
|
|
88
|
+
* plugins: [
|
|
89
|
+
* payloadWordPressMigrator({
|
|
90
|
+
* collections: {
|
|
91
|
+
* posts: { wpPostType: 'post', enableBlocks: true },
|
|
92
|
+
* media: { wpPostType: 'media' },
|
|
93
|
+
* },
|
|
94
|
+
* enableMediaDownload: true,
|
|
95
|
+
* migrationBatchSize: 10,
|
|
96
|
+
* }),
|
|
97
|
+
* ],
|
|
98
|
+
* })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare const payloadWordPressMigrator: (pluginOptions: PayloadWordPressMigratorConfig) => (config: Config) => Config;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
let pluginOptionsGlobal = null;
|
|
2
|
+
// Simple cache invalidation tracking
|
|
3
|
+
let lastCacheInvalidation = Date.now();
|
|
4
|
+
const invalidateLocalCache = ()=>{
|
|
5
|
+
lastCacheInvalidation = Date.now();
|
|
6
|
+
};
|
|
7
|
+
/** Returns the frozen plugin options set during initialization, or `null` if the plugin has not been initialized yet. Useful for accessing config in custom hooks or endpoints. */ const getPluginOptions = ()=>pluginOptionsGlobal;
|
|
8
|
+
/** Returns the timestamp (ms since epoch) of the last migration job change. Used by the dashboard to decide when to refetch summary data. */ const getLastCacheInvalidation = ()=>lastCacheInvalidation;
|
|
9
|
+
/**
|
|
10
|
+
* PayloadCMS plugin that adds WordPress content migration capabilities.
|
|
11
|
+
*
|
|
12
|
+
* Registers a `wordpress-migration` collection for job management, REST endpoints
|
|
13
|
+
* for the migration dashboard, and `migratedFromWordPress` metadata fields
|
|
14
|
+
* on configured target collections.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { payloadWordPressMigrator } from 'payload-wordpress-migrator'
|
|
19
|
+
*
|
|
20
|
+
* export default buildConfig({
|
|
21
|
+
* plugins: [
|
|
22
|
+
* payloadWordPressMigrator({
|
|
23
|
+
* collections: {
|
|
24
|
+
* posts: { wpPostType: 'post', enableBlocks: true },
|
|
25
|
+
* media: { wpPostType: 'media' },
|
|
26
|
+
* },
|
|
27
|
+
* enableMediaDownload: true,
|
|
28
|
+
* migrationBatchSize: 10,
|
|
29
|
+
* }),
|
|
30
|
+
* ],
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*/ const payloadWordPressMigrator = (pluginOptions)=>(config)=>{
|
|
34
|
+
pluginOptionsGlobal = Object.freeze({
|
|
35
|
+
...pluginOptions
|
|
36
|
+
});
|
|
37
|
+
if (!config.collections) {
|
|
38
|
+
config.collections = [];
|
|
39
|
+
}
|
|
40
|
+
// Add WordPress Migration collection (migration jobs only - site config handled in dashboard)
|
|
41
|
+
config.collections.push({
|
|
42
|
+
slug: 'wordpress-migration',
|
|
43
|
+
access: {
|
|
44
|
+
create: ({ req })=>!!req.user,
|
|
45
|
+
delete: async ({ id, req })=>{
|
|
46
|
+
if (!req.user) return false;
|
|
47
|
+
try {
|
|
48
|
+
// Check if job is running before allowing deletion
|
|
49
|
+
if (id) {
|
|
50
|
+
const job = await req.payload.findByID({
|
|
51
|
+
id: id,
|
|
52
|
+
collection: 'wordpress-migration'
|
|
53
|
+
});
|
|
54
|
+
if (job?.status === 'running') {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error('Error checking job status for deletion:', error);
|
|
61
|
+
return true // Allow deletion if we can't check status
|
|
62
|
+
;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
read: ({ req })=>!!req.user,
|
|
66
|
+
update: ({ req })=>!!req.user
|
|
67
|
+
},
|
|
68
|
+
admin: {
|
|
69
|
+
components: {
|
|
70
|
+
beforeList: [
|
|
71
|
+
'payload-wordpress-migrator/rsc#MigrationDashboardServer'
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
group: 'Migration',
|
|
75
|
+
useAsTitle: 'jobName'
|
|
76
|
+
},
|
|
77
|
+
fields: [
|
|
78
|
+
{
|
|
79
|
+
name: 'jobName',
|
|
80
|
+
type: 'text',
|
|
81
|
+
label: 'Migration Job Name',
|
|
82
|
+
required: true
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'contentType',
|
|
86
|
+
type: 'text',
|
|
87
|
+
admin: {
|
|
88
|
+
components: {
|
|
89
|
+
Field: 'payload-wordpress-migrator/client#ContentTypeSelect'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
label: 'Content Type to Migrate',
|
|
93
|
+
required: true
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'targetCollection',
|
|
97
|
+
type: 'select',
|
|
98
|
+
admin: {
|
|
99
|
+
description: 'The Payload collection where migrated content will be stored'
|
|
100
|
+
},
|
|
101
|
+
label: 'Target Payload Collection',
|
|
102
|
+
options: (()=>{
|
|
103
|
+
const collectionLabelMap = {
|
|
104
|
+
categories: 'Categories',
|
|
105
|
+
media: 'Media',
|
|
106
|
+
pages: 'Pages',
|
|
107
|
+
posts: 'Posts',
|
|
108
|
+
tags: 'Tags',
|
|
109
|
+
users: 'Users'
|
|
110
|
+
};
|
|
111
|
+
return config.collections?.filter((collection)=>{
|
|
112
|
+
// Filter out system collections and the wordpress-migration collection itself
|
|
113
|
+
return collection.slug !== 'wordpress-migration' && collection.slug !== 'payload-preferences' && collection.slug !== 'payload-migrations' && !collection.slug.startsWith('payload-');
|
|
114
|
+
}).map((collection)=>({
|
|
115
|
+
label: collectionLabelMap[collection.slug] || collection.slug.charAt(0).toUpperCase() + collection.slug.slice(1),
|
|
116
|
+
value: collection.slug
|
|
117
|
+
})).sort((a, b)=>a.label.localeCompare(b.label)) || [];
|
|
118
|
+
})(),
|
|
119
|
+
required: true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'includeIds',
|
|
123
|
+
type: 'text',
|
|
124
|
+
admin: {
|
|
125
|
+
description: 'Optional: Comma-separated list of specific WordPress post IDs to migrate (e.g., "123,456,789"). Leave empty to migrate all.'
|
|
126
|
+
},
|
|
127
|
+
label: 'Specific Post IDs (Optional)'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'dryRun',
|
|
131
|
+
type: 'checkbox',
|
|
132
|
+
admin: {
|
|
133
|
+
description: 'Preview migration results without creating any content in PayloadCMS'
|
|
134
|
+
},
|
|
135
|
+
defaultValue: false,
|
|
136
|
+
label: 'Dry Run'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'status',
|
|
140
|
+
type: 'select',
|
|
141
|
+
admin: {
|
|
142
|
+
readOnly: true
|
|
143
|
+
},
|
|
144
|
+
defaultValue: 'ready',
|
|
145
|
+
options: [
|
|
146
|
+
{
|
|
147
|
+
label: 'Ready to Start',
|
|
148
|
+
value: 'ready'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: 'Running',
|
|
152
|
+
value: 'running'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: 'Completed',
|
|
156
|
+
value: 'completed'
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
label: 'Failed',
|
|
160
|
+
value: 'failed'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
label: 'Paused',
|
|
164
|
+
value: 'paused'
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: 'Rolled Back',
|
|
168
|
+
value: 'rolled_back'
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'progress',
|
|
174
|
+
type: 'group',
|
|
175
|
+
admin: {
|
|
176
|
+
hidden: true
|
|
177
|
+
},
|
|
178
|
+
fields: [
|
|
179
|
+
{
|
|
180
|
+
name: 'totalItems',
|
|
181
|
+
type: 'number',
|
|
182
|
+
admin: {
|
|
183
|
+
readOnly: true
|
|
184
|
+
},
|
|
185
|
+
defaultValue: 0
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'processedItems',
|
|
189
|
+
type: 'number',
|
|
190
|
+
admin: {
|
|
191
|
+
readOnly: true
|
|
192
|
+
},
|
|
193
|
+
defaultValue: 0
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'successfulItems',
|
|
197
|
+
type: 'number',
|
|
198
|
+
admin: {
|
|
199
|
+
readOnly: true
|
|
200
|
+
},
|
|
201
|
+
defaultValue: 0
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'failedItems',
|
|
205
|
+
type: 'number',
|
|
206
|
+
admin: {
|
|
207
|
+
readOnly: true
|
|
208
|
+
},
|
|
209
|
+
defaultValue: 0
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'failedItemIds',
|
|
213
|
+
type: 'array',
|
|
214
|
+
admin: {
|
|
215
|
+
readOnly: true
|
|
216
|
+
},
|
|
217
|
+
fields: [
|
|
218
|
+
{
|
|
219
|
+
name: 'wpId',
|
|
220
|
+
type: 'number'
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'error',
|
|
224
|
+
type: 'text'
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'configuration',
|
|
232
|
+
type: 'group',
|
|
233
|
+
fields: [
|
|
234
|
+
{
|
|
235
|
+
name: 'batchSize',
|
|
236
|
+
type: 'number',
|
|
237
|
+
defaultValue: 10,
|
|
238
|
+
label: 'Batch Size',
|
|
239
|
+
max: 100,
|
|
240
|
+
min: 1
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'enableBlocks',
|
|
244
|
+
type: 'checkbox',
|
|
245
|
+
defaultValue: true,
|
|
246
|
+
label: 'Convert Gutenberg blocks'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'fieldMapping',
|
|
250
|
+
type: 'json',
|
|
251
|
+
admin: {
|
|
252
|
+
components: {
|
|
253
|
+
Field: 'payload-wordpress-migrator/client#SimpleFieldMapping'
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
label: 'Field Mapping'
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'logs',
|
|
262
|
+
type: 'array',
|
|
263
|
+
admin: {
|
|
264
|
+
hidden: true
|
|
265
|
+
},
|
|
266
|
+
fields: [
|
|
267
|
+
{
|
|
268
|
+
name: 'timestamp',
|
|
269
|
+
type: 'date',
|
|
270
|
+
admin: {
|
|
271
|
+
readOnly: true
|
|
272
|
+
},
|
|
273
|
+
defaultValue: ()=>new Date()
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'level',
|
|
277
|
+
type: 'select',
|
|
278
|
+
options: [
|
|
279
|
+
{
|
|
280
|
+
label: 'Info',
|
|
281
|
+
value: 'info'
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
label: 'Warning',
|
|
285
|
+
value: 'warning'
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
label: 'Error',
|
|
289
|
+
value: 'error'
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'message',
|
|
295
|
+
type: 'textarea'
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
hooks: {
|
|
301
|
+
afterChange: [
|
|
302
|
+
()=>{
|
|
303
|
+
invalidateLocalCache();
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
afterDelete: [
|
|
307
|
+
()=>{
|
|
308
|
+
invalidateLocalCache();
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
labels: {
|
|
313
|
+
plural: 'WordPress Migrations',
|
|
314
|
+
singular: 'WordPress Migration'
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
// Add fields to specified collections
|
|
318
|
+
if (pluginOptions.collections) {
|
|
319
|
+
for(const collectionSlug in pluginOptions.collections){
|
|
320
|
+
const collection = config.collections.find((collection)=>collection.slug === collectionSlug);
|
|
321
|
+
if (collection) {
|
|
322
|
+
collection.fields.push({
|
|
323
|
+
name: 'migratedFromWordPress',
|
|
324
|
+
type: 'group',
|
|
325
|
+
admin: {
|
|
326
|
+
hidden: true
|
|
327
|
+
},
|
|
328
|
+
fields: [
|
|
329
|
+
{
|
|
330
|
+
name: 'wpPostId',
|
|
331
|
+
type: 'number',
|
|
332
|
+
admin: {
|
|
333
|
+
readOnly: true
|
|
334
|
+
},
|
|
335
|
+
label: 'WordPress Post ID'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: 'wpPostType',
|
|
339
|
+
type: 'text',
|
|
340
|
+
admin: {
|
|
341
|
+
readOnly: true
|
|
342
|
+
},
|
|
343
|
+
label: 'WordPress Post Type'
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: 'migrationDate',
|
|
347
|
+
type: 'date',
|
|
348
|
+
admin: {
|
|
349
|
+
readOnly: true
|
|
350
|
+
},
|
|
351
|
+
label: 'Migration Date'
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.
|
|
360
|
+
*/ if (pluginOptions.disabled) {
|
|
361
|
+
return config;
|
|
362
|
+
}
|
|
363
|
+
if (!config.endpoints) {
|
|
364
|
+
config.endpoints = [];
|
|
365
|
+
}
|
|
366
|
+
// Add WordPress API endpoints
|
|
367
|
+
config.endpoints.push({
|
|
368
|
+
handler: async (req)=>{
|
|
369
|
+
const { wordpressConnectionHandler } = await import('./utils/wordpressApi.js');
|
|
370
|
+
return wordpressConnectionHandler(req, pluginOptions);
|
|
371
|
+
},
|
|
372
|
+
method: 'post',
|
|
373
|
+
path: '/wordpress/test-connection'
|
|
374
|
+
});
|
|
375
|
+
config.endpoints.push({
|
|
376
|
+
handler: async (req)=>{
|
|
377
|
+
const { migrationSummaryHandler } = await import('./utils/wordpressApi.js');
|
|
378
|
+
return migrationSummaryHandler(req, pluginOptions);
|
|
379
|
+
},
|
|
380
|
+
method: 'get',
|
|
381
|
+
path: '/wordpress/migration-summary'
|
|
382
|
+
});
|
|
383
|
+
config.endpoints.push({
|
|
384
|
+
handler: async (req)=>{
|
|
385
|
+
const { migrationJobHandler } = await import('./utils/wordpressApi.js');
|
|
386
|
+
return migrationJobHandler(req, pluginOptions);
|
|
387
|
+
},
|
|
388
|
+
method: 'get',
|
|
389
|
+
path: '/wordpress/migration-jobs'
|
|
390
|
+
});
|
|
391
|
+
config.endpoints.push({
|
|
392
|
+
handler: async (req)=>{
|
|
393
|
+
const { migrationJobHandler } = await import('./utils/wordpressApi.js');
|
|
394
|
+
return migrationJobHandler(req, pluginOptions);
|
|
395
|
+
},
|
|
396
|
+
method: 'post',
|
|
397
|
+
path: '/wordpress/migration-jobs'
|
|
398
|
+
});
|
|
399
|
+
config.endpoints.push({
|
|
400
|
+
handler: async (req)=>{
|
|
401
|
+
const { migrationJobHandler } = await import('./utils/wordpressApi.js');
|
|
402
|
+
return migrationJobHandler(req, pluginOptions);
|
|
403
|
+
},
|
|
404
|
+
method: 'put',
|
|
405
|
+
path: '/wordpress/migration-jobs'
|
|
406
|
+
});
|
|
407
|
+
config.endpoints.push({
|
|
408
|
+
handler: async (req)=>{
|
|
409
|
+
const { discoverWordPressContent } = await import('./utils/wordpressApi.js');
|
|
410
|
+
return discoverWordPressContent(req, pluginOptions);
|
|
411
|
+
},
|
|
412
|
+
method: 'post',
|
|
413
|
+
path: '/wordpress/discover-content'
|
|
414
|
+
});
|
|
415
|
+
config.endpoints.push({
|
|
416
|
+
handler: async (req)=>{
|
|
417
|
+
const { migrationJobHandler } = await import('./utils/wordpressApi.js');
|
|
418
|
+
return migrationJobHandler(req, pluginOptions);
|
|
419
|
+
},
|
|
420
|
+
method: 'delete',
|
|
421
|
+
path: '/wordpress/migration-jobs'
|
|
422
|
+
});
|
|
423
|
+
config.endpoints.push({
|
|
424
|
+
handler: async (req)=>{
|
|
425
|
+
const { fetchWordPressContentFields } = await import('./utils/wordpressApi.js');
|
|
426
|
+
return fetchWordPressContentFields(req, pluginOptions);
|
|
427
|
+
},
|
|
428
|
+
method: 'post',
|
|
429
|
+
path: '/wordpress/content-fields'
|
|
430
|
+
});
|
|
431
|
+
config.endpoints.push({
|
|
432
|
+
handler: async (req)=>{
|
|
433
|
+
const { fetchPayloadCollectionFields } = await import('./utils/wordpressApi.js');
|
|
434
|
+
return fetchPayloadCollectionFields(req);
|
|
435
|
+
},
|
|
436
|
+
method: 'get',
|
|
437
|
+
path: '/collections/:slug/fields'
|
|
438
|
+
});
|
|
439
|
+
return config;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export { getLastCacheInvalidation, getPluginOptions, payloadWordPressMigrator };
|
|
443
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { CollectionSlug, Config, PayloadRequest } from 'payload'\n\n/**\n * Configures how a WordPress content type maps to a PayloadCMS collection.\n */\nexport type WordPressCollectionMapping = {\n /** ACF field names to include in the migration (e.g., `['hero_image', 'subtitle']`). */\n customFields?: string[]\n /** Disable HTML-to-Lexical conversion for this collection. Useful for debugging content issues. @default false */\n disableHtmlConversion?: boolean\n /** Convert Gutenberg blocks to PayloadCMS Lexical block nodes. @default false */\n enableBlocks?: boolean\n /** Custom field mapping from WordPress field paths to Payload field paths (dot-notation supported). */\n fieldMapping?: Record<string, string>\n /** Auto-import images found in post/page HTML content. Requires `enableMediaDownload` on the plugin. @default true */\n importContentMedia?: boolean\n /** WordPress content type slug (e.g., `'post'`, `'page'`, `'product'`, or any custom post type registered with `show_in_rest`). */\n wpPostType: string\n}\n\n/**\n * Configuration for the WordPress migrator plugin.\n *\n * WordPress credentials can be provided here or entered per-job in the migration dashboard.\n */\nexport type PayloadWordPressMigratorConfig = {\n /**\n * Custom access control for migration endpoints. When provided, checked after authentication\n * — returning `false` results in a 403 response. Without this, any authenticated user can migrate.\n * @example\n * ```ts\n * access: ({ req }) => req.user?.role === 'admin'\n * ```\n */\n access?: (args: { req: PayloadRequest }) => boolean | Promise<boolean>\n /**\n * Allowed MIME types for media import. Supports exact types and wildcards.\n * @default ['image/*', 'application/pdf', 'video/mp4', 'audio/mpeg']\n */\n allowedMediaTypes?: string[]\n /** Allow connections to WordPress sites with self-signed or invalid SSL certificates. **Development only** — logs a warning in production. @default false */\n allowSelfSignedCerts?: boolean\n /** Map of PayloadCMS collection slugs to WordPress post type mappings. Each entry configures how a WordPress content type maps to a Payload collection. */\n collections?: Partial<Record<CollectionSlug, WordPressCollectionMapping>>\n /** Disable the plugin entirely. Collections and metadata fields are still added (for schema consistency) but endpoints are not registered. */\n disabled?: boolean\n /** Hide the migration dashboard in the Payload admin panel. */\n disableDashboard?: boolean\n /** Enable downloading media files from WordPress and uploading them to PayloadCMS. When `false`, only metadata is migrated. @default false */\n enableMediaDownload?: boolean\n /** Maximum media file size in bytes. Files exceeding this limit are skipped. @default 10485760 (10 MB) */\n maxMediaFileSize?: number\n /** Custom upload directory for downloaded media files. Falls back to Payload's default upload path. */\n mediaUploadPath?: string\n /** Number of WordPress items to fetch and process per batch. Lower values reduce memory usage and improve crash recovery granularity (at most batchSize-1 items may be re-processed after a crash). @default 10 */\n migrationBatchSize?: number\n /** Number of items to process in parallel within each batch. Higher values speed up migration but increase memory and API load. @default 1 */\n migrationConcurrency?: number\n /**\n * WordPress Application Password for REST API authentication.\n * Generate one at WordPress Admin > Users > Profile > Application Passwords.\n * **Not** the regular WordPress login password.\n */\n wpPassword?: string\n /** Delay in milliseconds between WordPress REST API page requests. Useful for rate-limited hosts. @default 0 */\n wpRequestDelay?: number\n /** WordPress site base URL (e.g., `'https://example.com'`). Used to construct REST API endpoints (`/wp-json/wp/v2/...`). */\n wpSiteUrl?: string\n /** WordPress username for REST API authentication. Must have read access to the content types being migrated. */\n wpUsername?: string\n}\n\nlet pluginOptionsGlobal: null | PayloadWordPressMigratorConfig = null\n\n// Simple cache invalidation tracking\nlet lastCacheInvalidation = Date.now()\n\nconst invalidateLocalCache = () => {\n lastCacheInvalidation = Date.now()\n}\n\n/** Returns the frozen plugin options set during initialization, or `null` if the plugin has not been initialized yet. Useful for accessing config in custom hooks or endpoints. */\nexport const getPluginOptions = () => pluginOptionsGlobal\n/** Returns the timestamp (ms since epoch) of the last migration job change. Used by the dashboard to decide when to refetch summary data. */\nexport const getLastCacheInvalidation = () => lastCacheInvalidation\n\n/**\n * PayloadCMS plugin that adds WordPress content migration capabilities.\n *\n * Registers a `wordpress-migration` collection for job management, REST endpoints\n * for the migration dashboard, and `migratedFromWordPress` metadata fields\n * on configured target collections.\n *\n * @example\n * ```ts\n * import { payloadWordPressMigrator } from 'payload-wordpress-migrator'\n *\n * export default buildConfig({\n * plugins: [\n * payloadWordPressMigrator({\n * collections: {\n * posts: { wpPostType: 'post', enableBlocks: true },\n * media: { wpPostType: 'media' },\n * },\n * enableMediaDownload: true,\n * migrationBatchSize: 10,\n * }),\n * ],\n * })\n * ```\n */\nexport const payloadWordPressMigrator =\n (pluginOptions: PayloadWordPressMigratorConfig) =>\n (config: Config): Config => {\n pluginOptionsGlobal = Object.freeze({ ...pluginOptions }) as PayloadWordPressMigratorConfig\n\n if (!config.collections) {\n config.collections = []\n }\n\n // Add WordPress Migration collection (migration jobs only - site config handled in dashboard)\n config.collections.push({\n slug: 'wordpress-migration',\n access: {\n create: ({ req }) => !!req.user,\n delete: async ({ id, req }) => {\n if (!req.user) return false\n try {\n // Check if job is running before allowing deletion\n if (id) {\n const job = await req.payload.findByID({\n id: id as string,\n collection: 'wordpress-migration',\n })\n if (job?.status === 'running') {\n return false\n }\n }\n return true\n } catch (error) {\n console.error('Error checking job status for deletion:', error)\n return true // Allow deletion if we can't check status\n }\n },\n read: ({ req }) => !!req.user,\n update: ({ req }) => !!req.user,\n },\n admin: {\n components: {\n beforeList: ['payload-wordpress-migrator/rsc#MigrationDashboardServer'],\n },\n group: 'Migration',\n useAsTitle: 'jobName',\n },\n fields: [\n {\n name: 'jobName',\n type: 'text',\n label: 'Migration Job Name',\n required: true,\n },\n {\n name: 'contentType',\n type: 'text',\n admin: {\n components: {\n Field: 'payload-wordpress-migrator/client#ContentTypeSelect',\n },\n },\n label: 'Content Type to Migrate',\n required: true,\n },\n {\n name: 'targetCollection',\n type: 'select',\n admin: {\n description: 'The Payload collection where migrated content will be stored',\n },\n label: 'Target Payload Collection',\n options: (() => {\n const collectionLabelMap: Record<string, string> = {\n categories: 'Categories',\n media: 'Media',\n pages: 'Pages',\n posts: 'Posts',\n tags: 'Tags',\n users: 'Users',\n }\n\n return (\n config.collections\n ?.filter((collection) => {\n // Filter out system collections and the wordpress-migration collection itself\n return (\n collection.slug !== 'wordpress-migration' &&\n collection.slug !== 'payload-preferences' &&\n collection.slug !== 'payload-migrations' &&\n !collection.slug.startsWith('payload-')\n )\n })\n .map((collection) => ({\n label:\n collectionLabelMap[collection.slug] ||\n collection.slug.charAt(0).toUpperCase() + collection.slug.slice(1),\n value: collection.slug,\n }))\n .sort((a, b) => a.label.localeCompare(b.label)) || []\n )\n })(),\n required: true,\n },\n {\n name: 'includeIds',\n type: 'text',\n admin: {\n description:\n 'Optional: Comma-separated list of specific WordPress post IDs to migrate (e.g., \"123,456,789\"). Leave empty to migrate all.',\n },\n label: 'Specific Post IDs (Optional)',\n },\n {\n name: 'dryRun',\n type: 'checkbox',\n admin: {\n description: 'Preview migration results without creating any content in PayloadCMS',\n },\n defaultValue: false,\n label: 'Dry Run',\n },\n {\n name: 'status',\n type: 'select',\n admin: {\n readOnly: true,\n },\n defaultValue: 'ready',\n options: [\n { label: 'Ready to Start', value: 'ready' },\n { label: 'Running', value: 'running' },\n { label: 'Completed', value: 'completed' },\n { label: 'Failed', value: 'failed' },\n { label: 'Paused', value: 'paused' },\n { label: 'Rolled Back', value: 'rolled_back' },\n ],\n },\n {\n name: 'progress',\n type: 'group',\n admin: {\n hidden: true, // Hide detailed progress from admin interface\n },\n fields: [\n {\n name: 'totalItems',\n type: 'number',\n admin: { readOnly: true },\n defaultValue: 0,\n },\n {\n name: 'processedItems',\n type: 'number',\n admin: { readOnly: true },\n defaultValue: 0,\n },\n {\n name: 'successfulItems',\n type: 'number',\n admin: { readOnly: true },\n defaultValue: 0,\n },\n {\n name: 'failedItems',\n type: 'number',\n admin: { readOnly: true },\n defaultValue: 0,\n },\n {\n name: 'failedItemIds',\n type: 'array',\n admin: { readOnly: true },\n fields: [\n {\n name: 'wpId',\n type: 'number',\n },\n {\n name: 'error',\n type: 'text',\n },\n ],\n },\n ],\n },\n {\n name: 'configuration',\n type: 'group',\n fields: [\n {\n name: 'batchSize',\n type: 'number',\n defaultValue: 10,\n label: 'Batch Size',\n max: 100,\n min: 1,\n },\n {\n name: 'enableBlocks',\n type: 'checkbox',\n defaultValue: true,\n label: 'Convert Gutenberg blocks',\n },\n {\n name: 'fieldMapping',\n type: 'json',\n admin: {\n components: {\n Field: 'payload-wordpress-migrator/client#SimpleFieldMapping',\n },\n },\n label: 'Field Mapping',\n },\n ],\n },\n {\n name: 'logs',\n type: 'array',\n admin: {\n hidden: true, // Hide logs from admin interface - use centralized logs instead\n },\n fields: [\n {\n name: 'timestamp',\n type: 'date',\n admin: { readOnly: true },\n defaultValue: () => new Date(),\n },\n {\n name: 'level',\n type: 'select',\n options: [\n { label: 'Info', value: 'info' },\n { label: 'Warning', value: 'warning' },\n { label: 'Error', value: 'error' },\n ],\n },\n {\n name: 'message',\n type: 'textarea',\n },\n ],\n },\n ],\n hooks: {\n afterChange: [\n () => {\n invalidateLocalCache()\n },\n ],\n afterDelete: [\n () => {\n invalidateLocalCache()\n },\n ],\n },\n labels: {\n plural: 'WordPress Migrations',\n singular: 'WordPress Migration',\n },\n })\n\n // Add fields to specified collections\n if (pluginOptions.collections) {\n for (const collectionSlug in pluginOptions.collections) {\n const collection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (collection) {\n collection.fields.push({\n name: 'migratedFromWordPress',\n type: 'group',\n admin: {\n hidden: true, // Hide from admin interface while keeping functionality\n },\n fields: [\n {\n name: 'wpPostId',\n type: 'number',\n admin: { readOnly: true },\n label: 'WordPress Post ID',\n },\n {\n name: 'wpPostType',\n type: 'text',\n admin: { readOnly: true },\n label: 'WordPress Post Type',\n },\n {\n name: 'migrationDate',\n type: 'date',\n admin: { readOnly: true },\n label: 'Migration Date',\n },\n ],\n })\n }\n }\n }\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n */\n if (pluginOptions.disabled) {\n return config\n }\n\n if (!config.endpoints) {\n config.endpoints = []\n }\n\n // Add WordPress API endpoints\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { wordpressConnectionHandler } = await import('./utils/wordpressApi.js')\n return wordpressConnectionHandler(req, pluginOptions)\n },\n method: 'post',\n path: '/wordpress/test-connection',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { migrationSummaryHandler } = await import('./utils/wordpressApi.js')\n return migrationSummaryHandler(req, pluginOptions)\n },\n method: 'get',\n path: '/wordpress/migration-summary',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { migrationJobHandler } = await import('./utils/wordpressApi.js')\n return migrationJobHandler(req, pluginOptions)\n },\n method: 'get',\n path: '/wordpress/migration-jobs',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { migrationJobHandler } = await import('./utils/wordpressApi.js')\n return migrationJobHandler(req, pluginOptions)\n },\n method: 'post',\n path: '/wordpress/migration-jobs',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { migrationJobHandler } = await import('./utils/wordpressApi.js')\n return migrationJobHandler(req, pluginOptions)\n },\n method: 'put',\n path: '/wordpress/migration-jobs',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { discoverWordPressContent } = await import('./utils/wordpressApi.js')\n return discoverWordPressContent(req, pluginOptions)\n },\n method: 'post',\n path: '/wordpress/discover-content',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { migrationJobHandler } = await import('./utils/wordpressApi.js')\n return migrationJobHandler(req, pluginOptions)\n },\n method: 'delete',\n path: '/wordpress/migration-jobs',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { fetchWordPressContentFields } = await import('./utils/wordpressApi.js')\n return fetchWordPressContentFields(req, pluginOptions)\n },\n method: 'post',\n path: '/wordpress/content-fields',\n })\n\n config.endpoints.push({\n handler: async (req: PayloadRequest) => {\n const { fetchPayloadCollectionFields } = await import('./utils/wordpressApi.js')\n return fetchPayloadCollectionFields(req)\n },\n method: 'get',\n path: '/collections/:slug/fields',\n })\n\n return config\n }\n"],"names":["pluginOptionsGlobal","lastCacheInvalidation","Date","now","invalidateLocalCache","getPluginOptions","getLastCacheInvalidation","payloadWordPressMigrator","pluginOptions","config","Object","freeze","collections","push","slug","access","create","req","user","delete","id","job","payload","findByID","collection","status","error","console","read","update","admin","components","beforeList","group","useAsTitle","fields","name","type","label","required","Field","description","options","collectionLabelMap","categories","media","pages","posts","tags","users","filter","startsWith","map","charAt","toUpperCase","slice","value","sort","a","b","localeCompare","defaultValue","readOnly","hidden","max","min","hooks","afterChange","afterDelete","labels","plural","singular","collectionSlug","find","disabled","endpoints","handler","wordpressConnectionHandler","method","path","migrationSummaryHandler","migrationJobHandler","discoverWordPressContent","fetchWordPressContentFields","fetchPayloadCollectionFields"],"mappings":"AAwEA,IAAIA,mBAAAA,GAA6D,IAAA;AAEjE;AACA,IAAIC,qBAAAA,GAAwBC,KAAKC,GAAG,EAAA;AAEpC,MAAMC,oBAAAA,GAAuB,IAAA;AAC3BH,IAAAA,qBAAAA,GAAwBC,KAAKC,GAAG,EAAA;AAClC,CAAA;AAEA,oLACO,MAAME,gBAAAA,GAAmB,IAAML;AACtC,8IACO,MAAMM,wBAAAA,GAA2B,IAAML;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;AAwBC,IACM,MAAMM,wBAAAA,GACX,CAACC,gBACD,CAACC,MAAAA,GAAAA;QACCT,mBAAAA,GAAsBU,MAAAA,CAAOC,MAAM,CAAC;AAAE,YAAA,GAAGH;AAAc,SAAA,CAAA;QAEvD,IAAI,CAACC,MAAAA,CAAOG,WAAW,EAAE;YACvBH,MAAAA,CAAOG,WAAW,GAAG,EAAE;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AAA,OAAOA,4BAA4BlE,GAAAA,EAAKT,aAAAA,CAAAA;AAC1C,YAAA,CAAA;YACAsE,MAAAA,EAAQ,MAAA;YACRC,IAAAA,EAAM;AACR,SAAA,CAAA;QAEAtE,MAAAA,CAAOkE,SAAS,CAAC9D,IAAI,CAAC;AACpB+D,YAAAA,OAAAA,EAAS,OAAO3D,GAAAA,GAAAA;AACd,gBAAA,MAAM,EAAEmE,4BAA4B,EAAE,GAAG,MAAM,OAAO,yBAAA,CAAA;AACtD,gBAAA,OAAOA,4BAAAA,CAA6BnE,GAAAA,CAAAA;AACtC,YAAA,CAAA;YACA6D,MAAAA,EAAQ,KAAA;YACRC,IAAAA,EAAM;AACR,SAAA,CAAA;QAEA,OAAOtE,MAAAA;IACT;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Lexical block validation, enhancement with PayloadCMS schema defaults, and media block processing. */
|
|
2
|
+
import type { Payload } from 'payload';
|
|
3
|
+
import type { PayloadWordPressMigratorConfig } from '../../index.js';
|
|
4
|
+
import type { LexicalRoot } from '../types.js';
|
|
5
|
+
export declare const processMediaBlocksInContent: (content: LexicalRoot | undefined, payload: Payload, pluginOptions?: PayloadWordPressMigratorConfig) => Promise<LexicalRoot | undefined>;
|
|
6
|
+
export declare const validateAndEnhanceBlocks: (content: any) => any;
|