Skip to content

Commit 178fc3f

Browse files
authored
Sh/parse cdata (#607)
* fix: allows deployment of metadata files with cdata * chore: auto-update metadata coverage in METADATA_SUPPORT.md * fix: exclude the registry completeness test from uts
1 parent ae37250 commit 178fc3f

File tree

6 files changed

+70
-36
lines changed

6 files changed

+70
-36
lines changed

.mocharc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"require": "ts-node/register,source-map-support/register",
3+
"exclude": "test/registry/registryCompleteness.test.ts",
34
"watch-extensions": "ts",
45
"extensions": [".ts", ".js", ".json"],
56
"watch-files": ["src", "test"],

METADATA_SUPPORT.md

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This list compares metadata types found in Salesforce v54 with the [metadata reg
44

55
This repository is used by both the Salesforce CLIs and Salesforce's VSCode Extensions.
66

7-
Currently, there are 442/465 supported metadata types.
7+
Currently, there are 456/492 supported metadata types.
88
For status on any existing gaps, please search or file an issue in the [Salesforce CLI issues only repo](https://github.com/forcedotcom/cli/issues).
99
To contribute a new metadata type, please see the [Contributing Metadata Types to the Registry](./contributing/metadata.md)
1010

@@ -48,14 +48,15 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
4848
|AppointmentSchedulingPolicy|||
4949
|ApprovalProcess|||
5050
|ArchiveSettings|||
51+
|AssessmentQuestion||Not supported, but support could be added|
52+
|AssessmentQuestionSet||Not supported, but support could be added|
5153
|AssignmentRules|||
5254
|AssistantContextItem|||
5355
|AssistantDefinition|||
5456
|AssistantSkillQuickAction|||
5557
|AssistantSkillSobjectAction|||
5658
|AssistantVersion|||
5759
|AssociationEngineSettings|||
58-
|AttributeDefinition2||Not supported, but support could be added|
5960
|Audience|||
6061
|AuraDefinitionBundle|||
6162
|AuthProvider|||
@@ -69,6 +70,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
6970
|BlockchainSettings|||
7071
|Bot|||
7172
|BotSettings|||
73+
|BotTemplate||Not supported, but support could be added|
7274
|BotVersion|||
7375
|BranchManagementSettings|||
7476
|BrandingSet|||
@@ -81,6 +83,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
8183
|CallCenter|||
8284
|CallCenterRoutingMap|||
8385
|CallCoachingMediaProvider|⚠️|Supports deploy/retrieve but not source tracking|
86+
|CallCtrAgentFavTrfrDest||Not supported, but support could be added|
8487
|CampaignInfluenceModel|||
8588
|CampaignSettings|||
8689
|CanvasMetadata|||
@@ -119,6 +122,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
119122
|CorsWhitelistOrigin|||
120123
|CspTrustedSite|||
121124
|CurrencySettings|||
125+
|CustomAddressFieldSettings|||
122126
|CustomApplication|||
123127
|CustomApplicationComponent|||
124128
|CustomFeedFilter|||
@@ -142,6 +146,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
142146
|DataConnectorIngestApi|||
143147
|DataConnectorS3|||
144148
|DataDotComSettings|||
149+
|DataImportManagementSettings|||
145150
|DataMapping|||
146151
|DataMappingFieldDefinition|||
147152
|DataMappingObjectDefinition|||
@@ -150,11 +155,16 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
150155
|DataSourceObject|||
151156
|DataSourceTenant|||
152157
|DataStreamDefinition|||
158+
|DecisionMatrixDefinition|||
159+
|DecisionMatrixDefinitionVersion|||
153160
|DecisionTable|||
154161
|DecisionTableDatasetLink|||
155162
|DelegateGroup|||
156163
|DeploymentSettings|||
157164
|DevHubSettings|||
165+
|DigitalExperience|undefined|undefined|
166+
|DigitalExperienceBundle|undefined|undefined|
167+
|DigitalExperienceBundleSetting|undefined|undefined|
158168
|DiscoveryAIModel|||
159169
|DiscoveryGoal|||
160170
|DiscoverySettings|||
@@ -200,10 +210,13 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
200210
|ExperienceBundleSettings|||
201211
|ExplainabilityActionDefinition|||
202212
|ExplainabilityActionVersion|||
213+
|ExpressionSetDefinition|||
214+
|ExpressionSetDefinitionVersion|||
203215
|ExternalAIModel||Not supported, but support could be added|
204216
|ExternalCredential||Not supported, but support could be added|
205217
|ExternalDataConnector|||
206218
|ExternalDataSource|||
219+
|ExternalDataSrcDescriptor||Not supported, but support could be added|
207220
|ExternalServiceRegistration|||
208221
|ExternalServicesSettings|||
209222
|FeatureParameterBoolean|||
@@ -222,6 +235,9 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
222235
|FlowCategory|||
223236
|FlowDefinition|⚠️|Supports deploy/retrieve but not source tracking|
224237
|FlowSettings|||
238+
|FlowTest|||
239+
|ForecastingFilter||Not supported, but support could be added|
240+
|ForecastingFilterCondition||Not supported, but support could be added|
225241
|ForecastingObjectListSettings|||
226242
|ForecastingSettings|||
227243
|ForecastingSourceDefinition|||
@@ -241,19 +257,19 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
241257
|Icon|||
242258
|IdeasSettings|||
243259
|IdentityVerificationProcDef||Not supported, but support could be added|
244-
|IdentityVerificationProcDtl||Not supported, but support could be added|
245-
|IdentityVerificationProcFld||Not supported, but support could be added|
246260
|IframeWhiteListUrlSettings|||
247261
|InboundCertificate|||
248262
|InboundNetworkConnection|||
249263
|IncidentMgmtSettings|||
250264
|Index|⚠️|Supports deploy/retrieve but not source tracking|
265+
|IndustriesAutomotiveSettings|||
251266
|IndustriesLoyaltySettings|||
252267
|IndustriesManufacturingSettings|||
253268
|IndustriesSettings|||
254269
|InstalledPackage|⚠️|Supports deploy/retrieve but not source tracking|
255270
|InterestTaggingSettings|||
256271
|InternalDataConnector|||
272+
|InvLatePymntRiskCalcSettings|||
257273
|InventorySettings|||
258274
|InvocableActionSettings|||
259275
|IoTSettings|||
@@ -286,10 +302,13 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
286302
|ManagedContentType|⚠️|Supports deploy/retrieve but not source tracking|
287303
|ManagedTopics|||
288304
|MapsAndLocationSettings|||
305+
|MarketSegmentDefinition|undefined|undefined|
289306
|MarketingAppExtActivity||Not supported, but support could be added|
290307
|MarketingAppExtension||Not supported, but support could be added|
291308
|MatchingRules|||
292309
|MediaAdSalesSettings|||
310+
|MeetingsSettings|||
311+
|MessagingChannel|undefined|undefined|
293312
|MfgProgramTemplate||Not supported, but support could be added|
294313
|MilestoneType|||
295314
|MktCalcInsightObjectDef|||
@@ -340,6 +359,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
340359
|PathAssistant|||
341360
|PathAssistantSettings|||
342361
|PaymentGatewayProvider|||
362+
|PaymentsManagementEnabledSettings|||
343363
|PermissionSet|||
344364
|PermissionSetGroup|||
345365
|PermissionSetLicenseDefinition|||
@@ -376,7 +396,9 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
376396
|RecordPageSettings|||
377397
|RecordType|||
378398
|RedirectWhitelistUrl|||
399+
|RegisteredExternalService||Not supported, but support could be added|
379400
|RelatedRecordAssocCriteria||Not supported, but support could be added|
401+
|RelationshipGraphDefinition||Not supported, but support could be added|
380402
|RemoteSiteSetting|||
381403
|Report|||
382404
|ReportFolder|||
@@ -387,6 +409,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
387409
|SalesAgreementSettings|||
388410
|SalesWorkQueueSettings|||
389411
|SamlSsoConfig|||
412+
|SchedulingObjective|undefined|undefined|
390413
|SchedulingRule|||
391414
|SchemaSettings|||
392415
|ScoreCategory||Not supported, but support could be added|
@@ -419,6 +442,8 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
419442
|StandardValueSetTranslation|||
420443
|StaticResource|||
421444
|StnryAssetEnvSrcCnfg|||
445+
|StreamingAppDataConnector||Not supported, but support could be added|
446+
|SubscriptionManagementSettings|||
422447
|SurveySettings|||
423448
|SvcCatalogCategory|||
424449
|SvcCatalogFulfillmentFlow|||
@@ -451,6 +476,8 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
451476
|VehicleAssetEmssnSrcCnfg|||
452477
|ViewDefinition|||
453478
|VirtualVisitConfig||Not supported, but support could be added|
479+
|VoiceSettings|||
480+
|WarrantyLifecycleMgmtSettings|||
454481
|WaveApplication|||
455482
|WaveComponent|||
456483
|WaveDashboard|||
@@ -483,37 +510,6 @@ v55 introduces the following new types. Here's their current level of support
483510

484511
|Metadata Type|Support|Notes|
485512
|:---|:---|:---|
486-
|AssessmentQuestion||Not supported, but support could be added|
487-
|AssessmentQuestionSet||Not supported, but support could be added|
488-
|BotTemplate||Not supported, but support could be added|
489-
|CallCtrAgentFavTrfrDest||Not supported, but support could be added|
490-
|ConvReasonReportDefinition||Not supported, but support could be added|
491-
|ConvReasonReportSegmentDef||Not supported, but support could be added|
492-
|CustomAddressFieldSettings|||
493-
|DataImportManagementSettings|||
494-
|DecisionMatrixDefinition|||
495-
|DecisionMatrixDefinitionVersion|||
496-
|DigitalExperience|undefined|undefined|
497-
|DigitalExperienceBundle|undefined|undefined|
498-
|DigitalExperienceBundleSetting|undefined|undefined|
499-
|ExpressionSetDefinition|||
500-
|ExpressionSetDefinitionVersion|||
501-
|ExternalDataSrcDescriptor||Not supported, but support could be added|
502-
|FlowTest|||
503-
|ForecastingFilter||Not supported, but support could be added|
504-
|ForecastingFilterCondition||Not supported, but support could be added|
505-
|IndustriesAutomotiveSettings|||
506-
|InvLatePymntRiskCalcSettings|||
507-
|MarketSegmentDefinition|undefined|undefined|
508-
|MeetingsSettings|||
509-
|MessagingChannel|undefined|undefined|
510-
|PaymentsManagementEnabledSettings|||
511-
|RegisteredExternalService||Not supported, but support could be added|
512-
|SchedulingObjective|undefined|undefined|
513-
|StreamingAppDataConnector||Not supported, but support could be added|
514-
|SubscriptionManagementSettings|||
515-
|VoiceSettings|||
516-
|WarrantyLifecycleMgmtSettings|||
517513

518514
## Additional Types
519515

src/convert/streams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export class JsToXml extends Readable {
282282
}
283283

284284
public _read(): void {
285-
const js2Xml = new j2xParser({ format: true, indentBy: ' ', ignoreAttributes: false });
285+
const js2Xml = new j2xParser({ format: true, indentBy: ' ', ignoreAttributes: false, cdataTagName: '__cdata' });
286286
const xmlContent = XML_DECL.concat(js2Xml.parse(this.xmlObject));
287287
this.push(xmlContent);
288288
this.push(null);

src/resolve/sourceComponent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export class SourceComponent implements MetadataComponent {
221221
const parsed = parse(contents.toString(), {
222222
ignoreAttributes: false,
223223
parseNodeValue: false,
224+
cdataTagName: '__cdata',
224225
}) as T;
225226
const [firstElement] = Object.keys(parsed);
226227
if (firstElement === this.type.name) {

test/convert/streams.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,26 @@ describe('Streams', () => {
516516

517517
expect(jsToXml.read().toString()).to.be.equal(expectedBody);
518518
});
519+
520+
it('should transform js object with cdata to xml string', () => {
521+
const xmlObj = {
522+
TestType: {
523+
[XML_NS_KEY]: XML_NS_URL,
524+
foo: 'bar',
525+
value: { __cdata: '<p>Hello</p>' },
526+
},
527+
};
528+
const jsToXml = new streams.JsToXml(xmlObj);
529+
let expectedBody = XML_DECL;
530+
expectedBody += `<TestType xmlns="${XML_NS_URL}">\n`;
531+
expectedBody += ' <foo>bar</foo>\n';
532+
expectedBody += ' <value>\n';
533+
expectedBody += '<![CDATA[<p>Hello</p>]]>\n';
534+
expectedBody += ' </value>\n';
535+
expectedBody += '</TestType>\n';
536+
537+
expect(jsToXml.read().toString()).to.be.equal(expectedBody);
538+
});
519539
});
520540

521541
describe('stream2buffer', () => {

test/resolve/sourceComponent.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,22 @@ describe('SourceComponent', () => {
206206
expect(result).to.deep.equal(expected);
207207
});
208208

209+
it('should parse cdata node values', async () => {
210+
const component = COMPONENT;
211+
env
212+
.stub(component.tree, 'readFile')
213+
.resolves(Buffer.from('<MatchingContentFile><test><![CDATA[<p>Hello</p>]]></test></MatchingContentFile>'));
214+
215+
const result = await component.parseXml();
216+
const expected = {
217+
MatchingContentFile: {
218+
test: { __cdata: '<p>Hello</p>' },
219+
},
220+
};
221+
222+
expect(result).to.deep.equal(expected);
223+
});
224+
209225
it('should parse attributes of nodes', async () => {
210226
const component = COMPONENT;
211227
env

0 commit comments

Comments
 (0)