Skip to content

Commit

Permalink
Added useful documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
thachp committed Jun 2, 2022
1 parent 4c73d8d commit cece1e1
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 6 deletions.
9 changes: 9 additions & 0 deletions dist/cqrs/event.publisher.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { IEvent } from "./event.interface";
export interface IEventPublisher {
publish<TEvent extends IEvent>(event: TEvent): Promise<void>;
publishAll<TEvent extends IEvent>(event: TEvent[]): Promise<void>;
}
export declare class EventPublisher implements EventPublisher {
publish<TEvent extends IEvent>(event: TEvent): Promise<void>;
publishAll<TEvent extends IEvent>(events: TEvent[]): Promise<void[]>[];
}
34 changes: 34 additions & 0 deletions dist/cqrs/event.publisher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventPublisher = void 0;
const typedi_1 = require("typedi");
const cqrs_config_1 = require("../cqrs.config");
let EventPublisher = class EventPublisher {
publish(event) {
return __awaiter(this, void 0, void 0, function* () {
cqrs_config_1.default.publish(event);
});
}
publishAll(events) {
return (events || []).map((event) => cqrs_config_1.default.publish(event));
}
};
EventPublisher = __decorate([
(0, typedi_1.Service)()
], EventPublisher);
exports.EventPublisher = EventPublisher;
1 change: 1 addition & 0 deletions dist/cqrs/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "reflect-metadata";
export * from "./event.publisher";
export * from "./hooks/command.hook";
export * from "./hooks/query.hook";
export * from "./query.interface";
Expand Down
1 change: 1 addition & 0 deletions dist/cqrs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
};
Object.defineProperty(exports, "__esModule", { value: true });
require("reflect-metadata");
__exportStar(require("./event.publisher"), exports);
__exportStar(require("./hooks/command.hook"), exports);
__exportStar(require("./hooks/query.hook"), exports);
__exportStar(require("./query.interface"), exports);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./utils/errorsFormatter";
import "reflect-metadata";
export * from "./cqrs.config";
export * from "./cqrs";
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./utils/errorsFormatter"), exports);
require("reflect-metadata");
__exportStar(require("./cqrs.config"), exports);
__exportStar(require("./cqrs"), exports);
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-cqrs",
"version": "1.1.11-alpha",
"version": "1.2.1-alpha",
"description": "React hooks library for applying CQRS design patterns and Single Responsibility Principle (SRP) in frontend development",
"keywords": [
"cqrs",
Expand Down Expand Up @@ -67,9 +67,7 @@
"@wry/equality": "^0.5.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"iterare": "^1.2.1",
"mediatr-ts": "^0.2.1",
"typedi": "^0.10.0"

}
}
}

0 comments on commit cece1e1

Please sign in to comment.