@rotorsoft/act 0.24.0 → 0.25.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.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @module adapters/ConsoleLogger
3
+ *
4
+ * High-performance console logger inspired by pino's design:
5
+ * - Numeric level comparison for O(1) gating
6
+ * - stdout.write() in production for raw JSON lines (no console overhead)
7
+ * - Colorized single-line output in development
8
+ * - No-op method replacement when level is above threshold
9
+ * - Child logger support with merged bindings
10
+ */
11
+ import type { Logger } from "../types/index.js";
12
+ /**
13
+ * Default console logger for the Act framework.
14
+ *
15
+ * Production mode emits newline-delimited JSON (compatible with GCP, AWS
16
+ * CloudWatch, Datadog, and other structured log ingestion systems).
17
+ *
18
+ * Development mode emits colorized, human-readable output.
19
+ */
20
+ export declare class ConsoleLogger implements Logger {
21
+ level: string;
22
+ private readonly _pretty;
23
+ readonly fatal: Logger["fatal"];
24
+ readonly error: Logger["error"];
25
+ readonly warn: Logger["warn"];
26
+ readonly info: Logger["info"];
27
+ readonly debug: Logger["debug"];
28
+ readonly trace: Logger["trace"];
29
+ constructor(options?: {
30
+ level?: string;
31
+ pretty?: boolean;
32
+ bindings?: Record<string, unknown>;
33
+ });
34
+ dispose(): Promise<void>;
35
+ child(bindings: Record<string, unknown>): Logger;
36
+ private _jsonWrite;
37
+ private _prettyWrite;
38
+ }
39
+ //# sourceMappingURL=ConsoleLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../../src/adapters/ConsoleLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAwBhD;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBAG9B,OAAO,GAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B;IAwBF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAQhD,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,YAAY;CAmCrB"}
@@ -1,3 +1,4 @@
1
+ export { ConsoleLogger } from "./ConsoleLogger.js";
1
2
  export { InMemoryCache } from "./InMemoryCache.js";
2
3
  export { InMemoryStore } from "./InMemoryStore.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAA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iFN;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,IAAI,CAiBN;AAGD,eAAO,MAAM,MAAM,GAAI,YAAY;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;;CAGnD,CAAC;AAGH,eAAO,MAAM,MAAM,iBAAkB,CAAC"}
@@ -1,12 +1,16 @@
1
- import type { Cache, Disposable, Disposer, Fetch, Lease, LogLevel, Schemas, Store } from "./types/index.js";
1
+ import { ConsoleLogger } from "./adapters/ConsoleLogger.js";
2
+ import type { Cache, Disposable, Disposer, Fetch, Lease, Logger, LogLevel, Schemas, Store } from "./types/index.js";
2
3
  /**
3
- * Port and adapter utilities for logging, store management, and resource disposal.
4
+ * Port/adapter infrastructure for the Act framework.
4
5
  *
5
- * Provides singleton store and logger instances, and helpers for resource lifecycle management.
6
+ * All infrastructure concerns (logging, storage, caching) are managed as
7
+ * singleton adapters injected via port functions. Each port follows the same
8
+ * pattern: first call wins with a sensible default, optional adapter injection.
6
9
  *
7
- * - Use `store()` to get or inject the event store (in-memory or persistent).
8
- * - Use `logger` for structured logging.
9
- * - Use `dispose()` to register resource disposers for graceful shutdown.
10
+ * - `log()` structured logging (default: ConsoleLogger)
11
+ * - `store()` event persistence (default: InMemoryStore)
12
+ * - `cache()` state checkpoints (default: InMemoryCache)
13
+ * - `dispose()` — register cleanup functions for graceful shutdown
10
14
  *
11
15
  * @module ports
12
16
  */
@@ -16,120 +20,73 @@ import type { Cache, Disposable, Disposer, Fetch, Lease, LogLevel, Schemas, Stor
16
20
  export declare const ExitCodes: readonly ["ERROR", "EXIT"];
17
21
  /**
18
22
  * Type for allowed exit codes.
19
- */
20
- export type ExitCode = (typeof ExitCodes)[number];
21
- /**
22
- * Singleton logger instance (Pino).
23
23
  *
24
- * Use for structured logging throughout your application.
25
- *
26
- * @example
27
- * logger.info("Application started");
24
+ * - `"ERROR"` abnormal termination (uncaught exception, unhandled rejection)
25
+ * - `"EXIT"` — clean shutdown (SIGINT, SIGTERM, or manual trigger)
28
26
  */
29
- export declare const logger: import("pino").Logger<never, boolean>;
27
+ export type ExitCode = (typeof ExitCodes)[number];
30
28
  /**
31
- * Helper to create a singleton port (adapter) with optional injection.
32
- *
33
- * @param injector The function that creates the port/adapter
34
- * @returns A function to get or inject the singleton instance
35
- *
36
- * @example
37
- * const store = port((adapter) => adapter || new InMemoryStore());
38
- * const myStore = store();
29
+ * Factory function that creates or returns the injected adapter.
30
+ * @internal
39
31
  */
40
32
  type Injector<Port extends Disposable> = (adapter?: Port) => Port;
41
- export declare function port<Port extends Disposable>(injector: Injector<Port>): (adapter?: Port) => Port;
42
- export declare function disposeAndExit(code?: ExitCode): Promise<void>;
43
33
  /**
44
- * Registers resource cleanup functions for graceful shutdown.
34
+ * Creates a singleton port with optional adapter injection.
45
35
  *
46
- * Disposers are called automatically when the process exits (SIGINT, SIGTERM)
47
- * or when manually triggered. They execute in reverse registration order,
48
- * allowing proper cleanup of dependent resources.
36
+ * The first call initializes the adapter (using the provided adapter or the
37
+ * injector's default). Subsequent calls return the cached singleton. Adapters
38
+ * are disposed in reverse registration order during {@link disposeAndExit}.
49
39
  *
50
- * Act automatically disposes registered stores and adapters. Use this function
51
- * to register additional cleanup for your own resources (database connections,
52
- * file handles, timers, etc.).
40
+ * @param injector - Named function that creates the default adapter
41
+ * @returns Port function: call with no args to get the singleton, or pass an
42
+ * adapter on the first call to override the default
53
43
  *
54
- * @param disposer - Async function to call during cleanup
55
- * @returns Function to manually trigger disposal and exit
56
- *
57
- * @example Register custom resource cleanup
44
+ * @example
58
45
  * ```typescript
59
- * import { dispose } from "@rotorsoft/act";
60
- *
61
- * const redis = createRedisClient();
62
- *
63
- * dispose(async () => {
64
- * console.log("Closing Redis connection...");
65
- * await redis.quit();
46
+ * const store = port(function store(adapter?: Store) {
47
+ * return adapter || new InMemoryStore();
66
48
  * });
67
- *
68
- * // On SIGINT/SIGTERM, Redis will be cleaned up automatically
49
+ * const s = store(); // InMemoryStore
69
50
  * ```
51
+ */
52
+ export declare function port<Port extends Disposable>(injector: Injector<Port>): (adapter?: Port) => Port;
53
+ /**
54
+ * Gets or injects the singleton logger.
70
55
  *
71
- * @example Multiple disposers in order
72
- * ```typescript
73
- * import { dispose } from "@rotorsoft/act";
74
- *
75
- * const db = connectDatabase();
76
- * dispose(async () => {
77
- * console.log("Closing database...");
78
- * await db.close();
79
- * });
56
+ * By default, Act uses a built-in {@link ConsoleLogger} that emits JSON lines
57
+ * in production (compatible with GCP, AWS CloudWatch, Datadog) and colorized
58
+ * output in development zero external dependencies.
80
59
  *
81
- * const cache = connectCache();
82
- * dispose(async () => {
83
- * console.log("Closing cache...");
84
- * await cache.disconnect();
85
- * });
60
+ * For pino, inject a `PinoLogger` from `@rotorsoft/act-pino` before building
61
+ * your application.
86
62
  *
87
- * // On exit: cache closes first, then database
88
- * ```
63
+ * @param adapter - Optional logger implementation to inject
64
+ * @returns The singleton logger instance
89
65
  *
90
- * @example Manual cleanup trigger
66
+ * @example Default console logger
91
67
  * ```typescript
92
- * import { dispose } from "@rotorsoft/act";
93
- *
94
- * const shutdown = dispose(async () => {
95
- * await cleanup();
96
- * });
97
- *
98
- * // Manually trigger cleanup and exit
99
- * process.on("SIGUSR2", async () => {
100
- * console.log("Manual shutdown requested");
101
- * await shutdown("EXIT");
102
- * });
68
+ * import { log } from "@rotorsoft/act";
69
+ * const logger = log();
70
+ * logger.info("Application started");
103
71
  * ```
104
72
  *
105
- * @example With error handling
73
+ * @example Injecting pino
106
74
  * ```typescript
107
- * import { dispose } from "@rotorsoft/act";
108
- *
109
- * dispose(async () => {
110
- * try {
111
- * await expensiveCleanup();
112
- * } catch (error) {
113
- * console.error("Cleanup failed:", error);
114
- * // Error doesn't prevent other disposers from running
115
- * }
116
- * });
75
+ * import { log } from "@rotorsoft/act";
76
+ * import { PinoLogger } from "@rotorsoft/act-pino";
77
+ * log(new PinoLogger({ level: "debug", pretty: true }));
117
78
  * ```
118
79
  *
119
- * @see {@link Disposer} for disposer function type
120
- * @see {@link Disposable} for disposable interface
80
+ * @see {@link Logger} for the interface contract
81
+ * @see {@link ConsoleLogger} for the default implementation
121
82
  */
122
- export declare function dispose(disposer?: Disposer): (code?: ExitCode) => Promise<void>;
123
- /**
124
- * Special event name for snapshot events in the event store.
125
- */
126
- export declare const SNAP_EVENT = "__snapshot__";
83
+ export declare const log: (adapter?: Logger | ConsoleLogger | undefined) => Logger | ConsoleLogger;
127
84
  /**
128
85
  * Gets or injects the singleton event store.
129
86
  *
130
- * By default, Act uses an in-memory store suitable for development and testing.
131
- * For production, inject a persistent store like PostgresStore before building
132
- * your application.
87
+ * By default, Act uses an {@link InMemoryStore} suitable for development and
88
+ * testing. For production, inject a persistent store like `PostgresStore` from
89
+ * `@rotorsoft/act-pg` before building your application.
133
90
  *
134
91
  * **Important:** Store injection must happen before creating any Act instances.
135
92
  * Once set, the store cannot be changed without restarting the application.
@@ -137,87 +94,102 @@ export declare const SNAP_EVENT = "__snapshot__";
137
94
  * @param adapter - Optional store implementation to inject
138
95
  * @returns The singleton store instance
139
96
  *
140
- * @example Using default in-memory store
97
+ * @example Default in-memory store
141
98
  * ```typescript
142
99
  * import { store } from "@rotorsoft/act";
143
- *
144
- * const currentStore = store(); // Returns InMemoryStore
100
+ * const s = store();
145
101
  * ```
146
102
  *
147
- * @example Injecting PostgreSQL store
103
+ * @example Injecting PostgreSQL
148
104
  * ```typescript
149
105
  * import { store } from "@rotorsoft/act";
150
106
  * import { PostgresStore } from "@rotorsoft/act-pg";
151
107
  *
152
- * // Inject before building your app
153
108
  * store(new PostgresStore({
154
109
  * host: "localhost",
155
110
  * port: 5432,
156
111
  * database: "myapp",
157
112
  * user: "postgres",
158
113
  * password: "secret",
159
- * schema: "public",
160
- * table: "events"
161
114
  * }));
162
- *
163
- * // Now build your app - it will use PostgreSQL
164
- * const app = act()
165
- * .withState(Counter)
166
- * .build();
167
- * ```
168
- *
169
- * @example With environment-based configuration
170
- * ```typescript
171
- * import { store } from "@rotorsoft/act";
172
- * import { PostgresStore } from "@rotorsoft/act-pg";
173
- *
174
- * if (process.env.NODE_ENV === "production") {
175
- * store(new PostgresStore({
176
- * host: process.env.DB_HOST,
177
- * port: parseInt(process.env.DB_PORT || "5432"),
178
- * database: process.env.DB_NAME,
179
- * user: process.env.DB_USER,
180
- * password: process.env.DB_PASSWORD
181
- * }));
182
- * }
183
- * // Development uses default in-memory store
184
- * ```
185
- *
186
- * @example Testing with fresh store
187
- * ```typescript
188
- * import { store } from "@rotorsoft/act";
189
- *
190
- * beforeEach(async () => {
191
- * // Reset store between tests
192
- * await store().seed();
193
- * });
194
- *
195
- * afterAll(async () => {
196
- * // Cleanup
197
- * await store().drop();
198
- * });
199
115
  * ```
200
116
  *
201
- * @see {@link Store} for the store interface
117
+ * @see {@link Store} for the interface contract
202
118
  * @see {@link InMemoryStore} for the default implementation
203
- * @see {@link PostgresStore} for production use
204
119
  */
205
120
  export declare const store: (adapter?: Store | undefined) => Store;
206
121
  /**
207
122
  * Gets or injects the singleton cache.
208
123
  *
209
- * By default, Act uses an in-memory LRU cache. For distributed deployments,
210
- * inject a Redis-backed cache before building your application.
211
- *
212
- * Cache unifies snapshotting — `snap()` writes to cache instead of the event store,
213
- * and `load()` checks cache before querying the store for tail events.
124
+ * By default, Act uses an {@link InMemoryCache} (LRU, maxSize 1000). For
125
+ * distributed deployments, inject a Redis-backed cache before building your
126
+ * application.
214
127
  *
215
128
  * @param adapter - Optional cache implementation to inject
216
129
  * @returns The singleton cache instance
130
+ *
131
+ * @see {@link Cache} for the interface contract
132
+ * @see {@link InMemoryCache} for the default implementation
217
133
  */
218
134
  export declare const cache: (adapter?: Cache | undefined) => Cache;
219
135
  /**
220
- * Tracer builder for logging fetches, leases, etc.
136
+ * Disposes all registered adapters and disposers, then exits the process.
137
+ *
138
+ * Execution order:
139
+ * 1. Custom disposers (registered via {@link dispose}) — in reverse order
140
+ * 2. Port adapters (log, store, cache) — in reverse registration order
141
+ * 3. Adapter registry is cleared
142
+ * 4. Process exits (skipped in test environment)
143
+ *
144
+ * In production, `"ERROR"` exits are silently ignored to avoid crashing on
145
+ * transient failures (e.g. an uncaught promise in a non-critical path).
146
+ *
147
+ * @param code - Exit code: `"EXIT"` for clean shutdown (exit 0),
148
+ * `"ERROR"` for abnormal termination (exit 1)
149
+ */
150
+ export declare function disposeAndExit(code?: ExitCode): Promise<void>;
151
+ /**
152
+ * Registers a cleanup function for graceful shutdown.
153
+ *
154
+ * Disposers are called automatically on SIGINT, SIGTERM, uncaught exceptions,
155
+ * and unhandled rejections. They execute in reverse registration order before
156
+ * port adapters are disposed.
157
+ *
158
+ * @param disposer - Async function to call during cleanup. Omit to get a
159
+ * reference to {@link disposeAndExit} without registering.
160
+ * @returns Function to manually trigger disposal and exit
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * import { dispose } from "@rotorsoft/act";
165
+ *
166
+ * const db = connectDatabase();
167
+ * dispose(async () => await db.close());
168
+ *
169
+ * // In tests
170
+ * afterAll(async () => await dispose()());
171
+ * ```
172
+ *
173
+ * @see {@link disposeAndExit} for the full shutdown sequence
174
+ */
175
+ export declare function dispose(disposer?: Disposer): (code?: ExitCode) => Promise<void>;
176
+ /**
177
+ * Event name used internally for snapshot events in the event store.
178
+ * Snapshot events store a full state checkpoint, enabling efficient cold-start
179
+ * recovery without replaying the entire event stream.
180
+ */
181
+ export declare const SNAP_EVENT = "__snapshot__";
182
+ /**
183
+ * Creates a tracer for detailed drain-cycle logging.
184
+ *
185
+ * When `logLevel` is `"trace"`, returns functions that log fetch, correlate,
186
+ * lease, ack, and block operations. At any other level, returns no-op
187
+ * functions to avoid overhead.
188
+ *
189
+ * @param logLevel - Current log level from configuration
190
+ * @returns Object with tracer methods (active or no-op)
191
+ *
192
+ * @internal Used by {@link Act} to instrument drain cycles.
221
193
  */
222
194
  export declare function build_tracer(logLevel: LogLevel): {
223
195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AAC,KAAK,EAAE,MAAM,CAAC,GAC/B,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CA+C7B"}
@@ -78,6 +78,34 @@ export type Disposable = {
78
78
  * @see {@link InMemoryStore} for the default implementation
79
79
  * @see {@link PostgresStore} for the PostgreSQL implementation
80
80
  */
81
+ /**
82
+ * Minimal logger port compatible with pino, winston, bunyan, and console.
83
+ *
84
+ * Each log method accepts either:
85
+ * - `(msg: string)` — plain message
86
+ * - `(obj: unknown, msg?: string)` — structured data with optional message
87
+ *
88
+ * Implementations should respect `level` to gate output.
89
+ *
90
+ * @see {@link ConsoleLogger} for the default implementation
91
+ * @see {@link https://www.npmjs.com/package/@rotorsoft/act-pino | @rotorsoft/act-pino} for the Pino adapter
92
+ */
93
+ export interface Logger extends Disposable {
94
+ level: string;
95
+ fatal(obj: unknown, msg?: string): void;
96
+ fatal(msg: string): void;
97
+ error(obj: unknown, msg?: string): void;
98
+ error(msg: string): void;
99
+ warn(obj: unknown, msg?: string): void;
100
+ warn(msg: string): void;
101
+ info(obj: unknown, msg?: string): void;
102
+ info(msg: string): void;
103
+ debug(obj: unknown, msg?: string): void;
104
+ debug(msg: string): void;
105
+ trace(obj: unknown, msg?: string): void;
106
+ trace(msg: string): void;
107
+ child(bindings: Record<string, unknown>): Logger;
108
+ }
81
109
  export interface Store extends Disposable {
82
110
  /**
83
111
  * Initializes or resets the store.
@@ -1 +1 @@
1
- {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/types/ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO,EACR,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,MAAM,SAAS,MAAM;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;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