nestjs-typed-events
Version:
Typesafe NestJS event emitter module
28 lines • 890 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventContractBuilder = void 0;
class EventContractBuilder {
constructor(jsonObject) {
this.jsonObject = jsonObject;
}
static create() {
return new EventContractBuilder({});
}
build() {
return this.jsonObject;
}
required(key, value) {
const nextPart = {
[key]: { schema: value, optional: false },
};
return new EventContractBuilder(Object.assign(Object.assign({}, this.jsonObject), nextPart));
}
optional(key, value) {
const nextPart = {
[key]: { schema: value, optional: true },
};
return new EventContractBuilder(Object.assign(Object.assign({}, this.jsonObject), nextPart));
}
}
exports.EventContractBuilder = EventContractBuilder;
//# sourceMappingURL=contract.js.map