Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function constructActivityEventData(activity) {
const hydraActivity = Object.assign({}, activity);
hydraActivity.actorId = base64.encode(`ciscospark://us/PEOPLE/${activity.actor.id}`);
// Base64 encode uuids
hydraActivity.id = base64.encode(`ciscospark://us/MESSAGE/${activity.id}`);
hydraActivity.roomId = base64.encode(`ciscospark://us/ROOM/${activity.target.id}`);
hydraActivity.target = Object.assign({}, activity.target, {
id: base64.encode(`ciscospark://us/ROOM/${activity.target.id}`)
});
return hydraActivity;
}
export function constructActivityEventData(activity) {
const hydraActivity = Object.assign({}, activity);
hydraActivity.actorId = base64.encode(`ciscospark://us/PEOPLE/${activity.actor.id}`);
// Base64 encode uuids
hydraActivity.id = base64.encode(`ciscospark://us/MESSAGE/${activity.id}`);
hydraActivity.roomId = base64.encode(`ciscospark://us/ROOM/${activity.target.id}`);
hydraActivity.target = Object.assign({}, activity.target, {
id: base64.encode(`ciscospark://us/ROOM/${activity.target.id}`)
});
return hydraActivity;
}
export function constructActivityEventData(activity) {
const hydraActivity = Object.assign({}, activity);
hydraActivity.actorId = base64.encode(`ciscospark://us/PEOPLE/${activity.actor.id}`);
// Base64 encode uuids
hydraActivity.id = base64.encode(`ciscospark://us/MESSAGE/${activity.id}`);
hydraActivity.roomId = base64.encode(`ciscospark://us/ROOM/${activity.target.id}`);
hydraActivity.target = Object.assign({}, activity.target, {
id: base64.encode(`ciscospark://us/ROOM/${activity.target.id}`)
});
return hydraActivity;
}
export function constructActivityEventData(activity) {
const hydraActivity = Object.assign({}, activity);
hydraActivity.actorId = base64.encode(`ciscospark://us/PEOPLE/${activity.actor.id}`);
// Base64 encode uuids
hydraActivity.id = base64.encode(`ciscospark://us/MESSAGE/${activity.id}`);
hydraActivity.roomId = base64.encode(`ciscospark://us/ROOM/${activity.target.id}`);
hydraActivity.target = Object.assign({}, activity.target, {
id: base64.encode(`ciscospark://us/ROOM/${activity.target.id}`)
});
return hydraActivity;
}
export function deconstructHydraId(id) {
const payload = base64.decode(id).split('/');
return {
id: payload.pop(),
type: payload.pop()
};
}
export function constructHydraId(type, id) {
return base64.encode(`ciscospark://us/${type.toUpperCase()}/${id}`);
}
generateScopedName: (name, filename, css) => {
let componentName;
const cssHash = base64.encode(css).substring(0, 8);
const paths = filename.split('/');
let index = paths.indexOf('@ciscospark');
if (index === -1) {
index = paths.indexOf('@webex');
}
if (index !== -1) {
componentName = paths[index + 1];
}
else {
componentName = filename;
}
return `${componentName}__${name}__${cssHash}`;
}
export function deconstructHydraId(id) {
const payload = base64.decode(id).split('/');
return {
id: payload.pop(),
type: payload.pop()
};
}
export function constructHydraId(type, id) {
return base64.encode(`ciscospark://us/${type.toUpperCase()}/${id}`);
}