Skip to content

Commit 5cda6a5

Browse files
committed
Merge branch 'v2-dev' into feat/migrate-external-cli-plugins-v2
2 parents 48b4d3f + bb0d8a4 commit 5cda6a5

8 files changed

Lines changed: 36 additions & 77 deletions

File tree

packages/contentstack-bootstrap/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-bootstrap",
33
"description": "Bootstrap contentstack apps",
4-
"version": "2.0.0-beta.19",
4+
"version": "2.0.0-beta.18",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -19,7 +19,7 @@
1919
"@contentstack/cli-cm-seed": "~2.0.0-beta.18",
2020
"@contentstack/cli-command": "~2.0.0-beta.7",
2121
"@contentstack/cli-utilities": "~2.0.0-beta.8",
22-
"@contentstack/cli-config": "~2.0.0-beta.9",
22+
"@contentstack/cli-config": "~2.0.0-beta.10",
2323
"@oclif/core": "^4.3.0",
2424
"inquirer": "12.11.1",
2525
"mkdirp": "^2.1.6",
@@ -70,4 +70,4 @@
7070
}
7171
},
7272
"repository": "contentstack/cli"
73-
}
73+
}

packages/contentstack-export/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies": {
88
"@contentstack/cli-command": "~2.0.0-beta.7",
99
"@contentstack/cli-utilities": "~2.0.0-beta.8",
10-
"@contentstack/cli-variants": "~2.0.0-beta.13",
10+
"@contentstack/cli-variants": "~2.0.0-beta.14",
1111
"@contentstack/cli-asset-management": "~1.0.0-beta.2",
1212
"@oclif/core": "^4.8.0",
1313
"async": "^3.2.6",
@@ -23,7 +23,7 @@
2323
},
2424
"devDependencies": {
2525
"@contentstack/cli-auth": "~2.0.0-beta.12",
26-
"@contentstack/cli-config": "~2.0.0-beta.9",
26+
"@contentstack/cli-config": "~2.0.0-beta.10",
2727
"@contentstack/cli-dev-dependencies": "~2.0.0-beta.0",
2828
"@oclif/plugin-help": "^6.2.28",
2929
"@oclif/test": "^4.1.18",
@@ -99,4 +99,4 @@
9999
}
100100
},
101101
"repository": "https://github.com/contentstack/cli"
102-
}
102+
}

packages/contentstack-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@contentstack/cli-audit": "~2.0.0-beta.12",
99
"@contentstack/cli-command": "~2.0.0-beta.7",
1010
"@contentstack/cli-utilities": "~2.0.0-beta.8",
11-
"@contentstack/cli-variants": "~2.0.0-beta.13",
11+
"@contentstack/cli-variants": "~2.0.0-beta.14",
1212
"@contentstack/cli-asset-management": "~1.0.0-beta.2",
1313
"@oclif/core": "^4.3.0",
1414
"big-json": "^3.2.0",

packages/contentstack-variants/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/cli-variants",
3-
"version": "2.0.0-beta.13",
3+
"version": "2.0.0-beta.14",
44
"description": "Variants plugin",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

packages/contentstack-variants/src/export/experiences.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export default class ExportExperiences extends PersonalizationAdapter<ExportConf
1616
headers: { 'X-Project-Uid': exportConfig.project_id },
1717
cmaConfig: {
1818
baseURL: exportConfig.region.cma + `/v3`,
19-
headers: { api_key: exportConfig.apiKey },
19+
headers: {
20+
api_key: exportConfig.apiKey,
21+
...(exportConfig.branchName ? { branch: exportConfig.branchName } : {}),
22+
},
2023
},
2124
});
2225
this.exportConfig = exportConfig;

packages/contentstack-variants/src/import/experiences.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export default class Experiences extends PersonalizationAdapter<ImportConfig> {
5050
headers: { 'X-Project-Uid': config.modules.personalize.project_id },
5151
cmaConfig: {
5252
baseURL: config.region.cma + `/v3`,
53-
headers: { api_key: config.apiKey },
53+
headers: {
54+
api_key: config.apiKey,
55+
...(config.branchName ? { branch: config.branchName } : {}),
56+
},
5457
},
5558
};
5659
super(Object.assign(config, conf));

packages/contentstack-variants/src/utils/personalization-api-adapter.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ export class PersonalizationAdapter<T> extends AdapterHelper<T, HttpClient> impl
155155
this.cmaAPIClient?.headers({ authtoken: token });
156156
}
157157
}
158+
159+
// Ensure the CMA client targets the configured branch. Variant groups, CT
160+
// links and other stack-CMA endpoints are branch-scoped, so without this
161+
// header the requests would fall back to the default (main) branch even
162+
// when the import/export is running against a non-main branch.
163+
const branchName = (this.config as any)?.branchName;
164+
if (this.adapterConfig.cmaConfig && branchName) {
165+
log.debug(`Setting branch header for CMA client: ${branchName}`, this.exportConfig?.context);
166+
this.cmaAPIClient?.headers({ branch: branchName });
167+
}
168+
158169
log.debug('Personalization adapter initialization completed', this.exportConfig?.context);
159170
} catch (error: any) {
160171
log.debug(`Personalization adapter initialization failed: ${error}`, this.exportConfig?.context);

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)