/
file.ts
28 lines (26 loc) · 901 Bytes
/
file.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. */
import { SourceFileStructure, StructureKind } from 'ts-morph';
import { VdmEntity, VdmServiceMetadata } from '../vdm-types';
import { entityClass } from './class';
import { importDeclarations, otherEntityImports } from './imports';
import {
entityTypeForceMandatoryInterface,
entityTypeInterface
} from './interface';
import { entityNamespace } from './namespace';
export function entitySourceFile(
entity: VdmEntity,
service: VdmServiceMetadata
): SourceFileStructure {
return {
kind: StructureKind.SourceFile,
statements: [
...importDeclarations(entity),
entityClass(entity, service),
...otherEntityImports(entity, service),
entityTypeInterface(entity, service),
entityTypeForceMandatoryInterface(entity, service),
entityNamespace(entity, service)
]
};
}