This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create graph with all change report entities
- Loading branch information
Showing
62 changed files
with
19,918 additions
and
24,560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 17 additions & 31 deletions
48
.../deserializers/infra-model-diff/component-operations/component-operation-deserializers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,46 @@ | ||
import { Component } from "../../../../infra-model"; | ||
import { | ||
InsertComponentOperation, | ||
RemoveComponentOperation, | ||
RenameComponentOperation, | ||
ReplaceComponentOperation, | ||
Transition | ||
} from "../../../../model-diffing/"; | ||
import { JSONSerializable, Serialized } from "../../../json-serializable"; | ||
import { SerializationID } from "../../../json-serializer"; | ||
import { SerializedComponentOperation } from "../../../serialized-interfaces/infra-model-diff/serialized-component-operation"; | ||
import { deserializeComponentOperationOptions } from "./utils"; | ||
import { deserializeOpNodeData, deserializeOpOutoingNodeReferences } from "./utils"; | ||
|
||
export function insertComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v2) | ||
throw Error("Insert Component Operation does not have a new Component"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new InsertComponentOperation(componentTransition.v2, options); | ||
return new InsertComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function removeComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v1) | ||
throw Error("Remove Component Operation does not have an old Component"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new RemoveComponentOperation(componentTransition.v1, options); | ||
return new RemoveComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function replaceComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v1 || !componentTransition.v2) | ||
throw Error("Replace Component Operation does not have both Components"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new ReplaceComponentOperation(componentTransition, options); | ||
return new ReplaceComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function renameComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v1 || !componentTransition.v2) | ||
throw Error("Rename Component Operation does not have both Components"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new RenameComponentOperation(componentTransition, options); | ||
return new RenameComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} |
76 changes: 19 additions & 57 deletions
76
...lizers/infra-model-diff/component-operations/property-component-operation-deserializer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,45 @@ | ||
import { Component, ComponentProperty } from "../../../../infra-model"; | ||
import { | ||
InsertPropertyComponentOperation, | ||
MovePropertyComponentOperation, | ||
PropertyComponentOperation, | ||
RemovePropertyComponentOperation, | ||
UpdatePropertyComponentOperation, | ||
Transition | ||
} from "../../../../model-diffing/"; | ||
import { JSONSerializable, Serialized } from "../../../json-serializable"; | ||
import { SerializationID } from "../../../json-serializer"; | ||
import { SerializedPropertyComponentOperation, SerializedUpdatePropertyComponentOperation } from "../../../serialized-interfaces/infra-model-diff/serialized-component-operation"; | ||
import { deserializeComponentOperationOptions } from "./utils"; | ||
import { SerializedPropertyComponentOperation } from "../../../serialized-interfaces/infra-model-diff/serialized-component-operation"; | ||
import { deserializeOpNodeData, deserializePropOpOutoingNodeReferences, deserializeUpdatePropOpOutoingNodeReferences } from "./utils"; | ||
|
||
export function insertPropertyComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedPropertyComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v2 || !componentTransition.v1) | ||
throw Error("'Insert Property' Component Operation does not have both Component versions"); | ||
|
||
const pathTransition = serialized.pathTransition; | ||
const propertyTransition = deserialize(serialized.propertyTransition) as Transition<ComponentProperty>; | ||
|
||
if(!pathTransition.v2 || !propertyTransition.v2) | ||
throw Error("'Insert Property' Component Operation does not have new property and its path"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new InsertPropertyComponentOperation(pathTransition, propertyTransition, componentTransition, options); | ||
return new InsertPropertyComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializePropOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function removePropertyComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedPropertyComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v2 || !componentTransition.v1) | ||
throw Error("'Remove Property' Component Operation does not have both Component versions"); | ||
|
||
const pathTransition = serialized.pathTransition; | ||
const propertyTransition = deserialize(serialized.propertyTransition) as Transition<ComponentProperty>; | ||
if(!pathTransition.v1 || !propertyTransition.v1) | ||
throw Error("'Remove Property' Component Operation does not have an old property and its path"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new RemovePropertyComponentOperation(pathTransition, propertyTransition, componentTransition, options); | ||
return new RemovePropertyComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializePropOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function movePropertyComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedPropertyComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v2 || !componentTransition.v1) | ||
throw Error("'Move Property' Component Operation does not have both Component versions"); | ||
|
||
const pathTransition = serialized.pathTransition; | ||
const propertyTransition = deserialize(serialized.propertyTransition) as Transition<ComponentProperty>; | ||
if(!pathTransition.v1 || !propertyTransition.v1) | ||
throw Error("'Move Property' Component Operation does not have both property and path versions"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new MovePropertyComponentOperation(pathTransition, propertyTransition, componentTransition, options); | ||
return new MovePropertyComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializePropOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function updatePropertyComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedUpdatePropertyComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v2 || !componentTransition.v1) | ||
throw Error("'Update Property' Component Operation does not have both Component versions"); | ||
|
||
const pathTransition = serialized.pathTransition; | ||
const propertyTransition = deserialize(serialized.propertyTransition) as Transition<ComponentProperty>; | ||
if(!pathTransition.v1 || !propertyTransition.v1) | ||
throw Error("'Update Property' Component Operation does not have both property and path versions"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
const innerOperations = serialized.innerOperations ? serialized.innerOperations.map(deserialize) as PropertyComponentOperation[] : undefined; | ||
const serialized = obj as SerializedPropertyComponentOperation; | ||
|
||
return new UpdatePropertyComponentOperation(pathTransition, propertyTransition, componentTransition, options, innerOperations); | ||
return new MovePropertyComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeUpdatePropOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} |
49 changes: 13 additions & 36 deletions
49
...s/infra-model-diff/component-operations/relationship-component-operation-deserializers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,37 @@ | ||
import { Component, Relationship } from "../../../../infra-model"; | ||
import { | ||
InsertOutgoingRelationshipComponentOperation, | ||
RemoveOutgoingRelationshipComponentOperation, | ||
UpdateOutgoingRelationshipComponentOperation, | ||
Transition | ||
} from "../../../../model-diffing/"; | ||
import { } from "../../../../model-diffing/"; | ||
import { JSONSerializable, Serialized } from "../../../json-serializable"; | ||
import { SerializationID } from "../../../json-serializer"; | ||
import { SerializedOutgoingRelationshipComponentOperation } from "../../../serialized-interfaces/infra-model-diff/serialized-component-operation"; | ||
import { deserializeComponentOperationOptions } from "./utils"; | ||
import { deserializeOpNodeData, deserializeRelationshipOpOutoingNodeReferences } from "./utils"; | ||
|
||
export function insertOutgoingRelationshipComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedOutgoingRelationshipComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v1 || !componentTransition.v2) | ||
throw Error("'Insert Outgoing Relationship' Component Operation does not have both Components"); | ||
|
||
const relationshipTransition = deserialize(serialized.relationshipTransition) as Transition<Relationship>; | ||
if(!relationshipTransition.v2) | ||
throw Error("'Insert Outgoing Relationship' Component Operation does not have new Relationship"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new InsertOutgoingRelationshipComponentOperation(componentTransition, relationshipTransition.v2, options); | ||
return new InsertOutgoingRelationshipComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeRelationshipOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function removeOutgoingRelationshipComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedOutgoingRelationshipComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v1 || !componentTransition.v2) | ||
throw Error("'Remove Outgoing Relationship' Component Operation does not have both Components"); | ||
|
||
const relationshipTransition = deserialize(serialized.relationshipTransition) as Transition<Relationship>; | ||
if(!relationshipTransition.v1) | ||
throw Error("'Remove Outgoing Relationship' Component Operation does not have new Relationship"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new RemoveOutgoingRelationshipComponentOperation(componentTransition, relationshipTransition.v1, options); | ||
return new RemoveOutgoingRelationshipComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeRelationshipOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} | ||
|
||
export function updateOutgoingRelationshipComponentOperationDeserializer(obj: Serialized, deserialize: (obj: SerializationID) => JSONSerializable): JSONSerializable { | ||
const serialized = obj as SerializedOutgoingRelationshipComponentOperation; | ||
|
||
const componentTransition = deserialize(serialized.componentTransition) as Transition<Component>; | ||
if(!componentTransition.v1 || !componentTransition.v2) | ||
throw Error("'Update Outgoing Relationship' Component Operation does not have both Components"); | ||
|
||
const relationshipTransition = deserialize(serialized.relationshipTransition) as Transition<Relationship>; | ||
if(!componentTransition.v1 || !componentTransition.v2) | ||
throw Error("'Update Outgoing Relationship' Component Operation does not have new Relationship"); | ||
|
||
const options = deserializeComponentOperationOptions(serialized, deserialize); | ||
|
||
return new UpdateOutgoingRelationshipComponentOperation(componentTransition, relationshipTransition, options); | ||
return new UpdateOutgoingRelationshipComponentOperation( | ||
deserializeOpNodeData(serialized), | ||
deserializeRelationshipOpOutoingNodeReferences(serialized, deserialize), | ||
); | ||
} |
41 changes: 37 additions & 4 deletions
41
...hange-analysis-models/export/deserializers/infra-model-diff/component-operations/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,44 @@ | ||
import { ComponentOperation, ComponentOperationOptions, OperationCertainty } from "../../../../model-diffing/"; | ||
import { Component, ComponentProperty, PropertyPath, Relationship } from "../../../../infra-model"; | ||
import { ComponentOperation, OperationCertainty, OpNodeData, OpOutgoingNodeReferences, PropertyComponentOperation, PropOpOutgoingNodeReferences, RelationshipOpOutgoingNodeReferences, Transition, UpdatePropOpOutgoingNodeReferences } from "../../../../model-diffing/"; | ||
import { JSONSerializable } from "../../../json-serializable"; | ||
import { SerializationID } from "../../../json-serializer"; | ||
import { SerializedComponentOperation } from "../../../serialized-interfaces/infra-model-diff/serialized-component-operation"; | ||
import { SerializedComponentOperation, SerializedOutgoingRelationshipComponentOperation, SerializedPropertyComponentOperation, SerializedUpdatePropertyComponentOperation } from "../../../serialized-interfaces/infra-model-diff/serialized-component-operation"; | ||
|
||
export function deserializeComponentOperationOptions(serialized: SerializedComponentOperation, deserialize: (obj: SerializationID) => JSONSerializable): ComponentOperationOptions { | ||
export function deserializeOpNodeData(serialized: SerializedComponentOperation): OpNodeData { | ||
return { | ||
cause: serialized.cause ? deserialize(serialized.cause) as ComponentOperation : undefined, | ||
certainty: OperationCertainty[serialized.certainty as keyof typeof OperationCertainty], | ||
}; | ||
} | ||
|
||
export function deserializeOpOutoingNodeReferences(serialized: SerializedComponentOperation, deserialize: (obj: SerializationID) => JSONSerializable): OpOutgoingNodeReferences { | ||
return { | ||
cause: serialized.cause ? deserialize(serialized.cause) as ComponentOperation : undefined, | ||
componentTransition: deserialize(serialized.componentTransition) as Transition<Component>, | ||
}; | ||
} | ||
|
||
// OutgoingRelationshipComponentOperations | ||
|
||
export function deserializeRelationshipOpOutoingNodeReferences(serialized: SerializedOutgoingRelationshipComponentOperation, deserialize: (obj: SerializationID) => JSONSerializable): RelationshipOpOutgoingNodeReferences { | ||
return { | ||
...deserializeOpOutoingNodeReferences(serialized, deserialize), | ||
relationshipTransition: deserialize(serialized.relationshipTransition) as Transition<Relationship>, | ||
}; | ||
} | ||
|
||
// PropertyComponentOperations | ||
|
||
export function deserializePropOpOutoingNodeReferences(serialized: SerializedPropertyComponentOperation, deserialize: (obj: SerializationID) => JSONSerializable): PropOpOutgoingNodeReferences { | ||
return { | ||
...deserializeOpOutoingNodeReferences(serialized, deserialize), | ||
pathTransition: deserialize(serialized.pathTransition) as Transition<PropertyPath>, | ||
propertyTransition: deserialize(serialized.propertyTransition) as Transition<ComponentProperty>, | ||
}; | ||
} | ||
|
||
export function deserializeUpdatePropOpOutoingNodeReferences(serialized: SerializedUpdatePropertyComponentOperation, deserialize: (obj: SerializationID) => JSONSerializable): UpdatePropOpOutgoingNodeReferences { | ||
return { | ||
...deserializePropOpOutoingNodeReferences(serialized, deserialize), | ||
innerOperations: serialized.innerOperations ? serialized.innerOperations.map(deserialize) as PropertyComponentOperation[] : undefined, | ||
}; | ||
} |
Oops, something went wrong.