Skip to content

Commit fd3f866

Browse files
committed
feat(cli): add an option to dump the model without any item id references.
1 parent ae357c5 commit fd3f866

4 files changed

Lines changed: 94 additions & 43 deletions

File tree

components/cli/CHANGELOG.md

Lines changed: 66 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,119 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [5.10.0]
6+
7+
- add an option to dump the model without any item id references.
8+
9+
## [5.9.3]
10+
11+
- bump libs and schema lib to 5.2.
12+
13+
## [5.9.2]
14+
15+
- bump libs and schema lib to 5.1.
16+
17+
## [5.9.1]
18+
19+
- added more errors on the serve command when authentication is failing.
20+
21+
## [5.9.0]
22+
23+
- piece name are now maintained in the content model dump.
24+
25+
## [5.8.2]
26+
27+
- move a log to a debug log.
28+
29+
## [5.8.1]
30+
31+
- allow relative path in bynary uploads.
32+
33+
## [5.8.0]
34+
35+
- update libs.
36+
- use new js-api-client.
37+
- handle file uploads in extra mutations.
38+
539
## [5.7.6]
640

7-
- adds codes to messages that are streamed to FE while tenant is being updated with selected template
41+
- adds codes to messages that are streamed to FE while tenant is being updated with selected template.
842

943
## [5.7.5]
1044

1145
- schema 4.0.0
12-
- compatible with Mass Operations for Customers
46+
- compatible with Mass Operations for Customers.
1347

1448
## [5.7.4]
1549

16-
- replace all iteration of the placeholders in the install process
50+
- replace all iteration of the placeholders in the install process.
1751

1852
## [5.7.3]
1953

20-
- Enable CORS
54+
- Enable CORS.
2155

2256
## [5.7.2]
2357

24-
- Expose the Crystallize Env in the web server default response
58+
- Expose the Crystallize Env in the web server default response.
2559

2660
## [5.7.1]
2761

28-
- simplify building
62+
- simplify building.
2963

3064
## [5.7.0]
3165

32-
- expose the CLI enroll command
33-
- add the enroll command
66+
- expose the CLI enroll command.
67+
- add the enroll command.
3468

3569
## [5.6.0]
3670

37-
- bumping libs
71+
- bumping libs.
3872

3973
## [5.5.0]
4074

41-
- bump Bun version to 1.2.4
42-
- call the bashcompinit if complete does not exist in the shell for autocompletion
75+
- bump Bun version to 1.2.4.
76+
- call the bashcompinit if complete does not exist in the shell for autocompletion.
4377

4478
## [5.4.6]
4579

46-
- really fixing typo introduced in 5.4.4
80+
- really fixing typo introduced in 5.4.4.
4781

4882
## [5.4.5]
4983

50-
- fix typo introduced in 5.4.4
84+
- fix typo introduced in 5.4.4.
5185

5286
## [5.4.4]
5387

54-
- adding the product configurator boilerplate
55-
- a bit more messages on the install trace
88+
- adding the product configurator boilerplate.
89+
- a bit more messages on the install trace.
5690

5791
## [5.4.3]
5892

59-
- fix the completion file
60-
- add documentation
61-
- add doc command
93+
- fix the completion file.
94+
- add documentation.
95+
- add doc command.
6296

6397
## [5.4.2]
6498

65-
- add the Furnitut boilerplate
99+
- add the Furnitut boilerplate.
66100

67101
## [5.4.1]
68102

69-
- Fix duplicates in the content model dump
103+
- Fix duplicates in the content model dump.
70104

71105
## [5.4.0]
72106

73-
- add a command to upload assets
74-
- add a command to execute mutations with dependencies
107+
- add a command to upload assets.
108+
- add a command to execute mutations with dependencies.
75109

76110
## [5.3.0]
77111

78-
- fix tenantId that was not setup on the .env file after installation
79-
- add discovery api tenant ignition
112+
- fix tenantId that was not setup on the .env file after installation.
113+
- add discovery api tenant ignition.
80114

81115
## [5.2.2]
82116

83-
- fix bug introduced in the 5.2.1 for tenant create command
117+
- fix bug introduced in the 5.2.1 for tenant create command.
84118

85119
## [5.2.1]
86120

@@ -91,7 +125,7 @@ All notable changes to this project will be documented in this file.
91125
### Added
92126

93127
- new boilerplates
94-
- dump content model as Mass Operations
128+
- dump content model as Mass Operations.
95129
- create invite(s) command.
96130
- get Shop Auth token command.
97131
- get Static Auth token command.
@@ -108,17 +142,17 @@ All notable changes to this project will be documented in this file.
108142
- `CHANGELOG.md` file is not present and can be used.
109143
- add the `changelog` command.
110144
- script completion file is installed on program run, and the install bash is reloading the SHELL.
111-
- create tenant command
145+
- create tenant command.
112146

113147
### Changed
114148

115-
- revamped the command organization. (BC)
149+
- revamped the command organization. (BC).
116150

117151
## [5.0.1]
118152

119153
### Added
120154

121-
- (internal) Make it work on the Crystallize Staging environement
155+
- (internal) Make it work on the Crystallize Staging environement.
122156

123157
## [5.0.0]
124158

@@ -133,9 +167,9 @@ This is the new version that will live in the future, built on top of Bun.js it
133167

134168
## [4.x]
135169

136-
The 4.x version called `@crystallize/cli-next`, hosted in NPMJS is now deprecated, it was mainly used to install boilerplates, dump and import
137-
tenant data. It was using `@crystallize/import-utilities` which is now deprecated in favor of Mass Operation
170+
The 4.x version called `@crystallize/cli-next`, hosted in NPMJS is now deprecated, it was mainly used to install boilerplates, dump and import.
171+
tenant data. It was using `@crystallize/import-utilities` which is now deprecated in favor of Mass Operation.
138172

139173
## [3.x]
140174

141-
The 3.x version called `@crystallize/cli`, hosted in NPMJS is now deprecated, it was mainly used to install old-legacy boilerplates
175+
The 3.x version called `@crystallize/cli`, hosted in NPMJS is now deprecated, it was mainly used to install old-legacy boilerplates.

components/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@crystallize/cli",
3-
"version": "5.9.3",
3+
"version": "5.10.0",
44
"description": "Crystallize CLI",
55
"module": "src/index.ts",
66
"repository": "https://github.com/CrystallizeAPI/crystallize-cli",

components/cli/src/command/mass-operation/dump-content-model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const createDumpContentModelMassOperationCommand = ({
2424
command.description('Create a valid Mass Operation file on your machine.');
2525
command.addArgument(new Argument('<tenant-identifier>', 'The tenant identifier to use.'));
2626
command.addArgument(new Argument('<file>', 'The file that will contains the Operations.'));
27+
command.addOption(new Option('--no-item-ids', 'Remove all reference to exising itemId. (like for Quick Select)'));
2728
command.addOption(new Option('-f, --force', 'Force and override the file it it exits.'));
2829
addInteractiveAndTokenOption(command);
2930

@@ -41,6 +42,7 @@ export const createDumpContentModelMassOperationCommand = ({
4142
const intent = queryBus.createQuery('CreateContentModelMassOperationFile', {
4243
tenantIdentifier,
4344
credentials,
45+
withItemIds: flags.itemIds,
4446
});
4547
const { result } = await queryBus.dispatch(intent);
4648
if (!result) {

components/cli/src/domain/use-cases/create-content-model-mass-operation.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Deps = {
2323
type Query = {
2424
tenantIdentifier: string;
2525
credentials: PimCredentials;
26+
withItemIds?: boolean;
2627
};
2728

2829
export type CreateContentModelMassOperationFileHandlerDefinition = QueryHandlerDefinition<
@@ -33,7 +34,7 @@ export type CreateContentModelMassOperationFileHandlerDefinition = QueryHandlerD
3334

3435
const handler = async (envelope: Envelope<Query>, deps: Deps) => {
3536
const { createCrystallizeClient } = deps;
36-
const { tenantIdentifier, credentials } = envelope.message;
37+
const { tenantIdentifier, credentials, withItemIds } = envelope.message;
3738

3839
const client = await createCrystallizeClient({
3940
tenantIdentifier: tenantIdentifier,
@@ -246,6 +247,20 @@ const handler = async (envelope: Envelope<Query>, deps: Deps) => {
246247
},
247248
};
248249
}
250+
if (component.type === 'itemRelations') {
251+
const config = component.config as ItemRelationsConfig;
252+
return {
253+
[component.type]: {
254+
...config,
255+
...(config.quickSelect && {
256+
quickSelect: {
257+
...config.quickSelect,
258+
folders: withItemIds === false ? [] : config.quickSelect.folders,
259+
},
260+
}),
261+
},
262+
};
263+
}
249264
return {
250265
[component.type]: component.config,
251266
};
@@ -390,15 +405,15 @@ const handler = async (envelope: Envelope<Query>, deps: Deps) => {
390405
})) || [],
391406
...(shape.type === 'product'
392407
? {
393-
variantComponents:
394-
shape.variantComponents?.map((component) => ({
395-
id: component.id,
396-
type: component.type,
397-
name: component.name,
398-
description: component.description,
399-
config: mapConfig(component),
400-
})) || [],
401-
}
408+
variantComponents:
409+
shape.variantComponents?.map((component) => ({
410+
id: component.id,
411+
type: component.type,
412+
name: component.name,
413+
description: component.description,
414+
config: mapConfig(component),
415+
})) || [],
416+
}
402417
: {}),
403418
});
404419
}

0 commit comments

Comments
 (0)