@flowcore/pathways 0.2.1 → 0.2.3
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 +16 -0
- package/esm/common/flowcore.type.d.ts +3 -3
- package/esm/common/flowcore.type.d.ts.map +1 -1
- package/esm/common/index.d.ts +2 -0
- package/esm/common/index.d.ts.map +1 -1
- package/esm/common/index.js +2 -0
- package/esm/compatibility/flowcore-transformer-core.sdk.d.ts +4 -0
- package/esm/compatibility/flowcore-transformer-core.sdk.d.ts.map +1 -1
- package/esm/compatibility/flowcore-transformer-core.sdk.js +2 -0
- package/esm/contracts/index.d.ts +2 -0
- package/esm/contracts/index.d.ts.map +1 -1
- package/esm/contracts/index.js +2 -0
- package/esm/mod.d.ts +2 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -0
- package/esm/pathways/builder.d.ts +87 -0
- package/esm/pathways/builder.d.ts.map +1 -1
- package/esm/pathways/builder.js +83 -8
- package/esm/pathways/index.d.ts +2 -0
- package/esm/pathways/index.d.ts.map +1 -1
- package/esm/pathways/index.js +2 -0
- package/esm/pathways/internal-pathway.state.d.ts +5 -7
- package/esm/pathways/internal-pathway.state.d.ts.map +1 -1
- package/esm/pathways/internal-pathway.state.js +5 -7
- package/esm/pathways/kv/bun-kv-adapter.d.ts +5 -7
- package/esm/pathways/kv/bun-kv-adapter.d.ts.map +1 -1
- package/esm/pathways/kv/bun-kv-adapter.js +5 -7
- package/esm/pathways/kv/kv-adapter.d.ts +7 -7
- package/esm/pathways/kv/kv-adapter.js +1 -1
- package/esm/pathways/kv/node-kv-adapter.d.ts +6 -8
- package/esm/pathways/kv/node-kv-adapter.d.ts.map +1 -1
- package/esm/pathways/kv/node-kv-adapter.js +6 -8
- package/esm/pathways/logger.d.ts +65 -12
- package/esm/pathways/logger.d.ts.map +1 -1
- package/esm/pathways/logger.js +48 -3
- package/esm/pathways/postgres/index.d.ts +2 -0
- package/esm/pathways/postgres/index.d.ts.map +1 -1
- package/esm/pathways/postgres/index.js +2 -0
- package/esm/pathways/postgres/postgres-adapter.d.ts +20 -29
- package/esm/pathways/postgres/postgres-adapter.d.ts.map +1 -1
- package/esm/pathways/postgres/postgres-adapter.js +12 -17
- package/esm/pathways/postgres/postgres-pathway-state.d.ts +2 -6
- package/esm/pathways/postgres/postgres-pathway-state.d.ts.map +1 -1
- package/esm/pathways/postgres/postgres-pathway-state.js +2 -4
- package/esm/pathways/types.d.ts +48 -3
- package/esm/pathways/types.d.ts.map +1 -1
- package/esm/router/index.d.ts +17 -11
- package/esm/router/index.d.ts.map +1 -1
- package/esm/router/index.js +21 -24
- package/package.json +2 -2
- package/script/common/flowcore.type.d.ts +3 -3
- package/script/common/flowcore.type.d.ts.map +1 -1
- package/script/common/index.d.ts +2 -0
- package/script/common/index.d.ts.map +1 -1
- package/script/common/index.js +2 -0
- package/script/compatibility/flowcore-transformer-core.sdk.d.ts +4 -0
- package/script/compatibility/flowcore-transformer-core.sdk.d.ts.map +1 -1
- package/script/compatibility/flowcore-transformer-core.sdk.js +2 -0
- package/script/contracts/index.d.ts +2 -0
- package/script/contracts/index.d.ts.map +1 -1
- package/script/contracts/index.js +2 -0
- package/script/mod.d.ts +2 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +2 -0
- package/script/pathways/builder.d.ts +87 -0
- package/script/pathways/builder.d.ts.map +1 -1
- package/script/pathways/builder.js +83 -8
- package/script/pathways/index.d.ts +2 -0
- package/script/pathways/index.d.ts.map +1 -1
- package/script/pathways/index.js +2 -0
- package/script/pathways/internal-pathway.state.d.ts +5 -7
- package/script/pathways/internal-pathway.state.d.ts.map +1 -1
- package/script/pathways/internal-pathway.state.js +5 -7
- package/script/pathways/kv/bun-kv-adapter.d.ts +5 -7
- package/script/pathways/kv/bun-kv-adapter.d.ts.map +1 -1
- package/script/pathways/kv/bun-kv-adapter.js +5 -7
- package/script/pathways/kv/kv-adapter.d.ts +7 -7
- package/script/pathways/kv/kv-adapter.js +1 -1
- package/script/pathways/kv/node-kv-adapter.d.ts +6 -8
- package/script/pathways/kv/node-kv-adapter.d.ts.map +1 -1
- package/script/pathways/kv/node-kv-adapter.js +6 -8
- package/script/pathways/logger.d.ts +65 -12
- package/script/pathways/logger.d.ts.map +1 -1
- package/script/pathways/logger.js +48 -3
- package/script/pathways/postgres/index.d.ts +2 -0
- package/script/pathways/postgres/index.d.ts.map +1 -1
- package/script/pathways/postgres/index.js +2 -0
- package/script/pathways/postgres/postgres-adapter.d.ts +20 -29
- package/script/pathways/postgres/postgres-adapter.d.ts.map +1 -1
- package/script/pathways/postgres/postgres-adapter.js +12 -17
- package/script/pathways/postgres/postgres-pathway-state.d.ts +2 -6
- package/script/pathways/postgres/postgres-pathway-state.d.ts.map +1 -1
- package/script/pathways/postgres/postgres-pathway-state.js +2 -4
- package/script/pathways/types.d.ts +48 -3
- package/script/pathways/types.d.ts.map +1 -1
- package/script/router/index.d.ts +17 -11
- package/script/router/index.d.ts.map +1 -1
- package/script/router/index.js +21 -24
|
@@ -9,17 +9,17 @@ export interface KvAdapter {
|
|
|
9
9
|
* Retrieves a value from storage by key
|
|
10
10
|
*
|
|
11
11
|
* @template T The expected type of the stored value
|
|
12
|
-
* @param
|
|
13
|
-
* @returns
|
|
12
|
+
* @param key The key to retrieve
|
|
13
|
+
* @returns The stored value or null if not found
|
|
14
14
|
*/
|
|
15
15
|
get<T>(key: string): (Promise<T | null> | T | null);
|
|
16
16
|
/**
|
|
17
17
|
* Stores a value in storage with the specified key and TTL
|
|
18
18
|
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
19
|
+
* @param key The key to store the value under
|
|
20
|
+
* @param value The value to store
|
|
21
|
+
* @param ttlMs Time-to-live in milliseconds
|
|
22
|
+
* @returns Promise or void when the operation completes
|
|
23
23
|
*/
|
|
24
24
|
set(key: string, value: unknown, ttlMs: number): (Promise<void> | void);
|
|
25
25
|
}
|
|
@@ -28,7 +28,7 @@ export interface KvAdapter {
|
|
|
28
28
|
*
|
|
29
29
|
* Attempts to use Bun KV adapter if running in Bun, falls back to Node adapter otherwise
|
|
30
30
|
*
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns A KV adapter instance for the current runtime
|
|
32
32
|
*/
|
|
33
33
|
export declare function createKvAdapter(): Promise<KvAdapter>;
|
|
34
34
|
//# sourceMappingURL=kv-adapter.d.ts.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Attempts to use Bun KV adapter if running in Bun, falls back to Node adapter otherwise
|
|
5
5
|
*
|
|
6
|
-
* @returns
|
|
6
|
+
* @returns A KV adapter instance for the current runtime
|
|
7
7
|
*/
|
|
8
8
|
export async function createKvAdapter() {
|
|
9
9
|
try {
|
|
@@ -3,8 +3,6 @@ import type { KvAdapter } from "./kv-adapter.js";
|
|
|
3
3
|
* KV adapter implementation for Node.js runtime
|
|
4
4
|
*
|
|
5
5
|
* Uses node-cache for in-memory key-value storage
|
|
6
|
-
*
|
|
7
|
-
* @implements {KvAdapter}
|
|
8
6
|
*/
|
|
9
7
|
export declare class NodeKvAdapter implements KvAdapter {
|
|
10
8
|
/**
|
|
@@ -16,17 +14,17 @@ export declare class NodeKvAdapter implements KvAdapter {
|
|
|
16
14
|
* Retrieves a value from the Node.js cache
|
|
17
15
|
*
|
|
18
16
|
* @template T The expected type of the stored value
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
17
|
+
* @param key The key to retrieve
|
|
18
|
+
* @returns The stored value or null if not found
|
|
21
19
|
*/
|
|
22
20
|
get<T>(key: string): Promise<T | null>;
|
|
23
21
|
/**
|
|
24
22
|
* Stores a value in the Node.js cache with the specified TTL
|
|
25
23
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @returns
|
|
24
|
+
* @param key The key to store the value under
|
|
25
|
+
* @param value The value to store
|
|
26
|
+
* @param ttlMs Time-to-live in milliseconds
|
|
27
|
+
* @returns Promise that resolves when the operation completes
|
|
30
28
|
*/
|
|
31
29
|
set(key: string, value: unknown, ttlMs: number): Promise<void>;
|
|
32
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/node-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"node-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/node-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC7C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAmB;IAEtC;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAK5C;;;;;;;OAOG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
|
|
@@ -3,8 +3,6 @@ import NodeCache from "node-cache";
|
|
|
3
3
|
* KV adapter implementation for Node.js runtime
|
|
4
4
|
*
|
|
5
5
|
* Uses node-cache for in-memory key-value storage
|
|
6
|
-
*
|
|
7
|
-
* @implements {KvAdapter}
|
|
8
6
|
*/
|
|
9
7
|
export class NodeKvAdapter {
|
|
10
8
|
constructor() {
|
|
@@ -23,8 +21,8 @@ export class NodeKvAdapter {
|
|
|
23
21
|
* Retrieves a value from the Node.js cache
|
|
24
22
|
*
|
|
25
23
|
* @template T The expected type of the stored value
|
|
26
|
-
* @param
|
|
27
|
-
* @returns
|
|
24
|
+
* @param key The key to retrieve
|
|
25
|
+
* @returns The stored value or null if not found
|
|
28
26
|
*/
|
|
29
27
|
async get(key) {
|
|
30
28
|
const result = await this.kv.get(key);
|
|
@@ -33,10 +31,10 @@ export class NodeKvAdapter {
|
|
|
33
31
|
/**
|
|
34
32
|
* Stores a value in the Node.js cache with the specified TTL
|
|
35
33
|
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @returns
|
|
34
|
+
* @param key The key to store the value under
|
|
35
|
+
* @param value The value to store
|
|
36
|
+
* @param ttlMs Time-to-live in milliseconds
|
|
37
|
+
* @returns Promise that resolves when the operation completes
|
|
40
38
|
*/
|
|
41
39
|
async set(key, value, ttlMs) {
|
|
42
40
|
await this.kv.set(key, value, (ttlMs / 1000));
|
package/esm/pathways/logger.d.ts
CHANGED
|
@@ -1,48 +1,101 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Logger interface that can be implemented by users to capture logs from pathways
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Metadata interface for logger context
|
|
6
|
+
*/
|
|
7
|
+
export interface LoggerMeta {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
label?: never;
|
|
10
|
+
level?: never;
|
|
11
|
+
message?: never;
|
|
12
|
+
timestamp?: never;
|
|
13
|
+
}
|
|
4
14
|
export interface Logger {
|
|
5
15
|
/**
|
|
6
16
|
* Log debug information
|
|
7
17
|
* @param message The message to log
|
|
8
18
|
* @param context Optional context data to include
|
|
9
19
|
*/
|
|
10
|
-
debug(message: string, context?:
|
|
20
|
+
debug(message: string, context?: LoggerMeta): void;
|
|
11
21
|
/**
|
|
12
22
|
* Log informational messages
|
|
13
23
|
* @param message The message to log
|
|
14
24
|
* @param context Optional context data to include
|
|
15
25
|
*/
|
|
16
|
-
info(message: string, context?:
|
|
26
|
+
info(message: string, context?: LoggerMeta): void;
|
|
17
27
|
/**
|
|
18
28
|
* Log warning messages
|
|
19
29
|
* @param message The message to log
|
|
20
30
|
* @param context Optional context data to include
|
|
21
31
|
*/
|
|
22
|
-
warn(message: string, context?:
|
|
32
|
+
warn(message: string, context?: LoggerMeta): void;
|
|
23
33
|
/**
|
|
24
34
|
* Log error messages
|
|
25
35
|
* @param message The message to log
|
|
36
|
+
* @param error Optional error object
|
|
26
37
|
* @param context Optional context data to include
|
|
27
38
|
*/
|
|
28
|
-
error(message: string,
|
|
39
|
+
error(message: string, error?: Error, context?: LoggerMeta): void;
|
|
29
40
|
}
|
|
30
41
|
/**
|
|
31
42
|
* A default console logger that logs to the console
|
|
32
43
|
*/
|
|
33
44
|
export declare class ConsoleLogger implements Logger {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Log debug information to the console
|
|
47
|
+
* @param message The message to log
|
|
48
|
+
* @param context Optional context data to include
|
|
49
|
+
*/
|
|
50
|
+
debug(message: string, context?: LoggerMeta): void;
|
|
51
|
+
/**
|
|
52
|
+
* Log informational messages to the console
|
|
53
|
+
* @param message The message to log
|
|
54
|
+
* @param context Optional context data to include
|
|
55
|
+
*/
|
|
56
|
+
info(message: string, context?: LoggerMeta): void;
|
|
57
|
+
/**
|
|
58
|
+
* Log warning messages to the console
|
|
59
|
+
* @param message The message to log
|
|
60
|
+
* @param context Optional context data to include
|
|
61
|
+
*/
|
|
62
|
+
warn(message: string, context?: LoggerMeta): void;
|
|
63
|
+
/**
|
|
64
|
+
* Log error messages to the console
|
|
65
|
+
* @param message The message to log
|
|
66
|
+
* @param error Optional error object
|
|
67
|
+
* @param context Optional context data to include
|
|
68
|
+
*/
|
|
69
|
+
error(message: string, error?: Error, context?: LoggerMeta): void;
|
|
38
70
|
}
|
|
39
71
|
/**
|
|
40
72
|
* A no-operation logger that does nothing
|
|
41
73
|
*/
|
|
42
74
|
export declare class NoopLogger implements Logger {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
75
|
+
/**
|
|
76
|
+
* No-op debug log
|
|
77
|
+
* @param _message The message to log (ignored)
|
|
78
|
+
* @param _context Optional context data (ignored)
|
|
79
|
+
*/
|
|
80
|
+
debug(_message: string, _context?: LoggerMeta): void;
|
|
81
|
+
/**
|
|
82
|
+
* No-op info log
|
|
83
|
+
* @param _message The message to log (ignored)
|
|
84
|
+
* @param _context Optional context data (ignored)
|
|
85
|
+
*/
|
|
86
|
+
info(_message: string, _context?: LoggerMeta): void;
|
|
87
|
+
/**
|
|
88
|
+
* No-op warning log
|
|
89
|
+
* @param _message The message to log (ignored)
|
|
90
|
+
* @param _context Optional context data (ignored)
|
|
91
|
+
*/
|
|
92
|
+
warn(_message: string, _context?: LoggerMeta): void;
|
|
93
|
+
/**
|
|
94
|
+
* No-op error log
|
|
95
|
+
* @param _message The message to log (ignored)
|
|
96
|
+
* @param _error Optional error object (ignored)
|
|
97
|
+
* @param _context Optional context data (ignored)
|
|
98
|
+
*/
|
|
99
|
+
error(_message: string, _error?: Error, _context?: LoggerMeta): void;
|
|
47
100
|
}
|
|
48
101
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/pathways/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/pathways/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,SAAS,CAAC,EAAE,KAAK,CAAA;CAClB;AAED,MAAM,WAAW,MAAM;IACrB;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAElD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAEjD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAEjD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;CAClE;AAED;;GAEG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIlD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIjD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAIjD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;CAGlE;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;IAEpD;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;IAEnD;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;IAEnD;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;CACrE"}
|
package/esm/pathways/logger.js
CHANGED
|
@@ -1,26 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger interface that can be implemented by users to capture logs from pathways
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* A default console logger that logs to the console
|
|
3
6
|
*/
|
|
4
7
|
export class ConsoleLogger {
|
|
8
|
+
/**
|
|
9
|
+
* Log debug information to the console
|
|
10
|
+
* @param message The message to log
|
|
11
|
+
* @param context Optional context data to include
|
|
12
|
+
*/
|
|
5
13
|
debug(message, context) {
|
|
6
14
|
console.debug(message, context ? JSON.stringify(context) : '');
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Log informational messages to the console
|
|
18
|
+
* @param message The message to log
|
|
19
|
+
* @param context Optional context data to include
|
|
20
|
+
*/
|
|
8
21
|
info(message, context) {
|
|
9
22
|
console.info(message, context ? JSON.stringify(context) : '');
|
|
10
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Log warning messages to the console
|
|
26
|
+
* @param message The message to log
|
|
27
|
+
* @param context Optional context data to include
|
|
28
|
+
*/
|
|
11
29
|
warn(message, context) {
|
|
12
30
|
console.warn(message, context ? JSON.stringify(context) : '');
|
|
13
31
|
}
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Log error messages to the console
|
|
34
|
+
* @param message The message to log
|
|
35
|
+
* @param error Optional error object
|
|
36
|
+
* @param context Optional context data to include
|
|
37
|
+
*/
|
|
38
|
+
error(message, error, context) {
|
|
39
|
+
console.error(message, error, context ? JSON.stringify(context) : '');
|
|
16
40
|
}
|
|
17
41
|
}
|
|
18
42
|
/**
|
|
19
43
|
* A no-operation logger that does nothing
|
|
20
44
|
*/
|
|
21
45
|
export class NoopLogger {
|
|
46
|
+
/**
|
|
47
|
+
* No-op debug log
|
|
48
|
+
* @param _message The message to log (ignored)
|
|
49
|
+
* @param _context Optional context data (ignored)
|
|
50
|
+
*/
|
|
22
51
|
debug(_message, _context) { }
|
|
52
|
+
/**
|
|
53
|
+
* No-op info log
|
|
54
|
+
* @param _message The message to log (ignored)
|
|
55
|
+
* @param _context Optional context data (ignored)
|
|
56
|
+
*/
|
|
23
57
|
info(_message, _context) { }
|
|
58
|
+
/**
|
|
59
|
+
* No-op warning log
|
|
60
|
+
* @param _message The message to log (ignored)
|
|
61
|
+
* @param _context Optional context data (ignored)
|
|
62
|
+
*/
|
|
24
63
|
warn(_message, _context) { }
|
|
25
|
-
|
|
64
|
+
/**
|
|
65
|
+
* No-op error log
|
|
66
|
+
* @param _message The message to log (ignored)
|
|
67
|
+
* @param _error Optional error object (ignored)
|
|
68
|
+
* @param _context Optional context data (ignored)
|
|
69
|
+
*/
|
|
70
|
+
error(_message, _error, _context) { }
|
|
26
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration options for PostgreSQL connection
|
|
3
|
-
*
|
|
4
|
-
* @interface PostgresConfig
|
|
5
3
|
*/
|
|
6
4
|
export interface PostgresConfig {
|
|
7
5
|
/** PostgreSQL server hostname */
|
|
@@ -21,40 +19,36 @@ export interface PostgresConfig {
|
|
|
21
19
|
* Interface for PostgreSQL database operations
|
|
22
20
|
*
|
|
23
21
|
* Provides methods for connecting, querying, and executing SQL statements
|
|
24
|
-
*
|
|
25
|
-
* @interface PostgresAdapter
|
|
26
22
|
*/
|
|
27
23
|
export interface PostgresAdapter {
|
|
28
24
|
/**
|
|
29
25
|
* Establishes a connection to the PostgreSQL database
|
|
30
|
-
* @returns
|
|
26
|
+
* @returns Promise that resolves when the connection is established
|
|
31
27
|
*/
|
|
32
28
|
connect(): Promise<void>;
|
|
33
29
|
/**
|
|
34
30
|
* Closes the connection to the PostgreSQL database
|
|
35
|
-
* @returns
|
|
31
|
+
* @returns Promise that resolves when the connection is closed
|
|
36
32
|
*/
|
|
37
33
|
disconnect(): Promise<void>;
|
|
38
34
|
/**
|
|
39
35
|
* Executes a SQL query and returns the results
|
|
40
36
|
* @template T The expected result type
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @returns
|
|
37
|
+
* @param sql The SQL query to execute
|
|
38
|
+
* @param params Optional parameters for the query
|
|
39
|
+
* @returns Promise that resolves to the query results
|
|
44
40
|
*/
|
|
45
41
|
query<T>(sql: string, params?: unknown[]): Promise<T>;
|
|
46
42
|
/**
|
|
47
43
|
* Executes a SQL statement without returning results
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @returns
|
|
44
|
+
* @param sql The SQL statement to execute
|
|
45
|
+
* @param params Optional parameters for the statement
|
|
46
|
+
* @returns Promise that resolves when the statement has been executed
|
|
51
47
|
*/
|
|
52
48
|
execute(sql: string, params?: unknown[]): Promise<void>;
|
|
53
49
|
}
|
|
54
50
|
/**
|
|
55
51
|
* Implementation of PostgresAdapter using the postgres.js library
|
|
56
|
-
*
|
|
57
|
-
* @implements {PostgresAdapter}
|
|
58
52
|
*/
|
|
59
53
|
export declare class PostgresJsAdapter implements PostgresAdapter {
|
|
60
54
|
/** The postgres.js client factory function */
|
|
@@ -68,45 +62,42 @@ export declare class PostgresJsAdapter implements PostgresAdapter {
|
|
|
68
62
|
/**
|
|
69
63
|
* Creates a new PostgresJsAdapter instance
|
|
70
64
|
*
|
|
71
|
-
* @param
|
|
65
|
+
* @param config The PostgreSQL connection configuration
|
|
72
66
|
*/
|
|
73
67
|
constructor(config: PostgresConfig);
|
|
74
68
|
/**
|
|
75
69
|
* Establishes a connection to the PostgreSQL database
|
|
76
70
|
*
|
|
77
|
-
* @returns
|
|
78
|
-
* @throws
|
|
71
|
+
* @returns Promise that resolves when connection is established
|
|
72
|
+
* @throws Error if connection fails
|
|
79
73
|
*/
|
|
80
74
|
connect(): Promise<void>;
|
|
81
75
|
/**
|
|
82
76
|
* Closes the connection to the PostgreSQL database
|
|
83
|
-
*
|
|
84
|
-
* @returns {Promise<void>}
|
|
77
|
+
* @returns Promise that resolves when the connection is closed
|
|
85
78
|
*/
|
|
86
79
|
disconnect(): Promise<void>;
|
|
87
80
|
/**
|
|
88
81
|
* Executes a SQL query and returns the results
|
|
89
|
-
*
|
|
90
82
|
* @template T The expected result type
|
|
91
|
-
* @param
|
|
92
|
-
* @param
|
|
93
|
-
* @returns
|
|
83
|
+
* @param sql The SQL query to execute
|
|
84
|
+
* @param params Optional parameters for the query
|
|
85
|
+
* @returns Promise that resolves to the query results
|
|
94
86
|
*/
|
|
95
87
|
query<T>(sql: string, params?: unknown[]): Promise<T>;
|
|
96
88
|
/**
|
|
97
89
|
* Executes a SQL statement without returning results
|
|
98
|
-
*
|
|
99
|
-
* @param
|
|
100
|
-
* @
|
|
101
|
-
* @returns {Promise<void>}
|
|
90
|
+
* @param sql The SQL statement to execute
|
|
91
|
+
* @param params Optional parameters for the statement
|
|
92
|
+
* @returns Promise that resolves when the statement has been executed
|
|
102
93
|
*/
|
|
103
94
|
execute(sql: string, params?: unknown[]): Promise<void>;
|
|
104
95
|
}
|
|
105
96
|
/**
|
|
106
97
|
* Creates and initializes a PostgreSQL adapter
|
|
107
98
|
*
|
|
108
|
-
* @param
|
|
109
|
-
* @returns
|
|
99
|
+
* @param config The PostgreSQL connection configuration
|
|
100
|
+
* @returns An initialized PostgreSQL adapter
|
|
110
101
|
*/
|
|
111
102
|
export declare function createPostgresAdapter(config: PostgresConfig): Promise<PostgresAdapter>;
|
|
112
103
|
//# sourceMappingURL=postgres-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"postgres-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;;;;OAMG;IACH,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAoBD;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IACvD,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAA+D;IAC/E,oCAAoC;IACpC,OAAO,CAAC,GAAG,CAA+B;IAC1C,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAiB;IAC/B,yDAAyD;IACzD,OAAO,CAAC,gBAAgB,CAAS;IAEjC;;;;OAIG;gBACS,MAAM,EAAE,cAAc;IAQlC;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;;;;OAMG;IACG,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAO/D;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAI5F"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Implementation of PostgresAdapter using the postgres.js library
|
|
3
|
-
*
|
|
4
|
-
* @implements {PostgresAdapter}
|
|
5
3
|
*/
|
|
6
4
|
export class PostgresJsAdapter {
|
|
7
5
|
/**
|
|
8
6
|
* Creates a new PostgresJsAdapter instance
|
|
9
7
|
*
|
|
10
|
-
* @param
|
|
8
|
+
* @param config The PostgreSQL connection configuration
|
|
11
9
|
*/
|
|
12
10
|
constructor(config) {
|
|
13
11
|
/** The postgres.js client factory function */
|
|
@@ -47,8 +45,8 @@ export class PostgresJsAdapter {
|
|
|
47
45
|
/**
|
|
48
46
|
* Establishes a connection to the PostgreSQL database
|
|
49
47
|
*
|
|
50
|
-
* @returns
|
|
51
|
-
* @throws
|
|
48
|
+
* @returns Promise that resolves when connection is established
|
|
49
|
+
* @throws Error if connection fails
|
|
52
50
|
*/
|
|
53
51
|
async connect() {
|
|
54
52
|
try {
|
|
@@ -63,8 +61,7 @@ export class PostgresJsAdapter {
|
|
|
63
61
|
}
|
|
64
62
|
/**
|
|
65
63
|
* Closes the connection to the PostgreSQL database
|
|
66
|
-
*
|
|
67
|
-
* @returns {Promise<void>}
|
|
64
|
+
* @returns Promise that resolves when the connection is closed
|
|
68
65
|
*/
|
|
69
66
|
async disconnect() {
|
|
70
67
|
if (this.sql) {
|
|
@@ -74,11 +71,10 @@ export class PostgresJsAdapter {
|
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
76
73
|
* Executes a SQL query and returns the results
|
|
77
|
-
*
|
|
78
74
|
* @template T The expected result type
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @returns
|
|
75
|
+
* @param sql The SQL query to execute
|
|
76
|
+
* @param params Optional parameters for the query
|
|
77
|
+
* @returns Promise that resolves to the query results
|
|
82
78
|
*/
|
|
83
79
|
async query(sql, params = []) {
|
|
84
80
|
if (!this.sql) {
|
|
@@ -88,10 +84,9 @@ export class PostgresJsAdapter {
|
|
|
88
84
|
}
|
|
89
85
|
/**
|
|
90
86
|
* Executes a SQL statement without returning results
|
|
91
|
-
*
|
|
92
|
-
* @param
|
|
93
|
-
* @
|
|
94
|
-
* @returns {Promise<void>}
|
|
87
|
+
* @param sql The SQL statement to execute
|
|
88
|
+
* @param params Optional parameters for the statement
|
|
89
|
+
* @returns Promise that resolves when the statement has been executed
|
|
95
90
|
*/
|
|
96
91
|
async execute(sql, params = []) {
|
|
97
92
|
if (!this.sql) {
|
|
@@ -103,8 +98,8 @@ export class PostgresJsAdapter {
|
|
|
103
98
|
/**
|
|
104
99
|
* Creates and initializes a PostgreSQL adapter
|
|
105
100
|
*
|
|
106
|
-
* @param
|
|
107
|
-
* @returns
|
|
101
|
+
* @param config The PostgreSQL connection configuration
|
|
102
|
+
* @returns An initialized PostgreSQL adapter
|
|
108
103
|
*/
|
|
109
104
|
export async function createPostgresAdapter(config) {
|
|
110
105
|
const adapter = new PostgresJsAdapter(config);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { PathwayState } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration options for PostgreSQL pathway state storage
|
|
4
|
-
*
|
|
5
|
-
* @interface PostgresPathwayStateConfig
|
|
6
4
|
*/
|
|
7
5
|
export interface PostgresPathwayStateConfig {
|
|
8
6
|
/** PostgreSQL server hostname */
|
|
@@ -27,8 +25,6 @@ export interface PostgresPathwayStateConfig {
|
|
|
27
25
|
*
|
|
28
26
|
* This class provides persistent storage of pathway state using a PostgreSQL database,
|
|
29
27
|
* which allows for state to be shared across multiple instances of the application.
|
|
30
|
-
*
|
|
31
|
-
* @implements {PathwayState}
|
|
32
28
|
*/
|
|
33
29
|
export declare class PostgresPathwayState implements PathwayState {
|
|
34
30
|
private config;
|
|
@@ -106,8 +102,8 @@ export declare class PostgresPathwayState implements PathwayState {
|
|
|
106
102
|
/**
|
|
107
103
|
* Creates a new PostgreSQL pathway state instance
|
|
108
104
|
*
|
|
109
|
-
* @param
|
|
110
|
-
* @returns
|
|
105
|
+
* @param config The PostgreSQL configuration
|
|
106
|
+
* @returns A new PostgresPathwayState instance
|
|
111
107
|
*/
|
|
112
108
|
export declare function createPostgresPathwayState(config: PostgresPathwayStateConfig): PostgresPathwayState;
|
|
113
109
|
//# sourceMappingURL=postgres-pathway-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-pathway-state.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-pathway-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD
|
|
1
|
+
{"version":3,"file":"postgres-pathway-state.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-pathway-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IA0C3C,OAAO,CAAC,MAAM;IAzC1B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEvD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAmB;IAE7D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAkB;IAElC;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAS;IAE1B;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAS;IAEtB;;;OAGG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;OAIG;gBACiB,MAAM,EAAE,0BAA0B;IAMtD;;;;;OAKG;YACW,UAAU;IAgCxB;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAcpD;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAelD;;;;;OAKG;YACW,cAAc;IAQ5B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,0BAA0B,GAAG,oBAAoB,CAGnG"}
|
|
@@ -4,8 +4,6 @@ import { createPostgresAdapter } from "./postgres-adapter.js";
|
|
|
4
4
|
*
|
|
5
5
|
* This class provides persistent storage of pathway state using a PostgreSQL database,
|
|
6
6
|
* which allows for state to be shared across multiple instances of the application.
|
|
7
|
-
*
|
|
8
|
-
* @implements {PathwayState}
|
|
9
7
|
*/
|
|
10
8
|
export class PostgresPathwayState {
|
|
11
9
|
/**
|
|
@@ -179,8 +177,8 @@ Object.defineProperty(PostgresPathwayState, "DEFAULT_TABLE_NAME", {
|
|
|
179
177
|
/**
|
|
180
178
|
* Creates a new PostgreSQL pathway state instance
|
|
181
179
|
*
|
|
182
|
-
* @param
|
|
183
|
-
* @returns
|
|
180
|
+
* @param config The PostgreSQL configuration
|
|
181
|
+
* @returns A new PostgresPathwayState instance
|
|
184
182
|
*/
|
|
185
183
|
export function createPostgresPathwayState(config) {
|
|
186
184
|
const state = new PostgresPathwayState(config);
|