Skip to content

Commit ff3bd8e

Browse files
authored
Merge pull request #1019 from contentstack/feature/wordpress
Feature/wordpress
2 parents e909b51 + 1b1e46f commit ff3bd8e

12 files changed

Lines changed: 4811 additions & 2705 deletions

File tree

api/package-lock.json

Lines changed: 3555 additions & 1409 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@
5959
"php-serialize": "^5.1.3",
6060
"socket.io": "^4.7.5",
6161
"uuid": "^9.0.1",
62-
"winston": "^3.11.0"
62+
"winston": "^3.11.0",
63+
"@emnapi/core": "1.9.1",
64+
"@emnapi/runtime" : "1.9.1",
65+
"@emnapi/wasi-threads": "1.2.0"
6366
},
6467
"devDependencies": {
6568
"@types/cors": "^2.8.17",
@@ -95,7 +98,8 @@
9598
"glob": ">=11.1.0",
9699
"rollup": ">=4.59.0",
97100
"tar": ">=7.5.8",
98-
"@tootallnate/once": ">=3.0.1"
101+
"@tootallnate/once": ">=3.0.1",
102+
"undici": ">=7.24.0"
99103
},
100104
"keywords": []
101105
}

package-lock.json

Lines changed: 474 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package-lock.json

Lines changed: 517 additions & 1029 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"@contentstack/json-rte-serializer": "^3.0.5",
7-
"@contentstack/venus-components": "^3.0.3",
7+
"@contentstack/venus-components": "^3.0.4",
88
"@reduxjs/toolkit": "^2.8.2",
99
"@types/react": "^18.3.21",
1010
"@types/react-dom": "^18.2.13",
@@ -43,6 +43,7 @@
4343
"coverage:ui": "npx serve coverage -l 3939"
4444
},
4545
"devDependencies": {
46+
"@testing-library/dom": "^10.4.0",
4647
"@testing-library/jest-dom": "^6.9.1",
4748
"@testing-library/react": "^16.3.2",
4849
"@testing-library/user-event": "^14.6.1",

ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ const FileComponent = ( { fileDetails, fileFormatId }: Props ) =>
5757
<div>
5858
{ isSQL ? (
5959
// ✅ SQL format (from legacyCms.json allowed_file_formats): show MySQL details
60-
fileDetails?.mySQLDetails && (
60+
fileDetails?.mysql && (
6161
<div>
62-
<p className="pb-2">Host: { fileDetails?.mySQLDetails?.host }</p>
63-
<p className="pb-2">Database: { fileDetails?.mySQLDetails?.database }</p>
64-
<p className="pb-2">User: { fileDetails?.mySQLDetails?.user }</p>
62+
<p className="pb-2">Host: { fileDetails?.mysql?.host }</p>
63+
<p className="pb-2">Database: { fileDetails?.mysql?.database }</p>
64+
<p className="pb-2">User: { fileDetails?.mysql?.user }</p>
6565
</div>
6666
)
6767
) : fileDetails?.isLocalPath ? (
@@ -176,11 +176,11 @@ const LoadUploadFile = ( props: LoadUploadFileProps ) =>
176176
bucketName: responseFileDetails?.awsData?.bucketName,
177177
bucketKey: responseFileDetails?.awsData?.bucketKey
178178
},
179-
mySQLDetails: {
180-
host: responseFileDetails?.mySQLDetails?.host,
181-
user: responseFileDetails?.mySQLDetails?.user,
182-
database: responseFileDetails?.mySQLDetails?.database,
183-
port: responseFileDetails?.mySQLDetails?.port
179+
mysql: {
180+
host: responseFileDetails?.mysql?.host,
181+
user: responseFileDetails?.mysql?.user,
182+
database: responseFileDetails?.mysql?.database,
183+
port: responseFileDetails?.mysql?.port
184184
},
185185
assetsConfig: {
186186
base_url: responseFileDetails?.assetsConfig?.base_url,
@@ -206,7 +206,7 @@ const LoadUploadFile = ( props: LoadUploadFileProps ) =>
206206

207207
// Update the ref immediately before dispatching to avoid stale data in subsequent operations
208208
newMigrationDataRef.current = newMigrationDataObj;
209-
dispatch( updateNewMigrationData( newMigrationDataObj ) );
209+
210210

211211
// Derive SQL check from selectedFileFormat (data-driven via legacyCms.json)
212212
const currentFormatId = newMigrationDataObj?.legacy_cms?.selectedFileFormat?.fileformat_id?.toLowerCase();
@@ -295,6 +295,7 @@ const LoadUploadFile = ( props: LoadUploadFileProps ) =>
295295
setProcessing( 'Processing...100%' );
296296

297297
await new Promise( ( resolve ) => setTimeout( resolve, 1000 ) );
298+
dispatch( updateNewMigrationData( newMigrationDataObj ) );
298299

299300
setTimeout( () =>
300301
{
@@ -437,24 +438,11 @@ const LoadUploadFile = ( props: LoadUploadFileProps ) =>
437438
}
438439
};
439440

440-
// Update fileDetails whenever Redux state changes
441-
useEffect( () =>
442-
{
443-
const latestFileDetails = newMigrationData?.legacy_cms?.uploadedFile?.file_details;
444-
445-
// Always update fileDetails from Redux, even if it's empty (to clear stale data)
446-
setFileDetails( latestFileDetails );
447-
448-
}, [ newMigrationData?.legacy_cms?.uploadedFile?.file_details ] );
449441

450442
useEffect( () =>
451443
{
452444
getConfigDetails();
453-
}, [
454-
// Re-run when selectedFileFormat or file_details change (e.g., after LoadSelectCms or fetchProjectData dispatches)
455-
newMigrationData?.legacy_cms?.selectedFileFormat?.fileformat_id,
456-
newMigrationData?.legacy_cms?.uploadedFile?.file_details?.localPath
457-
] );
445+
}, [] );
458446

459447
useEffect( () =>
460448
{

ui/src/context/app/app.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface FileDetails {
5656
bucketName?: string;
5757
bucketKey?: string;
5858
};
59-
mySQLDetails?: {
59+
mysql?: {
6060
host?: string;
6161
user?: string;
6262
database?: string;

ui/src/pages/Migration/index.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@ const Migration = () => {
275275
awsRegion: data?.awsData?.awsRegion,
276276
bucketName: data?.awsData?.bucketName,
277277
bucketKey: data?.awsData?.bucketKey
278+
},
279+
mysql: {
280+
host: data?.mysql?.host,
281+
user: data?.mysql?.user,
282+
database: data?.mysql?.database,
283+
port: data?.mysql?.port
284+
},
285+
assetsConfig: {
286+
base_url: data?.assetsConfig?.base_url,
287+
public_path: data?.assetsConfig?.public_path
278288
}
279289
},
280290
cmsType: data?.cmsType
@@ -382,7 +392,17 @@ const Migration = () => {
382392
bucketName: projectData?.legacy_cms?.awsDetails?.bucketName,
383393
bucketKey: projectData?.legacy_cms?.awsDetails?.bucketKey
384394
},
385-
isLocalPath: projectData?.legacy_cms?.is_localPath
395+
isLocalPath: projectData?.legacy_cms?.is_localPath,
396+
mysql: {
397+
host: projectData?.legacy_cms?.mySQLDetails?.host,
398+
user: projectData?.legacy_cms?.mySQLDetails?.user,
399+
database: projectData?.legacy_cms?.mySQLDetails?.database,
400+
port: projectData?.legacy_cms?.mySQLDetails?.port
401+
},
402+
assetsConfig: {
403+
base_url: projectData?.legacy_cms?.assetsConfig?.base_url,
404+
public_path: projectData?.legacy_cms?.assetsConfig?.public_path
405+
}
386406
},
387407
isValidated: projectData?.legacy_cms?.is_fileValid,
388408
reValidate: newMigrationData?.legacy_cms?.uploadedFile?.reValidate,
@@ -400,7 +420,17 @@ const Migration = () => {
400420
awsRegion: uploadObj?.file_details?.awsData?.awsRegion || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.awsData?.awsRegion,
401421
bucketName: uploadObj?.file_details?.awsData?.bucketName || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.awsData?.bucketName,
402422
bucketKey: uploadObj?.file_details?.awsData?.bucketKey || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.awsData?.bucketKey,
403-
}
423+
},
424+
mysql: {
425+
host: uploadObj?.file_details?.mysql?.host || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.mysql?.host,
426+
user: uploadObj?.file_details?.mysql?.user || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.mysql?.user,
427+
database: uploadObj?.file_details?.mysql?.database || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.mysql?.database,
428+
port: uploadObj?.file_details?.mysql?.port || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.mysql?.port,
429+
},
430+
assetsConfig: {
431+
base_url: uploadObj?.file_details?.assetsConfig?.base_url || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.assetsConfig?.base_url,
432+
public_path: uploadObj?.file_details?.assetsConfig?.public_path || newMigrationDataRef?.current?.legacy_cms?.uploadedFile?.file_details?.assetsConfig?.public_path,
433+
}
404434
}
405435
},
406436
isFileFormatCheckboxChecked: true,

ui/tests/unit/store/authSlice.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,19 @@ describe('store/slice/authSlice', () => {
174174
});
175175

176176
it('should reset state on error', async () => {
177+
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
177178
vi.mocked(getUser).mockRejectedValue(new Error('Network error'));
178179

179-
const store = createTestStore();
180-
store.dispatch(setAuthToken({ authToken: 'old-token', isAuthenticated: true }));
181-
await store.dispatch(getUserDetails());
180+
try {
181+
const store = createTestStore();
182+
store.dispatch(setAuthToken({ authToken: 'old-token', isAuthenticated: true }));
183+
await store.dispatch(getUserDetails());
182184

183-
const state = store.getState().authentication;
184-
expect(state.authToken).toBe('');
185+
const state = store.getState().authentication;
186+
expect(state.authToken).toBe('');
187+
} finally {
188+
consoleSpy.mockRestore();
189+
}
185190
});
186191
});
187192
});

upload-api/migration-aem/package-lock.json

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)