data-projector.d.ts 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {Service} from '@e22m4u/js-service';
  2. import {ProjectDataOptions} from './project-data.js';
  3. import {ProjectionSchemaDefinition} from './definitions/index.js';
  4. import {
  5. ProjectionSchema,
  6. ProjectionSchemaName,
  7. ProjectionSchemaFactory,
  8. } from './projection-schema.js';
  9. /**
  10. * Data projector.
  11. */
  12. export class DataProjector extends Service {
  13. /**
  14. * Define schema.
  15. *
  16. * @param schemaDef
  17. */
  18. defineSchema(schemaDef: ProjectionSchemaDefinition): this;
  19. /**
  20. * Has schema.
  21. *
  22. * @param schemaName
  23. */
  24. hasSchema(schemaName: ProjectionSchemaName): boolean;
  25. /**
  26. * Project.
  27. *
  28. * @param schemaOrFactory
  29. * @param data
  30. * @param options
  31. */
  32. project<T>(
  33. schemaOrFactory:
  34. | ProjectionSchema
  35. | ProjectionSchemaFactory
  36. | ProjectionSchemaName,
  37. data: T,
  38. options?: Omit<ProjectDataOptions, 'resolver'>,
  39. ): T;
  40. }