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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 25x 25x 25x 25x 25x 25x 25x 29x 13x 9x 5x 3x 29x | import { Promisor, PromisorType, typeToPromisor } from "@jonloucks/contracts-ts/api/Promisor";
import { PromisorFactory } from "@jonloucks/contracts-ts/api/PromisorFactory";
import { OptionalType, RequiredType, TransformType, typeToTransform } from "@jonloucks/contracts-ts/api/Types";
import { create as createExtractor } from "./ExtractorPromisor.impl";
import { create as createLifeCycle } from "./LifeCyclePromisor.impl";
import { create as createSingleton } from "./SingletonPromisor.impl";
import { create as createValue } from "./ValuePromisor.impl";
/**
* Factory to create a PromisorFactory implementation
*
* @returns the PromisorFactory implementation
*/
export function create(): RequiredType<PromisorFactory> {
return PromisorsImpl.internalCreate();
}
// ---- Implementation details below ----
/**
* Implementation for PromisorFactory
*/
class PromisorsImpl implements PromisorFactory {
/**
* PromisorFactory.createValue override.
*/
createValue<T>(deliverable: OptionalType<T>): RequiredType<Promisor<T>> {
return createValue<T>(deliverable);
}
/**
* PromisorFactory.createSingleton override.
*/
createSingleton<T>(promisor: PromisorType<T>): RequiredType<Promisor<T>> {
return createSingleton<T>(typeToPromisor(promisor));
}
/**
* PromisorFactory.createLifeCycle override.
*/
createLifeCycle<T>(promisor: PromisorType<T>): RequiredType<Promisor<T>> {
return createLifeCycle(typeToPromisor(promisor));
}
/**
* PromisorFactory.createExtractor override.
*/
createExtractor<T, R>(promisor: PromisorType<T>, extractor: TransformType<T, R>): RequiredType<Promisor<R>> {
return createExtractor<T, R>(typeToPromisor(promisor), typeToTransform(extractor));
}
static internalCreate(): RequiredType<PromisorFactory> {
return new PromisorsImpl();
}
private constructor() {
}
}
|