Skip to content

Commit

Permalink
Merge branch 'development' into 'master'
Browse files Browse the repository at this point in the history
Development

See merge request b650/Deep-Lynx!217
  • Loading branch information
DnOberon committed Mar 21, 2022
2 parents 30281b1 + 4aeb44c commit 93e9828
Show file tree
Hide file tree
Showing 24 changed files with 826 additions and 632 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ module.exports = {
es6: true,
node: true,
},
extends: ['plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'prettier'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'prettier', 'plugin:security-node/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
plugins: ['eslint-plugin-prefer-arrow', '@typescript-eslint'],
plugins: ['eslint-plugin-prefer-arrow', '@typescript-eslint', 'security-node'],
rules: {
'max-len': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion AdminWebApp/src/components/etl/transformationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ export default class TransformationDialog extends Vue {
if(relationship) {
this.propertyMapping.push({
key: payloadKey,
metatype_relationshipc_key_id: relationship.id
metatype_relationship_key_id: relationship.id
})
}
})
Expand Down
658 changes: 359 additions & 299 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-security-node": "^1.1.1",
"express-session": "^1.17.1",
"faker": "^4.1.0",
"husky": "^6.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,18 @@ export default class MetatypeRelationshipKeyMapper extends Mapper {
modified_by = k.modified_by,
modified_at = NOW()
FROM(VALUES %L) AS
k(id, name, metatype_relationship_id, container_id, description, property_name, required, data_type, options, default_value, validation, modified_by)
k(id,
name,
metatype_relationship_id,
container_id,
description,
property_name,
required,
data_type,
options,
default_value,
validation,
modified_by)
WHERE k.id::bigint = m.id RETURNING m.*`;
const values = keys.map((key) => [
key.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export default class NodeRepository extends Repository implements RepositoryInte
super.query('relationship_name', operator, value);
return this;
}

relationshipName(operator: string, value: any) {
super.query('relationship_id', operator, value);
return this;
Expand All @@ -353,7 +353,7 @@ export default class NodeRepository extends Repository implements RepositoryInte
await Promise.all(
results.value.map((node) => {
return new Promise((resolve) => {
void this.#metatypeRepo.findByID(node.metatype_id!).then((metatype) => {
void this.#metatypeRepo.findByID(node.metatype_id).then((metatype) => {
if (metatype.isError) {
resolve(Result.Failure(`unable to load node's metatypes ${metatype.error?.error}`));
return;
Expand Down
233 changes: 116 additions & 117 deletions src/domain_objects/data_warehouse/data/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Container from '../ontology/container';
import Edge from './edge';
import {Conversion} from '../etl/type_transformation';
import MetatypeRelationshipPair, {MetatypeRelationshipPairID} from '../ontology/metatype_relationship_pair';
import { EdgeMetadata } from './edge';
import {EdgeMetadata} from './edge';

export class NodeMetadata {
@IsOptional()
Expand Down Expand Up @@ -108,11 +108,7 @@ export default class Node extends BaseDomainClass {

if (input) {
input.container_id instanceof Container ? (this.container_id = input.container_id.id) : (this.container_id = input.container_id);
input.metatype instanceof Metatype
? (this.metatype = input.metatype)
: (this.metatype = plainToClass(Metatype, {
id: input.metatype,
}));
input.metatype instanceof Metatype ? (this.metatype = input.metatype) : (this.metatype = plainToClass(Metatype, {id: input.metatype}));
if (input.metatype_name) this.metatype_name = input.metatype_name;
this.properties = input.properties;
if (input.original_data_id) this.original_data_id = input.original_data_id;
Expand Down Expand Up @@ -141,136 +137,136 @@ export function IsNodes(set: Node[] | Edge[]): set is Node[] {
*/
export class NodeLeaf extends BaseDomainClass {
// origin (root node) properties
origin_id?: string;

origin_container_id?: string;

// use metatype id to retrieve information on the origin node's metatype.
// Retrieves the whole class, not just the id.
@MetatypeID({message: 'Metatype must have valid ID'})
@Expose({name: 'metatype_id', toClassOnly: true})
@Transform(
({value}) => {
const metatype = plainToClass(Metatype, {});
metatype.id = value;
return metatype;
},
{toClassOnly: true},
)
origin_metatype: Metatype | undefined;

// get orig metatype id from Metatype class
@Expose({toPlainOnly: true})
get origin_metatype_id(): string {
return this.origin_metatype ? this.origin_metatype.id! : '';
}
origin_id?: string;

origin_metatype_name?: string;
origin_container_id?: string;

origin_properties: object = {};
// use metatype id to retrieve information on the origin node's metatype.
// Retrieves the whole class, not just the id.
@MetatypeID({message: 'Metatype must have valid ID'})
@Expose({name: 'metatype_id', toClassOnly: true})
@Transform(
({value}) => {
const metatype = plainToClass(Metatype, {});
metatype.id = value;
return metatype;
},
{toClassOnly: true},
)
origin_metatype: Metatype | undefined;

origin_original_data_id?: string;
// get orig metatype id from Metatype class
@Expose({toPlainOnly: true})
get origin_metatype_id(): string {
return this.origin_metatype ? this.origin_metatype.id! : '';
}

origin_import_data_id?: string;
origin_metatype_name?: string;

origin_data_staging_id?: string;
origin_properties: object = {};

origin_data_source_id?: string;
origin_original_data_id?: string;

origin_type_mapping_transformation_id?: string;
origin_import_data_id?: string;

@Type(() => NodeMetadata)
origin_metadata?: NodeMetadata;
origin_data_staging_id?: string;

origin_created_at?: Date;
origin_data_source_id?: string;

origin_type_mapping_transformation_id?: string;

@Type(() => NodeMetadata)
origin_metadata?: NodeMetadata;

origin_created_at?: Date;

// edge properties
edge_id?: string;

edge_container_id?: string;

// use metatype relationship pair id to get info on the edge's
// relationship type. Gets the whole class, not just the id.
@MetatypeRelationshipPairID({
message: 'Metatype relationship pair must have valid ID',
})
@Expose({name: 'relationship_pair_id', toClassOnly: true})
@Transform(
({value}) => {
const p = plainToClass(MetatypeRelationshipPair, {})
p.id = value;
return p;
},
{toClassOnly: true},
)
metatypeRelationshipPair: MetatypeRelationshipPair | undefined;

// get relationship pair id from Metatype Relationship Pair class
@Expose({toPlainOnly: true})
get relationship_pair_id(): string {
return this.metatypeRelationshipPair ? this.metatypeRelationshipPair.id! : '';
}
edge_id?: string;

metatype_relationship_name?: string;
edge_container_id?: string;

edge_properties: object = {};
// use metatype relationship pair id to get info on the edge's
// relationship type. Gets the whole class, not just the id.
@MetatypeRelationshipPairID({
message: 'Metatype relationship pair must have valid ID',
})
@Expose({name: 'relationship_pair_id', toClassOnly: true})
@Transform(
({value}) => {
const p = plainToClass(MetatypeRelationshipPair, {});
p.id = value;
return p;
},
{toClassOnly: true},
)
metatypeRelationshipPair: MetatypeRelationshipPair | undefined;

edge_import_data_id?: string;
// get relationship pair id from Metatype Relationship Pair class
@Expose({toPlainOnly: true})
get relationship_pair_id(): string {
return this.metatypeRelationshipPair ? this.metatypeRelationshipPair.id! : '';
}

edge_data_staging_id?: string;
metatype_relationship_name?: string;

edge_data_source_id?: string;
edge_properties: object = {};

edge_type_mapping_transformation_id?: string;
edge_import_data_id?: string;

@Type(() => EdgeMetadata)
edge_metadata?: EdgeMetadata;
edge_data_staging_id?: string;

edge_created_at?: Date;
edge_data_source_id?: string;

edge_type_mapping_transformation_id?: string;

@Type(() => EdgeMetadata)
edge_metadata?: EdgeMetadata;

edge_created_at?: Date;

// destination (outer node) properties
destination_id?: string;

destination_container_id?: string;

// use metatype id to retrieve information on the origin node's metatype.
// Retrieves the whole class, not just the id.
@MetatypeID({message: 'Metatype must have valid ID'})
@Expose({name: 'metatype_id', toClassOnly: true})
@Transform(
({value}) => {
const metatype = plainToClass(Metatype, {});
metatype.id = value;
return metatype;
},
{toClassOnly: true},
)
destination_metatype: Metatype | undefined;

// get orig metatype id from Metatype class
@Expose({toPlainOnly: true})
get destination_metatype_id(): string {
return this.destination_metatype ? this.destination_metatype.id! : '';
}
destination_id?: string;

destination_metatype_name?: string;
destination_container_id?: string;

// use metatype id to retrieve information on the origin node's metatype.
// Retrieves the whole class, not just the id.
@MetatypeID({message: 'Metatype must have valid ID'})
@Expose({name: 'metatype_id', toClassOnly: true})
@Transform(
({value}) => {
const metatype = plainToClass(Metatype, {});
metatype.id = value;
return metatype;
},
{toClassOnly: true},
)
destination_metatype: Metatype | undefined;

destination_properties: object = {};
// get orig metatype id from Metatype class
@Expose({toPlainOnly: true})
get destination_metatype_id(): string {
return this.destination_metatype ? this.destination_metatype.id! : '';
}

destination_original_data_id?: string;
destination_metatype_name?: string;

destination_import_data_id?: string;
destination_properties: object = {};

destination_data_staging_id?: string;
destination_original_data_id?: string;

destination_data_source_id?: string;
destination_import_data_id?: string;

destination_type_mapping_transformation_id?: string;
destination_data_staging_id?: string;

@Type(() => NodeMetadata)
destination_metadata?: NodeMetadata;
destination_data_source_id?: string;

destination_created_at?: Date;
destination_type_mapping_transformation_id?: string;

@Type(() => NodeMetadata)
destination_metadata?: NodeMetadata;

destination_created_at?: Date;

// level of depth
depth?: string;
Expand Down Expand Up @@ -313,19 +309,21 @@ export class NodeLeaf extends BaseDomainClass {
super();

if (input) {
input.origin_container_id instanceof Container? (this.origin_container_id = input.origin_container_id.id) : (this.origin_container_id = input.origin_container_id);
input.destination_container_id instanceof Container? (this.destination_container_id = input.destination_container_id.id) : (this.destination_container_id = input.destination_container_id);
input.edge_container_id instanceof Container? (this.edge_container_id = input.edge_container_id.id) : (this.edge_container_id = input.edge_container_id);
input.origin_container_id instanceof Container
? (this.origin_container_id = input.origin_container_id.id)
: (this.origin_container_id = input.origin_container_id);
input.destination_container_id instanceof Container
? (this.destination_container_id = input.destination_container_id.id)
: (this.destination_container_id = input.destination_container_id);
input.edge_container_id instanceof Container
? (this.edge_container_id = input.edge_container_id.id)
: (this.edge_container_id = input.edge_container_id);
input.origin_metatype instanceof Metatype
? (this.origin_metatype = input.origin_metatype)
: (this.origin_metatype = plainToClass(Metatype, {
id: input.origin_metatype_name,
}));
: (this.origin_metatype = plainToClass(Metatype, {id: input.origin_metatype_name}));
input.destination_metatype instanceof Metatype
? (this.destination_metatype = input.destination_metatype)
: (this.destination_metatype = plainToClass(Metatype, {
id: input.destination_metatype_name,
}));
: (this.destination_metatype = plainToClass(Metatype, {id: input.destination_metatype_name}));
if (input.origin_metatype_name) this.origin_metatype_name = input.metatype_name;
if (input.destination_metatype_name) this.destination_metatype_name = input.metatype_name;
this.origin_properties = input.origin_properties;
Expand All @@ -341,7 +339,8 @@ export class NodeLeaf extends BaseDomainClass {
if (input.destination_data_source_id) this.destination_data_source_id = input.destination_data_source_id;
if (input.origin_type_mapping_transformation_id) this.origin_type_mapping_transformation_id = input.origin_type_mapping_transformation_id;
if (input.edge_type_mapping_transformation_id) this.edge_type_mapping_transformation_id = input.edge_type_mapping_transformation_id;
if (input.destination_type_mapping_transformation_id) this.destination_type_mapping_transformation_id = input.destination_type_mapping_transformation_id;
if (input.destination_type_mapping_transformation_id)
this.destination_type_mapping_transformation_id = input.destination_type_mapping_transformation_id;
if (input.origin_metadata) this.origin_metadata = input.origin_metadata;
if (input.edge_metadata) this.edge_metadata = input.edge_metadata;
if (input.destination_metadata) this.destination_metadata = input.destination_metadata;
Expand All @@ -351,4 +350,4 @@ export class NodeLeaf extends BaseDomainClass {
if (input.depth) this.depth = input.depth;
}
}
}
}
Loading

0 comments on commit 93e9828

Please sign in to comment.