I’m checking this on a Spring’19 v45 Sandbox in Execute Anonymous:
[ select Id from AuraDefinitionBundle ] // ==> works fine! [ select Id from AuraDefinition ] // ==> flawless!
I would have strongly expected, that the new LWC will be mapped as the same way as Aura, Apex, Visualforce and StaticResources are mapped into the database. Just as a consistent behavior of the platform. But as a great unfortunate, those lines do FAIL:
[ select Id from LightningComponentBundle ] // ==> Invalid type: Schema.LightningComponentBundle [ select Id from LightningComponentResource ] // ==> Invalid type: Schema.LightningComponentResource
Question
Is this just because the stuff is too NEW and not 100% completed or has Salesforce now decided against mirroring these Metadata into the database for good? Are we forced to use Metadata-api and Tooling-api just for reading these resources?? This would be not nice.
For sure, I would like to get LightningComponentBundle and LightningComponentResource mapped into the database.
Will this come later? Or am I doing something wrong?
Answer
Via twitter, it sounds like they have added a work item to expose this functionality in a future release.
https://twitter.com/tahir_farhan/status/1085939366764134401?s=09
Cool. Let us get to work on that. FYI, W-4277797 is the work number we are using to track. You can reference it in future conversations. Thanks
Farhan Tahir
Attribution
Source : Link , Question Author : Uwe Heim , Answer Author : Daniel Ballinger