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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { importMediaFromUrl } from '../media/import.js';
|
|
2
|
+
|
|
3
|
+
const processMediaBlocksInContent = async (content, payload, pluginOptions)=>{
|
|
4
|
+
if (!content?.root?.children || !payload || !pluginOptions?.enableMediaDownload) {
|
|
5
|
+
return content;
|
|
6
|
+
}
|
|
7
|
+
const processNode = async (node)=>{
|
|
8
|
+
if (node.type === 'block' && node.fields?.blockType === 'mediaBlock' && node.fields?.__migrationMeta?.needsMediaImport) {
|
|
9
|
+
const migrationData = node.fields.__migrationMeta;
|
|
10
|
+
try {
|
|
11
|
+
const mediaId = await importMediaFromUrl(migrationData.originalSrc, payload, pluginOptions, 'media', migrationData.alt || '', migrationData.title || '', migrationData.caption);
|
|
12
|
+
if (mediaId) {
|
|
13
|
+
node.fields.media = mediaId;
|
|
14
|
+
} else {
|
|
15
|
+
console.warn(`Failed to import media: ${migrationData.originalSrc}`);
|
|
16
|
+
}
|
|
17
|
+
delete node.fields.__migrationMeta;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
console.warn(`Failed to import media for MediaBlock: ${migrationData.originalSrc}`, error);
|
|
20
|
+
delete node.fields.__migrationMeta;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (node.children && Array.isArray(node.children)) {
|
|
24
|
+
const results = await Promise.allSettled(node.children.map(processNode));
|
|
25
|
+
node.children = results.filter((r)=>r.status === 'fulfilled').map((r)=>r.value);
|
|
26
|
+
}
|
|
27
|
+
return node;
|
|
28
|
+
};
|
|
29
|
+
if (content.root.children && Array.isArray(content.root.children)) {
|
|
30
|
+
const results = await Promise.allSettled(content.root.children.map(processNode));
|
|
31
|
+
content.root.children = results.filter((r)=>r.status === 'fulfilled').map((r)=>r.value);
|
|
32
|
+
content.root.children = content.root.children.filter((child)=>{
|
|
33
|
+
if (child.type === 'block' && child.fields?.blockType === 'mediaBlock' && child.fields?.media === null) {
|
|
34
|
+
console.warn(`Removing MediaBlock with null media (failed import) - blockName: ${child.fields?.blockName}`);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return content;
|
|
41
|
+
};
|
|
42
|
+
const validateAndEnhanceBlocks = (content)=>{
|
|
43
|
+
if (!content?.root?.children) {
|
|
44
|
+
return content;
|
|
45
|
+
}
|
|
46
|
+
const processNode = (node)=>{
|
|
47
|
+
if (node.type === 'block' && node.fields?.blockType) {
|
|
48
|
+
const blockType = node.fields.blockType;
|
|
49
|
+
if (blockType === 'accordion') {
|
|
50
|
+
node.fields = {
|
|
51
|
+
bottomPadding: 'medium',
|
|
52
|
+
topPadding: 'medium',
|
|
53
|
+
description: null,
|
|
54
|
+
heading: null,
|
|
55
|
+
...node.fields
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (blockType === 'iframeBlock') {
|
|
59
|
+
node.fields = {
|
|
60
|
+
height: 400,
|
|
61
|
+
loading: 'lazy',
|
|
62
|
+
title: null,
|
|
63
|
+
...node.fields
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (blockType === 'mediaBlock') {
|
|
67
|
+
node.fields = {
|
|
68
|
+
media: null,
|
|
69
|
+
...node.fields
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (node.children && Array.isArray(node.children)) {
|
|
74
|
+
node.children = node.children.map(processNode);
|
|
75
|
+
}
|
|
76
|
+
if (node.fields?.accordionItems && Array.isArray(node.fields.accordionItems)) {
|
|
77
|
+
node.fields.accordionItems = node.fields.accordionItems.map((item)=>{
|
|
78
|
+
if (item.content?.root?.children) {
|
|
79
|
+
item.content.root.children = item.content.root.children.map(processNode);
|
|
80
|
+
}
|
|
81
|
+
return item;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return node;
|
|
85
|
+
};
|
|
86
|
+
if (content.root.children && Array.isArray(content.root.children)) {
|
|
87
|
+
content.root.children = content.root.children.map(processNode);
|
|
88
|
+
}
|
|
89
|
+
return content;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export { processMediaBlocksInContent, validateAndEnhanceBlocks };
|
|
93
|
+
//# sourceMappingURL=blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.js","sources":["../../../src/utils/content/blocks.ts"],"sourcesContent":["/** Lexical block validation, enhancement with PayloadCMS schema defaults, and media block processing. */\n\nimport type { Payload } from 'payload'\n\nimport type { PayloadWordPressMigratorConfig } from '../../index.js'\nimport type { LexicalRoot } from '../types.js'\n\nimport { importMediaFromUrl } from '../media/import.js'\n\nexport const processMediaBlocksInContent = async (\n content: LexicalRoot | undefined,\n payload: Payload,\n pluginOptions?: PayloadWordPressMigratorConfig,\n): Promise<LexicalRoot | undefined> => {\n if (!content?.root?.children || !payload || !pluginOptions?.enableMediaDownload) {\n return content\n }\n\n const processNode = async (node: any): Promise<any> => {\n if (\n node.type === 'block' &&\n node.fields?.blockType === 'mediaBlock' &&\n node.fields?.__migrationMeta?.needsMediaImport\n ) {\n const migrationData = node.fields.__migrationMeta\n\n try {\n const mediaId = await importMediaFromUrl(\n migrationData.originalSrc,\n payload,\n pluginOptions,\n 'media',\n migrationData.alt || '',\n migrationData.title || '',\n migrationData.caption,\n )\n\n if (mediaId) {\n node.fields.media = mediaId\n } else {\n console.warn(`Failed to import media: ${migrationData.originalSrc}`)\n }\n\n delete node.fields.__migrationMeta\n } catch (error) {\n console.warn(`Failed to import media for MediaBlock: ${migrationData.originalSrc}`, error)\n delete node.fields.__migrationMeta\n }\n }\n\n if (node.children && Array.isArray(node.children)) {\n const results = await Promise.allSettled(node.children.map(processNode))\n node.children = results\n .filter((r): r is PromiseFulfilledResult<unknown> => r.status === 'fulfilled')\n .map(r => r.value)\n }\n\n return node\n }\n\n if (content.root.children && Array.isArray(content.root.children)) {\n const results = await Promise.allSettled(content.root.children.map(processNode))\n content.root.children = results\n .filter((r): r is PromiseFulfilledResult<unknown> => r.status === 'fulfilled')\n .map(r => r.value)\n\n content.root.children = content.root.children.filter((child: any) => {\n if (\n child.type === 'block' &&\n child.fields?.blockType === 'mediaBlock' &&\n child.fields?.media === null\n ) {\n console.warn(\n `Removing MediaBlock with null media (failed import) - blockName: ${child.fields?.blockName}`,\n )\n return false\n }\n return true\n })\n }\n\n return content\n}\n\nexport const validateAndEnhanceBlocks = (content: any): any => {\n if (!content?.root?.children) {\n return content\n }\n\n const processNode = (node: any): any => {\n if (node.type === 'block' && node.fields?.blockType) {\n const blockType = node.fields.blockType\n\n if (blockType === 'accordion') {\n node.fields = {\n bottomPadding: 'medium',\n topPadding: 'medium',\n description: null,\n heading: null,\n ...node.fields,\n }\n }\n\n if (blockType === 'iframeBlock') {\n node.fields = {\n height: 400,\n loading: 'lazy',\n title: null,\n ...node.fields,\n }\n }\n\n if (blockType === 'mediaBlock') {\n node.fields = {\n media: null,\n ...node.fields,\n }\n }\n }\n\n if (node.children && Array.isArray(node.children)) {\n node.children = node.children.map(processNode)\n }\n\n if (node.fields?.accordionItems && Array.isArray(node.fields.accordionItems)) {\n node.fields.accordionItems = node.fields.accordionItems.map((item: any) => {\n if (item.content?.root?.children) {\n item.content.root.children = item.content.root.children.map(processNode)\n }\n return item\n })\n }\n\n return node\n }\n\n if (content.root.children && Array.isArray(content.root.children)) {\n content.root.children = content.root.children.map(processNode)\n }\n\n return content\n}\n"],"names":["processMediaBlocksInContent","content","payload","pluginOptions","root","children","enableMediaDownload","processNode","node","type","fields","blockType","__migrationMeta","needsMediaImport","migrationData","mediaId","importMediaFromUrl","originalSrc","alt","title","caption","media","console","warn","error","Array","isArray","results","Promise","allSettled","map","filter","r","status","value","child","blockName","validateAndEnhanceBlocks","bottomPadding","topPadding","description","heading","height","loading","accordionItems","item"],"mappings":";;AASO,MAAMA,2BAAAA,GAA8B,OACzCC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GAAGG,IAAAA,CAAKH,QAAQ,CAACyB,GAAG,CAACvB,WAAAA,CAAAA;AACpC,QAAA;QAEA,IAAIC,IAAAA,CAAKE,MAAM,EAAEkC,cAAAA,IAAkBnB,KAAAA,CAAMC,OAAO,CAAClB,IAAAA,CAAKE,MAAM,CAACkC,cAAc,CAAA,EAAG;YAC5EpC,IAAAA,CAAKE,MAAM,CAACkC,cAAc,GAAGpC,IAAAA,CAAKE,MAAM,CAACkC,cAAc,CAACd,GAAG,CAAC,CAACe,IAAAA,GAAAA;AAC3D,gBAAA,IAAIA,IAAAA,CAAK5C,OAAO,EAAEG,IAAAA,EAAMC,QAAAA,EAAU;AAChCwC,oBAAAA,IAAAA,CAAK5C,OAAO,CAACG,IAAI,CAACC,QAAQ,GAAGwC,IAAAA,CAAK5C,OAAO,CAACG,IAAI,CAACC,QAAQ,CAACyB,GAAG,CAACvB,WAAAA,CAAAA;AAC9D,gBAAA;gBACA,OAAOsC,IAAAA;AACT,YAAA,CAAA,CAAA;AACF,QAAA;QAEA,OAAOrC,IAAAA;AACT,IAAA,CAAA;AAEA,IAAA,IAAIP,OAAAA,CAAQG,IAAI,CAACC,QAAQ,IAAIoB,KAAAA,CAAMC,OAAO,CAACzB,OAAAA,CAAQG,IAAI,CAACC,QAAQ,CAAA,EAAG;QACjEJ,OAAAA,CAAQG,IAAI,CAACC,QAAQ,GAAGJ,OAAAA,CAAQG,IAAI,CAACC,QAAQ,CAACyB,GAAG,CAACvB,WAAAA,CAAAA;AACpD,IAAA;IAEA,OAAON,OAAAA;AACT;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Field mapping engine: apply WordPress-to-Payload field mappings with relationship ID conversion. */
|
|
2
|
+
import type { Payload } from 'payload';
|
|
3
|
+
import type { FieldMappingConfig, WordPressItem } from '../types.js';
|
|
4
|
+
export declare const shouldImportFeaturedImage: (fieldMapping: FieldMappingConfig | string | undefined) => null | string;
|
|
5
|
+
export declare const convertWordPressRelationshipIds: (wpIds: number[], collectionType: "categories" | "tags" | "users", payload: Payload) => Promise<{
|
|
6
|
+
convertedIds: number[];
|
|
7
|
+
missingIds: number[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare const applyFieldMapping: (payloadData: Record<string, unknown>, wpItem: WordPressItem, fieldMapping: FieldMappingConfig | string | undefined, payload?: Payload) => Promise<Record<string, unknown>>;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { convertHtmlToLexical } from '../lexical/preprocessor.js';
|
|
2
|
+
import { createSafeLexicalRoot } from '../lexical/nodeFactories.js';
|
|
3
|
+
import { getNestedValue, setNestedValue } from '../helpers/objectHelpers.js';
|
|
4
|
+
|
|
5
|
+
const shouldImportFeaturedImage = (fieldMapping)=>{
|
|
6
|
+
if (!fieldMapping || typeof fieldMapping !== 'object') {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const mappings = typeof fieldMapping === 'string' ? JSON.parse(fieldMapping) : fieldMapping;
|
|
11
|
+
if (!mappings.fieldMappings || !Array.isArray(mappings.fieldMappings)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const featuredImageMapping = mappings.fieldMappings.find((mapping)=>mapping.sourceField === 'featured_media' && mapping.destinationField);
|
|
15
|
+
return featuredImageMapping ? featuredImageMapping.destinationField : null;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn('Error checking featured image mapping:', error);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const convertWordPressRelationshipIds = async (wpIds, collectionType, payload)=>{
|
|
22
|
+
if (!payload || !Array.isArray(wpIds) || wpIds.length === 0) {
|
|
23
|
+
return {
|
|
24
|
+
convertedIds: [],
|
|
25
|
+
missingIds: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const payloadItems = await payload.find({
|
|
30
|
+
collection: collectionType,
|
|
31
|
+
limit: wpIds.length || 100,
|
|
32
|
+
where: {
|
|
33
|
+
'migratedFromWordPress.wpPostId': {
|
|
34
|
+
in: wpIds
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const convertedIds = [];
|
|
39
|
+
const foundWpIds = new Set();
|
|
40
|
+
payloadItems.docs.forEach((item)=>{
|
|
41
|
+
const wpId = item.migratedFromWordPress?.wpPostId;
|
|
42
|
+
if (wpId && wpIds.includes(wpId)) {
|
|
43
|
+
convertedIds.push(item.id);
|
|
44
|
+
foundWpIds.add(wpId);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const missingIds = wpIds.filter((id)=>!foundWpIds.has(id));
|
|
48
|
+
if (missingIds.length > 0) {
|
|
49
|
+
console.warn(`WordPress ${collectionType} not found in PayloadCMS: [${missingIds.join(', ')}]. Migrate ${collectionType} before posts to preserve relationships.`);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
convertedIds,
|
|
53
|
+
missingIds
|
|
54
|
+
};
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(`Error converting WordPress ${collectionType} IDs:`, error);
|
|
57
|
+
return {
|
|
58
|
+
convertedIds: [],
|
|
59
|
+
missingIds: wpIds
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const applyFieldMapping = async (payloadData, wpItem, fieldMapping, payload)=>{
|
|
64
|
+
if (!fieldMapping || typeof fieldMapping !== 'object') {
|
|
65
|
+
return payloadData;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const mappings = typeof fieldMapping === 'string' ? JSON.parse(fieldMapping) : fieldMapping;
|
|
69
|
+
if (!mappings.fieldMappings || !Array.isArray(mappings.fieldMappings)) {
|
|
70
|
+
return payloadData;
|
|
71
|
+
}
|
|
72
|
+
const mappedData = {
|
|
73
|
+
...payloadData
|
|
74
|
+
};
|
|
75
|
+
for (const mapping of mappings.fieldMappings){
|
|
76
|
+
if (mapping.sourceField && mapping.destinationField) {
|
|
77
|
+
try {
|
|
78
|
+
// Skip featured_media if destination already has a value — the media auto-import
|
|
79
|
+
// pipeline (extractFeaturedMedia) runs before field mapping and has already
|
|
80
|
+
// resolved the WordPress media ID to a Payload media document reference.
|
|
81
|
+
if (mapping.sourceField === 'featured_media' && getNestedValue(mappedData, mapping.destinationField) !== undefined) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const wpValue = getNestedValue(wpItem, mapping.sourceField);
|
|
85
|
+
// Block raw WordPress `content.rendered` objects from being mapped to `content` —
|
|
86
|
+
// this would create a `{ rendered: "<html>..." }` structure inside the Lexical
|
|
87
|
+
// field instead of a proper Lexical root. The HTML-to-Lexical converter handles
|
|
88
|
+
// this correctly upstream; this guard prevents user-configured mappings from
|
|
89
|
+
// accidentally undoing that conversion.
|
|
90
|
+
if (mapping.destinationField === 'content' && mapping.sourceField === 'content' && typeof wpValue === 'object' && wpValue !== null && 'rendered' in wpValue) {
|
|
91
|
+
console.warn(`Skipping mapping that would create nested content structure: ${mapping.sourceField} -> ${mapping.destinationField}`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// Don't overwrite Lexical content that was already properly converted from HTML —
|
|
95
|
+
// a user's field mapping of `some_field -> content` would replace the structured
|
|
96
|
+
// Lexical tree with a raw string or object.
|
|
97
|
+
if (mapping.destinationField === 'content' && mappedData.content && typeof mappedData.content === 'object' && mappedData.content.root && mappedData.content.root?.type === 'root') {
|
|
98
|
+
console.warn(`Skipping field mapping ${mapping.sourceField} -> content because properly converted Lexical content already exists`);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (mapping.destinationField === 'content') {
|
|
102
|
+
console.warn(`Field mapping to content detected: ${mapping.sourceField} -> ${mapping.destinationField}`, 'Value type:', typeof wpValue, 'Value preview:', JSON.stringify(wpValue).substring(0, 100));
|
|
103
|
+
if (mappedData.content !== undefined) {
|
|
104
|
+
console.warn(`This mapping will OVERWRITE existing content! Current content type: ${typeof mappedData.content}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (wpValue !== undefined) {
|
|
108
|
+
if (mapping.destinationField === 'email') {
|
|
109
|
+
if (!wpValue || typeof wpValue === 'string' && wpValue.trim().length === 0) {
|
|
110
|
+
console.warn(`Skipping email mapping for item ${wpItem.id} - empty/invalid value: "${wpValue}"`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (mapping.sourceField === 'featured_media' && wpValue === 0) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (mapping.destinationField === 'categories' && Array.isArray(wpValue) && wpValue.length > 0) {
|
|
118
|
+
if (payload) {
|
|
119
|
+
const { convertedIds: convertedCategoryIds, missingIds: missingCategoryIds } = await convertWordPressRelationshipIds(wpValue, 'categories', payload);
|
|
120
|
+
if (convertedCategoryIds.length > 0) {
|
|
121
|
+
setNestedValue(mappedData, mapping.destinationField, convertedCategoryIds);
|
|
122
|
+
}
|
|
123
|
+
if (missingCategoryIds.length > 0) {
|
|
124
|
+
console.warn(`No PayloadCMS categories found for WordPress IDs [${missingCategoryIds.join(', ')}]. Migrate categories first.`);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
console.warn(`Cannot convert categories - payload instance not available`);
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (mapping.destinationField === 'tags' && Array.isArray(wpValue) && wpValue.length > 0) {
|
|
132
|
+
if (payload) {
|
|
133
|
+
const { convertedIds: convertedTagIds, missingIds: missingTagIds } = await convertWordPressRelationshipIds(wpValue, 'tags', payload);
|
|
134
|
+
if (convertedTagIds.length > 0) {
|
|
135
|
+
setNestedValue(mappedData, mapping.destinationField, convertedTagIds);
|
|
136
|
+
}
|
|
137
|
+
if (missingTagIds.length > 0) {
|
|
138
|
+
console.warn(`No PayloadCMS tags found for WordPress IDs [${missingTagIds.join(', ')}]. Migrate tags first.`);
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
console.warn(`Cannot convert tags - payload instance not available`);
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if ((mapping.destinationField === 'authors' || mapping.destinationField === 'author') && wpValue) {
|
|
146
|
+
const userIds = Array.isArray(wpValue) ? wpValue : [
|
|
147
|
+
wpValue
|
|
148
|
+
];
|
|
149
|
+
if (payload) {
|
|
150
|
+
const { convertedIds: convertedUserIds, missingIds: missingUserIds } = await convertWordPressRelationshipIds(userIds, 'users', payload);
|
|
151
|
+
if (convertedUserIds.length > 0) {
|
|
152
|
+
const finalValue = Array.isArray(wpValue) ? convertedUserIds : convertedUserIds[0];
|
|
153
|
+
setNestedValue(mappedData, mapping.destinationField, finalValue);
|
|
154
|
+
}
|
|
155
|
+
if (missingUserIds.length > 0) {
|
|
156
|
+
console.warn(`No PayloadCMS users found for WordPress IDs [${missingUserIds.join(', ')}]. Migrate users first.`);
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
console.warn(`Cannot convert users - payload instance not available`);
|
|
160
|
+
}
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (mapping.destinationField === 'content' && typeof wpValue === 'string') {
|
|
164
|
+
if (wpValue.trim().length === 0) {
|
|
165
|
+
const safeRoot = createSafeLexicalRoot();
|
|
166
|
+
mappedData[mapping.destinationField] = safeRoot;
|
|
167
|
+
} else if (wpValue.includes('<') && wpValue.includes('>')) {
|
|
168
|
+
const converted = convertHtmlToLexical(wpValue);
|
|
169
|
+
mappedData[mapping.destinationField] = converted;
|
|
170
|
+
} else {
|
|
171
|
+
mappedData[mapping.destinationField] = {
|
|
172
|
+
root: {
|
|
173
|
+
type: 'root',
|
|
174
|
+
children: [
|
|
175
|
+
{
|
|
176
|
+
type: 'paragraph',
|
|
177
|
+
children: [
|
|
178
|
+
{
|
|
179
|
+
type: 'text',
|
|
180
|
+
detail: 0,
|
|
181
|
+
format: 0,
|
|
182
|
+
mode: 'normal',
|
|
183
|
+
style: '',
|
|
184
|
+
text: wpValue,
|
|
185
|
+
version: 1
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
direction: 'ltr',
|
|
189
|
+
format: '',
|
|
190
|
+
indent: 0,
|
|
191
|
+
version: 1
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
direction: 'ltr',
|
|
195
|
+
format: '',
|
|
196
|
+
indent: 0,
|
|
197
|
+
version: 1
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
setNestedValue(mappedData, mapping.destinationField, wpValue);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.warn(`Error applying field mapping ${mapping.sourceField} -> ${mapping.destinationField}:`, error);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return mappedData;
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.warn('Error applying field mapping:', error);
|
|
213
|
+
return payloadData;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export { applyFieldMapping, convertWordPressRelationshipIds, shouldImportFeaturedImage };
|
|
218
|
+
//# sourceMappingURL=fieldMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldMapping.js","sources":["../../../src/utils/content/fieldMapping.ts"],"sourcesContent":["/** Field mapping engine: apply WordPress-to-Payload field mappings with relationship ID conversion. */\n\nimport type { Payload } from 'payload'\n\nimport type { FieldMappingConfig, WordPressItem } from '../types.js'\n\nimport { convertHtmlToLexical } from '../lexical/preprocessor.js'\nimport { createSafeLexicalRoot } from '../lexical/nodeFactories.js'\nimport { getNestedValue, setNestedValue } from '../helpers/objectHelpers.js'\n\nexport const shouldImportFeaturedImage = (fieldMapping: FieldMappingConfig | string | undefined): null | string => {\n if (!fieldMapping || typeof fieldMapping !== 'object') {\n return null\n }\n\n try {\n const mappings = typeof fieldMapping === 'string' ? JSON.parse(fieldMapping) : fieldMapping\n\n if (!mappings.fieldMappings || !Array.isArray(mappings.fieldMappings)) {\n return null\n }\n\n const featuredImageMapping = mappings.fieldMappings.find(\n (mapping: any) => mapping.sourceField === 'featured_media' && mapping.destinationField,\n )\n\n return featuredImageMapping ? featuredImageMapping.destinationField : null\n } catch (error) {\n console.warn('Error checking featured image mapping:', error)\n return null\n }\n}\n\nexport const convertWordPressRelationshipIds = async (\n wpIds: number[],\n collectionType: 'categories' | 'tags' | 'users',\n payload: Payload,\n): Promise<{ convertedIds: number[]; missingIds: number[] }> => {\n if (!payload || !Array.isArray(wpIds) || wpIds.length === 0) {\n return { convertedIds: [], missingIds: [] }\n }\n\n try {\n const payloadItems = await payload.find({\n collection: collectionType,\n limit: wpIds.length || 100,\n where: {\n 'migratedFromWordPress.wpPostId': {\n in: wpIds,\n },\n },\n })\n\n const convertedIds: number[] = []\n const foundWpIds = new Set()\n\n payloadItems.docs.forEach((item: any) => {\n const wpId = item.migratedFromWordPress?.wpPostId\n if (wpId && wpIds.includes(wpId)) {\n convertedIds.push(item.id)\n foundWpIds.add(wpId)\n }\n })\n\n const missingIds = wpIds.filter((id) => !foundWpIds.has(id))\n if (missingIds.length > 0) {\n console.warn(\n `WordPress ${collectionType} not found in PayloadCMS: [${missingIds.join(', ')}]. Migrate ${collectionType} before posts to preserve relationships.`,\n )\n }\n\n return { convertedIds, missingIds }\n } catch (error) {\n console.error(`Error converting WordPress ${collectionType} IDs:`, error)\n return { convertedIds: [], missingIds: wpIds }\n }\n}\n\nexport const applyFieldMapping = async (\n payloadData: Record<string, unknown>,\n wpItem: WordPressItem,\n fieldMapping: FieldMappingConfig | string | undefined,\n payload?: Payload,\n) => {\n if (!fieldMapping || typeof fieldMapping !== 'object') {\n return payloadData\n }\n\n try {\n const mappings = typeof fieldMapping === 'string' ? JSON.parse(fieldMapping) : fieldMapping\n\n if (!mappings.fieldMappings || !Array.isArray(mappings.fieldMappings)) {\n return payloadData\n }\n\n const mappedData = { ...payloadData }\n\n for (const mapping of mappings.fieldMappings) {\n if (mapping.sourceField && mapping.destinationField) {\n try {\n // Skip featured_media if destination already has a value — the media auto-import\n // pipeline (extractFeaturedMedia) runs before field mapping and has already\n // resolved the WordPress media ID to a Payload media document reference.\n if (\n mapping.sourceField === 'featured_media' &&\n getNestedValue(mappedData, mapping.destinationField) !== undefined\n ) {\n continue\n }\n\n const wpValue = getNestedValue(wpItem, mapping.sourceField)\n\n // Block raw WordPress `content.rendered` objects from being mapped to `content` —\n // this would create a `{ rendered: \"<html>...\" }` structure inside the Lexical\n // field instead of a proper Lexical root. The HTML-to-Lexical converter handles\n // this correctly upstream; this guard prevents user-configured mappings from\n // accidentally undoing that conversion.\n if (\n mapping.destinationField === 'content' &&\n mapping.sourceField === 'content' &&\n typeof wpValue === 'object' &&\n wpValue !== null &&\n 'rendered' in wpValue\n ) {\n console.warn(\n `Skipping mapping that would create nested content structure: ${mapping.sourceField} -> ${mapping.destinationField}`,\n )\n continue\n }\n\n // Don't overwrite Lexical content that was already properly converted from HTML —\n // a user's field mapping of `some_field -> content` would replace the structured\n // Lexical tree with a raw string or object.\n if (\n mapping.destinationField === 'content' &&\n mappedData.content &&\n typeof mappedData.content === 'object' &&\n (mappedData.content as Record<string, unknown>).root &&\n ((mappedData.content as Record<string, unknown>).root as Record<string, unknown>)?.type === 'root'\n ) {\n console.warn(\n `Skipping field mapping ${mapping.sourceField} -> content because properly converted Lexical content already exists`,\n )\n continue\n }\n\n if (mapping.destinationField === 'content') {\n console.warn(\n `Field mapping to content detected: ${mapping.sourceField} -> ${mapping.destinationField}`,\n 'Value type:',\n typeof wpValue,\n 'Value preview:',\n JSON.stringify(wpValue).substring(0, 100),\n )\n\n if (mappedData.content !== undefined) {\n console.warn(\n `This mapping will OVERWRITE existing content! Current content type: ${typeof mappedData.content}`,\n )\n }\n }\n\n if (wpValue !== undefined) {\n if (mapping.destinationField === 'email') {\n if (!wpValue || (typeof wpValue === 'string' && wpValue.trim().length === 0)) {\n console.warn(\n `Skipping email mapping for item ${wpItem.id} - empty/invalid value: \"${wpValue}\"`,\n )\n continue\n }\n }\n\n if (mapping.sourceField === 'featured_media' && wpValue === 0) {\n continue\n }\n\n if (\n mapping.destinationField === 'categories' &&\n Array.isArray(wpValue) &&\n wpValue.length > 0\n ) {\n if (payload) {\n const { convertedIds: convertedCategoryIds, missingIds: missingCategoryIds } = await convertWordPressRelationshipIds(\n wpValue,\n 'categories',\n payload,\n )\n if (convertedCategoryIds.length > 0) {\n setNestedValue(mappedData, mapping.destinationField, convertedCategoryIds)\n }\n if (missingCategoryIds.length > 0) {\n console.warn(\n `No PayloadCMS categories found for WordPress IDs [${missingCategoryIds.join(', ')}]. Migrate categories first.`,\n )\n }\n } else {\n console.warn(`Cannot convert categories - payload instance not available`)\n }\n continue\n }\n\n if (\n mapping.destinationField === 'tags' &&\n Array.isArray(wpValue) &&\n wpValue.length > 0\n ) {\n if (payload) {\n const { convertedIds: convertedTagIds, missingIds: missingTagIds } = await convertWordPressRelationshipIds(\n wpValue,\n 'tags',\n payload,\n )\n if (convertedTagIds.length > 0) {\n setNestedValue(mappedData, mapping.destinationField, convertedTagIds)\n }\n if (missingTagIds.length > 0) {\n console.warn(\n `No PayloadCMS tags found for WordPress IDs [${missingTagIds.join(', ')}]. Migrate tags first.`,\n )\n }\n } else {\n console.warn(`Cannot convert tags - payload instance not available`)\n }\n continue\n }\n\n if (\n (mapping.destinationField === 'authors' || mapping.destinationField === 'author') &&\n wpValue\n ) {\n const userIds = Array.isArray(wpValue) ? wpValue : [wpValue]\n\n if (payload) {\n const { convertedIds: convertedUserIds, missingIds: missingUserIds } = await convertWordPressRelationshipIds(\n userIds,\n 'users',\n payload,\n )\n if (convertedUserIds.length > 0) {\n const finalValue = Array.isArray(wpValue) ? convertedUserIds : convertedUserIds[0]\n setNestedValue(mappedData, mapping.destinationField, finalValue)\n }\n if (missingUserIds.length > 0) {\n console.warn(\n `No PayloadCMS users found for WordPress IDs [${missingUserIds.join(', ')}]. Migrate users first.`,\n )\n }\n } else {\n console.warn(`Cannot convert users - payload instance not available`)\n }\n continue\n }\n\n if (mapping.destinationField === 'content' && typeof wpValue === 'string') {\n if (wpValue.trim().length === 0) {\n const safeRoot = createSafeLexicalRoot()\n mappedData[mapping.destinationField] = safeRoot\n } else if (wpValue.includes('<') && wpValue.includes('>')) {\n const converted = convertHtmlToLexical(wpValue)\n mappedData[mapping.destinationField] = converted\n } else {\n mappedData[mapping.destinationField] = {\n root: {\n type: 'root',\n children: [\n {\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text: wpValue,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n }\n } else {\n setNestedValue(mappedData, mapping.destinationField, wpValue)\n }\n }\n } catch (error) {\n console.warn(\n `Error applying field mapping ${mapping.sourceField} -> ${mapping.destinationField}:`,\n error,\n )\n }\n }\n }\n\n return mappedData\n } catch (error) {\n console.warn('Error applying field mapping:', error)\n return payloadData\n }\n}\n"],"names":["shouldImportFeaturedImage","fieldMapping","mappings","JSON","parse","fieldMappings","Array","isArray","featuredImageMapping","find","mapping","sourceField","destinationField","error","console","warn","convertWordPressRelationshipIds","wpIds","collectionType","payload","length","convertedIds","missingIds","payloadItems","collection","limit","where","in","foundWpIds","Set","docs","forEach","item","wpId","migratedFromWordPress","wpPostId","includes","push","id","add","filter","has","join","applyFieldMapping","payloadData","wpItem","mappedData","getNestedValue","undefined","wpValue","content","root","type","stringify","substring","trim","convertedCategoryIds","missingCategoryIds","setNestedValue","convertedTagIds","missingTagIds","userIds","convertedUserIds","missingUserIds","finalValue","safeRoot","createSafeLexicalRoot","converted","convertHtmlToLexical","children","detail","format","mode","style","text","version","direction","indent"],"mappings":";;;;AAUO,MAAMA,4BAA4B,CAACC,YAAAA,GAAAA;AACxC,IAAA,IAAI,CAACA,YAAAA,IA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AAAA,EAAS;AACX;AACD,yCAAA;wCACDC,SAAAA,EAAW,KAAA;wCACXL,MAAAA,EAAQ,EAAA;wCACRM,MAAAA,EAAQ,CAAA;wCACRF,OAAAA,EAAS;AACX;AACF,iCAAA;AACF,4BAAA;wBACF,CAAA,MAAO;4BACLjB,cAAAA,CAAeZ,UAAAA,EAAYpC,OAAAA,CAAQE,gBAAgB,EAAEqC,OAAAA,CAAAA;AACvD,wBAAA;AACF,oBAAA;AACF,gBAAA,CAAA,CAAE,OAAOpC,KAAAA,EAAO;AACdC,oBAAAA,OAAAA,CAAQC,IAAI,CACV,CAAC,6BAA6B,EAAEL,OAAAA,CAAQC,WAAW,CAAC,IAAI,EAAED,OAAAA,CAAQE,gBAAgB,CAAC,CAAC,CAAC,EACrFC,KAAAA,CAAAA;AAEJ,gBAAA;AACF,YAAA;AACF,QAAA;QAEA,OAAOiC,UAAAA;AACT,IAAA,CAAA,CAAE,OAAOjC,KAAAA,EAAO;QACdC,OAAAA,CAAQC,IAAI,CAAC,+BAAA,EAAiCF,KAAAA,CAAAA;QAC9C,OAAO+B,WAAAA;AACT,IAAA;AACF;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Barrel re-export of all content transformation modules. */
|
|
2
|
+
export { processMediaBlocksInContent, validateAndEnhanceBlocks } from './blocks.js';
|
|
3
|
+
export { applyFieldMapping, convertWordPressRelationshipIds, shouldImportFeaturedImage } from './fieldMapping.js';
|
|
4
|
+
export { transformWordPressContent } from './transformer.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { processMediaBlocksInContent, validateAndEnhanceBlocks } from './blocks.js';
|
|
2
|
+
export { applyFieldMapping, convertWordPressRelationshipIds, shouldImportFeaturedImage } from './fieldMapping.js';
|
|
3
|
+
export { transformWordPressContent } from './transformer.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Transform WordPress content items to PayloadCMS format by content type. */
|
|
2
|
+
import type { Payload } from 'payload';
|
|
3
|
+
import type { PayloadWordPressMigratorConfig } from '../../index.js';
|
|
4
|
+
import type { JobConfiguration, MediaUploadResult, RegularContentResult, WordPressClientConfig, WordPressItem } from '../types.js';
|
|
5
|
+
export declare const transformWordPressContent: (wpItem: WordPressItem, contentType: string, configuration: JobConfiguration | undefined, payload?: Payload, pluginOptions?: PayloadWordPressMigratorConfig, wpClient?: WordPressClientConfig) => Promise<MediaUploadResult | RegularContentResult>;
|