You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.3 KiB

2 years ago
  1. import { Plugin } from '@nuxt/types'
  2. import { repositories } from './repositories'
  3. import { ExampleApplicationService } from '@/services/application/example/exampleApplicationService'
  4. import { LabelApplicationService } from '@/services/application/label/labelApplicationService'
  5. import { OptionApplicationService } from '@/services/application/option/optionApplicationService'
  6. import { ProjectApplicationService } from '@/services/application/project/projectApplicationService'
  7. import { TagApplicationService } from '@/services/application/tag/tagApplicationService'
  8. import { BoundingBoxApplicationService } from '@/services/application/tasks/boundingBox/boundingBoxApplicationService'
  9. import { SegmentationApplicationService } from '@/services/application/tasks/segmentation/segmentationApplicationService'
  10. import { SequenceLabelingApplicationService } from '@/services/application/tasks/sequenceLabeling/sequenceLabelingApplicationService'
  11. export interface Services {
  12. categoryType: LabelApplicationService
  13. spanType: LabelApplicationService
  14. relationType: LabelApplicationService
  15. project: ProjectApplicationService
  16. example: ExampleApplicationService
  17. sequenceLabeling: SequenceLabelingApplicationService
  18. option: OptionApplicationService
  19. tag: TagApplicationService
  20. bbox: BoundingBoxApplicationService
  21. segmentation: SegmentationApplicationService
  22. }
  23. declare module 'vue/types/vue' {
  24. interface Vue {
  25. readonly $services: Services
  26. }
  27. }
  28. const plugin: Plugin = (_, inject) => {
  29. const services: Services = {
  30. categoryType: new LabelApplicationService(repositories.categoryType),
  31. spanType: new LabelApplicationService(repositories.spanType),
  32. relationType: new LabelApplicationService(repositories.relationType),
  33. project: new ProjectApplicationService(repositories.project),
  34. example: new ExampleApplicationService(repositories.example),
  35. sequenceLabeling: new SequenceLabelingApplicationService(
  36. repositories.span,
  37. repositories.relation
  38. ),
  39. option: new OptionApplicationService(repositories.option),
  40. tag: new TagApplicationService(repositories.tag),
  41. bbox: new BoundingBoxApplicationService(repositories.boundingBox),
  42. segmentation: new SegmentationApplicationService(repositories.segmentation)
  43. }
  44. inject('services', services)
  45. }
  46. export default plugin