How to use the sp2.mergeUpdateOperations 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
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);
  }
  /**
github phenyl / phenyl / modules / state / src / phenyl-state-updater.ts View on Github external
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);
  }
github phenyl / phenyl / modules / central-state / src / versioning.ts View on Github external
public static mergeUpdateOperations(
    ...operations: GeneralUpdateOperation[]
  ): GeneralUpdateOperation {
    const mergedOperation = mergeUpdateOperations(...operations);
    const { operation } = this.attachMetaInfoToUpdateCommand({
      operation: mergedOperation
    });
    return operation;
  }