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.

153 lines
8.3 KiB

  1. import { Plugin } from '@nuxt/types'
  2. import { APITaskStatusRepository } from '@/repositories/celery/apiTaskStatusRepository'
  3. import { TaskStatusApplicationService } from '@/services/application/celery/taskStatusApplicationService'
  4. import { APICatalogRepository } from '../repositories/upload/apiCatalogRepository'
  5. import { CatalogApplicationService } from '../services/application/upload/catalogApplicationService'
  6. import { APIParseRepository } from '../repositories/upload/apiParseRepository'
  7. import { ParseApplicationService } from '../services/application/upload/parseApplicationService'
  8. import { APISequenceLabelingRepository } from '~/repositories/tasks/sequenceLabeling/apiSequenceLabeling'
  9. import { APISeq2seqRepository } from '~/repositories/tasks/seq2seq/apiSeq2seq'
  10. import { APIConfigRepository } from '~/repositories/autoLabeling/config/apiConfigRepository'
  11. import { APITemplateRepository } from '~/repositories/autoLabeling/template/apiTemplateRepository'
  12. import { APIUserRepository } from '~/repositories/user/apiUserRepository'
  13. import { APIMetricsRepository } from '~/repositories/metrics/apiMetricsRepository'
  14. import { APIRoleRepository } from '~/repositories/role/apiRoleRepository'
  15. import { APIProjectRepository } from '~/repositories/project/apiProjectRepository'
  16. import { LocalStorageOptionRepository} from '~/repositories/option/apiOptionRepository'
  17. import { APIMemberRepository } from '~/repositories/member/apiMemberRepository'
  18. import { APILabelRepository } from '~/repositories/label/apiLabelRepository'
  19. import { APIExampleRepository } from '~/repositories/example/apiDocumentRepository'
  20. import { APICommentRepository } from '~/repositories/comment/apiCommentRepository'
  21. import { APIAuthRepository } from '~/repositories/auth/apiAuthRepository'
  22. import { LabelApplicationService } from '~/services/application/label/labelApplicationService'
  23. import { MemberApplicationService } from '~/services/application/member/memberApplicationService'
  24. import { UserApplicationService } from '~/services/application/user/userApplicationService'
  25. import { RoleApplicationService } from '~/services/application/role/roleApplicationService'
  26. import { ProjectApplicationService } from '~/services/application/project/projectApplicationService'
  27. import { CommentApplicationService } from '~/services/application/comment/commentApplicationService'
  28. import { MetricsApplicationService } from '~/services/application/metrics/metricsApplicationService'
  29. import { ExampleApplicationService } from '~/services/application/example/exampleApplicationService'
  30. import { OptionApplicationService } from '~/services/application/option/optionApplicationService'
  31. import { SequenceLabelingApplicationService } from '~/services/application/tasks/sequenceLabeling/sequenceLabelingApplicationService'
  32. import { Seq2seqApplicationService } from '~/services/application/tasks/seq2seq/seq2seqApplicationService'
  33. import { ConfigApplicationService } from '~/services/application/autoLabeling/configApplicationService'
  34. import { TemplateApplicationService } from '~/services/application/autoLabeling/templateApplicationService'
  35. import { APITextClassificationRepository } from '~/repositories/tasks/textClassification/apiTextClassification'
  36. import { TextClassificationApplicationService } from '~/services/application/tasks/textClassification/textClassificationApplicationService'
  37. import { AuthApplicationService } from '~/services/application/auth/authApplicationService'
  38. import { APIDownloadFormatRepository } from '~/repositories/download/apiDownloadFormatRepository'
  39. import { APIDownloadRepository } from '~/repositories/download/apiDownloadRepository'
  40. import { DownloadApplicationService } from '~/services/application/download/downloadApplicationService'
  41. import { DownloadFormatApplicationService } from '~/services/application/download/downloadFormatApplicationService'
  42. import { APITagRepository } from '~/repositories/tag/apiTagRepository'
  43. import { TagApplicationService } from '~/services/application/tag/tagApplicationService'
  44. import { ApiRelationRepository } from "~/repositories/tasks/sequenceLabeling/apiRelationRepository"
  45. export interface Services {
  46. categoryType: LabelApplicationService,
  47. spanType: LabelApplicationService,
  48. relationType: LabelApplicationService,
  49. member: MemberApplicationService,
  50. user: UserApplicationService,
  51. role: RoleApplicationService,
  52. project: ProjectApplicationService,
  53. comment: CommentApplicationService,
  54. metrics: MetricsApplicationService,
  55. example: ExampleApplicationService,
  56. textClassification: TextClassificationApplicationService,
  57. sequenceLabeling: SequenceLabelingApplicationService,
  58. seq2seq: Seq2seqApplicationService,
  59. option: OptionApplicationService,
  60. config: ConfigApplicationService,
  61. template: TemplateApplicationService,
  62. auth: AuthApplicationService,
  63. catalog: CatalogApplicationService,
  64. parse: ParseApplicationService,
  65. taskStatus: TaskStatusApplicationService,
  66. downloadFormat: DownloadFormatApplicationService,
  67. download: DownloadApplicationService,
  68. tag: TagApplicationService,
  69. }
  70. declare module 'vue/types/vue' {
  71. interface Vue {
  72. readonly $services: Services
  73. }
  74. }
  75. const plugin: Plugin = (context, inject) => {
  76. const memberRepository = new APIMemberRepository()
  77. const userRepository = new APIUserRepository()
  78. const roleRepository = new APIRoleRepository()
  79. const projectRepository = new APIProjectRepository()
  80. const commentRepository = new APICommentRepository()
  81. const metricsRepository = new APIMetricsRepository()
  82. const exampleRepository = new APIExampleRepository()
  83. const textClassificationRepository = new APITextClassificationRepository()
  84. const sequenceLabelingRepository = new APISequenceLabelingRepository()
  85. const linkRepository = new ApiRelationRepository()
  86. const seq2seqRepository = new APISeq2seqRepository()
  87. const optionRepository = new LocalStorageOptionRepository()
  88. const configRepository = new APIConfigRepository()
  89. const tagRepository = new APITagRepository()
  90. const templateRepository = new APITemplateRepository()
  91. const authRepository = new APIAuthRepository()
  92. const catalogRepository = new APICatalogRepository()
  93. const parseRepository = new APIParseRepository()
  94. const taskStatusRepository = new APITaskStatusRepository()
  95. const downloadFormatRepository = new APIDownloadFormatRepository()
  96. const downloadRepository = new APIDownloadRepository()
  97. const categoryType = new LabelApplicationService(new APILabelRepository('category-type'))
  98. const spanType = new LabelApplicationService(new APILabelRepository('span-type'))
  99. const relationType = new LabelApplicationService(new APILabelRepository('relation-type'))
  100. const member = new MemberApplicationService(memberRepository)
  101. const user = new UserApplicationService(userRepository)
  102. const role = new RoleApplicationService(roleRepository)
  103. const project = new ProjectApplicationService(projectRepository)
  104. const comment = new CommentApplicationService(commentRepository)
  105. const metrics = new MetricsApplicationService(metricsRepository)
  106. const example = new ExampleApplicationService(exampleRepository)
  107. const textClassification = new TextClassificationApplicationService(textClassificationRepository)
  108. const sequenceLabeling = new SequenceLabelingApplicationService(sequenceLabelingRepository, linkRepository)
  109. const seq2seq = new Seq2seqApplicationService(seq2seqRepository)
  110. const option = new OptionApplicationService(optionRepository)
  111. const config = new ConfigApplicationService(configRepository)
  112. const tag = new TagApplicationService(tagRepository)
  113. const template = new TemplateApplicationService(templateRepository)
  114. const auth = new AuthApplicationService(authRepository)
  115. const catalog = new CatalogApplicationService(catalogRepository)
  116. const parse = new ParseApplicationService(parseRepository)
  117. const taskStatus = new TaskStatusApplicationService(taskStatusRepository)
  118. const downloadFormat = new DownloadFormatApplicationService(downloadFormatRepository)
  119. const download = new DownloadApplicationService(downloadRepository)
  120. const services: Services = {
  121. categoryType,
  122. spanType,
  123. relationType,
  124. member,
  125. user,
  126. role,
  127. project,
  128. comment,
  129. metrics,
  130. example,
  131. textClassification,
  132. sequenceLabeling,
  133. seq2seq,
  134. option,
  135. config,
  136. template,
  137. auth,
  138. catalog,
  139. parse,
  140. taskStatus,
  141. downloadFormat,
  142. download,
  143. tag,
  144. }
  145. inject('services', services)
  146. }
  147. export default plugin