@etohq/event-bus-local 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ <p align="center">
2
+ <a href="https://www.etohq.com">
3
+ <img alt="Eto" src="https://user-images.githubusercontent.com/7554214/153162406-bf8fd16f-aa98-4604-b87b-e13ab4baf604.png" width="100" />
4
+ </a>
5
+ </p>
6
+ <h1 align="center">
7
+ @etohq/event-bus-local
8
+ </h1>
9
+
10
+ <h4 align="center">
11
+ <a href="https://docs.etohq.com">Documentation</a> |
12
+ <a href="https://www.etohq.com">Website</a>
13
+ </h4>
14
+
15
+ <p align="center">
16
+ An open source composable commerce engine built for developers.
17
+ </p>
18
+ <p align="center">
19
+ <a href="https://github.com/etohq/eto/blob/master/LICENSE">
20
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Eto is released under the MIT license." />
21
+ </a>
22
+ <a href="https://circleci.com/gh/etohq/eto">
23
+ <img src="https://circleci.com/gh/etohq/eto.svg?style=shield" alt="Current CircleCI build status." />
24
+ </a>
25
+ <a href="https://github.com/etohq/eto/blob/master/CONTRIBUTING.md">
26
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
27
+ </a>
28
+ <a href="https://www.producthunt.com/posts/eto"><img src="https://img.shields.io/badge/Product%20Hunt-%231%20Product%20of%20the%20Day-%23DA552E" alt="Product Hunt"></a>
29
+ <a href="https://discord.gg/xpCwq3Kfn8">
30
+ <img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
31
+ </a>
32
+ <a href="https://twitter.com/intent/follow?screen_name=etohq">
33
+ <img src="https://img.shields.io/twitter/follow/etohq.svg?label=Follow%20@etohq" alt="Follow @etohq" />
34
+ </a>
35
+ </p>
36
+
37
+ ## Overview
38
+
39
+ Local Event Bus module for Eto. When installed, the events system of Eto is powered by the Node EventEmitter. This module installed by default in new (> v1.8.0) Eto projects.
40
+
41
+ The Node EventEmitter is limited to a single process environment. We generally recommend using the `@etohq/event-bus-redis` module in a production environment.
42
+
43
+ ## Getting started
44
+
45
+ Install the module:
46
+
47
+ ```bash
48
+ yarn add @etohq/event-bus-local
49
+ ```
50
+
51
+ You don't need to add the module to your project configuration as it is the default one. Eto will try to use it, if no other event buses are installed.
52
+
53
+ ```js
54
+ module.exports = {
55
+ // ...
56
+ modules: [ ... ],
57
+ // ...
58
+ }
59
+ ```
60
+
61
+ ## Configuration
62
+
63
+ The module comes with no configuration options.
@@ -0,0 +1,8 @@
1
+ import { ModuleExports } from "@etohq/framework/types";
2
+ import LocalEventBus from "./services/event-bus-local";
3
+ export declare const service: typeof LocalEventBus;
4
+ export declare const loaders: (({ logger }: import("@etohq/framework/types").LoaderOptions) => Promise<void>)[];
5
+ declare const moduleDefinition: ModuleExports;
6
+ export default moduleDefinition;
7
+ export * from "./initialize";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,aAAa,MAAM,4BAA4B,CAAA;AAEtD,eAAO,MAAM,OAAO,sBAAgB,CAAA;AACpC,eAAO,MAAM,OAAO,mFAAW,CAAA;AAE/B,QAAA,MAAM,gBAAgB,EAAE,aAGvB,CAAA;AAED,eAAe,gBAAgB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.loaders = exports.service = void 0;
21
+ const loaders_1 = __importDefault(require("./loaders"));
22
+ const event_bus_local_1 = __importDefault(require("./services/event-bus-local"));
23
+ exports.service = event_bus_local_1.default;
24
+ exports.loaders = [loaders_1.default];
25
+ const moduleDefinition = {
26
+ service: exports.service,
27
+ loaders: exports.loaders,
28
+ };
29
+ exports.default = moduleDefinition;
30
+ __exportStar(require("./initialize"), exports);
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,wDAA8B;AAC9B,iFAAsD;AAEzC,QAAA,OAAO,GAAG,yBAAa,CAAA;AACvB,QAAA,OAAO,GAAG,CAAC,iBAAM,CAAC,CAAA;AAE/B,MAAM,gBAAgB,GAAkB;IACtC,OAAO,EAAP,eAAO;IACP,OAAO,EAAP,eAAO;CACR,CAAA;AAED,kBAAe,gBAAgB,CAAA;AAC/B,+CAA4B"}
@@ -0,0 +1,3 @@
1
+ import { IEventBusService } from "@etohq/framework/types";
2
+ export declare const initialize: () => Promise<IEventBusService>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initialize/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,gBAAgB,CAQ3D,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialize = void 0;
4
+ const modules_sdk_1 = require("@etohq/framework/modules-sdk");
5
+ const utils_1 = require("@etohq/framework/utils");
6
+ const initialize = async () => {
7
+ const serviceKey = utils_1.Modules.EVENT_BUS;
8
+ const loaded = await modules_sdk_1.EtoModule.bootstrap({
9
+ moduleKey: serviceKey,
10
+ defaultPath: "@etohq/event-bus-local",
11
+ });
12
+ return loaded[serviceKey];
13
+ };
14
+ exports.initialize = initialize;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/initialize/index.ts"],"names":[],"mappings":";;;AAAA,8DAAwD;AAExD,kDAAgD;AAEzC,MAAM,UAAU,GAAG,KAAK,IAA+B,EAAE;IAC9D,MAAM,UAAU,GAAG,eAAO,CAAC,SAAS,CAAA;IACpC,MAAM,MAAM,GAAG,MAAM,uBAAS,CAAC,SAAS,CAAmB;QACzD,SAAS,EAAE,UAAU;QACrB,WAAW,EAAE,wBAAwB;KACtC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,UAAU,CAAC,CAAA;AAC3B,CAAC,CAAA;AARY,QAAA,UAAU,cAQtB"}
@@ -0,0 +1,4 @@
1
+ import { LoaderOptions } from "@etohq/framework/types";
2
+ declare const _default: ({ logger }: LoaderOptions) => Promise<void>;
3
+ export default _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;qCAEpB,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAA/D,wBAIC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = async ({ logger }) => {
4
+ logger?.warn("Local Event Bus installed. This is not recommended for production.");
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":";;AAEA,kBAAe,KAAK,EAAE,EAAE,MAAM,EAAiB,EAAiB,EAAE;IAChE,MAAM,EAAE,IAAI,CACV,oEAAoE,CACrE,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { EventBusTypes, InternalModuleDeclaration, Logger, EtoContainer, Message, Subscriber } from "@etohq/framework/types";
2
+ import { AbstractEventBusModuleService } from "@etohq/framework/utils";
3
+ import { EventEmitter } from "events";
4
+ type InjectedDependencies = {
5
+ logger: Logger;
6
+ };
7
+ type StagingQueueType = Map<string, Message[]>;
8
+ export default class LocalEventBusService extends AbstractEventBusModuleService {
9
+ protected readonly logger_?: Logger;
10
+ protected readonly eventEmitter_: EventEmitter;
11
+ protected groupedEventsMap_: StagingQueueType;
12
+ constructor({ logger }: EtoContainer & InjectedDependencies, moduleOptions: {} | undefined, moduleDeclaration: InternalModuleDeclaration);
13
+ /**
14
+ * Accept an event name and some options
15
+ *
16
+ * @param eventsData
17
+ * @param options The options can include `internal` which will prevent the event from being logged
18
+ */
19
+ emit<T = unknown>(eventsData: Message<T> | Message<T>[], options?: Record<string, unknown>): Promise<void>;
20
+ private groupOrEmitEvent;
21
+ private groupEvent;
22
+ releaseGroupedEvents(eventGroupId: string): Promise<void>;
23
+ clearGroupedEvents(eventGroupId: string): Promise<void>;
24
+ subscribe(event: string | symbol, subscriber: Subscriber): this;
25
+ unsubscribe(event: string | symbol, subscriber: Subscriber, context?: EventBusTypes.SubscriberContext): this;
26
+ }
27
+ export {};
28
+ //# sourceMappingURL=event-bus-local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus-local.d.ts","sourceRoot":"","sources":["../../src/services/event-bus-local.ts"],"names":[],"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"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@etohq/framework/utils");
4
+ const events_1 = require("events");
5
+ const promises_1 = require("timers/promises");
6
+ const ulid_1 = require("ulid");
7
+ const eventEmitter = new events_1.EventEmitter();
8
+ eventEmitter.setMaxListeners(Infinity);
9
+ // eslint-disable-next-line max-len
10
+ class LocalEventBusService extends utils_1.AbstractEventBusModuleService {
11
+ constructor({ logger }, moduleOptions = {}, moduleDeclaration) {
12
+ // @ts-ignore
13
+ // eslint-disable-next-line prefer-rest-params
14
+ super(...arguments);
15
+ this.logger_ = logger;
16
+ this.eventEmitter_ = eventEmitter;
17
+ this.groupedEventsMap_ = new Map();
18
+ }
19
+ /**
20
+ * Accept an event name and some options
21
+ *
22
+ * @param eventsData
23
+ * @param options The options can include `internal` which will prevent the event from being logged
24
+ */
25
+ async emit(eventsData, options = {}) {
26
+ const normalizedEventsData = Array.isArray(eventsData)
27
+ ? eventsData
28
+ : [eventsData];
29
+ for (const eventData of normalizedEventsData) {
30
+ const eventListenersCount = this.eventEmitter_.listenerCount(eventData.name);
31
+ if (eventListenersCount === 0) {
32
+ continue;
33
+ }
34
+ if (!options.internal && !eventData.options?.internal) {
35
+ this.logger_?.info(`Processing ${eventData.name} which has ${eventListenersCount} subscribers`);
36
+ }
37
+ await this.groupOrEmitEvent({
38
+ ...eventData,
39
+ options,
40
+ });
41
+ }
42
+ }
43
+ // If the data of the event consists of a eventGroupId, we don't emit the event, instead
44
+ // we add them to a queue grouped by the eventGroupId and release them when
45
+ // explicitly requested.
46
+ // This is useful in the event of a distributed transaction where you'd want to emit
47
+ // events only once the transaction ends.
48
+ async groupOrEmitEvent(eventData) {
49
+ const { options, ...eventBody } = eventData;
50
+ const eventGroupId = eventBody.metadata?.eventGroupId;
51
+ if (eventGroupId) {
52
+ await this.groupEvent(eventGroupId, eventData);
53
+ }
54
+ else {
55
+ const { options, ...eventBody } = eventData;
56
+ const options_ = options;
57
+ const delay = options?.delay ? promises_1.setTimeout : async () => { };
58
+ delay(options_?.delay).then(() => this.eventEmitter_.emit(eventData.name, eventBody));
59
+ }
60
+ }
61
+ // Groups an event to a queue to be emitted upon explicit release
62
+ async groupEvent(eventGroupId, eventData) {
63
+ const groupedEvents = this.groupedEventsMap_.get(eventGroupId) || [];
64
+ groupedEvents.push(eventData);
65
+ this.groupedEventsMap_.set(eventGroupId, groupedEvents);
66
+ }
67
+ async releaseGroupedEvents(eventGroupId) {
68
+ const groupedEvents = this.groupedEventsMap_.get(eventGroupId) || [];
69
+ for (const event of groupedEvents) {
70
+ const { options, ...eventBody } = event;
71
+ const options_ = options;
72
+ const delay = options?.delay ? promises_1.setTimeout : async () => { };
73
+ delay(options_?.delay).then(() => this.eventEmitter_.emit(event.name, eventBody));
74
+ }
75
+ await this.clearGroupedEvents(eventGroupId);
76
+ }
77
+ async clearGroupedEvents(eventGroupId) {
78
+ this.groupedEventsMap_.delete(eventGroupId);
79
+ }
80
+ subscribe(event, subscriber) {
81
+ if (!this.isWorkerMode) {
82
+ return this;
83
+ }
84
+ const randId = (0, ulid_1.ulid)();
85
+ this.storeSubscribers({ event, subscriberId: randId, subscriber });
86
+ this.eventEmitter_.on(event, async (data) => {
87
+ try {
88
+ await subscriber(data);
89
+ }
90
+ catch (err) {
91
+ this.logger_?.error(`An error occurred while processing ${event.toString()}:`);
92
+ this.logger_?.error(err);
93
+ }
94
+ });
95
+ return this;
96
+ }
97
+ unsubscribe(event, subscriber, context) {
98
+ if (!this.isWorkerMode) {
99
+ return this;
100
+ }
101
+ const existingSubscribers = this.eventToSubscribersMap_.get(event);
102
+ if (existingSubscribers?.length) {
103
+ const subIndex = existingSubscribers?.findIndex((sub) => sub.id === context?.subscriberId);
104
+ if (subIndex !== -1) {
105
+ this.eventToSubscribersMap_.get(event)?.splice(subIndex, 1);
106
+ }
107
+ }
108
+ this.eventEmitter_.off(event, subscriber);
109
+ return this;
110
+ }
111
+ }
112
+ exports.default = LocalEventBusService;
113
+ //# sourceMappingURL=event-bus-local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus-local.js","sourceRoot":"","sources":["../../src/services/event-bus-local.ts"],"names":[],"mappings":";;AASA,kDAAsE;AACtE,mCAAqC;AACrC,8CAA4C;AAC5C,+BAA2B;AAQ3B,MAAM,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;AACvC,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;AAEtC,mCAAmC;AACnC,MAAqB,oBAAqB,SAAQ,qCAA6B;IAK7E,YACE,EAAE,MAAM,EAAuC,EAC/C,aAAa,GAAG,EAAE,EAClB,iBAA4C;QAE5C,aAAa;QACb,8CAA8C;QAC9C,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAEnB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAA;QACjC,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAA;IACpC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,UAAqC,EACrC,UAAmC,EAAE;QAErC,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;YACpD,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;QAEhB,KAAK,MAAM,SAAS,IAAI,oBAAoB,EAAE,CAAC;YAC7C,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAC1D,SAAS,CAAC,IAAI,CACf,CAAA;YAED,IAAI,mBAAmB,KAAK,CAAC,EAAE,CAAC;gBAC9B,SAAQ;YACV,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;gBACtD,IAAI,CAAC,OAAO,EAAE,IAAI,CAChB,cAAc,SAAS,CAAC,IAAI,cAAc,mBAA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EAAE,KAAK,CACjB,sCAAsC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAC1D,CAAA;gBACD,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,WAAW,CACT,KAAsB,EACtB,UAAsB,EACtB,OAAyC;QAEzC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAElE,IAAI,mBAAmB,EAAE,MAAM,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAG,mBAAmB,EAAE,SAAS,CAC7C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,OAAO,EAAE,YAAY,CAC1C,CAAA;YAED,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,QAAkB,EAAE,CAAC,CAAC,CAAA;YACvE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA3JD,uCA2JC"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/initialize/index.ts","../src/loaders/index.ts","../src/services/event-bus-local.ts","../src/services/__tests__/event-bus-local.ts"],"version":"5.6.2"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@etohq/event-bus-local",
3
+ "version": "1.0.0",
4
+ "description": "Local Event Bus Module for Eto",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist",
8
+ "!dist/**/__tests__",
9
+ "!dist/**/__mocks__",
10
+ "!dist/**/__fixtures__"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/etohq/eto",
15
+ "directory": "packages/event-bus-local"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "engines": {
21
+ "node": ">=20"
22
+ },
23
+ "author": "Eto",
24
+ "license": "MIT",
25
+ "devDependencies": {
26
+ "@etohq/framework": "^1.0.0",
27
+ "@swc/core": "^1.7.28",
28
+ "@swc/jest": "^0.2.36",
29
+ "@types/jest": "^29.5.14",
30
+ "jest": "^29.7.0",
31
+ "rimraf": "^5.0.2",
32
+ "typescript": "^5.6.2"
33
+ },
34
+ "scripts": {
35
+ "watch": "tsc --build --watch",
36
+ "build": "rimraf dist && tsc --build",
37
+ "test": "jest --passWithNoTests"
38
+ },
39
+ "dependencies": {
40
+ "ulid": "^2.3.0"
41
+ },
42
+ "peerDependencies": {
43
+ "@etohq/framework": "^1.0.0"
44
+ }
45
+ }