export.js
/**
* Ownership modes:
* IGNORE: leave user as is
* REMOVE: remove reference to user
* OVERWRITE: set user to it 
*/
Ownership modes:
IGNORE: leave user as is
REMOVE: remove reference to user
OVERWRITE: set user to it
Ownership modes : IGNORE : leave user as is REMOVE : remove reference to user OVERWRITE : set user to it
function configureOwnership() {
	for (var objectType in metaData) {
		if (!Array.isArray(metaData[objectType])) continue;
		for (var obj of metaData[objectType]) {
			if (currentExport.hasOwnProperty("_ownership") && obj.hasOwnProperty("user")) {
				if (currentExport._ownership.modeOwner == "REMOVE") {
					delete obj.user;
				}
				else if (currentExport._ownership.modeOwner == "OVERWRITE") {
					obj.user = {
						"id": currentExport._ownership.ownerId
					};
				}
			}
			if (currentExport.hasOwnProperty("_ownership") && obj.hasOwnProperty("lastUpdatedBy")) {
				if (currentExport._ownership.modeLastUpdated == "REMOVE") {
					delete obj.lastUpdatedBy;
				}
				else if (currentExport._ownership.modeLastUpdated == "OVERWRITE") {
					obj.lastUpdatedBy = {
						"id": currentExport._ownership.ownerId
					};
				}
			}
			if (currentExport.hasOwnProperty("_ownership") && obj.hasOwnProperty("createdBy")) {
				if (currentExport._ownership.modeCreatedBy == "REMOVE") {
					delete obj.createdBy;
				} else if (currentExport._ownership.modeCreatedBy == "OVERWRITE") {
					obj.createdBy = {
						"id": currentExport._ownership.ownerId
					}
				}
			}
		}
	}
}
function configureOwnership ( ) { for ( var objectType in metaData ) { if ( ! Array . isArray ( metaData [ objectType ] ) ) continue ; for ( var obj of metaData [ objectType ] ) { if ( currentExport . hasOwnProperty ( "_ownership" ) && obj . hasOwnProperty ( "user" ) ) { if ( currentExport . _ownership . modeOwner == "REMOVE" ) { delete obj . user ; } else if ( currentExport . _ownership . modeOwner == "OVERWRITE" ) { obj . user = { "id" : currentExport . _ownership . ownerId } ; } } if ( currentExport . hasOwnProperty ( "_ownership" ) && obj . hasOwnProperty ( "lastUpdatedBy" ) ) { if ( currentExport . _ownership . modeLastUpdated == "REMOVE" ) { delete obj . lastUpdatedBy ; } else if ( currentExport . _ownership . modeLastUpdated == "OVERWRITE" ) { obj . lastUpdatedBy = { "id" : currentExport . _ownership . ownerId } ; } } if ( currentExport . hasOwnProperty ( "_ownership" ) && obj . hasOwnProperty ( "createdBy" ) ) { if ( currentExport . _ownership . modeCreatedBy == "REMOVE" ) { delete obj . createdBy ; } else if ( currentExport . _ownership . modeCreatedBy == "OVERWRITE" ) { obj . createdBy = { "id" : currentExport . _ownership . ownerId } } } } } }
Ownership modes:
IGNORE: leave user as is
REMOVE: remove reference to user
OVERWRITE: set user to it
Ownership modes : IGNORE : leave user as is REMOVE : remove reference to user OVERWRITE : set user to it
//It not iterable, skip //For each object of objectType //Set ownersip, if applicable