Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createBodyOfPostStorage(folderId, fileName) {
// create a new storage for the ouput item version
let createStorage = new CreateStorage();
let storageRelationshipsTargetData = new StorageRelationshipsTargetData("folders", folderId);
let storageRelationshipsTarget = new StorageRelationshipsTarget;
let createStorageDataRelationships = new CreateStorageDataRelationships();
let createStorageData = new CreateStorageData();
let createStorageDataAttributes = new CreateStorageDataAttributes();
createStorageDataAttributes.name = fileName;
storageRelationshipsTarget.data = storageRelationshipsTargetData;
createStorageDataRelationships.target = storageRelationshipsTarget;
createStorageData.relationships = createStorageDataRelationships;
createStorageData.type = 'objects';
createStorageData.attributes = createStorageDataAttributes;
createStorage.data = createStorageData;
return createStorage;
}
let createItemRelationshipsStorage = new CreateItemRelationshipsStorage();
let createItemRelationshipsStorageData = new CreateItemRelationshipsStorageData();
createItemRelationshipsStorageData.type = "objects";
createItemRelationshipsStorageData.id = storageId;
createItemRelationshipsStorage.data = createItemRelationshipsStorageData;
let createVersionDataRelationships = new CreateVersionDataRelationships();
createVersionDataRelationships.item = createVersionDataRelationshipsItem;
createVersionDataRelationships.storage = createItemRelationshipsStorage;
let baseAttributesExtensionObject = new BaseAttributesExtensionObject();
baseAttributesExtensionObject.type = versionType;
baseAttributesExtensionObject.version = "1.0";
let createStorageDataAttributes = new CreateStorageDataAttributes();
createStorageDataAttributes.name = fileName;
createStorageDataAttributes.extension = baseAttributesExtensionObject;
let createVersionData = new CreateVersionData();
createVersionData.type = "versions";
createVersionData.attributes = createStorageDataAttributes;
createVersionData.relationships = createVersionDataRelationships;
let createVersion = new CreateVersion();
createVersion.data = createVersionData;
return createVersion;
}