baseProcessor.ts 825 B

12345678910111213141516171819202122232425262728293031323334
  1. import { Context } from '@nuxt/types/app'
  2. import { AnyJson, DataProviderArgs } from '~/types/interfaces'
  3. import Hookable from '~/services/data/hookable'
  4. class BaseProcessor extends Hookable {
  5. protected arguments!: DataProviderArgs;
  6. protected ctx!: Context;
  7. constructor (ctx: Context, args: DataProviderArgs) {
  8. super()
  9. this.arguments = args
  10. this.ctx = ctx
  11. }
  12. /**
  13. * Is the given argument a supported model
  14. * @param _args
  15. */
  16. public static support (_args: DataProviderArgs): boolean {
  17. throw new Error('Not implemented')
  18. }
  19. /**
  20. * Process and return the given data to the Provider
  21. *
  22. * @param _data
  23. */
  24. // eslint-disable-next-line require-await
  25. public async process (_data: AnyJson): Promise<any> {
  26. throw new Error('Not implemented')
  27. }
  28. }
  29. export default BaseProcessor