parent
3991c9b4bb
commit
3e4f8f00f2
@ -0,0 +1,6 @@
|
|||||||
|
import AppClass from '../lifecycle/AppClass.ts'
|
||||||
|
export { Service } from '../../../di/src/decorator/Service.ts'
|
||||||
|
|
||||||
|
export class ServiceProvider extends AppClass {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
import {InstantiableCanonical} from './InstantiableCanonical.ts'
|
||||||
|
import {ServiceProvider} from '../service/ServiceProvider.ts'
|
||||||
|
import {CanonicalDefinition} from './Canonical.ts'
|
||||||
|
|
||||||
|
export default class Services extends InstantiableCanonical<ServiceProvider> {
|
||||||
|
protected base_path = './app/services'
|
||||||
|
protected canonical_item = 'service'
|
||||||
|
protected suffix = '.service.ts'
|
||||||
|
|
||||||
|
public async init_canonical_item(def: CanonicalDefinition) {
|
||||||
|
const item = await super.init_canonical_item(def)
|
||||||
|
if ( !(item instanceof ServiceProvider) ) {
|
||||||
|
throw new TypeError(`Invalid service provider definition: ${def.original_name}. Service providers must extend from Daton's base ServiceProvider class.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue