@beignet/provider-event-bus-memory 0.0.33 → 0.0.35

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @beignet/provider-event-bus-memory
2
2
 
3
+ ## 0.0.35
4
+
5
+ ## 0.0.34
6
+
7
+ ### Patch Changes
8
+
9
+ - 9345cc9: Stabilize the pre-1.0 public surface around factory-only providers, canonical server and testing imports, consistent memory naming, and the removal of deprecated aliases.
10
+
3
11
  ## 0.0.33
4
12
 
5
13
  ## 0.0.32
package/README.md CHANGED
@@ -25,7 +25,7 @@ bun add @beignet/provider-event-bus-memory @beignet/core
25
25
 
26
26
  ```typescript
27
27
  import { defineEvent } from "@beignet/core/events";
28
- import { createInMemoryEventBus } from "@beignet/provider-event-bus-memory";
28
+ import { createMemoryEventBus } from "@beignet/provider-event-bus-memory";
29
29
  import { z } from "zod";
30
30
 
31
31
  // Define your domain events
@@ -37,7 +37,7 @@ const UserRegistered = defineEvent("user.registered", {
37
37
  });
38
38
 
39
39
  // Create the event bus
40
- const eventBus = createInMemoryEventBus();
40
+ const eventBus = createMemoryEventBus();
41
41
 
42
42
  // Subscribe to events
43
43
  const unsubscribe = eventBus.subscribe(UserRegistered, (payload) => {
@@ -59,14 +59,14 @@ unsubscribe();
59
59
 
60
60
  ```typescript
61
61
  import { createNextServer, createNextServerLoader } from "@beignet/next";
62
- import { createInMemoryEventBusProvider } from "@beignet/provider-event-bus-memory";
62
+ import { createMemoryEventBusProvider } from "@beignet/provider-event-bus-memory";
63
63
  import { appPorts } from "@/infra/app-ports";
64
64
  import { routes } from "@/server/routes";
65
65
 
66
66
  export const getServer = createNextServerLoader(() =>
67
67
  createNextServer({
68
68
  ports: appPorts,
69
- providers: [createInMemoryEventBusProvider()],
69
+ providers: [createMemoryEventBusProvider()],
70
70
  context: ({ ports }) => ({
71
71
  ports,
72
72
  }),
@@ -75,7 +75,7 @@ export const getServer = createNextServerLoader(() =>
75
75
  );
76
76
  ```
77
77
 
78
- Use `createInMemoryEventBus()` directly when you want to manually assign an
78
+ Use `createMemoryEventBus()` directly when you want to manually assign an
79
79
  event bus under `ports`.
80
80
 
81
81
  The provider contributes `ctx.ports.eventBus`, the standard Beignet
@@ -91,7 +91,7 @@ Pass a provider instrumentation target when creating the direct event bus to
91
91
  record published events under the `eventBus` watcher:
92
92
 
93
93
  ```typescript
94
- const eventBus = createInMemoryEventBus({
94
+ const eventBus = createMemoryEventBus({
95
95
  instrumentation: ports,
96
96
  });
97
97
  ```
@@ -184,7 +184,7 @@ import { definePorts } from "@beignet/core/ports";
184
184
 
185
185
  // Type-safe ports definition
186
186
  const appPorts = definePorts({
187
- eventBus: createInMemoryEventBus() as EventBusPort,
187
+ eventBus: createMemoryEventBus() as EventBusPort,
188
188
  // ... other ports
189
189
  });
190
190
 
@@ -200,7 +200,7 @@ import { describe, expect, it, mock } from "bun:test";
200
200
 
201
201
  describe("User Registration", () => {
202
202
  it("should publish UserRegistered event", async () => {
203
- const eventBus = createInMemoryEventBus();
203
+ const eventBus = createMemoryEventBus();
204
204
  const handler = mock(() => {});
205
205
 
206
206
  eventBus.subscribe(UserRegistered, handler);
package/dist/index.d.ts CHANGED
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
- * import { createInMemoryEventBus } from "@beignet/provider-event-bus-memory";
12
+ * import { createMemoryEventBus } from "@beignet/provider-event-bus-memory";
13
13
  *
14
- * const eventBus = createInMemoryEventBus();
14
+ * const eventBus = createMemoryEventBus();
15
15
  *
16
16
  * // Subscribe to an event
17
17
  * const unsubscribe = eventBus.subscribe(UserRegistered, (payload) => {
@@ -30,11 +30,11 @@ import { type ProviderInstrumentationTarget } from "@beignet/core/providers";
30
30
  /**
31
31
  * Delivery mode for the in-memory event bus.
32
32
  */
33
- export type InMemoryEventBusDelivery = "await-handlers" | "fire-and-forget";
33
+ export type MemoryEventBusDelivery = "await-handlers" | "fire-and-forget";
34
34
  /**
35
35
  * Options for the in-memory event bus.
36
36
  */
37
- export interface InMemoryEventBusOptions {
37
+ export interface MemoryEventBusOptions {
38
38
  /**
39
39
  * Optional instrumentation target. Providers pass existing app ports here
40
40
  * automatically; direct factory users can pass an instrumentation port.
@@ -47,7 +47,7 @@ export interface InMemoryEventBusOptions {
47
47
  * work deterministically. Use "fire-and-forget" for detached in-process
48
48
  * delivery when the caller should not wait for listeners.
49
49
  */
50
- delivery?: InMemoryEventBusDelivery;
50
+ delivery?: MemoryEventBusDelivery;
51
51
  /**
52
52
  * Called when an async event handler throws an error.
53
53
  *
@@ -65,7 +65,7 @@ export interface InMemoryEventBusOptions {
65
65
  /**
66
66
  * Options for the in-memory event bus provider.
67
67
  */
68
- export interface InMemoryEventBusProviderOptions extends Omit<InMemoryEventBusOptions, "instrumentation"> {
68
+ export interface MemoryEventBusProviderOptions extends Omit<MemoryEventBusOptions, "instrumentation"> {
69
69
  /**
70
70
  * Provider name. Defaults to "event-bus-memory".
71
71
  */
@@ -74,7 +74,7 @@ export interface InMemoryEventBusProviderOptions extends Omit<InMemoryEventBusOp
74
74
  /**
75
75
  * Ports contributed by the in-memory event bus provider.
76
76
  */
77
- export interface InMemoryEventBusProviderPorts {
77
+ export interface MemoryEventBusProviderPorts {
78
78
  /**
79
79
  * Beignet event bus port.
80
80
  */
@@ -89,7 +89,7 @@ export interface InMemoryEventBusProviderPorts {
89
89
  *
90
90
  * @example
91
91
  * ```ts
92
- * const eventBus = createInMemoryEventBus();
92
+ * const eventBus = createMemoryEventBus();
93
93
  *
94
94
  * eventBus.subscribe(UserRegistered, (payload) => {
95
95
  * console.log(`User registered: ${payload.email}`);
@@ -101,18 +101,18 @@ export interface InMemoryEventBusProviderPorts {
101
101
  * @example
102
102
  * ```ts
103
103
  * // With error handling
104
- * const eventBus = createInMemoryEventBus({
104
+ * const eventBus = createMemoryEventBus({
105
105
  * onHandlerError: (error, eventName, payload) => {
106
106
  * logger.error(`Event handler failed for ${eventName}`, { error, payload });
107
107
  * },
108
108
  * });
109
109
  * ```
110
110
  */
111
- export declare function createInMemoryEventBus(options?: InMemoryEventBusOptions): EventBusPort;
111
+ export declare function createMemoryEventBus(options?: MemoryEventBusOptions): EventBusPort;
112
112
  /**
113
113
  * Create a provider that contributes an in-memory event bus.
114
114
  */
115
- export declare function createInMemoryEventBusProvider(options?: InMemoryEventBusProviderOptions): import("@beignet/core/providers").ServiceProvider<unknown, import("@standard-schema/spec").StandardSchemaV1<void, void>, {
115
+ export declare function createMemoryEventBusProvider(options?: MemoryEventBusProviderOptions): import("@beignet/core/providers").ServiceProvider<unknown, import("@standard-schema/spec").StandardSchemaV1<void, void>, {
116
116
  eventBus: EventBusPort;
117
117
  }, unknown, void>;
118
118
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,eAAe,CAAC,EAAE,6BAA6B,CAAC;IAEhD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IAEpC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CACf,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,KACb,IAAI,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,+BACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,iBAAiB,CAAC;IACxD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;C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AC1C,OAAO,GAAE,6BAAkC;;kBAiB5C"}
package/dist/index.js CHANGED
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
- * import { createInMemoryEventBus } from "@beignet/provider-event-bus-memory";
12
+ * import { createMemoryEventBus } from "@beignet/provider-event-bus-memory";
13
13
  *
14
- * const eventBus = createInMemoryEventBus();
14
+ * const eventBus = createMemoryEventBus();
15
15
  *
16
16
  * // Subscribe to an event
17
17
  * const unsubscribe = eventBus.subscribe(UserRegistered, (payload) => {
@@ -35,7 +35,7 @@ import { createProvider, createProviderInstrumentation, } from "@beignet/core/pr
35
35
  *
36
36
  * @example
37
37
  * ```ts
38
- * const eventBus = createInMemoryEventBus();
38
+ * const eventBus = createMemoryEventBus();
39
39
  *
40
40
  * eventBus.subscribe(UserRegistered, (payload) => {
41
41
  * console.log(`User registered: ${payload.email}`);
@@ -47,14 +47,14 @@ import { createProvider, createProviderInstrumentation, } from "@beignet/core/pr
47
47
  * @example
48
48
  * ```ts
49
49
  * // With error handling
50
- * const eventBus = createInMemoryEventBus({
50
+ * const eventBus = createMemoryEventBus({
51
51
  * onHandlerError: (error, eventName, payload) => {
52
52
  * logger.error(`Event handler failed for ${eventName}`, { error, payload });
53
53
  * },
54
54
  * });
55
55
  * ```
56
56
  */
57
- export function createInMemoryEventBus(options = {}) {
57
+ export function createMemoryEventBus(options = {}) {
58
58
  const onHandlerError = options?.onHandlerError;
59
59
  const delivery = options.delivery ?? "await-handlers";
60
60
  const instrumentation = createProviderInstrumentation(options.instrumentation, {
@@ -126,14 +126,14 @@ export function createInMemoryEventBus(options = {}) {
126
126
  /**
127
127
  * Create a provider that contributes an in-memory event bus.
128
128
  */
129
- export function createInMemoryEventBusProvider(options = {}) {
129
+ export function createMemoryEventBusProvider(options = {}) {
130
130
  const { name = "event-bus-memory", ...eventBusOptions } = options;
131
131
  return createProvider({
132
132
  name,
133
133
  setup({ ports }) {
134
134
  return {
135
135
  ports: {
136
- eventBus: createInMemoryEventBus({
136
+ eventBus: createMemoryEventBus({
137
137
  ...eventBusOptions,
138
138
  instrumentation: ports,
139
139
  }),
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EACL,cAAc,EACd,6BAA6B,GAE9B,MAAM,yBAAyB,CAAC;AAkEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAmC,EAAE;IAErC,MAAM,cAAc,GAAG,OAAO,EAAE,cAAc,CAAC;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,gBAAgB,CAAC;IACtD,MAAM,eAAe,GAAG,6BAA6B,CACnD,OAAO,CAAC,eAAe,EACvB;QACE,YAAY,EAAE,kBAAkB;QAChC,OAAO,EAAE,UAAU;KACpB,CACF,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAGrB,CAAC;IAEJ,MAAM,kBAAkB,GAAG,CACzB,KAAc,EACd,SAAiB,EACjB,OAAgB,EAChB,EAAE;QACF,IAAI,CAAC;YACH,cAAc,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,wFAAwF;QAC1F,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,OAAO,CAAC,KAAK,EAAE,OAAO;YACpB,eAAe,CAAC,MAAM,CAAC;gBACrB,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,KAAK,CAAC,IAAI;aACtB,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACtC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;gBAAE,OAAO;YAErC,MAAM,WAAW,GAAG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F,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beignet/provider-event-bus-memory",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "type": "module",
5
5
  "description": "In-memory event bus provider for Beignet - implements EventBusPort for single-process applications",
6
6
  "main": "./dist/index.js",
@@ -80,7 +80,8 @@
80
80
  "registration": {
81
81
  "required": false,
82
82
  "tokens": [
83
- "createInMemoryEventBus"
83
+ "createMemoryEventBus",
84
+ "createMemoryEventBusProvider"
84
85
  ]
85
86
  }
86
87
  }
package/src/index.ts CHANGED
@@ -9,9 +9,9 @@
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
- * import { createInMemoryEventBus } from "@beignet/provider-event-bus-memory";
12
+ * import { createMemoryEventBus } from "@beignet/provider-event-bus-memory";
13
13
  *
14
- * const eventBus = createInMemoryEventBus();
14
+ * const eventBus = createMemoryEventBus();
15
15
  *
16
16
  * // Subscribe to an event
17
17
  * const unsubscribe = eventBus.subscribe(UserRegistered, (payload) => {
@@ -36,12 +36,12 @@ import {
36
36
  /**
37
37
  * Delivery mode for the in-memory event bus.
38
38
  */
39
- export type InMemoryEventBusDelivery = "await-handlers" | "fire-and-forget";
39
+ export type MemoryEventBusDelivery = "await-handlers" | "fire-and-forget";
40
40
 
41
41
  /**
42
42
  * Options for the in-memory event bus.
43
43
  */
44
- export interface InMemoryEventBusOptions {
44
+ export interface MemoryEventBusOptions {
45
45
  /**
46
46
  * Optional instrumentation target. Providers pass existing app ports here
47
47
  * automatically; direct factory users can pass an instrumentation port.
@@ -55,7 +55,7 @@ export interface InMemoryEventBusOptions {
55
55
  * work deterministically. Use "fire-and-forget" for detached in-process
56
56
  * delivery when the caller should not wait for listeners.
57
57
  */
58
- delivery?: InMemoryEventBusDelivery;
58
+ delivery?: MemoryEventBusDelivery;
59
59
 
60
60
  /**
61
61
  * Called when an async event handler throws an error.
@@ -79,8 +79,8 @@ export interface InMemoryEventBusOptions {
79
79
  /**
80
80
  * Options for the in-memory event bus provider.
81
81
  */
82
- export interface InMemoryEventBusProviderOptions
83
- extends Omit<InMemoryEventBusOptions, "instrumentation"> {
82
+ export interface MemoryEventBusProviderOptions
83
+ extends Omit<MemoryEventBusOptions, "instrumentation"> {
84
84
  /**
85
85
  * Provider name. Defaults to "event-bus-memory".
86
86
  */
@@ -90,7 +90,7 @@ export interface InMemoryEventBusProviderOptions
90
90
  /**
91
91
  * Ports contributed by the in-memory event bus provider.
92
92
  */
93
- export interface InMemoryEventBusProviderPorts {
93
+ export interface MemoryEventBusProviderPorts {
94
94
  /**
95
95
  * Beignet event bus port.
96
96
  */
@@ -106,7 +106,7 @@ export interface InMemoryEventBusProviderPorts {
106
106
  *
107
107
  * @example
108
108
  * ```ts
109
- * const eventBus = createInMemoryEventBus();
109
+ * const eventBus = createMemoryEventBus();
110
110
  *
111
111
  * eventBus.subscribe(UserRegistered, (payload) => {
112
112
  * console.log(`User registered: ${payload.email}`);
@@ -118,15 +118,15 @@ export interface InMemoryEventBusProviderPorts {
118
118
  * @example
119
119
  * ```ts
120
120
  * // With error handling
121
- * const eventBus = createInMemoryEventBus({
121
+ * const eventBus = createMemoryEventBus({
122
122
  * onHandlerError: (error, eventName, payload) => {
123
123
  * logger.error(`Event handler failed for ${eventName}`, { error, payload });
124
124
  * },
125
125
  * });
126
126
  * ```
127
127
  */
128
- export function createInMemoryEventBus(
129
- options: InMemoryEventBusOptions = {},
128
+ export function createMemoryEventBus(
129
+ options: MemoryEventBusOptions = {},
130
130
  ): EventBusPort {
131
131
  const onHandlerError = options?.onHandlerError;
132
132
  const delivery = options.delivery ?? "await-handlers";
@@ -216,8 +216,8 @@ export function createInMemoryEventBus(
216
216
  /**
217
217
  * Create a provider that contributes an in-memory event bus.
218
218
  */
219
- export function createInMemoryEventBusProvider(
220
- options: InMemoryEventBusProviderOptions = {},
219
+ export function createMemoryEventBusProvider(
220
+ options: MemoryEventBusProviderOptions = {},
221
221
  ) {
222
222
  const { name = "event-bus-memory", ...eventBusOptions } = options;
223
223
 
@@ -226,11 +226,11 @@ export function createInMemoryEventBusProvider(
226
226
  setup({ ports }) {
227
227
  return {
228
228
  ports: {
229
- eventBus: createInMemoryEventBus({
229
+ eventBus: createMemoryEventBus({
230
230
  ...eventBusOptions,
231
231
  instrumentation: ports,
232
232
  }),
233
- } satisfies InMemoryEventBusProviderPorts,
233
+ } satisfies MemoryEventBusProviderPorts,
234
234
  };
235
235
  },
236
236
  });