Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
intents.form.changeEmail.map(email => assoc("email", email)), // --//--
intents.form.register.map((_) => always(seeds.form.input)) // reset `form`
}
}
const entityCreated = await executeWrite(async wTx => {
logger.debug(`[GRAKN - infer: false] createEntity > ${query}`);
const iterator = await wTx.tx.query(query);
const txEntity = await iterator.next();
const concept = txEntity.map().get('entity');
const types = await conceptTypes(concept);
return { id: concept.id, types };
});
if (entityCreated) {
// Transaction succeed, complete the result to send it back
const completedData = pipe(
assoc('id', internalId),
// Grakn identifiers
assoc('grakn_id', entityCreated.id),
// Types (entity type directly saved)
assoc('parent_types', entityCreated.types)
)(data);
// Transaction succeed, index the result
if (indexable) {
await indexElements([completedData]);
}
// Complete with eventual relations (will eventually update the index)
await addOwner(internalId, entity.createdByOwner, opts);
await addCreatedByRef(internalId, entity.createdByRef, opts);
await addMarkingDefs(internalId, entity.markingDefinitions, opts);
await addTags(internalId, entity.tags, opts);
await addKillChains(internalId, entity.killChainPhases, opts);
await addObservableRefs(internalId, entity.observableRefs, opts);
// Else simply return the data
return completedData;
it("should return sum types when passed key already has in passed object", () => {
(_.assoc("a", "s", { a: 1, b: 2 }): {
a: number | string,
b: number | string,
...
});
});
});
return df.map((row, i) => R.assoc(col, arr[i], row))
})
.then((stats) => R.assoc('score', getScore(stats), stats)));
}
.then((profile: any) => {
this.me = R.assoc("_isMe", true, profile);
normalized.target = this.me;
return normalized;
});
})
export const addCampaign = async (user, campaign) => {
const currentDate = now();
const campaignToCreate = pipe(
assoc('first_seen', campaign.first_seen ? campaign.first_seen : currentDate),
assoc('last_seen', campaign.first_seen ? campaign.first_seen : currentDate)
)(campaign);
const created = await createEntity(campaignToCreate, 'Campaign');
return notify(BUS_TOPICS.StixDomainEntity.ADDED_TOPIC, created, user);
};
return Promise.resolve(inferencesPromises).then(relationInferences => {
if (isInversed(relation.relationship_type, fromRoleLabel)) {
return pipe(
assoc('fromId', toObject.id),
assoc('fromRole', toRoleLabel),
assoc('toId', fromObject.id),
assoc('toRole', fromRoleLabel),
assoc('inferences', { edges: relationInferences })
)(relation);
}
return pipe(
assoc('fromId', fromObject.id),
assoc('fromRole', fromRoleLabel),
assoc('toId', toObject.id),
assoc('toRole', toRoleLabel),
assoc('inferences', { edges: relationInferences })
)(relation);
});
});
clean () {
return this.map(compose(
assoc('selection', null),
assoc('hash', null),
assoc('rawTx', null)
))
}
function updateWidgetField(fieldName, fieldValue) {
props.updateField('data', R.assoc(fieldName, fieldValue, props.data.data))
}