All files / src/impl IdempotentFactory.impl.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 4/4
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37          25x 25x                     25x 33x               32x       33x       33x    
import { Contracts } from "@jonloucks/contracts-ts/api/Contracts";
import { IdempotentFactory } from "@jonloucks/contracts-ts/auxiliary/IdempotentFactory";
import { Idempotent, Config as IdempotentConfig } from "@jonloucks/contracts-ts/auxiliary/Idempotent";
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
 
import { create as createIdempotentImpl } from "./Idempotent.impl";
import { used } from "../auxiliary/Checks";
 
export interface Config {
  contracts?: Contracts;
}
  
/**
 * Create a new IdempotentFactory
 *
 * @return the new IdempotentFactory
 */
export function create(config?: Config): IdempotentFactory {
  return IdempotentFactoryImpl.internalCreate(config);
}
 
// ---- Implementation details below ----
 
class IdempotentFactoryImpl implements IdempotentFactory {
  
  createIdempotent(config: IdempotentConfig): RequiredType<Idempotent> {
    return createIdempotentImpl(config);
  }
 
  static internalCreate(config?: Config): IdempotentFactory {
    return new IdempotentFactoryImpl(config);
  }
 
  private constructor(config?: Config) {
    used(config);
  }
};