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

Variants changes #1473

Merged
merged 2,266 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
2266 commits
Select commit Hold shift + click to select a range
7e8fa28
Merge branch 'development' of github.com:contentstack/cli-variants in…
shafeeqd959 Apr 24, 2024
30e1ca9
Ui text updated
cs-raj Apr 24, 2024
685f795
fix when entry does not have title or title is empty
cs-raj Apr 24, 2024
720d7fb
Merge pull request #1385 from contentstack/fix/Ui-Text-Fixed
cs-raj Apr 24, 2024
1543666
lock-file-update
cs-raj Apr 24, 2024
02631a5
Merge pull request #1386 from contentstack/fix/lock-file-update
cs-raj Apr 24, 2024
417d6b5
API key and branch name included in the header
antonyagustine Apr 24, 2024
b4e7739
Merge pull request #25 from contentstack/fix/variant-entry-fix
antonyagustine Apr 24, 2024
11fd7f0
Merge pull request #1387 from contentstack/development
cs-raj Apr 24, 2024
6ff5957
Fix: Headers added
antonyagustine Apr 24, 2024
894af8f
Merge pull request #27 from contentstack/fix/variant-entry-import-fix
antonyagustine Apr 25, 2024
e7cb502
updated personalization url
shafeeqd959 Apr 25, 2024
223dd1a
Merge pull request #26 from contentstack/feat/CS-44627
shafeeqd959 Apr 25, 2024
22e5b2d
feat: Added Audit and audit fix for Select fields in entries and mino…
cs-raj Apr 27, 2024
aff8bff
Merge remote-tracking branch 'origin/development' into feat/CS-44502
cs-raj Apr 27, 2024
261fec1
test: Variant entries export test,Unit test basic setup
antonyagustine Apr 29, 2024
c571eb4
Merge pull request #28 from contentstack/test/CS-44748-export
antonyagustine Apr 29, 2024
9be37e2
PR fixes and version bump of CLI
cs-raj Apr 29, 2024
22c0065
Merge pull request #1388 from contentstack/staging
cs-raj Apr 29, 2024
3dae123
PR fixes
cs-raj Apr 29, 2024
dfd323f
Merge pull request #1390 from contentstack/main
cs-raj Apr 29, 2024
43e8071
Merge pull request #1391 from contentstack/staging-to-development
cs-raj Apr 29, 2024
cf6466b
Merge branch 'development' into feat/CS-44502
cs-raj Apr 29, 2024
826ac3b
PR fixes and lock-file update
cs-raj Apr 29, 2024
39e0ad6
log removal
cs-raj Apr 29, 2024
1b46298
Merge pull request #1389 from contentstack/feat/CS-44502
cs-raj Apr 29, 2024
a218749
test: Variant entries import unit test cases
antonyagustine Apr 30, 2024
8c9e43a
Merge pull request #29 from contentstack/test/CS-44748-import
antonyagustine Apr 30, 2024
eba7675
fix: handle error in variant import
aman19K May 2, 2024
00d4ea7
Merge pull request #30 from contentstack/fix/DX-488-variant-import
aman19K May 2, 2024
ed1dbe7
fix: resolved the asset publish issue caused by the multiple languages
aman19K May 3, 2024
48ae308
Merge branch 'hotfix/DX-530' into hotfix/DX-530-stag
aman19K May 3, 2024
f9af75a
Merge pull request #1394 from contentstack/hotfix/DX-530-stag
cs-raj May 3, 2024
93ea693
Merge pull request #1392 from contentstack/hotfix/DX-530
cs-raj May 3, 2024
be0140c
Merge branch 'main' into main-to-staging
cs-raj May 3, 2024
9bda78a
lock-file and readme updated
cs-raj May 3, 2024
a5f5dfd
Merge pull request #1396 from contentstack/main-to-staging
cs-raj May 3, 2024
818bc25
Merge branch 'staging' into staging-to-development
cs-raj May 3, 2024
f4aa123
Lock-file and readme update
cs-raj May 3, 2024
6dd0125
Merge pull request #1398 from contentstack/staging-to-development
cs-raj May 3, 2024
71e1309
fix: added success message for exporting experience
aman19K May 6, 2024
cbc09b9
Merge pull request #31 from contentstack/fix/DX-487-export-experience…
aman19K May 6, 2024
a471f03
added audit and audit fix for mandatory fields in Entries, and added …
cs-raj May 6, 2024
62bb5c4
PR fixes and lock-file update
cs-raj May 6, 2024
9b70237
PR comment fixes
cs-raj May 6, 2024
d2942ca
added condition to show extension updated message successfully, in ma…
cs-raj May 6, 2024
70e5e46
formatting
cs-raj May 6, 2024
e5d823a
PR change
cs-raj May 6, 2024
c794718
displaying the audit report for the mandatory feilds in case of no pu…
cs-raj May 6, 2024
905a28d
Merge pull request #1400 from contentstack/fix/DX-54
cs-raj May 6, 2024
28e8eff
removing redundant checks
cs-raj May 6, 2024
6495f46
Merge branch 'development' into feat/DX-523
cs-raj May 7, 2024
f20c73d
Merge pull request #1399 from contentstack/feat/DX-523
cs-raj May 7, 2024
05ae5de
upgraded oclif/core to 3.26.5 and version bump
cs-raj May 7, 2024
3337c1c
used the length property to validate the missing mandatory fields, av…
cs-raj May 7, 2024
0d0da65
Merge pull request #1402 from contentstack/bugfix/DX-552
cs-raj May 7, 2024
df0badc
handled the case when Csdx context is not found
cs-raj May 7, 2024
57f215d
lock-file update
cs-raj May 8, 2024
68c35f2
Merge pull request #1403 from contentstack/fix/lock-files
cs-raj May 8, 2024
56700b8
Merge pull request #1404 from contentstack/development
cs-raj May 8, 2024
4b1d69b
Merge branch 'development' into feat/DX-524
cs-raj May 8, 2024
c933f81
feat: handled variant api errors
aman19K May 9, 2024
c633199
fix: attribute, audience, event & experience fail cases
aman19K May 9, 2024
d70f22d
revert dev url
aman19K May 9, 2024
1514232
Merge pull request #32 from contentstack/feat/DX-317-handle-variant-a…
aman19K May 9, 2024
12f3f87
updated personalization url to access in multiple region
shafeeqd959 May 9, 2024
9a5fd82
merged changes
shafeeqd959 May 9, 2024
c7c55f0
removed console
shafeeqd959 May 9, 2024
4e61e45
Merge pull request #33 from contentstack/feat/DX-502
shafeeqd959 May 9, 2024
b4c46ac
changed remove publish_details function and changed the logs for both…
cs-raj May 13, 2024
5891dfa
formatting and used the previous function with changed name for publi…
cs-raj May 13, 2024
580ddf6
lock-file update
cs-raj May 13, 2024
debd815
Merge pull request #1405 from contentstack/staging
cs-raj May 13, 2024
3112f51
import and export version bump
cs-raj May 13, 2024
5269873
Merge pull request #1406 from contentstack/fix/DX-92
cs-raj May 13, 2024
c1d3079
Merge pull request #1407 from contentstack/main
cs-raj May 13, 2024
e3620b3
Merge branch 'staging' into staging-to-development
cs-raj May 13, 2024
69419c2
Back merge lock-file update
cs-raj May 13, 2024
bec9eb0
Merge pull request #1408 from contentstack/staging-to-development
cs-raj May 13, 2024
9f737c7
Merge remote-tracking branch 'origin/development' into feat/DX-524
cs-raj May 13, 2024
5ad0d3d
lock-file update
cs-raj May 13, 2024
4b9fd62
Merge pull request #1401 from contentstack/feat/DX-524
cs-raj May 13, 2024
1c94309
fix: issue with import entries arising from compact library
aman19K May 14, 2024
ed729dc
fix: typo
aman19K May 15, 2024
5d6e248
Merge pull request #1409 from contentstack/fix/DX-591
aman19K May 15, 2024
dc28a4f
cli-command version bump
cs-raj May 15, 2024
3e020a5
Merge branch 'development' into fix/version-bump
cs-raj May 15, 2024
9a02c56
Merge pull request #1410 from contentstack/fix/version-bump
cs-raj May 15, 2024
7e18eeb
Merge pull request #1411 from contentstack/development
cs-raj May 15, 2024
fe01905
SRE fixes
cs-raj May 16, 2024
7a27156
fix path related issues
cs-raj May 17, 2024
4fc06d6
variable update
cs-raj May 17, 2024
d5ce142
fixed Regex
cs-raj May 17, 2024
5a2c782
sca-scan.yml
aravindbuilt May 17, 2024
3b178f1
jira.yml
aravindbuilt May 17, 2024
959455c
sast-scan.yml
aravindbuilt May 17, 2024
f0b86d4
Delete secrets-scan.yml
aravindbuilt May 17, 2024
1d9304b
codeql-analysis.yml
aravindbuilt May 17, 2024
495a6e6
fix auth issues
cs-raj May 17, 2024
54ab51b
Resolved Regular expression DOS attacks and prototype pollution
cs-raj May 20, 2024
4e72a14
Merge branch 'main' into main-to-stage
cs-raj May 20, 2024
b0d219f
Merge pull request #1413 from contentstack/main-to-stage
cs-raj May 20, 2024
1e3cbef
Merge pull request #1414 from contentstack/staging-to-development
cs-raj May 20, 2024
813ff16
fix: variant import & handle import error
aman19K May 20, 2024
c88e713
version bump and reverted changes for asset url
cs-raj May 21, 2024
da69139
fix: import logger issue
aman19K May 21, 2024
7f0bd30
Merge branch 'development' into fix/DX-94
cs-raj May 21, 2024
d834c01
removed unsed regex
cs-raj May 21, 2024
d304357
refactor: create variant entry
aman19K May 21, 2024
b6fd2c9
fix: variant entries list check
aman19K May 21, 2024
d86ca8d
refactor: variant import error handling
aman19K May 21, 2024
b5e9497
Merge pull request #34 from contentstack/fix/Dx-581-import-variant-en…
aman19K May 21, 2024
ee30df6
fix: asset import & variant export issue
aman19K May 21, 2024
3376c69
Merge pull request #35 from contentstack/fix/DX-624
aman19K May 21, 2024
2f395a5
PR fixes and formating
cs-raj May 21, 2024
7a053f0
adding sanitize path in callsite
cs-raj May 21, 2024
ce3816f
typo error
cs-raj May 21, 2024
16b5e12
Merge pull request #1415 from contentstack/fix/DX-94
cs-raj May 21, 2024
5710ef8
feat: implemented entry variants publish
aman19K May 22, 2024
30d8fe0
fix: variant uid mapper
aman19K May 22, 2024
a69c7e5
fix: entries mapper issue
aman19K May 22, 2024
a9ff25d
fix: variant publish issue
aman19K May 23, 2024
5621e3d
formatting & doc
aman19K May 23, 2024
f05af8a
Merge pull request #36 from contentstack/feat/DX-319-variant-entries-…
aman19K May 23, 2024
077ed4d
fixed the generating tree structure for the assets during branches merge
cs-raj May 23, 2024
202d3e0
fix: handled log message if stack not connected with any project
aman19K May 23, 2024
5f579be
Merge pull request #37 from contentstack/fix/DX-650
aman19K May 23, 2024
f54fd8a
Merge pull request #1416 from contentstack/fix/DX-525
cs-raj May 24, 2024
08f70af
Merge pull request #1412 from contentstack/staging
cs-raj May 24, 2024
9a3aaa7
fixed content type attaching in experience, empty entry variants fold…
shafeeqd959 May 24, 2024
e3ed6ee
Merge pull request #38 from contentstack/fix/DX-579/DX-580
shafeeqd959 May 24, 2024
4322cf7
Merge pull request #1417 from contentstack/main
cs-raj May 24, 2024
16ea0f1
added variant success file
aman19K May 24, 2024
f1e72ee
revert dev url
aman19K May 24, 2024
4e7c1ec
Merge branch 'staging' into staging-to-development
cs-raj May 24, 2024
f07d6af
Merge pull request #1419 from contentstack/staging-to-development
cs-raj May 24, 2024
1e2630c
handle failed entry variant case
aman19K May 27, 2024
cde5833
added variant uid in publish logger msg
aman19K May 27, 2024
25a329f
Merge pull request #39 from contentstack/fix/variant-success-file
aman19K May 28, 2024
79cd09f
fix: variant folder issues & added personalization module check befor…
aman19K May 30, 2024
4251b8d
refactor: default personalization disabled
aman19K May 30, 2024
c8e800f
Merge pull request #40 from contentstack/fix/DX-676
aman19K May 30, 2024
3a337a8
Merge pull request #1420 from contentstack/development
harshithad0703 May 31, 2024
5929828
fix: Handled pagination during the script creation
cs-raj Jun 3, 2024
fc10e46
minor version bump
cs-raj Jun 3, 2024
15dc431
variable declaration fix
cs-raj Jun 3, 2024
5578d6c
fixed the issues with rich text type and bugs in entries helper
cs-raj Jun 4, 2024
831fd0d
fix: handle deprecation warning message
aman19K Jun 4, 2024
e3d4694
Merge pull request #1422 from contentstack/bugfix/DX-717
cs-raj Jun 4, 2024
d93a129
Merge remote-tracking branch 'origin/development' into fix/DX-647
cs-raj Jun 4, 2024
811cf3a
fixed the entry migration script for contentTypes
cs-raj Jun 4, 2024
301d39f
Merge pull request #1424 from contentstack/fix/dev
cs-raj Jun 4, 2024
f57d92b
Merge branch 'development' into fix/DX-647
cs-raj Jun 4, 2024
7df5a10
Merge pull request #1423 from contentstack/fix/DX-647
cs-raj Jun 4, 2024
c6c48f6
Implemented compass app integration with Seed and Bootstrap command (…
sunil-lakshman Jun 5, 2024
90dc8cc
Merge branch 'development' into fix/DX-51/deprecation-warning
aman19K Jun 5, 2024
997c9f9
Merge pull request #1427 from contentstack/fix/DX-51/deprecation-warning
aman19K Jun 5, 2024
23570d0
Merge pull request #1421 from contentstack/staging
harshithad0703 Jun 5, 2024
5fd14eb
Merge pull request #1428 from contentstack/main
harshithad0703 Jun 5, 2024
b2cab26
Merge branch 'staging' into staging-to-development
harshithad0703 Jun 5, 2024
299451b
Merge pull request #1429 from contentstack/staging-to-development
harshithad0703 Jun 5, 2024
18d4878
fixed entry variant import for file fields and fixed project name dup…
shafeeqd959 Jun 5, 2024
284691f
added project flag
shafeeqd959 Jun 6, 2024
314402a
Merge pull request #41 from contentstack/fix/DX-643/DX-644
shafeeqd959 Jun 6, 2024
f56882c
fix: added rte field missing fix
Jun 6, 2024
6320ee5
feat: Added two flags for excluding the global modules and one for pr…
cs-raj Jun 7, 2024
dfa3ffd
fix: Reverted bootstrap changes
cs-raj Jun 7, 2024
6c0f65d
Merge pull request #1432 from contentstack/revert/changes
cs-raj Jun 7, 2024
87d1f6e
Merge pull request #1433 from contentstack/development
cs-raj Jun 7, 2024
bbcf41c
fixed project creation
shafeeqd959 Jun 7, 2024
6af75a1
Merge pull request #42 from contentstack/fix/DX-643/DX-644
shafeeqd959 Jun 7, 2024
7bb65e3
added prompt for mapper directory
cs-raj Jun 10, 2024
d1710ae
only webhooks are excluded
cs-raj Jun 10, 2024
cac073d
Merge remote-tracking branch 'origin/development' into feat/DX-56
cs-raj Jun 10, 2024
329f17b
lock-file update
cs-raj Jun 10, 2024
efd2b91
pnpm file update
cs-raj Jun 10, 2024
87da972
Merge remote-tracking branch 'origin/development' into feat/DX-56
cs-raj Jun 10, 2024
22e519e
version bump
cs-raj Jun 10, 2024
6aeac45
removed unused code
cs-raj Jun 10, 2024
0b5ae6d
PR fix
cs-raj Jun 10, 2024
0384d6d
Removed mapper directory
cs-raj Jun 10, 2024
6f954f3
chore: upgraded marketplace sdk package
harshithad0703 Jun 10, 2024
0611639
version bump
harshithad0703 Jun 10, 2024
51fe246
final PR changes !
cs-raj Jun 10, 2024
038ba89
Merge pull request #1431 from contentstack/feat/DX-56
cs-raj Jun 10, 2024
7dcddb0
Merge branch 'development' into fix/DX-775-upgrade-marketplace-sdk
harshithad0703 Jun 10, 2024
f013d58
Merge pull request #1435 from contentstack/fix/DX-775-upgrade-marketp…
harshithad0703 Jun 10, 2024
a5cc115
chore: version bump
harshithad0703 Jun 10, 2024
35cafdc
Merge branch 'development' into fix/DX-775-upgrade-marketplace-sdk
harshithad0703 Jun 10, 2024
226ddcd
Merge pull request #1436 from contentstack/fix/DX-775-upgrade-marketp…
harshithad0703 Jun 10, 2024
5aad9bc
Merge pull request #1434 from contentstack/staging
cs-raj Jun 11, 2024
c9fed8b
Merge pull request #1437 from contentstack/main
cs-raj Jun 11, 2024
06c0c06
Merge remote-tracking branch 'origin/staging' into stage-to-development
cs-raj Jun 11, 2024
89d4961
lock-file update
cs-raj Jun 11, 2024
ceab81a
Merge pull request #1439 from contentstack/stage-to-development
cs-raj Jun 11, 2024
fa7ab5f
fix: removed rteCTs check
Jun 18, 2024
754cdd8
Merge branch 'development' into fix/DX-606
cs-raj Jun 19, 2024
ab5f5f8
Merge pull request #1430 from contentstack/fix/DX-606
aman19K Jun 19, 2024
079934e
fix: handle taxonomy & environment mapper issue
aman19K Jun 21, 2024
6d3715e
Merge pull request #1440 from contentstack/fix/DX-803-mapper-issue
aman19K Jun 24, 2024
c237921
fixed the failing of audit when no publish details were found and del…
cs-raj Jun 24, 2024
8768dfa
Ui text updates
cs-raj Jun 24, 2024
d2c8334
fixed management token on variants, fixed asset reference handling is…
shafeeqd959 Jun 24, 2024
e93aba1
Merge pull request #1442 from contentstack/staging
cs-raj Jun 24, 2024
f646893
Merge pull request #43 from contentstack/fix/DX-777,DX-778
shafeeqd959 Jun 25, 2024
36af104
Merge branch 'development' into fix/DX-829
cs-raj Jun 26, 2024
c0b9a8f
Merge pull request #1441 from contentstack/fix/DX-829
cs-raj Jun 26, 2024
3f4a6da
Merge pull request #1443 from contentstack/main
cs-raj Jun 26, 2024
7960e93
Merge branch 'staging' into staging-to-development
cs-raj Jun 26, 2024
fd080f0
lock file update
cs-raj Jun 26, 2024
44f160c
Merge pull request #1444 from contentstack/staging-to-development
cs-raj Jun 26, 2024
e0c9650
chore: upgraded marketplace package in cli-utilities
harshithad0703 Jun 28, 2024
1bb6b30
Merge pull request #1445 from contentstack/fix/DX-809-marketplace-ver…
harshithad0703 Jun 28, 2024
d5db2e4
chore: upgraded cli-utilities package to 1.6.3
harshithad0703 Jun 28, 2024
6000534
Merge pull request #1448 from contentstack/fix/DX-809-marketplace-ver…
harshithad0703 Jun 28, 2024
d25ed1d
fixed the snyk code issues
cs-raj Jul 1, 2024
490dbd2
version bump
cs-raj Jul 1, 2024
40fcae6
Merge remote-tracking branch 'origin/development' into fix/DX-787
cs-raj Jul 1, 2024
5cff427
Removed the branches test file
cs-raj Jul 1, 2024
58a6e11
removed the js changes and removed pattern
cs-raj Jul 1, 2024
b2f760c
pr fixes
cs-raj Jul 1, 2024
4b8c0c2
Merge pull request #1450 from contentstack/fix/DX-787
cs-raj Jul 1, 2024
82f703a
Merge branch 'development' of github.com:contentstack/cli into next-f…
shafeeqd959 Jul 1, 2024
28d3846
Merge branch 'development' of github.com:contentstack/cli into next-f…
shafeeqd959 Jul 1, 2024
548dcf4
merged latest cli changes
shafeeqd959 Jul 1, 2024
5ffd2cd
updated config
shafeeqd959 Jul 1, 2024
c80e9a5
Merge branch 'next-feature-update' of github.com:contentstack/cli int…
shafeeqd959 Jul 8, 2024
ac956ce
Merge branch 'development' of github.com:contentstack/cli into next-f…
shafeeqd959 Jul 8, 2024
791b437
Merge remote-tracking branch 'upstream/next-feature-update' into late…
shafeeqd959 Jul 8, 2024
a2265e1
fixed mapper folder creation for projects
shafeeqd959 Jul 12, 2024
5205b27
Merge branch 'development' of github.com:contentstack/cli into next-f…
shafeeqd959 Jul 12, 2024
75b08a5
Merge remote-tracking branch 'upstream/next-feature-update' into late…
shafeeqd959 Jul 12, 2024
ba1fcb1
Merge branch 'development' of github.com:contentstack/cli into next-f…
shafeeqd959 Jul 23, 2024
2d5c40a
updated message
shafeeqd959 Jul 23, 2024
7989b77
latest change
shafeeqd959 Aug 12, 2024
9e7d300
personalize api update for contentype attachment
shafeeqd959 Aug 16, 2024
7216afb
cma config check in adapter
shafeeqd959 Aug 16, 2024
a311b2e
axios upgraded
shafeeqd959 Aug 19, 2024
19f016d
Merge pull request #1519 from contentstack/feat/DX-1130,DX-1133
shafeeqd959 Aug 19, 2024
c0508c5
merged changes
shafeeqd959 Aug 20, 2024
aabcd37
changes
shafeeqd959 Aug 20, 2024
7748f2d
removed secrets scan
shafeeqd959 Aug 21, 2024
514b944
Merge branch 'development' of github.com:contentstack/cli into next-f…
shafeeqd959 Aug 21, 2024
6d2f4c6
latest updates
shafeeqd959 Aug 22, 2024
9757f3a
Merge branch 'staging' of github.com:contentstack/cli into next-featu…
shafeeqd959 Aug 28, 2024
c9fcaa9
updated code to check environment support/ provided the url for perso…
shafeeqd959 Aug 28, 2024
8ab75df
bumped version
shafeeqd959 Aug 28, 2024
fe2d737
Merge branch 'staging' of github.com:contentstack/cli into next-featu…
shafeeqd959 Sep 5, 2024
ea62b3e
lastest changes
shafeeqd959 Sep 5, 2024
3726f57
Merge branch 'staging' of github.com:contentstack/cli into next-featu…
shafeeqd959 Sep 5, 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
Empty file modified README.md
100755 → 100644
shafeeqd959 marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
2,978 changes: 626 additions & 2,352 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/contentstack-command/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export interface Region {
name: string;
cma: string;
cda: string;
uiHost: string;
developerHubUrl: string;
launchHubUrl: string;
personalizeUrl: string;
launchHubUrl: string;
uiHost: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default class ExportCommand extends Command {
let exportConfig = await setupExportConfig(flags);
// Note setting host to create cma client
exportConfig.host = this.cmaHost;
exportConfig.region = this.region;
exportConfig.developerHubBaseUrl = this.developerHubUrl;
exportDir = exportConfig.cliLogsPath || exportConfig.data || exportConfig.exportDir;
const managementAPIClient: ContentstackClient = await managementSDKClient(exportConfig);
Expand Down
84 changes: 83 additions & 1 deletion packages/contentstack-export/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const config: DefaultConfig = {
'content-types',
'custom-roles',
'workflows',
'personalization',
'entries',
'labels',
'marketplace-apps',
Expand Down Expand Up @@ -143,6 +144,47 @@ const config: DefaultConfig = {
dependencies: ['locales', 'content-types'],
exportVersions: false,
},
personalization: {
baseURL: {
NA: 'https://personalization-api.contentstack.com',
},
dirName: 'personalization',
exportOrder: ['attributes', 'audiences', 'events', 'experiences'],
projects: {
dirName: 'projects',
fileName: 'projects.json',
},
attributes: {
dirName: 'attributes',
fileName: 'attributes.json',
},
audiences: {
dirName: 'audiences',
fileName: 'audiences.json',
},
events: {
dirName: 'events',
fileName: 'events.json',
},
experiences: {
dirName: 'experiences',
fileName: 'experiences.json',
},
},
variantEntry: {
serveMockData: false,
dirName: 'variants',
fileName: 'index.json',
chunkFileSize: 1,
query: {
skip: 0,
limit: 100,
include_variant: false,
include_count: true,
include_publish_details: true,
},
mockDataPath: './variant-mock-data.json',
},
extensions: {
dirName: 'extensions',
fileName: 'extensions.json',
Expand All @@ -166,7 +208,46 @@ const config: DefaultConfig = {
dirName: 'taxonomies',
fileName: 'taxonomies.json',
invalidKeys: ['updated_at', 'created_by', 'updated_by', 'stackHeaders', 'urlPath', 'created_at'],
}
},
events: {
dirName: 'events',
fileName: 'events.json',
invalidKeys: [
'updatedAt',
'createdBy',
'updatedBy',
'_id',
'createdAt',
'createdByUserName',
'updatedByUserName',
],
},
audiences: {
dirName: 'audiences',
fileName: 'audiences.json',
invalidKeys: [
'updatedAt',
'createdBy',
'updatedBy',
'_id',
'createdAt',
'createdByUserName',
'updatedByUserName',
],
},
attributes: {
dirName: 'attributes',
fileName: 'attributes.json',
invalidKeys: [
'updatedAt',
'createdBy',
'updatedBy',
'_id',
'createdAt',
'createdByUserName',
'updatedByUserName',
],
},
},
languagesCode: [
'af-za',
Expand Down Expand Up @@ -393,6 +474,7 @@ const config: DefaultConfig = {
stacks: '/stacks/',
},
preserveStackVersion: false,
personalizationEnabled: false,
fetchConcurrency: 5,
writeConcurrency: 5,
developerHubBaseUrl: '',
Expand Down
65 changes: 55 additions & 10 deletions packages/contentstack-export/src/export/modules/entries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as path from 'path';
import { ContentstackClient, FsUtility } from '@contentstack/cli-utilities';
import { LogType, Export, ExportProjects } from '@contentstack/cli-variants';

import { log, formatError, fsUtil } from '../../utils';
import { ExportConfig, ModuleClassParams } from '../../types';
import BaseClass, { ApiOptions } from './base-class';
Expand All @@ -19,17 +21,24 @@ export default class EntriesExport extends BaseClass {
batchLimit?: number;
exportVersions: boolean;
};
private variantEntries!: any;
private entriesDirPath: string;
private localesFilePath: string;
private schemaFilePath: string;
private entriesFileHelper: FsUtility;
private projectInstance: ExportProjects;
public exportVariantEntry: boolean = false;

constructor({ exportConfig, stackAPIClient }: ModuleClassParams) {
super({ exportConfig, stackAPIClient });
this.stackAPIClient = stackAPIClient;
this.exportConfig = exportConfig;
this.entriesConfig = exportConfig.modules.entries;
this.entriesDirPath = path.resolve(sanitizePath(exportConfig.data), sanitizePath(exportConfig.branchName || ''), sanitizePath(this.entriesConfig.dirName));
this.entriesDirPath = path.resolve(
sanitizePath(exportConfig.data),
sanitizePath(exportConfig.branchName || ''),
sanitizePath(this.entriesConfig.dirName),
);
this.localesFilePath = path.resolve(
sanitizePath(exportConfig.data),
sanitizePath(exportConfig.branchName || ''),
Expand All @@ -42,6 +51,7 @@ export default class EntriesExport extends BaseClass {
sanitizePath(exportConfig.modules.content_types.dirName),
'schema.json',
);
this.projectInstance = new ExportProjects(this.exportConfig);
}

async start() {
Expand All @@ -53,13 +63,26 @@ export default class EntriesExport extends BaseClass {
log(this.exportConfig, 'No content types found to export entries', 'info');
return;
}

// NOTE Check if variant is enabled in specific stack
if (this.exportConfig.personalizationEnabled) {
let project_id;
try {
const project = await this.projectInstance.projects({ connectedStackApiKey: this.exportConfig.apiKey });

if (project && project[0]?.uid) {
project_id = project[0].uid;
this.exportVariantEntry = true;
}

this.variantEntries = new Export.VariantEntries(Object.assign(this.exportConfig, { project_id }));
} catch (error) {
log(this.exportConfig, `Failed to export variant entries ${error}`, 'error');
}
}

const entryRequestOptions = this.createRequestObjects(locales, contentTypes);
for (let entryRequestOption of entryRequestOptions) {
// log(
// this.exportConfig,
// `Starting export of entries of content type - ${entryRequestOption.contentType} locale - ${entryRequestOption.locale}`,
// 'info',
// );
await this.getEntries(entryRequestOption);
this.entriesFileHelper?.completeFile(true);
log(
Expand All @@ -71,7 +94,7 @@ export default class EntriesExport extends BaseClass {
log(this.exportConfig, 'Entries exported successfully', 'success');
} catch (error) {
log(this.exportConfig, `Failed to export entries ${formatError(error)}`, 'error');
throw new Error('Failed to export entries');
// throw new Error('Failed to export entries');
}
}

Expand Down Expand Up @@ -119,7 +142,11 @@ export default class EntriesExport extends BaseClass {

if (Array.isArray(entriesSearchResponse.items) && entriesSearchResponse.items.length > 0) {
if (options.skip === 0) {
const entryBasePath = path.join(sanitizePath(this.entriesDirPath), sanitizePath(options.contentType), sanitizePath(options.locale));
const entryBasePath = path.join(
sanitizePath(this.entriesDirPath),
sanitizePath(options.contentType),
sanitizePath(options.locale),
);
await fsUtil.makeDirectory(entryBasePath);
this.entriesFileHelper = new FsUtility({
moduleName: 'entries',
Expand All @@ -132,14 +159,29 @@ export default class EntriesExport extends BaseClass {
}
this.entriesFileHelper.writeIntoFile(entriesSearchResponse.items, { mapKeyVal: true });
if (this.entriesConfig.exportVersions) {
let versionedEntryPath = path.join(sanitizePath(this.entriesDirPath), sanitizePath(options.contentType),sanitizePath(options.locale), 'versions');
let versionedEntryPath = path.join(
sanitizePath(this.entriesDirPath),
sanitizePath(options.contentType),
sanitizePath(options.locale),
'versions',
);
fsUtil.makeDirectory(versionedEntryPath);
await this.fetchEntriesVersions(entriesSearchResponse.items, {
locale: options.locale,
contentType: options.contentType,
versionedEntryPath,
});
}

// NOTE Export all base entry specific 'variant entries'
if (this.exportVariantEntry) {
await this.variantEntries.exportVariantEntry({
locale: options.locale,
contentTypeUid: options.contentType,
entries: entriesSearchResponse.items,
});
}

options.skip += this.entriesConfig.limit || 100;
if (options.skip >= entriesSearchResponse.count) {
return Promise.resolve(true);
Expand All @@ -153,7 +195,10 @@ export default class EntriesExport extends BaseClass {
options: { locale: string; contentType: string; versionedEntryPath: string },
): Promise<void> {
const onSuccess = ({ response, apiData: entry }: any) => {
fsUtil.writeFile(path.join(sanitizePath(options.versionedEntryPath), sanitizePath(`${entry.uid}.json`)), response);
fsUtil.writeFile(
path.join(sanitizePath(options.versionedEntryPath), sanitizePath(`${entry.uid}.json`)),
response,
);
log(
this.exportConfig,
`Exported versioned entries of type '${options.contentType}' locale '${options.locale}'`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
ExportProjects,
ExportExperiences,
ExportEvents,
ExportAttributes,
ExportAudiences,
} from '@contentstack/cli-variants';

import { log, formatError } from '../../utils';
import { ModuleClassParams, ExportConfig } from '../../types';

export default class ExportPersonalization {
public exportConfig: ExportConfig;
constructor({ exportConfig }: ModuleClassParams) {
this.exportConfig = exportConfig;
}

async start(): Promise<void> {
try {
if (this.exportConfig.management_token) {
log(this.exportConfig, 'Skipping Personalize project export when using management token', 'info');
return;
}
await new ExportProjects(this.exportConfig).start();
if (this.exportConfig.personalizationEnabled) {
const moduleMapper = {
events: new ExportEvents(this.exportConfig),
attributes: new ExportAttributes(this.exportConfig),
audiences: new ExportAudiences(this.exportConfig),
experiences: new ExportExperiences(this.exportConfig),
};

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

for (const module of order) {
if (moduleMapper[module]) {
await moduleMapper[module].start();
} else {
log(this.exportConfig, `No implementation found for the module ${module}`, 'info');
}
}
}
} catch (error) {
this.exportConfig.personalizationEnabled = false;
log(this.exportConfig, error, 'error');
}
}
}
39 changes: 39 additions & 0 deletions packages/contentstack-export/src/types/default-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Modules } from '.';

interface AnyProperty {
[propName: string]: any;
}

export default interface DefaultConfig {
contentVersion: number;
versioning: boolean;
Expand Down Expand Up @@ -118,6 +122,22 @@ export default interface DefaultConfig {
dependencies?: Modules[];
exportVersions: boolean;
};
personalization: {
dirName: string;
baseURL: Record<string, string>;
} & AnyProperty;
variantEntry: {
dirName: string;
fileName: string;
chunkFileSize: number;
query: {
skip: number;
limit: number;
include_variant: boolean;
include_count: boolean;
include_publish_details: boolean;
} & AnyProperty;
} & AnyProperty;
extensions: {
dirName: string;
fileName: string;
Expand Down Expand Up @@ -152,6 +172,24 @@ export default interface DefaultConfig {
invalidKeys: string[];
dependencies?: Modules[];
};
events: {
dirName: string;
fileName: string;
invalidKeys: string[];
dependencies?: Modules[];
};
audiences: {
dirName: string;
fileName: string;
invalidKeys: string[];
dependencies?: Modules[];
};
attributes: {
dirName: string;
fileName: string;
invalidKeys: string[];
dependencies?: Modules[];
};
};
languagesCode: string[];
apis: {
Expand All @@ -169,6 +207,7 @@ export default interface DefaultConfig {
stacks: string;
};
preserveStackVersion: boolean;
personalizationEnabled: boolean;
fetchConcurrency: number;
writeConcurrency: number;
developerHubBaseUrl: string;
Expand Down
Loading
Loading