Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2d3a4c3
Enhance LoadSelectCms and LoadUploadFile components to preserve exist…
sauravraw Feb 13, 2026
e889613
Update package dependencies and remove unused packages across multipl…
sauravraw Feb 13, 2026
48a6cdd
Update package dependencies in package.json and package-lock.json. Up…
sauravraw Feb 13, 2026
cf4681d
Remove lodash dependency from package.json and refactor Migration com…
sauravraw Feb 13, 2026
fed0de2
Update jsonpath dependency to version 1.2.1 in package.json and packa…
sauravraw Feb 13, 2026
e67445a
Update package-lock.json files across multiple modules to upgrade var…
sauravraw Feb 13, 2026
14fdb27
Add new package-lock.json files for migration modules including AEM, …
sauravraw Feb 13, 2026
f49711d
Update package-lock.json files to mark several dependencies as develo…
sauravraw Feb 13, 2026
d72dc0e
Refactor migration modules by removing Contentful and Sitecore packag…
sauravraw Feb 13, 2026
c9187b7
Remove unused TypeScript type definitions from package.json and packa…
sauravraw Feb 13, 2026
630c89f
Update package dependencies across multiple modules, including upgrad…
sauravraw Feb 13, 2026
6d7677e
Update package-lock.json and package.json to remove the deprecated 'g…
sauravraw Feb 13, 2026
dcacb24
Remove 'tar' dependency from package.json overrides to streamline dep…
sauravraw Feb 13, 2026
65b220b
Update package.json and package-lock.json to remove the 'diff' depend…
sauravraw Feb 13, 2026
d49d103
Remove 'jsonpath' dependency from package.json and package-lock.json …
sauravraw Feb 13, 2026
d25d7e6
Update package.json and package-lock.json to add 'qs' dependency at v…
sauravraw Feb 13, 2026
0f8b2a5
Update package.json and package-lock.json in both UI and upload-api t…
sauravraw Feb 16, 2026
eecdcab
Update package-lock.json to include resolved URLs and integrity hashe…
sauravraw Feb 16, 2026
f3c9fed
Update package.json and package-lock.json to upgrade ESLint and relat…
sauravraw Feb 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,923 changes: 276 additions & 1,647 deletions api/package-lock.json

Large diffs are not rendered by default.

16 changes: 5 additions & 11 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@
"fs-readdir-recursive": "^1.1.0",
"helmet": "^8.0.0",
"html-to-json-parser": "^2.0.1",
"http": "^0.0.1-security",
"js-yaml": "^4.1.1",
"jsdom": "^24.1.0",
"jsonpath": "^1.2.0",
"jsonwebtoken": "^9.0.3",
"lodash": "^4.17.21",
"lowdb": "^7.0.1",
"mkdirp": "^3.0.1",
"mysql2": "^3.16.2",
"p-limit": "^6.2.0",
"path-to-regexp": "^8.2.0",
"php-serialize": "^5.1.3",
"router": "^2.0.0",
"shelljs": "^0.9.0",
"socket.io": "^4.7.5",
"uuid": "^9.0.1",
"winston": "^3.11.0"
Expand All @@ -64,22 +59,21 @@
"@types/fs-extra": "^11.0.4",
"@types/fs-readdir-recursive": "^1.1.3",
"@types/jsdom": "^21.1.7",
"@types/jsonpath": "^0.2.4",
"@types/jsonwebtoken": "^9.0.5",
"@types/lodash": "^4.17.0",
"@types/mkdirp": "^2.0.0",
"@types/node": "^20.10.4",
"@types/shelljs": "^0.8.15",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.0",
"eslint-config-prettier": "^8.3.0",
"lodash": "^4.17.21",
"prettier": "^2.4.1",
"tsx": "^4.7.1",
"typescript": "^5.4.3"
},
"overrides": {
"qs": ">=6.14.2",
"tmp": ">=0.2.4"
},
"keywords": []
}
43 changes: 32 additions & 11 deletions api/src/services/contentful.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import path from "path";
import { v4 as uuidv4 } from "uuid";
import _ from "lodash";
import axios from "axios";
import jsonpath from "jsonpath";
import pLimit from 'p-limit';
import { JSDOM } from "jsdom";
import { jsonToHtml, jsonToMarkdown, htmlToJson } from '@contentstack/json-rte-serializer';
Expand Down Expand Up @@ -368,23 +367,45 @@ const cleanBrackets = (lang_value: any) => {
};

// Helper function to process arrays and resolve IDs for entries and assets
// Replaces jsonpath.query(array, "$..id") with direct item-level processing
// (following the same pattern as Team Fury's processField for arrays)
const processArrayFields = (array: any, entryId: any, assetId: any) => {
const ids = jsonpath.query(array, "$..id");
ids.forEach((id: any, i: number) => {
if (id in entryId) {
array.splice(i, 1, entryId[id]);
} else if (id in assetId) {
array.splice(i, 1, assetId?.[id]);
// Handle primitive arrays directly (strings, numbers, booleans)
if (array.every((item: any) => typeof item !== 'object' || item === null)) {
return array;
}

const processedArray = array.reduce((acc: any[], item: any) => {
if (item?.sys?.id) {
// Handle Contentful system links (Entry or Asset references)
const { linkType, id } = item.sys;
if (linkType === 'Entry' && id in entryId) {
acc.push(entryId[id]);
} else if (linkType === 'Asset' && id in assetId) {
acc.push(assetId[id]);
} else {
// Keep unresolved references intact — the import process has a
// separate reference update step that resolves these later.
acc.push(item);
}
} else if (item !== null && typeof item === 'object') {
// Keep non-reference objects as-is (nested objects, RTE fragments, etc.)
acc.push(item);
} else if (item !== null && item !== undefined) {
// Keep primitive values (strings, numbers, booleans)
acc.push(item);
}
});
// Clean up empty objects
const cleanedArray = JSON.stringify(array)
return acc;
}, []);

// Clean up empty objects (matches original cleanup behavior)
const cleanedArray = JSON.stringify(processedArray)
.replace(/{},/g, "")
.replace(/,{}/g, "")
.replace(/,{},/g, "")
.replace(/{}/g, "");
const result = typeof cleanedArray === 'string' && JSON.parse(cleanedArray);
return result.length > 0 ? result : undefined;
return Array.isArray(result) && result.length > 0 ? result : undefined;
};

// Helper function to process Rich Text Editor (RTE) or nested object
Expand Down
Loading