Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static register>(
state: EntityState,
entityName: EN,
...entities: M[EN][]
): GeneralUpdateOperation {
const operationList = entities.map(entity => {
const docPath = ["pool", entityName, entity.id].join(".");
return {
$set: {
[docPath]: entity
}
};
});
return mergeUpdateOperations(...operationList);
}
/**
static updateMulti>(
state: EntityState,
command: MultiUpdateCommand
): GeneralUpdateOperation {
const { where, entityName, operation } = command;
const targetEntities = PhenylStateFinder.find(state, {
entityName,
where
});
const operationList = targetEntities.map(targetEntity => {
const docPath = ["pool", entityName, targetEntity.id].join(".");
return retargetOperation(docPath, operation);
});
return mergeUpdateOperations(...operationList);
}
public static mergeUpdateOperations(
...operations: GeneralUpdateOperation[]
): GeneralUpdateOperation {
const mergedOperation = mergeUpdateOperations(...operations);
const { operation } = this.attachMetaInfoToUpdateCommand({
operation: mergedOperation
});
return operation;
}