@univerjs-procollaborationinterfacesItransformservice

@univerjs-pro/collaboration v0.5.4


Interface: ITransformService

Defined in: packages/collaboration/src/services/transform/transform.service.ts:41

This service’s responsibility is to transform mutations (changesets).

Features could register transform algorithms to this service, so this the service could transform more mutations.

This should be used both on client and server.

This service is also business-agnostic, so it could be used in docs, sheets and slides.

Properties

PropertyTypeDescriptionDefined in
registerTransformAlgorithm(algorithms: IMutationTransformAlgorithm) => voidRegister an algorithm to transform two kinds of mutations. Note that this method is not the same as other registering methods in Univer, it wouldn’t return a disposable, because it would cause critical problems if you unregister a transform algorithm.packages/collaboration/src/services/transform/transform.service.ts:48
transformMutationsWithChangeset(c1: IChangeset, m2: IMutationInfo[]) => ITransformMutationsWithChangesetResultInternal Transform mutations with changesets. We only wants transformed mutations here.packages/collaboration/src/services/transform/transform.service.ts:111

Methods

transformChangesets()

Call Signature

transformChangesets(c1, c2): 
  | IFailureTransformChangesetsResult
| Omit<ISuccessTransformChangesetsResult, "c1Prime">

Defined in: packages/collaboration/src/services/transform/transform.service.ts:103

Internal

Transform two arrays of changesets

Parameters
ParameterType
c1IChangeset[]
c2IChangeset[]
Returns

| IFailureTransformChangesetsResult | Omit<ISuccessTransformChangesetsResult, "c1Prime">

Call Signature

transformChangesets(
   c1, 
   c2, 
   onlyLater): ITransformChangesetsResult

Defined in: packages/collaboration/src/services/transform/transform.service.ts:104

Parameters
ParameterType
c1IChangeset[]
c2IChangeset[]
onlyLaterfalse
Returns

ITransformChangesetsResult


transformMutation()

Call Signature

transformMutation(m1, m2): 
  | IFailureTransformMutationResult
| Omit<ISuccessTransformMutationResult, "m1Prime">

Defined in: packages/collaboration/src/services/transform/transform.service.ts:68

Internal

Transform two single mutations. Note that m1Prime and m2Prime may not be single mutations. 1x1 may result in nxn.

Visualization:

               /\
          m1  /  \  m2
             /    \
             \    /
   m2Prime    \  /    m1Prime
               /
Parameters
ParameterType
m1IMutationInfo
m2IMutationInfo
Returns

| IFailureTransformMutationResult | Omit<ISuccessTransformMutationResult, "m1Prime">

Call Signature

transformMutation(
   m1, 
   m2, 
   onlyLater): ITransformMutationResult

Defined in: packages/collaboration/src/services/transform/transform.service.ts:69

Parameters
ParameterType
m1IMutationInfo
m2IMutationInfo
onlyLaterfalse
Returns

ITransformMutationResult


transformMutations()

Call Signature

transformMutations(m1, m2): 
  | IFailureTransformMutationsResult
| Omit<ISuccessTransformMutationsResult, "m1Prime">

Defined in: packages/collaboration/src/services/transform/transform.service.ts:95

Internal

Transform two array of mutations. Not that the time complexity (also memory complexity) of this method is O(m*n), in which m & n are numbers of mutations in each array.

Visualization:

               /\
          m1  /  \  m2
             /    \
            /\    /\
           /  \  /  \
          /    /    \
          \    /\    /
           \  /  \  /
            /    /
             \    /
              \  /
    m2Prime    /    m1Prime
Parameters
ParameterType
m1IMutationInfo[]
m2IMutationInfo[]
Returns

| IFailureTransformMutationsResult | Omit<ISuccessTransformMutationsResult, "m1Prime">

Call Signature

transformMutations(
   m1, 
   m2, 
   onlyLater): ITransformMutationsResult

Defined in: packages/collaboration/src/services/transform/transform.service.ts:96

Parameters
ParameterType
m1IMutationInfo[]
m2IMutationInfo[]
onlyLaterboolean
Returns

ITransformMutationsResult