How to use the sp2.retargetOperation function in sp2

To help you get started, we’ve selected a few sp2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phenyl / phenyl / modules / state / src / phenyl-state-updater.ts View on Github external
const operationList = targetEntities.map(targetEntity => {
      const docPath = ["pool", entityName, targetEntity.id].join(".");
      return retargetOperation(docPath, operation);
    });
    return mergeUpdateOperations(...operationList);
github phenyl / phenyl / modules / state / src / phenyl-state-updater.ts View on Github external
state: EntityState,
    command: IdUpdateCommand
  ): GeneralUpdateOperation {
    const { id, entityName, operation } = command;

    if (
      !PhenylStateFinder.has(state, {
        entityName,
        id
      })
    ) {
      throw new Error("Could not find any entity to update.");
    }

    const docPath = ["pool", entityName, id].join(".");
    return retargetOperation(docPath, operation);
  }