Open jgaehring opened 10 months ago
I also parameterized the Drupal meta fields on the transformD9Schema
function, so you can pass it an optional second parameter, which is an object with the attributes and relationships you want to remove from the schema, something like this:
const exclude = {
attributes: [
'created',
'changed',
'drupal_internal__id',
'drupal_internal__revision_id',
'langcode',
'revision_created',
'revision_log_message',
'default_langcode',
'revision_translation_affected',
'revision_default',
],
relationships: ['revision_user', 'uid'],
};
const dedrupalizedSchema = transformD9Schema(drupalificSchema, exclude);
The ones above there are the defaults if you don't pass the parameter. If you do pass a parameter, only the ones you explicitly list will be removed; in other words, your exclude
replaces the default exclude
, it doesn't add to it. If Drupal was consistent and always used that drupal_internal__
prefix this could probably be done with some regex or something more subtle, but alas...
There are some other ways those meta fields are used internally, such as in transformRemoteEntity
, which does a similar operation on the actual data, but at the same time plucks information from the Drupal meta data, transforms and moves it to a dedicated meta
property, outside of attributes
and relationships
, so properties like created
, the internal drupal_internal__id
and drupal_internal__revision_id
are not lost but can still be used for the purposes of syncing and subrequests and what have you. So just be mindful, @duarteoctavio, you could introduce some bugs if you combine usage of transformD9Schema
with normal usage of farm.log.fetch()
or farm.log.update()
. Hopefully not, but I haven't tested it.
@duarteoctavio, if this looks good to you, I can merge and tag it as 2.0.0-beta.16.