PropertyIdentifierNamesCacheStorage.ts 1.1 KB

1234567891011121314151617181920212223242526272829
  1. import { inject, injectable, postConstruct } from 'inversify';
  2. import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
  3. import { IOptions } from '../../interfaces/options/IOptions';
  4. import { IPropertyIdentifierNamesCacheStorage } from '../../interfaces/storages/identifier-names-cache/IPropertyIdentifierNamesCacheStorage';
  5. import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
  6. import { MapStorage } from '../MapStorage';
  7. @injectable()
  8. export class PropertyIdentifierNamesCacheStorage extends MapStorage <string, string> implements IPropertyIdentifierNamesCacheStorage {
  9. /**
  10. * @param {IRandomGenerator} randomGenerator
  11. * @param {IOptions} options
  12. */
  13. public constructor (
  14. @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
  15. @inject(ServiceIdentifiers.IOptions) options: IOptions
  16. ) {
  17. super(randomGenerator, options);
  18. }
  19. @postConstruct()
  20. public override initialize (): void {
  21. super.initialize();
  22. this.storage = new Map(Object.entries(this.options.identifierNamesCache?.propertyIdentifiers ?? {}));
  23. }
  24. }