Skip to content

Commit 3f30cf4

Browse files
committed
added new app
1 parent d5cb3b9 commit 3f30cf4

File tree

5 files changed

+310
-11
lines changed

5 files changed

+310
-11
lines changed

api/src/constants/app/index.json

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3429,6 +3429,239 @@
34293429
"environment": "blt0b5712e5b06ac8b6",
34303430
"locale": "en-us"
34313431
}
3432+
},
3433+
{
3434+
"uid": "bltd54177d2353a7558",
3435+
"_version": 7,
3436+
"locale": "en-us",
3437+
"ACL": {},
3438+
"_in_progress": false,
3439+
"app_type": [
3440+
{
3441+
"uid": "blte9d290b2e9e0931e",
3442+
"_content_type_uid": "app_types",
3443+
"title": "Stack App"
3444+
}
3445+
],
3446+
"app_uid": "6227528cd2485c001994d262",
3447+
"built_by": [
3448+
{
3449+
"_content_type_uid": "organizations",
3450+
"_version": 3,
3451+
"locale": "en-us",
3452+
"uid": "bltec929d731b1f9d85",
3453+
"ACL": {},
3454+
"_in_progress": false,
3455+
"accelerator": [],
3456+
"additional_info": "",
3457+
"app": [],
3458+
"automation": [],
3459+
"badges": [],
3460+
"collections": [],
3461+
"created_at": "2022-03-29T11:12:21.999Z",
3462+
"created_by": "blt89b5b90cb9e7c645",
3463+
"date": null,
3464+
"description": "Contentstack - Headless CMS",
3465+
"is_this_a_guide": false,
3466+
"linked_app": [],
3467+
"logo": {
3468+
"_version": 2,
3469+
"is_dir": false,
3470+
"uid": "bltd1599ef0db421778",
3471+
"ACL": {},
3472+
"content_type": "image/svg+xml",
3473+
"created_at": "2022-03-29T11:10:05.681Z",
3474+
"created_by": "blt89b5b90cb9e7c645",
3475+
"description": "",
3476+
"file_size": "3347",
3477+
"filename": "Logo.svg",
3478+
"parent_uid": null,
3479+
"tags": [],
3480+
"title": "Contentstack",
3481+
"updated_at": "2024-07-23T07:59:25.044Z",
3482+
"updated_by": "blt7314f6e631536c9d",
3483+
"publish_details": {
3484+
"environment": "blt0b5712e5b06ac8b6",
3485+
"locale": "en-us",
3486+
"time": "2024-07-23T08:16:12.228Z",
3487+
"user": "blt7314f6e631536c9d"
3488+
},
3489+
"url": "https://eu-images.contentstack.com/v3/assets/blt8f94ebff857fe1ae/bltd1599ef0db421778/669f62ddf2780933e9679fae/Logo.svg"
3490+
},
3491+
"metadata": {
3492+
"page_title": "",
3493+
"page_description": "",
3494+
"page_thumb": {
3495+
"_version": 3,
3496+
"is_dir": false,
3497+
"uid": "blt2af4c7391167e253",
3498+
"ACL": {},
3499+
"content_type": "image/webp",
3500+
"created_at": "2022-03-29T11:11:02.983Z",
3501+
"created_by": "blt89b5b90cb9e7c645",
3502+
"description": "",
3503+
"file_size": "73804",
3504+
"filename": "Cs_Marketplace.webp",
3505+
"parent_uid": "blt9dddaa4b9192231d",
3506+
"tags": [],
3507+
"title": "Marketplace_Hero.jpg",
3508+
"updated_at": "2024-06-19T12:55:48.327Z",
3509+
"updated_by": "bltb79b1c5ff2fe28ae",
3510+
"publish_details": {
3511+
"environment": "blt0b5712e5b06ac8b6",
3512+
"locale": "en-us",
3513+
"time": "2024-06-19T12:56:08.635Z",
3514+
"user": "bltb79b1c5ff2fe28ae"
3515+
},
3516+
"url": "https://eu-images.contentstack.com/v3/assets/blt8f94ebff857fe1ae/blt2af4c7391167e253/6672d5545c79863c672295ca/Cs_Marketplace.webp"
3517+
},
3518+
"twitter_title": "",
3519+
"twitter_description": "",
3520+
"opengraph_title": "",
3521+
"opengraph_description": "",
3522+
"canonical_url": "",
3523+
"json_ld": "",
3524+
"robots": ""
3525+
},
3526+
"partner_details": {
3527+
"categories": [],
3528+
"documentation_links": [],
3529+
"external_links": [],
3530+
"company_info": "",
3531+
"website": {
3532+
"title": "",
3533+
"href": ""
3534+
},
3535+
"location": [],
3536+
"headquarters": "",
3537+
"consultants": "",
3538+
"projects": "",
3539+
"cta": {
3540+
"title": "",
3541+
"link": ""
3542+
},
3543+
"services": "",
3544+
"use_cases": "",
3545+
"other_headlines": [],
3546+
"related_articles": [],
3547+
"video_section": {
3548+
"title": "",
3549+
"description": "",
3550+
"video_embed_code": ""
3551+
},
3552+
"download_cta": {
3553+
"title": "",
3554+
"href": ""
3555+
}
3556+
},
3557+
"partner_facets": [],
3558+
"starter": [],
3559+
"tags": [],
3560+
"title": "Contentstack",
3561+
"updated_at": "2024-12-11T11:41:35.586Z",
3562+
"updated_by": "blt05ac693470ad5ff7",
3563+
"url": "/contentstack",
3564+
"publish_details": {
3565+
"environment": "blt0b5712e5b06ac8b6",
3566+
"locale": "en-us",
3567+
"time": "2025-01-28T10:07:08.871Z",
3568+
"user": "blt05ac693470ad5ff7"
3569+
}
3570+
}
3571+
],
3572+
"category": [
3573+
{
3574+
"uid": "blte953c795ff59241c",
3575+
"_content_type_uid": "categories",
3576+
"title": "Development"
3577+
}
3578+
],
3579+
"coming_soon": false,
3580+
"created_at": "2022-03-29T11:13:00.640Z",
3581+
"created_by": "blt89b5b90cb9e7c645",
3582+
"description": "<p>To further enhance the business user experience, Contentstack provides prebuilt custom field extensions that let you extend the functionality of your custom fields to serve your unique business needs while providing a native Contentstack look and feel.</p><p>Using Contentstack Custom Fields, you can now input a JSON text into an entry field. With the JSON Editor custom field, you can view, edit and format JSON text, code, trees, etc. within your Contentstack entry.</p>",
3583+
"dynamic_links": [],
3584+
"feature_types": [
3585+
{
3586+
"feature_type": [
3587+
{
3588+
"uid": "blt6b35fa46f253a6bd",
3589+
"_content_type_uid": "app_features",
3590+
"title": "Custom Field"
3591+
}
3592+
],
3593+
"_metadata": {
3594+
"uid": "cs3b4ec101f90bd171"
3595+
},
3596+
"description": "While creating entries, you can add a JSON code."
3597+
}
3598+
],
3599+
"icon": {
3600+
"_version": 1,
3601+
"is_dir": false,
3602+
"uid": "blt38b2ab4ea0da2357",
3603+
"ACL": {},
3604+
"content_type": "image/svg+xml",
3605+
"created_at": "2022-03-29T11:09:08.207Z",
3606+
"created_by": "blt89b5b90cb9e7c645",
3607+
"file_size": "6981",
3608+
"filename": "json-editor.svg",
3609+
"parent_uid": "blt2eb26851df9c0e2e",
3610+
"tags": [],
3611+
"title": "json-editor.svg",
3612+
"updated_at": "2022-03-29T11:09:08.207Z",
3613+
"updated_by": "blt89b5b90cb9e7c645",
3614+
"publish_details": {
3615+
"environment": "blt0b5712e5b06ac8b6",
3616+
"locale": "en-us",
3617+
"time": "2025-01-28T10:07:08.871Z",
3618+
"user": "blt05ac693470ad5ff7"
3619+
},
3620+
"url": "https://eu-images.contentstack.com/v3/assets/blt8f94ebff857fe1ae/blt38b2ab4ea0da2357/6242e8d49eb79b7d7303c4bd/json-editor.svg"
3621+
},
3622+
"installation_url": "#!/apps/6227528cd2485c001994d262/install",
3623+
"links": {
3624+
"source_code": "",
3625+
"documentation": "",
3626+
"others": [],
3627+
"end_user_license_agreement": "https://www.contentstack.com/legal/eula-for-contentstack-proprietary-marketplace-apps/"
3628+
},
3629+
"seo": {
3630+
"canonical_url": "",
3631+
"description": "",
3632+
"image": null,
3633+
"robots": "",
3634+
"title": ""
3635+
},
3636+
"static_links": [
3637+
{
3638+
"type": "Documentation",
3639+
"url": "https://www.contentstack.com/docs/developers/marketplace-apps/json-editor/",
3640+
"_metadata": {
3641+
"uid": "csda257d0ac99cc671"
3642+
}
3643+
},
3644+
{
3645+
"type": "End-User License Agreement",
3646+
"url": "https://www.contentstack.com/legal/eula-for-contentstack-proprietary-marketplace-apps/",
3647+
"_metadata": {
3648+
"uid": "cs920e968d62d4580b"
3649+
}
3650+
}
3651+
],
3652+
"summary": "Enables users to view, edit, and format input data in JSON.",
3653+
"tags": [],
3654+
"title": "JSON Editor",
3655+
"updated_at": "2025-01-24T11:19:14.626Z",
3656+
"updated_by": "blt05ac693470ad5ff7",
3657+
"url": "/marketplace/json-editor",
3658+
"use_cases": "<p><strong>Easy To Interpret:</strong> The JSON editor locates errors instantly, eliminating the need to locate errors within the entire code. In addition, it provides multiple view options like code, text, tree to name a few.</p><p><strong>Validation made simple: </strong>You can validate and check for any necessary fixes in just a few seconds. In addition, because JSON does not have many elements like XML, you can even practice your coding and see the results instantly.</p>",
3659+
"publish_details": {
3660+
"time": "2025-01-28T10:55:14.197Z",
3661+
"user": "blt05ac693470ad5ff7",
3662+
"environment": "blt0b5712e5b06ac8b6",
3663+
"locale": "en-us"
3664+
}
34323665
}
34333666
],
34343667
"count": 11

api/src/services/contentful.service.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,21 @@ async function writeFile(dirPath: string, filename: string, data: any) {
180180
console.error('Error writing ${dirPath}/${filename}::', err);
181181
}
182182
}
183-
const damApp = (type: string, data: any) => {
183+
184+
function convertToArray(data: any) {
185+
if (typeof data === 'object' && data !== null && !Array.isArray(data)) {
186+
return [data]// Converts object values into an array
187+
}
188+
return data; // Return as is if it's already an array or not an object
189+
}
190+
191+
const mktApp = (type: string, data: any) => {
184192
switch (type) {
185193
case 'zjcnWgBknf9zB7IM9HZjE':
186194
return transformCloudinaryObject(data);
195+
case 'objectEditor': {
196+
return convertToArray(data);
197+
}
187198
}
188199
}
189200

@@ -247,7 +258,7 @@ const processField = (
247258
}
248259

249260
case 'app': {
250-
return damApp(fieldData?.otherCmsType, lang_value)
261+
return mktApp(fieldData?.otherCmsType, lang_value)
251262
}
252263

253264
case 'boolean': {

api/src/utils/content-type-creator.utils.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ interface ContentType {
3333
schema: any[]; // Replace `any` with the specific type if known
3434
}
3535

36+
function extractFieldName(input: string): string {
37+
// Extract text inside parentheses (e.g., "JSON Editor-App")
38+
const match = input.match(/\(([^)]+)\)/);
39+
const insideParentheses = match ? match?.[1] : input; // If no match, use the original string
40+
41+
// Remove "-App" and unwanted characters
42+
const cleanedString = insideParentheses
43+
.replace(/-App/g, '') // Remove "-App"
44+
.trim(); // Trim spaces
45+
46+
return cleanedString || ''; // Return the final processed string
47+
}
48+
49+
50+
51+
3652
function extractValue(input: string, prefix: string, anoter: string): any {
3753
if (input.startsWith(prefix + anoter)) {
3854
return input.replace(prefix + anoter, '');
@@ -472,7 +488,7 @@ const convertToSchemaFormate = ({ field, advanced = true, marketPlacePath }: any
472488
}
473489

474490
case 'app': {
475-
const appName = field?.otherCmsField?.replace?.(/[()-App]/g, '')?.trim?.()?.split?.(' ')?.[1];
491+
const appName = extractFieldName(field?.otherCmsField);
476492
const title = field?.title?.split?.(' ')?.[0];
477493
const appDetails = appMeta?.entries?.find?.((item: any) => item?.title === appName);
478494
if (appDetails?.uid) {

api/src/utils/test-folder-creator.utils.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,17 +270,22 @@ export const testFolderCreator = async ({ destinationStackId }: any) => {
270270
if (!filePath?.endsWith('index.json')) {
271271
const entryData = await JSON.parse(await fs.promises.readFile(path.join(entriesPath, filePath), 'utf8'));
272272
if (Object?.keys?.(entryData)?.length) {
273-
const ct = filePath?.split?.('/')?.[0];
274-
const locale = filePath?.split?.('/')?.[1];
273+
const normalizedPath = path.normalize(filePath);
274+
// Split using `path.sep` for cross-platform support
275+
const pathParts = normalizedPath.split(path.sep);
276+
const ct = pathParts?.[0]; // First directory
277+
const locale = pathParts?.[1]; // Second directory
275278
allData?.push({ contentType: ct, count: Object?.keys?.(entryData)?.length, entryData, filePath, locale })
276279
}
277280
}
278281
}
279-
const sortData = allData?.length > 3 ? allData.sort((a, b) => b?.count - a?.count).slice?.(0, 3) : allData;
282+
// const sortData = allData?.length > 3 ? allData.sort((a, b) => b?.count - a?.count).slice?.(0, 3) : allData;
283+
const sortData = allData;
280284
const finalData: any = [];
281285
sortData.forEach((et: any) => {
282286
const entryObj: any = {};
283-
const ctData = et?.count > 4 ? Object?.values?.(et?.entryData)?.splice?.(0, 5) : Object?.values?.(et?.entryData);
287+
// const ctData = et?.count > 4 ? Object?.values?.(et?.entryData)?.splice?.(0, 5) : Object?.values?.(et?.entryData);
288+
const ctData = Object?.values?.(et?.entryData)?.splice?.(0, 1);
284289
ctData?.forEach?.((entItem: any) => {
285290
entryObj[entItem?.uid] = entItem;
286291
})

0 commit comments

Comments
 (0)