"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.versionMetadataFromResource = versionMetadataFromResource;
/**
 * Returns an IVersionMetadata from the resource search result item
 * @param resource
 * @private
 */
function versionMetadataFromResource(resource) {
    // we get access, path, and size from the resource itself
    const { access, resource: path, size } = resource;
    // the rest is on properties as a json string
    let properties;
    const propertiesJson = resource.properties || "{}";
    try {
        properties = JSON.parse(propertiesJson);
    }
    catch (_e) {
        properties = {};
    }
    return Object.assign(Object.assign({}, properties), { access,
        path,
        size });
}
//# sourceMappingURL=versionMetadataFromResource.js.map