@salesforce/plugin-bre-to-cml 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/LICENSE.txt +206 -0
  2. package/README.md +158 -0
  3. package/lib/commands/cml/convert/prod-cfg-rules.d.ts +29 -0
  4. package/lib/commands/cml/convert/prod-cfg-rules.js +226 -0
  5. package/lib/commands/cml/convert/prod-cfg-rules.js.map +1 -0
  6. package/lib/commands/cml/import/as-expression-set.d.ts +18 -0
  7. package/lib/commands/cml/import/as-expression-set.js +184 -0
  8. package/lib/commands/cml/import/as-expression-set.js.map +1 -0
  9. package/lib/index.d.ts +2 -0
  10. package/lib/index.js +17 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/shared/bre-rules-generator.d.ts +20 -0
  13. package/lib/shared/bre-rules-generator.js +497 -0
  14. package/lib/shared/bre-rules-generator.js.map +1 -0
  15. package/lib/shared/cml.d.ts +2 -0
  16. package/lib/shared/cml.js +13 -0
  17. package/lib/shared/cml.js.map +1 -0
  18. package/lib/shared/constants/constants.d.ts +94 -0
  19. package/lib/shared/constants/constants.js +109 -0
  20. package/lib/shared/constants/constants.js.map +1 -0
  21. package/lib/shared/grouping.d.ts +4 -0
  22. package/lib/shared/grouping.js +88 -0
  23. package/lib/shared/grouping.js.map +1 -0
  24. package/lib/shared/models.d.ts +65 -0
  25. package/lib/shared/models.js +2 -0
  26. package/lib/shared/models.js.map +1 -0
  27. package/lib/shared/pcm-generator.d.ts +57 -0
  28. package/lib/shared/pcm-generator.js +418 -0
  29. package/lib/shared/pcm-generator.js.map +1 -0
  30. package/lib/shared/pcm-products.d.ts +14 -0
  31. package/lib/shared/pcm-products.js +125 -0
  32. package/lib/shared/pcm-products.js.map +1 -0
  33. package/lib/shared/pcm-products.types.d.ts +99 -0
  34. package/lib/shared/pcm-products.types.js +2 -0
  35. package/lib/shared/pcm-products.types.js.map +1 -0
  36. package/lib/shared/types/association.d.ts +15 -0
  37. package/lib/shared/types/association.js +64 -0
  38. package/lib/shared/types/association.js.map +1 -0
  39. package/lib/shared/types/base/annotated-cml-element-w-attributes.d.ts +10 -0
  40. package/lib/shared/types/base/annotated-cml-element-w-attributes.js +36 -0
  41. package/lib/shared/types/base/annotated-cml-element-w-attributes.js.map +1 -0
  42. package/lib/shared/types/base/annotated-cml-element.d.ts +9 -0
  43. package/lib/shared/types/base/annotated-cml-element.js +39 -0
  44. package/lib/shared/types/base/annotated-cml-element.js.map +1 -0
  45. package/lib/shared/types/base/types.d.ts +2 -0
  46. package/lib/shared/types/base/types.js +18 -0
  47. package/lib/shared/types/base/types.js.map +1 -0
  48. package/lib/shared/types/cml-attribute.d.ts +17 -0
  49. package/lib/shared/types/cml-attribute.js +84 -0
  50. package/lib/shared/types/cml-attribute.js.map +1 -0
  51. package/lib/shared/types/cml-constraint.d.ts +50 -0
  52. package/lib/shared/types/cml-constraint.js +277 -0
  53. package/lib/shared/types/cml-constraint.js.map +1 -0
  54. package/lib/shared/types/cml-domain.d.ts +25 -0
  55. package/lib/shared/types/cml-domain.js +132 -0
  56. package/lib/shared/types/cml-domain.js.map +1 -0
  57. package/lib/shared/types/cml-model.d.ts +39 -0
  58. package/lib/shared/types/cml-model.js +153 -0
  59. package/lib/shared/types/cml-model.js.map +1 -0
  60. package/lib/shared/types/cml-relation.d.ts +31 -0
  61. package/lib/shared/types/cml-relation.js +118 -0
  62. package/lib/shared/types/cml-relation.js.map +1 -0
  63. package/lib/shared/types/cml-type.d.ts +22 -0
  64. package/lib/shared/types/cml-type.js +111 -0
  65. package/lib/shared/types/cml-type.js.map +1 -0
  66. package/lib/shared/types/sobject.d.ts +13 -0
  67. package/lib/shared/types/sobject.js +2 -0
  68. package/lib/shared/types/sobject.js.map +1 -0
  69. package/lib/shared/types/types.d.ts +8 -0
  70. package/lib/shared/types/types.js +24 -0
  71. package/lib/shared/types/types.js.map +1 -0
  72. package/lib/shared/utils/association.utils.d.ts +61 -0
  73. package/lib/shared/utils/association.utils.js +175 -0
  74. package/lib/shared/utils/association.utils.js.map +1 -0
  75. package/lib/shared/utils/common.utils.d.ts +191 -0
  76. package/lib/shared/utils/common.utils.js +338 -0
  77. package/lib/shared/utils/common.utils.js.map +1 -0
  78. package/messages/call.external.service.md +20 -0
  79. package/messages/cml.convert.prod-cfg-rules.md +59 -0
  80. package/messages/cml.import.as-expression-set.md +32 -0
  81. package/messages/connect.org.md +19 -0
  82. package/messages/hello.world.md +29 -0
  83. package/oclif.lock +8313 -0
  84. package/oclif.manifest.json +209 -0
  85. package/package.json +227 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,206 @@
1
+ Apache License Version 2.0
2
+
3
+ Copyright (c) 2025 Salesforce, Inc.
4
+ All rights reserved.
5
+
6
+ Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "{}"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright {yyyy} {name of copyright owner}
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # plugin-bre-to-cml
2
+
3
+ [![NPM](https://img.shields.io/npm/v/@salesforce/plugin-agent.svg?label=@salesforce/plugin-agent)](https://www.npmjs.com/package/@salesforce/plugin-bre-to-cml) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/plugin-bre-to-cml.svg)](https://npmjs.org/package/@salesforce/plugin-bre-to-cml) [![License](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://opensource.org/license/apache-2-0)
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ sf plugins install @salesforce/plugin-bre-to-cml@x.y.z
9
+ ```
10
+
11
+ ## Contributing
12
+
13
+ 1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
14
+ 2. Create a new issue before starting your project so that we can keep track of
15
+ what you are trying to add/fix. That way, we can also offer suggestions or
16
+ let you know if there is already an effort in progress.
17
+ 3. Fork this repository.
18
+ 4. [Build the plugin locally](#build)
19
+ 5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
20
+ 6. Edit the code in your fork.
21
+ 7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
22
+ 8. Sign CLA (see [CLA](#cla) below).
23
+ 9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
24
+
25
+ ### CLA
26
+
27
+ External contributors will be required to sign a Contributor's License
28
+ Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
29
+
30
+ ### Build
31
+
32
+ To build the plugin locally, make sure to have yarn installed and run the following commands:
33
+
34
+ ```bash
35
+ # Clone the repository
36
+ git clone git@github.com:salesforcecli/plugin-bre-to-cml
37
+
38
+ # Install the dependencies and compile
39
+ yarn install
40
+ yarn build
41
+ ```
42
+
43
+ To use your plugin, run using the local `./bin/dev.js` or `./bin/dev.cmd` file.
44
+
45
+ ```bash
46
+ # Run using local run file.
47
+ ./bin/dev cml
48
+ ```
49
+
50
+ There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
51
+
52
+ ```bash
53
+ # Link your plugin to the sf cli
54
+ sf plugins link .
55
+ # To verify
56
+ sf plugins
57
+ ```
58
+
59
+ ## Commands
60
+
61
+ <!-- commands -->
62
+
63
+ - [`sf cml convert prod-cfg-rules`](#sf-cml-convert-prod-cfg-rules)
64
+ - [`sf cml import as-expression-set`](#sf-cml-import-as-expression-set)
65
+
66
+ ## `sf cml convert prod-cfg-rules`
67
+
68
+ Converts BRE based Standard Configurator rules represented as JSON to CML and saves it as a pair of CML and association files.
69
+
70
+ ```
71
+ USAGE
72
+ $ sf cml convert prod-cfg-rules -o <value> -r <value> -c <value> [--json] [--flags-dir <value>] [--api-version <value>] [-d
73
+ <value>] [-x <value>] [-v <value>]
74
+
75
+ FLAGS
76
+ -c, --cml-api=<value> (required) Unique CML API Name to be created.
77
+ -d, --workspace-dir=<value> Directory where working files are located, exported rules JSON and where CMLs will
78
+ be created.
79
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
80
+ configuration variable is already set.
81
+ -r, --pcr-file=<value> (required) Name of the JSON file that contain exported standard Product
82
+ Configuration Rules.
83
+ -v, --products-file=<value> Name of the JSON file that contain exported Products from PCM (if not present
84
+ products will be fetched automatically).
85
+ -x, --additional-products=<value> Comma-separated list of additional product IDs for which CML types should be
86
+ generated.
87
+ --api-version=<value> Override the api version used for api requests made by this command
88
+
89
+ GLOBAL FLAGS
90
+ --flags-dir=<value> Import flag values from a directory.
91
+ --json Format output as json.
92
+
93
+ DESCRIPTION
94
+ Converts BRE based Standard Configurator rules represented as JSON to CML and saves it as a pair of CML and
95
+ association files.
96
+
97
+ Before you execute this command make sure to migrate you PCM or perform migration of rules within the same org.
98
+
99
+ Export BRE based Standard Configurator rules using sf data export bulk plugin and save results in a JSON file:
100
+ sf data export bulk -o breMigOrg --query "SELECT ApiName, ConfigurationRuleDefinition,Description, EffectiveFromDate,
101
+ EffectiveToDate, Id, IsDeleted, Name, ProcessScope, RuleSubType, RuleType, Sequence, Status FROM
102
+ ProductConfigurationRule WHERE RuleType = 'Configurator' AND ApiName = 'myTestBundle'" --output-file
103
+ ./data/ProductConfigurationRules.json --result-format json --wait 10 --all-rows
104
+
105
+ This command executes following logic:
106
+
107
+ - Read SC Rules from the json file and build a list of `ConfiguratorRuleInput` to mimic the JSON structure of
108
+ `ConfigurationRuleDefinition`
109
+ - Group rules by non-intersecting `Product2` IDs (CMLs can’t share products)
110
+ - For each group:
111
+ - Query PCM for related products (for bundle rules) or root definitions (for others)
112
+ - Build an in-memory representation of the CML
113
+ - Apply logic to build constraints
114
+ - Serialize the in-memory CML to a blob for import as an Expression Set, save it in a cml-api.cml file.
115
+ - Create `ExpressionSetConstraintObj` association records pointing to the `cml-api` name and write them to
116
+ `cml-api_associations.csv` file.
117
+ - If multiple CML and association files are produced 1-N number will be appended to the names of files.
118
+
119
+ EXAMPLES
120
+ $ sf cml convert prod-cfg-rules --pcr-file data/ProductConfigurationRules.json --cml-api MY_TEST --workspace-dir data --target-org breMigOrg
121
+ ```
122
+
123
+ ## `sf cml import as-expression-set`
124
+
125
+ Imports CML and associations to the target org
126
+
127
+ ```
128
+ USAGE
129
+ $ sf cml import as-expression-set -o <value> -x <value> -c <value> [--json] [--flags-dir <value>] [--api-version <value>] [-d
130
+ <value>]
131
+
132
+ FLAGS
133
+ -c, --cml-api=<value> (required) Unique CML API Name to be created.
134
+ -d, --workspace-dir=<value> Directory where converted CML and assocciations csv files are located.
135
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
136
+ configuration variable is already set.
137
+ -x, --context-definition=<value> (required) Context Definition name to be assocciated with the CML.
138
+ --api-version=<value> Override the api version used for api requests made by this command
139
+
140
+ GLOBAL FLAGS
141
+ --flags-dir=<value> Import flag values from a directory.
142
+ --json Format output as json.
143
+
144
+ DESCRIPTION
145
+ Imports CML and associations to the target org
146
+
147
+ Review CM created by conversion command before doing import.
148
+ This command executes following logic:
149
+ - Import one CML at a time
150
+ - Upsert the Expression Set using the `cml-api` name
151
+ - Read and upsert `ExpressionSetConstraintObj` rows from the `cml-api_associations.csv` file (resolving FKs)
152
+ - Upload the CML blob
153
+
154
+ EXAMPLES
155
+ $ sf cml import as-expression-set --cml-api MY_TEST --context-definition PricingTransactionCD2 --workspace-dir data --target-org tgtOrg
156
+ ```
157
+
158
+ <!-- commandsstop -->
@@ -0,0 +1,29 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type CmlConvertProdCfgRulesResult = {
3
+ path: string;
4
+ };
5
+ export default class CmlConvertProdCfgRules extends SfCommand<CmlConvertProdCfgRulesResult> {
6
+ static readonly summary: string;
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static readonly flags: {
10
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'pcr-file': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'cml-api': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'workspace-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'additional-products': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'products-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ };
18
+ run(): Promise<CmlConvertProdCfgRulesResult>;
19
+ /**
20
+ * Generates CML model for given products and rules.
21
+ *
22
+ * @param {Array} rulesInGroup - Array of rules for given products.
23
+ * @param {Array} productsWithIds - Array of products with ids.
24
+ * @param {string} safeApi - Safe API name of target CML.
25
+ * @param {number} index - Index of the group.
26
+ * @param {string | undefined} workspaceDir - Workspace directory.
27
+ */
28
+ private generateCmlForProductsAndRulesGroup;
29
+ }
@@ -0,0 +1,226 @@
1
+ /*
2
+ * Copyright 2025, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import * as fs from 'node:fs/promises';
17
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
+ import { Messages } from '@salesforce/core';
19
+ import { extractProductIds, groupByNonIntersectingProduct2 } from '../../../shared/grouping.js';
20
+ import { fetchProductsFromPcm, reduceProductsToRootLevelOnly } from '../../../shared/pcm-products.js';
21
+ import { BreRulesGenerator } from '../../../shared/bre-rules-generator.js';
22
+ import { PcmGenerator } from '../../../shared/pcm-generator.js';
23
+ import { BASE_LINE_ITEM_TYPE_NAME, CmlModel, CmlType } from '../../../shared/types/types.js';
24
+ import { generateCsvForAssociations } from '../../../shared/utils/association.utils.js';
25
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
26
+ const messages = Messages.loadMessages('@salesforce/plugin-bre-to-cml', 'cml.convert.prod-cfg-rules');
27
+ function newCmlModel() {
28
+ const cmlModel = new CmlModel();
29
+ const lineItemType = new CmlType(BASE_LINE_ITEM_TYPE_NAME, undefined, undefined);
30
+ cmlModel.addType(lineItemType);
31
+ return cmlModel;
32
+ }
33
+ export default class CmlConvertProdCfgRules extends SfCommand {
34
+ static summary = messages.getMessage('summary');
35
+ static description = messages.getMessage('description');
36
+ static examples = messages.getMessages('examples');
37
+ static flags = {
38
+ 'target-org': Flags.requiredOrg(),
39
+ 'api-version': Flags.orgApiVersion(),
40
+ 'pcr-file': Flags.file({
41
+ summary: messages.getMessage('flags.pcr-file.summary'),
42
+ char: 'r',
43
+ required: true,
44
+ exists: true,
45
+ }),
46
+ 'cml-api': Flags.string({
47
+ summary: messages.getMessage('flags.cml-api.summary'),
48
+ char: 'c',
49
+ required: true,
50
+ }),
51
+ 'workspace-dir': Flags.directory({
52
+ summary: messages.getMessage('flags.workspace-dir.summary'),
53
+ char: 'd',
54
+ exists: true,
55
+ }),
56
+ 'additional-products': Flags.string({
57
+ summary: messages.getMessage('flags.additional-products.summary'),
58
+ char: 'x',
59
+ exists: true,
60
+ }),
61
+ 'products-file': Flags.file({
62
+ summary: messages.getMessage('flags.products-file.summary'),
63
+ char: 'v',
64
+ exists: true,
65
+ }),
66
+ };
67
+ async run() {
68
+ const { flags } = await this.parse(CmlConvertProdCfgRules);
69
+ const api = flags['cml-api'];
70
+ const pcrFile = flags['pcr-file'];
71
+ const workspaceDir = flags['workspace-dir'];
72
+ const targetOrg = flags['target-org'];
73
+ this.log(`Using CML API: ${api}`);
74
+ this.log(`Using PCR File: ${pcrFile}`);
75
+ this.log(`Using Workspace Directory: ${workspaceDir ?? 'not specified'}`);
76
+ this.log(`Using Target Org: ${targetOrg.getUsername() ?? 'unknown'}`);
77
+ const pcrFileContents = await fs.readFile(pcrFile, 'utf8');
78
+ const pcrData = JSON.parse(pcrFileContents);
79
+ const rules = [];
80
+ for (const raw of pcrData) {
81
+ try {
82
+ const parsed = JSON.parse(raw.ConfigurationRuleDefinition);
83
+ rules.push(parsed);
84
+ }
85
+ catch {
86
+ this.warn(`❌ Failed to parse ConfigurationRuleDefinition for rule: ${raw.Name}`);
87
+ }
88
+ }
89
+ this.log(`Parsed ${rules.length} valid configuration rules`);
90
+ rules.sort((l, r) => (l.sequence ?? 0) - (r.sequence ?? 0));
91
+ const groups = groupByNonIntersectingProduct2(rules);
92
+ this.log(`Found ${groups.size} non-intersecting Product2 groups`);
93
+ const safeApi = api.replace(/[^a-zA-Z0-9_-]/g, '_');
94
+ const uniqProductIds = new Set();
95
+ const additionalProductIds = flags['additional-products']?.split(',')?.map((p) => p.trim()) ?? [];
96
+ rules
97
+ .map(extractProductIds)
98
+ .flatMap((set) => [...set])
99
+ .forEach((p) => uniqProductIds.add(p));
100
+ additionalProductIds.forEach((p) => uniqProductIds.add(p));
101
+ let products;
102
+ const productsFile = flags['products-file'];
103
+ if (productsFile) {
104
+ const prods = JSON.parse(await fs.readFile(productsFile, 'utf8'));
105
+ products = new Map(Object.entries(prods));
106
+ }
107
+ else {
108
+ const conn = targetOrg.getConnection(flags['api-version']);
109
+ products = await fetchProductsFromPcm(conn, Array.from(uniqProductIds));
110
+ }
111
+ this.log('📦 Convert products and BRE rules to CML');
112
+ /*
113
+ * We need to reduce the products to have on top level only bundle products and simple products
114
+ * that are not contained in any other bundle product structure.
115
+ *
116
+ * In example, we have products in map:
117
+ * - Laptop Pro Bundle
118
+ * - Laptop
119
+ * - Printer Bundle
120
+ * - "Some Product Not From Laptop Pro Bundle"
121
+ *
122
+ * We need to reduce it to:
123
+ * - Laptop Pro Bundle
124
+ * - "Some Product Not From Laptop Pro Bundle"
125
+ */
126
+ const rootLevelProducts = reduceProductsToRootLevelOnly(products);
127
+ const isProductIdInProductWithIds = (productId, productWithIds) => productWithIds.productIds.includes(productId) ||
128
+ productWithIds.productIds.some((pId) => pId.startsWith(productId) || productId.startsWith(pId));
129
+ const findProductWithIdsByProductIds = (productIds) => {
130
+ const result = new Set();
131
+ for (const productId of productIds) {
132
+ for (const productWithIds of rootLevelProducts.values()) {
133
+ if (isProductIdInProductWithIds(productId, productWithIds)) {
134
+ result.add(productWithIds);
135
+ break;
136
+ }
137
+ }
138
+ }
139
+ return Array.from(result);
140
+ };
141
+ /*
142
+ * Group non-intersecting rules groups by top-level products.
143
+ *
144
+ * In example, we have rules for products:
145
+ * - Rule1 - for Laptop and Mouse
146
+ * - Rule2 - for Printer and Printer Paper
147
+ * - Rule3 - for Mouse
148
+ * - Rule4 - for "Some Product Not From Laptop Pro Bundle"
149
+ *
150
+ * These rules will be grouped by top-level products:
151
+ * - Laptop Pro Bundle - Rule1, Rule2, Rule3
152
+ * - "Some Product Not From Laptop Pro Bundle" - Rule4
153
+ */
154
+ const productsWithRules = new Map();
155
+ for (const [group, rulesInGroup] of groups) {
156
+ const productIdsInGroup = group.split(',');
157
+ // Find top-level products for given rules group.
158
+ const productsForRulesInGroup = findProductWithIdsByProductIds(Array.from(productIdsInGroup));
159
+ let found = false;
160
+ for (const [targetGroupProducts, targetGroupRules] of productsWithRules) {
161
+ // If there is any product that is in both groups, then we can merge them.
162
+ if (targetGroupProducts.some((pwi) => productsForRulesInGroup.some((pwiInGroup) => isProductIdInProductWithIds(pwiInGroup.product.id, pwi)))) {
163
+ // Merge rules and products.
164
+ rulesInGroup
165
+ .filter((ruleInGroup) => !targetGroupRules.some(({ apiName }) => apiName === ruleInGroup.apiName))
166
+ .forEach((ruleInGroup) => targetGroupRules.push(ruleInGroup));
167
+ productsForRulesInGroup
168
+ .filter((pwiInGroup) => !targetGroupProducts.some((pwi) => isProductIdInProductWithIds(pwiInGroup.product.id, pwi)))
169
+ .forEach((pwiInGroup) => targetGroupProducts.push(pwiInGroup));
170
+ found = true;
171
+ break;
172
+ }
173
+ }
174
+ // If no product was found, then we can add new group.
175
+ if (!found) {
176
+ productsWithRules.set(productsForRulesInGroup, rulesInGroup);
177
+ }
178
+ }
179
+ // Generate CML for each group of products and rules.
180
+ let index = 0;
181
+ const genCmlPromises = Array.from(productsWithRules.entries()).map(([productsWithIds, rulesInGroup]) => this.generateCmlForProductsAndRulesGroup(rulesInGroup, productsWithIds, safeApi, index++, workspaceDir));
182
+ await Promise.all(genCmlPromises);
183
+ this.log('✅ Done');
184
+ return {
185
+ path: 'src/commands/cml/convert/prod-cfg-rules.ts',
186
+ };
187
+ }
188
+ /**
189
+ * Generates CML model for given products and rules.
190
+ *
191
+ * @param {Array} rulesInGroup - Array of rules for given products.
192
+ * @param {Array} productsWithIds - Array of products with ids.
193
+ * @param {string} safeApi - Safe API name of target CML.
194
+ * @param {number} index - Index of the group.
195
+ * @param {string | undefined} workspaceDir - Workspace directory.
196
+ */
197
+ async generateCmlForProductsAndRulesGroup(rulesInGroup, productsWithIds, safeApi, index, workspaceDir) {
198
+ this.log(`📦 Generating CML model for rules ${rulesInGroup.map(({ apiName }) => apiName).join(', ')}`);
199
+ const cmlModel = newCmlModel();
200
+ const modelInfo = PcmGenerator.generateViewModels(cmlModel, productsWithIds.map(({ product }) => product));
201
+ for (const type of modelInfo.types) {
202
+ modelInfo.attributes.get(type.name)?.forEach((attr) => type.addAttribute(attr));
203
+ modelInfo.relations.get(type.name)?.forEach((rel) => type.addRelation(rel));
204
+ cmlModel.addType(type);
205
+ }
206
+ for (const association of modelInfo.associations) {
207
+ cmlModel.addAssociation(association);
208
+ }
209
+ BreRulesGenerator.generateConstraints(cmlModel, rulesInGroup, {
210
+ info: (msg) => this.log(msg),
211
+ warn: (msg) => this.warn(msg),
212
+ error: (msg) => this.error(msg),
213
+ });
214
+ const cmlContent = cmlModel.generateCml();
215
+ const associationsCsvContent = generateCsvForAssociations(safeApi, cmlModel.associations);
216
+ const cmlFileName = `${safeApi}_${index}.cml`;
217
+ const associationsFileName = `${safeApi}_${index}_Associations.csv`;
218
+ const fullPath = workspaceDir ? `${workspaceDir}/${cmlFileName}` : cmlFileName;
219
+ const associationsFullPath = workspaceDir ? `${workspaceDir}/${associationsFileName}` : associationsFileName;
220
+ this.log(`📦 Writing CML content to ${cmlFileName}`);
221
+ await fs.writeFile(fullPath, cmlContent, 'utf8');
222
+ await fs.writeFile(associationsFullPath, associationsCsvContent, 'utf8');
223
+ this.log(`✅ Wrote CML to ${fullPath} with related associations to ${associationsFullPath}`);
224
+ }
225
+ }
226
+ //# sourceMappingURL=prod-cfg-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prod-cfg-rules.js","sourceRoot":"","sources":["../../../../src/commands/cml/convert/prod-cfg-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAkB,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAE7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAExF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,+BAA+B,EAAE,4BA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K,mBAAmB,CAAC;QACpE,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QAC/E,MAAM,oBAAoB,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,IAAI,oBAAoB,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC;QAE7G,IAAI,CAAC,GAAG,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAC;QAErD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,EAAE,CAAC,SAAS,CAAC,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,CAAC,CAAC;QAEzE,IAAI,CAAC,GAAG,CAAC,kBAAkB,QAAQ,iCAAiC,oBAAoB,EAAE,CAAC,CAAC;IAC9F,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type CmlImportAsExpressionSetResult = {
3
+ path: string;
4
+ };
5
+ export default class CmlImportAsExpressionSet extends SfCommand<CmlImportAsExpressionSetResult> {
6
+ static readonly summary: string;
7
+ static readonly description: string;
8
+ static readonly examples: string[];
9
+ static readonly flags: {
10
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'context-definition': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'cml-api': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'workspace-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ };
16
+ run(): Promise<CmlImportAsExpressionSetResult>;
17
+ private readCsv;
18
+ }