Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next feature update #1582

Merged
merged 27 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a914518
replaced personalize-url with getter methodcd
harshithad0703 Aug 28, 2024
223f80e
updated for personalize url in attributes
harshithad0703 Aug 29, 2024
01f2738
updated personalizeUrl im import, export and variants
harshithad0703 Sep 19, 2024
e5b2138
reverting
harshithad0703 Sep 19, 2024
085c92d
Merge pull request #1572 from contentstack/fix/dx-1171-replace-person…
harshithad0703 Sep 19, 2024
63722f3
refactor: entry variant api response & replaced personalization with …
aman19K Sep 20, 2024
bd74063
added build info in gitignore file
aman19K Sep 20, 2024
57a885c
refactor: replaced personalizationConfig with personalizeConfig
aman19K Sep 20, 2024
557d4bd
Added support for experience versioning
shafeeqd959 Sep 23, 2024
e5fffaf
conflicts resolved
shafeeqd959 Sep 23, 2024
f06afc1
sanitized path
shafeeqd959 Sep 23, 2024
5c48678
Merge pull request #1579 from contentstack/feat/CS-1402,CS-1401
aman19K Sep 23, 2024
9842025
Merge branch 'next-feature-update' into feat/DX-1463
aman19K Sep 23, 2024
57a9c16
refactor: experience & variant-entries code
aman19K Sep 23, 2024
9ba38ba
refactor: error handling in attribute, audiences &events
aman19K Sep 23, 2024
56d2e2a
fixed
shafeeqd959 Sep 24, 2024
6778c3d
refactor: added personalize url
aman19K Sep 24, 2024
a05b812
Merge pull request #1581 from contentstack/fix/feat/DX-1463
aman19K Sep 24, 2024
8bb3f1d
Merge pull request #1573 from contentstack/feat/DX-1463
aman19K Sep 24, 2024
1d8c5e4
Merge branch 'staging' of github.com:contentstack/cli into next-featu…
shafeeqd959 Sep 24, 2024
33ef991
version bumped
shafeeqd959 Sep 24, 2024
27e4674
Merge branch 'next-feature-update' of github.com:contentstack/cli int…
shafeeqd959 Sep 24, 2024
c9c4fff
refactor: error formatting
aman19K Sep 24, 2024
a213cd0
Merge pull request #1586 from contentstack/fix/error
aman19K Sep 24, 2024
0b8e5ea
fix: handle forbidden error
aman19K Sep 24, 2024
4635359
Merge branch 'staging' into next-feature-update
aman19K Sep 24, 2024
eae602d
update lock & yaml file
aman19K Sep 25, 2024
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
4 changes: 2 additions & 2 deletions packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-bootstrap",
"description": "Bootstrap contentstack apps",
"version": "1.11.0",
"version": "1.12.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
},
"dependencies": {
"@contentstack/cli-cm-seed": "~1.8.0",
"@contentstack/cli-cm-seed": "~1.9.0",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.2",
"inquirer": "8.2.4",
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@contentstack/cli-cm-clone",
"description": "Contentstack stack clone plugin",
"version": "1.11.1",
"version": "1.12.0",
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@colors/colors": "^1.5.0",
"@contentstack/cli-cm-export": "~1.12.0",
"@contentstack/cli-cm-import": "~1.17.0",
"@contentstack/cli-cm-export": "~1.13.0",
"@contentstack/cli-cm-import": "~1.18.0",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.2",
"async": "^3.2.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/contentstack-config/src/utils/region-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const regions = {
name: 'NA',
'developerHubUrl': 'https://developerhub-api.contentstack.com',
'launchHubUrl': 'https://launch-api.contentstack.com',
'personalizeUrl': 'https://personalization-api.contentstack.com',
'personalizeUrl': 'https://personalize-api.contentstack.com',
},
EU: {
cma: 'https://eu-api.contentstack.com',
Expand All @@ -33,7 +33,7 @@ const regions = {
name: 'EU',
'developerHubUrl': 'https://eu-developerhub-api.contentstack.com',
'launchHubUrl': 'https://eu-launch-api.contentstack.com',
'personalizeUrl': 'Not available',
'personalizeUrl': 'https://eu-personalize-api.contentstack.com',
},
'AZURE-NA': {
cma: 'https://azure-na-api.contentstack.com',
Expand All @@ -42,7 +42,7 @@ const regions = {
name: 'AZURE-NA',
'developerHubUrl': 'https://azure-na-developerhub-api.contentstack.com',
'launchHubUrl': 'https://azure-na-launch-api.contentstack.com',
'personalizeUrl': 'Not available',
'personalizeUrl': 'https://azure-na-personalize-api.contentstack.com',
},
'AZURE-EU': {
cma: 'https://azure-eu-api.contentstack.com',
Expand All @@ -51,7 +51,7 @@ const regions = {
name: 'AZURE-EU',
'developerHubUrl': 'https://azure-eu-developerhub-api.contentstack.com',
'launchHubUrl': 'https://azure-eu-launch-api.contentstack.com',
'personalizeUrl': 'Not available',
'personalizeUrl': 'https://azure-eu-personalize-api.contentstack.com',
},
'GCP-NA': {
cma: 'https://gcp-na-api.contentstack.com',
Expand All @@ -60,7 +60,7 @@ const regions = {
name: 'GCP-NA',
'developerHubUrl': 'https://gcp-na-developerhub-api.contentstack.com',
'launchHubUrl': 'Not available',
'personalizeUrl': 'Not available',
'personalizeUrl': 'https://gcp-na-personalize-api.contentstack.com',
},
};

Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-export/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@contentstack/cli-cm-export",
"description": "Contentstack CLI plugin to export content from stack",
"version": "1.12.1",
"version": "1.13.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-variants": "~0.0.1-alpha",
"@contentstack/cli-variants": "~1.0.0",
"@contentstack/cli-utilities": "~1.7.2",
"@oclif/core": "^3.26.5",
"async": "^3.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default class ExportCommand extends Command {
exportConfig.host = this.cmaHost;
exportConfig.region = this.region;
exportConfig.developerHubBaseUrl = this.developerHubUrl;
if (this.personalizeUrl) exportConfig.modules.personalize.baseURL[exportConfig.region.name] = this.personalizeUrl;
exportDir = exportConfig.cliLogsPath || exportConfig.data || exportConfig.exportDir;
const managementAPIClient: ContentstackClient = await managementSDKClient(exportConfig);
const moduleExporter = new ModuleExporter(managementAPIClient, exportConfig);
Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-export/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const config: DefaultConfig = {
'content-types',
'custom-roles',
'workflows',
'personalization',
'personalize',
'entries',
'labels',
'marketplace-apps',
Expand Down Expand Up @@ -144,11 +144,11 @@ const config: DefaultConfig = {
dependencies: ['locales', 'content-types'],
exportVersions: false,
},
personalization: {
personalize: {
baseURL: {
NA: 'https://personalization-api.contentstack.com',
NA: 'https://personalize-api.contentstack.com',
},
dirName: 'personalization',
dirName: 'personalize',
exportOrder: ['attributes', 'audiences', 'events', 'experiences'],
projects: {
dirName: 'projects',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import {
import { log, formatError } from '../../utils';
import { ModuleClassParams, ExportConfig } from '../../types';

export default class ExportPersonalization {
export default class ExportPersonalize {
public exportConfig: ExportConfig;
public personalizeConfig: { dirName: string; baseURL: Record<string, string> } & AnyProperty;
constructor({ exportConfig }: ModuleClassParams) {
this.exportConfig = exportConfig;
this.personalizeConfig = exportConfig.modules.personalization;
this.personalizeConfig = exportConfig.modules.personalize;
}

async start(): Promise<void> {
Expand All @@ -39,7 +39,7 @@ export default class ExportPersonalization {
experiences: new ExportExperiences(this.exportConfig),
};

const order: (keyof typeof moduleMapper)[] = this.exportConfig.modules.personalization
const order: (keyof typeof moduleMapper)[] = this.exportConfig.modules.personalize
.exportOrder as (keyof typeof moduleMapper)[];

for (const module of order) {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/src/types/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default interface DefaultConfig {
dependencies?: Modules[];
exportVersions: boolean;
};
personalization: {
personalize: {
dirName: string;
baseURL: Record<string, string>;
} & AnyProperty;
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export type Modules =
| 'labels'
| 'marketplace-apps'
| 'taxonomies'
| 'personalization';
| 'personalize';

export type ModuleClassParams = {
stackAPIClient: ReturnType<ContentstackClient['stack']>;
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.17.1",
"version": "1.18.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-audit": "~1.7.0",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.2",
"@contentstack/management": "~1.17.0",
"@contentstack/cli-variants": "0.0.1-alpha",
"@contentstack/cli-variants": "~1.0.0",
"@oclif/core": "^3.26.5",
"big-json": "^3.2.0",
"bluebird": "^3.7.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default class ImportCommand extends Command {
importConfig.host = this.cmaHost;
importConfig.region = this.region;
importConfig.developerHubBaseUrl = this.developerHubUrl;
if (this.personalizeUrl) importConfig.modules.personalize.baseURL[importConfig.region.name] = this.personalizeUrl;
backupDir = importConfig.cliLogsPath || importConfig.backupDir;

const managementAPIClient: ContentstackClient = await managementSDKClient(importConfig);
Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-import/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const config: DefaultConfig = {
'marketplace-apps',
'global-fields',
'content-types',
'personalization',
'personalize',
'custom-roles',
'workflows',
'entries',
Expand Down Expand Up @@ -151,12 +151,12 @@ const config: DefaultConfig = {
dirName: 'taxonomies',
fileName: 'taxonomies.json',
},
personalization: {
personalize: {
baseURL: {
NA: 'https://personalization-api.contentstack.com',
NA: 'https://personalize-api.contentstack.com',
},
importData: true,
dirName: 'personalization',
dirName: 'personalize',
importOrder: ['attributes', 'audiences', 'events', 'experiences'],
project_id: '',
projects: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { Import, LogType } from '@contentstack/cli-variants';
import { log } from '../../utils';
import { ImportConfig, ModuleClassParams } from '../../types';

export default class ImportPersonalization {
export default class ImportPersonalize {
private config: ImportConfig;
public personalizeConfig: ImportConfig['modules']['personalization'];
public personalizeConfig: ImportConfig['modules']['personalize'];

constructor({ importConfig }: ModuleClassParams) {
this.config = importConfig;
this.personalizeConfig = importConfig.modules.personalization;
this.personalizeConfig = importConfig.modules.personalize;
}

/**
Expand Down Expand Up @@ -45,10 +45,10 @@ export default class ImportPersonalization {
}
}
} catch (error) {
this.personalizeConfig.importData = false; // Stop personalization import if project creation fails
this.personalizeConfig.importData = false; // Stop personalize import if project creation fails
log(this.config, error, 'error');
if (!this.personalizeConfig.importData) {
log(this.config, 'Skipping personalization migration...', 'warn');
log(this.config, 'Skipping personalize migration...', 'warn');
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import {

export default class ImportVarientEntries {
private config: ImportConfig;
public personalization: ImportConfig['modules']['personalization'];
public personalize: ImportConfig['modules']['personalize'];
private projectMapperFilePath: string;

constructor({ importConfig }: ModuleClassParams) {
this.config = importConfig;
this.personalization = importConfig.modules.personalization;
this.personalize = importConfig.modules.personalize;
this.projectMapperFilePath = path.resolve(
sanitizePath(this.config.data),
'mapper',
sanitizePath(this.personalization.dirName),
sanitizePath(this.personalize.dirName),
'projects',
'projects.json',
);
Expand All @@ -36,8 +36,8 @@ export default class ImportVarientEntries {
async start(): Promise<void> {
try {
const project = fsUtil.readFile(this.projectMapperFilePath) as ProjectStruct;
if (project && project.uid && this.personalization.importData) {
this.config.modules.personalization.project_id = project.uid;
if (project && project.uid) {
this.config.modules.personalize.project_id = project.uid;
const helpers: ImportHelperMethodsConfig = {
lookUpTerms,
lookupAssets,
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/src/types/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default interface DefaultConfig {
fileName: string;
dependencies?: Modules[];
};
personalization: {
personalize: {
baseURL: Record<string, string>;
dirName: string;
importData: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export type Modules =
| 'labels'
| 'marketplace-apps'
| 'taxonomies'
| 'personalization'
| 'personalize'
| 'variant-entries';

export type ModuleClassParams = {
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-seed/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@contentstack/cli-cm-seed",
"description": "create a Stack from existing content types, entries, assets, etc.",
"version": "1.8.0",
"version": "1.9.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-cm-import": "~1.17.0",
"@contentstack/cli-cm-import": "~1.18.0",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.2",
"inquirer": "8.2.4",
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-variants/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
/yarn.lock
node_modules
.DS_Store
coverage
coverage
/tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion packages/contentstack-variants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-variants",
"version": "0.0.1-alpha",
"version": "1.0.0",
"description": "Variants plugin",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/contentstack-variants/src/export/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ import omit from 'lodash/omit';
import { resolve as pResolve } from 'node:path';
import { sanitizePath } from '@contentstack/cli-utilities';
import { formatError, fsUtil, PersonalizationAdapter, log } from '../utils';
import { PersonalizationConfig, ExportConfig, AttributesConfig, AttributeStruct } from '../types';
import { PersonalizeConfig, ExportConfig, AttributesConfig, AttributeStruct } from '../types';

export default class ExportAttributes extends PersonalizationAdapter<ExportConfig> {
private attributesConfig: AttributesConfig;
private attributesFolderPath: string;
private attributes: Record<string, unknown>[];
public personalizationConfig: PersonalizationConfig;
public personalizeConfig: PersonalizeConfig;

constructor(readonly exportConfig: ExportConfig) {
super({
config: exportConfig,
baseURL: exportConfig.modules.personalization.baseURL[exportConfig.region.name],
baseURL: exportConfig.modules.personalize.baseURL[exportConfig.region.name],
headers: { authtoken: exportConfig.auth_token, 'X-Project-Uid': exportConfig.project_id },
});
this.personalizationConfig = exportConfig.modules.personalization;
this.personalizeConfig = exportConfig.modules.personalize;
this.attributesConfig = exportConfig.modules.attributes;
this.attributesFolderPath = pResolve(
sanitizePath(exportConfig.data),
sanitizePath(exportConfig.branchName || ''),
sanitizePath(this.personalizationConfig.dirName),
sanitizePath(this.personalizeConfig.dirName),
sanitizePath(this.attributesConfig.dirName),
);
this.attributes = [];
Expand Down
10 changes: 5 additions & 5 deletions packages/contentstack-variants/src/export/audiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ import omit from 'lodash/omit';
import { resolve as pResolve } from 'node:path';

import { formatError, fsUtil, PersonalizationAdapter, log } from '../utils';
import { PersonalizationConfig, ExportConfig, AudienceStruct, AudiencesConfig } from '../types';
import { PersonalizeConfig, ExportConfig, AudienceStruct, AudiencesConfig } from '../types';

export default class ExportAudiences extends PersonalizationAdapter<ExportConfig> {
private audiencesConfig: AudiencesConfig;
private audiencesFolderPath: string;
private audiences: Record<string, unknown>[];
public personalizationConfig: PersonalizationConfig;
public personalizeConfig: PersonalizeConfig;

constructor(readonly exportConfig: ExportConfig) {
super({
config: exportConfig,
baseURL: exportConfig.modules.personalization.baseURL[exportConfig.region.name],
baseURL: exportConfig.modules.personalize.baseURL[exportConfig.region.name],
headers: { authtoken: exportConfig.auth_token, 'X-Project-Uid': exportConfig.project_id },
});
this.personalizationConfig = exportConfig.modules.personalization;
this.personalizeConfig = exportConfig.modules.personalize;
this.audiencesConfig = exportConfig.modules.audiences;
this.audiencesFolderPath = pResolve(
exportConfig.data,
exportConfig.branchName || '',
this.personalizationConfig.dirName,
this.personalizeConfig.dirName,
this.audiencesConfig.dirName,
);
this.audiences = [];
Expand Down
Loading
Loading