mirror of https://github.com/abpframework/abp.git
8 changed files with 82 additions and 24 deletions
@ -1,6 +1,7 @@ |
|||||
export * from './api-definition'; |
export * from './api-definition'; |
||||
export * from './import'; |
export * from './import'; |
||||
export * from './method'; |
export * from './method'; |
||||
|
export * from './model'; |
||||
export * from './project'; |
export * from './project'; |
||||
export * from './service'; |
export * from './service'; |
||||
export * from './util'; |
export * from './util'; |
||||
|
|||||
@ -0,0 +1,39 @@ |
|||||
|
import { Import } from './import'; |
||||
|
import { Omissible } from './util'; |
||||
|
|
||||
|
export class Model { |
||||
|
imports: Import[] = []; |
||||
|
interfaces: Interface[] = []; |
||||
|
namespace: string; |
||||
|
|
||||
|
constructor(options: ModelOptions) { |
||||
|
Object.assign(this, options); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export type ModelOptions = Omissible<Model, 'imports' | 'interfaces'>; |
||||
|
|
||||
|
export class Interface { |
||||
|
base: string | null; |
||||
|
identifier: string; |
||||
|
properties: Property[] = []; |
||||
|
|
||||
|
constructor(options: InterfaceOptions) { |
||||
|
Object.assign(this, options); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export type InterfaceOptions = Omissible<Interface, 'properties'>; |
||||
|
|
||||
|
export class Property { |
||||
|
name: string; |
||||
|
type: string; |
||||
|
default: string = ''; |
||||
|
optional: '' | '?' = ''; |
||||
|
|
||||
|
constructor(options: PropertyOptions) { |
||||
|
Object.assign(this, options); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export type PropertyOptions = Omissible<Property, 'default' | 'optional'>; |
||||
@ -0,0 +1,10 @@ |
|||||
|
import { Model } from '../models'; |
||||
|
import { parseNamespace } from './namespace'; |
||||
|
|
||||
|
export function createImportRefToModelMapper(solution: string) { |
||||
|
return (importRef: string) => { |
||||
|
return new Model({ |
||||
|
namespace: parseNamespace(solution, importRef), |
||||
|
}); |
||||
|
}; |
||||
|
} |
||||
Loading…
Reference in new issue