@flowcore/pathways 0.2.1 → 0.2.2
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 +9 -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 +46 -3
- package/esm/pathways/logger.d.ts.map +1 -1
- package/esm/pathways/logger.js +45 -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 +46 -3
- package/script/pathways/logger.d.ts.map +1 -1
- package/script/pathways/logger.js +45 -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
|
@@ -2,8 +2,6 @@ import type { PathwayState } from "./types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Internal implementation of PathwayState interface that uses KV storage
|
|
4
4
|
* for tracking processed events to prevent duplicate processing
|
|
5
|
-
*
|
|
6
|
-
* @implements {PathwayState}
|
|
7
5
|
*/
|
|
8
6
|
export declare class InternalPathwayState implements PathwayState {
|
|
9
7
|
/**
|
|
@@ -20,21 +18,21 @@ export declare class InternalPathwayState implements PathwayState {
|
|
|
20
18
|
* Gets or initializes the KV adapter
|
|
21
19
|
*
|
|
22
20
|
* @private
|
|
23
|
-
* @returns
|
|
21
|
+
* @returns The KV adapter instance
|
|
24
22
|
*/
|
|
25
23
|
private getKv;
|
|
26
24
|
/**
|
|
27
25
|
* Checks if an event has already been processed
|
|
28
26
|
*
|
|
29
|
-
* @param
|
|
30
|
-
* @returns
|
|
27
|
+
* @param eventId The ID of the event to check
|
|
28
|
+
* @returns True if the event has been processed, false otherwise
|
|
31
29
|
*/
|
|
32
30
|
isProcessed(eventId: string): Promise<boolean>;
|
|
33
31
|
/**
|
|
34
32
|
* Marks an event as processed
|
|
35
33
|
*
|
|
36
|
-
* @param
|
|
37
|
-
* @returns
|
|
34
|
+
* @param eventId The ID of the event to mark as processed
|
|
35
|
+
* @returns Promise that resolves when the operation completes
|
|
38
36
|
*/
|
|
39
37
|
setProcessed(eventId: string): Promise<void>;
|
|
40
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-pathway.state.d.ts","sourceRoot":"","sources":["../../src/pathways/internal-pathway.state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"internal-pathway.state.d.ts","sourceRoot":"","sources":["../../src/pathways/internal-pathway.state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEvD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAA0B;IAEpC;;;;;OAKG;YACW,KAAK;IAOnB;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpD;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAInD"}
|
|
@@ -5,8 +5,6 @@ const kv_adapter_js_1 = require("./kv/kv-adapter.js");
|
|
|
5
5
|
/**
|
|
6
6
|
* Internal implementation of PathwayState interface that uses KV storage
|
|
7
7
|
* for tracking processed events to prevent duplicate processing
|
|
8
|
-
*
|
|
9
|
-
* @implements {PathwayState}
|
|
10
8
|
*/
|
|
11
9
|
class InternalPathwayState {
|
|
12
10
|
constructor() {
|
|
@@ -25,7 +23,7 @@ class InternalPathwayState {
|
|
|
25
23
|
* Gets or initializes the KV adapter
|
|
26
24
|
*
|
|
27
25
|
* @private
|
|
28
|
-
* @returns
|
|
26
|
+
* @returns The KV adapter instance
|
|
29
27
|
*/
|
|
30
28
|
async getKv() {
|
|
31
29
|
if (!this.kv) {
|
|
@@ -36,8 +34,8 @@ class InternalPathwayState {
|
|
|
36
34
|
/**
|
|
37
35
|
* Checks if an event has already been processed
|
|
38
36
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @returns
|
|
37
|
+
* @param eventId The ID of the event to check
|
|
38
|
+
* @returns True if the event has been processed, false otherwise
|
|
41
39
|
*/
|
|
42
40
|
async isProcessed(eventId) {
|
|
43
41
|
const kv = await this.getKv();
|
|
@@ -47,8 +45,8 @@ class InternalPathwayState {
|
|
|
47
45
|
/**
|
|
48
46
|
* Marks an event as processed
|
|
49
47
|
*
|
|
50
|
-
* @param
|
|
51
|
-
* @returns
|
|
48
|
+
* @param eventId The ID of the event to mark as processed
|
|
49
|
+
* @returns Promise that resolves when the operation completes
|
|
52
50
|
*/
|
|
53
51
|
async setProcessed(eventId) {
|
|
54
52
|
const kv = await this.getKv();
|
|
@@ -3,8 +3,6 @@ import type { KvAdapter } from "./kv-adapter.js";
|
|
|
3
3
|
* KV adapter implementation for Bun runtime
|
|
4
4
|
*
|
|
5
5
|
* Uses Bun's SQLite-based key-value store for storage
|
|
6
|
-
*
|
|
7
|
-
* @implements {KvAdapter}
|
|
8
6
|
*/
|
|
9
7
|
export declare class BunKvAdapter implements KvAdapter {
|
|
10
8
|
/**
|
|
@@ -20,16 +18,16 @@ export declare class BunKvAdapter implements KvAdapter {
|
|
|
20
18
|
* Retrieves a value from the Bun KV store
|
|
21
19
|
*
|
|
22
20
|
* @template T The expected type of the stored value
|
|
23
|
-
* @param
|
|
24
|
-
* @returns
|
|
21
|
+
* @param key The key to retrieve
|
|
22
|
+
* @returns The stored value or null if not found
|
|
25
23
|
*/
|
|
26
24
|
get<T>(key: string): T | null;
|
|
27
25
|
/**
|
|
28
26
|
* Stores a value in the Bun KV store with the specified TTL
|
|
29
27
|
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
28
|
+
* @param key The key to store the value under
|
|
29
|
+
* @param value The value to store
|
|
30
|
+
* @param ttlMs Time-to-live in milliseconds
|
|
33
31
|
*/
|
|
34
32
|
set(key: string, value: unknown, ttlMs: number): void;
|
|
35
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/bun-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"bun-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/bun-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,SAAS;IAC5C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAoB;IAEjC;;OAEG;;IAKH;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAK7B;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAGtD"}
|
|
@@ -6,8 +6,6 @@ const bun_sqlite_key_value_1 = require("bun-sqlite-key-value");
|
|
|
6
6
|
* KV adapter implementation for Bun runtime
|
|
7
7
|
*
|
|
8
8
|
* Uses Bun's SQLite-based key-value store for storage
|
|
9
|
-
*
|
|
10
|
-
* @implements {KvAdapter}
|
|
11
9
|
*/
|
|
12
10
|
class BunKvAdapter {
|
|
13
11
|
/**
|
|
@@ -30,8 +28,8 @@ class BunKvAdapter {
|
|
|
30
28
|
* Retrieves a value from the Bun KV store
|
|
31
29
|
*
|
|
32
30
|
* @template T The expected type of the stored value
|
|
33
|
-
* @param
|
|
34
|
-
* @returns
|
|
31
|
+
* @param key The key to retrieve
|
|
32
|
+
* @returns The stored value or null if not found
|
|
35
33
|
*/
|
|
36
34
|
get(key) {
|
|
37
35
|
const value = this.store.get(key);
|
|
@@ -40,9 +38,9 @@ class BunKvAdapter {
|
|
|
40
38
|
/**
|
|
41
39
|
* Stores a value in the Bun KV store with the specified TTL
|
|
42
40
|
*
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
41
|
+
* @param key The key to store the value under
|
|
42
|
+
* @param value The value to store
|
|
43
|
+
* @param ttlMs Time-to-live in milliseconds
|
|
46
44
|
*/
|
|
47
45
|
set(key, value, ttlMs) {
|
|
48
46
|
this.store.set(key, value, ttlMs);
|
|
@@ -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
|
|
@@ -29,7 +29,7 @@ exports.createKvAdapter = createKvAdapter;
|
|
|
29
29
|
*
|
|
30
30
|
* Attempts to use Bun KV adapter if running in Bun, falls back to Node adapter otherwise
|
|
31
31
|
*
|
|
32
|
-
* @returns
|
|
32
|
+
* @returns A KV adapter instance for the current runtime
|
|
33
33
|
*/
|
|
34
34
|
async function createKvAdapter() {
|
|
35
35
|
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"}
|
|
@@ -9,8 +9,6 @@ const node_cache_1 = __importDefault(require("node-cache"));
|
|
|
9
9
|
* KV adapter implementation for Node.js runtime
|
|
10
10
|
*
|
|
11
11
|
* Uses node-cache for in-memory key-value storage
|
|
12
|
-
*
|
|
13
|
-
* @implements {KvAdapter}
|
|
14
12
|
*/
|
|
15
13
|
class NodeKvAdapter {
|
|
16
14
|
constructor() {
|
|
@@ -29,8 +27,8 @@ class NodeKvAdapter {
|
|
|
29
27
|
* Retrieves a value from the Node.js cache
|
|
30
28
|
*
|
|
31
29
|
* @template T The expected type of the stored value
|
|
32
|
-
* @param
|
|
33
|
-
* @returns
|
|
30
|
+
* @param key The key to retrieve
|
|
31
|
+
* @returns The stored value or null if not found
|
|
34
32
|
*/
|
|
35
33
|
async get(key) {
|
|
36
34
|
const result = await this.kv.get(key);
|
|
@@ -39,10 +37,10 @@ class NodeKvAdapter {
|
|
|
39
37
|
/**
|
|
40
38
|
* Stores a value in the Node.js cache with the specified TTL
|
|
41
39
|
*
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns
|
|
40
|
+
* @param key The key to store the value under
|
|
41
|
+
* @param value The value to store
|
|
42
|
+
* @param ttlMs Time-to-live in milliseconds
|
|
43
|
+
* @returns Promise that resolves when the operation completes
|
|
46
44
|
*/
|
|
47
45
|
async set(key, value, ttlMs) {
|
|
48
46
|
await this.kv.set(key, value, (ttlMs / 1000));
|
|
@@ -23,26 +23,69 @@ export interface Logger {
|
|
|
23
23
|
/**
|
|
24
24
|
* Log error messages
|
|
25
25
|
* @param message The message to log
|
|
26
|
+
* @param error Optional error object
|
|
26
27
|
* @param context Optional context data to include
|
|
27
28
|
*/
|
|
28
|
-
error(message: string, context?: Record<string, unknown>): void;
|
|
29
|
+
error(message: string, error?: Error, context?: Record<string, unknown>): void;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* A default console logger that logs to the console
|
|
32
33
|
*/
|
|
33
34
|
export declare class ConsoleLogger implements Logger {
|
|
35
|
+
/**
|
|
36
|
+
* Log debug information to the console
|
|
37
|
+
* @param message The message to log
|
|
38
|
+
* @param context Optional context data to include
|
|
39
|
+
*/
|
|
34
40
|
debug(message: string, context?: Record<string, unknown>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Log informational messages to the console
|
|
43
|
+
* @param message The message to log
|
|
44
|
+
* @param context Optional context data to include
|
|
45
|
+
*/
|
|
35
46
|
info(message: string, context?: Record<string, unknown>): void;
|
|
47
|
+
/**
|
|
48
|
+
* Log warning messages to the console
|
|
49
|
+
* @param message The message to log
|
|
50
|
+
* @param context Optional context data to include
|
|
51
|
+
*/
|
|
36
52
|
warn(message: string, context?: Record<string, unknown>): void;
|
|
37
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Log error messages to the console
|
|
55
|
+
* @param message The message to log
|
|
56
|
+
* @param error Optional error object
|
|
57
|
+
* @param context Optional context data to include
|
|
58
|
+
*/
|
|
59
|
+
error(message: string, error?: Error, context?: Record<string, unknown>): void;
|
|
38
60
|
}
|
|
39
61
|
/**
|
|
40
62
|
* A no-operation logger that does nothing
|
|
41
63
|
*/
|
|
42
64
|
export declare class NoopLogger implements Logger {
|
|
65
|
+
/**
|
|
66
|
+
* No-op debug log
|
|
67
|
+
* @param _message The message to log (ignored)
|
|
68
|
+
* @param _context Optional context data (ignored)
|
|
69
|
+
*/
|
|
43
70
|
debug(_message: string, _context?: Record<string, unknown>): void;
|
|
71
|
+
/**
|
|
72
|
+
* No-op info log
|
|
73
|
+
* @param _message The message to log (ignored)
|
|
74
|
+
* @param _context Optional context data (ignored)
|
|
75
|
+
*/
|
|
44
76
|
info(_message: string, _context?: Record<string, unknown>): void;
|
|
77
|
+
/**
|
|
78
|
+
* No-op warning log
|
|
79
|
+
* @param _message The message to log (ignored)
|
|
80
|
+
* @param _context Optional context data (ignored)
|
|
81
|
+
*/
|
|
45
82
|
warn(_message: string, _context?: Record<string, unknown>): void;
|
|
46
|
-
|
|
83
|
+
/**
|
|
84
|
+
* No-op error log
|
|
85
|
+
* @param _message The message to log (ignored)
|
|
86
|
+
* @param _error Optional error object (ignored)
|
|
87
|
+
* @param _context Optional context data (ignored)
|
|
88
|
+
*/
|
|
89
|
+
error(_message: string, _error?: Error, _context?: Record<string, unknown>): void;
|
|
47
90
|
}
|
|
48
91
|
//# 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,MAAM;IACrB;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAE/D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAE9D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAE9D
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/pathways/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAE/D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAE9D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAE9D;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC/E;AAED;;GAEG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI/D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAG/E;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAEjE;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAEhE;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAEhE;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAClF"}
|
|
@@ -5,17 +5,38 @@ exports.NoopLogger = exports.ConsoleLogger = void 0;
|
|
|
5
5
|
* A default console logger that logs to the console
|
|
6
6
|
*/
|
|
7
7
|
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
|
+
*/
|
|
8
13
|
debug(message, context) {
|
|
9
14
|
console.debug(message, context ? JSON.stringify(context) : '');
|
|
10
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
|
+
*/
|
|
11
21
|
info(message, context) {
|
|
12
22
|
console.info(message, context ? JSON.stringify(context) : '');
|
|
13
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
|
+
*/
|
|
14
29
|
warn(message, context) {
|
|
15
30
|
console.warn(message, context ? JSON.stringify(context) : '');
|
|
16
31
|
}
|
|
17
|
-
|
|
18
|
-
|
|
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) : '');
|
|
19
40
|
}
|
|
20
41
|
}
|
|
21
42
|
exports.ConsoleLogger = ConsoleLogger;
|
|
@@ -23,9 +44,30 @@ exports.ConsoleLogger = ConsoleLogger;
|
|
|
23
44
|
* A no-operation logger that does nothing
|
|
24
45
|
*/
|
|
25
46
|
class NoopLogger {
|
|
47
|
+
/**
|
|
48
|
+
* No-op debug log
|
|
49
|
+
* @param _message The message to log (ignored)
|
|
50
|
+
* @param _context Optional context data (ignored)
|
|
51
|
+
*/
|
|
26
52
|
debug(_message, _context) { }
|
|
53
|
+
/**
|
|
54
|
+
* No-op info log
|
|
55
|
+
* @param _message The message to log (ignored)
|
|
56
|
+
* @param _context Optional context data (ignored)
|
|
57
|
+
*/
|
|
27
58
|
info(_message, _context) { }
|
|
59
|
+
/**
|
|
60
|
+
* No-op warning log
|
|
61
|
+
* @param _message The message to log (ignored)
|
|
62
|
+
* @param _context Optional context data (ignored)
|
|
63
|
+
*/
|
|
28
64
|
warn(_message, _context) { }
|
|
29
|
-
|
|
65
|
+
/**
|
|
66
|
+
* No-op error log
|
|
67
|
+
* @param _message The message to log (ignored)
|
|
68
|
+
* @param _error Optional error object (ignored)
|
|
69
|
+
* @param _context Optional context data (ignored)
|
|
70
|
+
*/
|
|
71
|
+
error(_message, _error, _context) { }
|
|
30
72
|
}
|
|
31
73
|
exports.NoopLogger = NoopLogger;
|
|
@@ -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"}
|
|
@@ -19,6 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
*
|
|
20
20
|
* This module exports components for using PostgreSQL as a storage backend
|
|
21
21
|
* for pathway state and other persistent data.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
22
24
|
*/
|
|
23
25
|
__exportStar(require("./postgres-adapter.js"), exports);
|
|
24
26
|
__exportStar(require("./postgres-pathway-state.js"), exports);
|
|
@@ -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"}
|
|
@@ -27,14 +27,12 @@ exports.PostgresJsAdapter = void 0;
|
|
|
27
27
|
exports.createPostgresAdapter = createPostgresAdapter;
|
|
28
28
|
/**
|
|
29
29
|
* Implementation of PostgresAdapter using the postgres.js library
|
|
30
|
-
*
|
|
31
|
-
* @implements {PostgresAdapter}
|
|
32
30
|
*/
|
|
33
31
|
class PostgresJsAdapter {
|
|
34
32
|
/**
|
|
35
33
|
* Creates a new PostgresJsAdapter instance
|
|
36
34
|
*
|
|
37
|
-
* @param
|
|
35
|
+
* @param config The PostgreSQL connection configuration
|
|
38
36
|
*/
|
|
39
37
|
constructor(config) {
|
|
40
38
|
/** The postgres.js client factory function */
|
|
@@ -74,8 +72,8 @@ class PostgresJsAdapter {
|
|
|
74
72
|
/**
|
|
75
73
|
* Establishes a connection to the PostgreSQL database
|
|
76
74
|
*
|
|
77
|
-
* @returns
|
|
78
|
-
* @throws
|
|
75
|
+
* @returns Promise that resolves when connection is established
|
|
76
|
+
* @throws Error if connection fails
|
|
79
77
|
*/
|
|
80
78
|
async connect() {
|
|
81
79
|
try {
|
|
@@ -90,8 +88,7 @@ class PostgresJsAdapter {
|
|
|
90
88
|
}
|
|
91
89
|
/**
|
|
92
90
|
* Closes the connection to the PostgreSQL database
|
|
93
|
-
*
|
|
94
|
-
* @returns {Promise<void>}
|
|
91
|
+
* @returns Promise that resolves when the connection is closed
|
|
95
92
|
*/
|
|
96
93
|
async disconnect() {
|
|
97
94
|
if (this.sql) {
|
|
@@ -101,11 +98,10 @@ class PostgresJsAdapter {
|
|
|
101
98
|
}
|
|
102
99
|
/**
|
|
103
100
|
* Executes a SQL query and returns the results
|
|
104
|
-
*
|
|
105
101
|
* @template T The expected result type
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @returns
|
|
102
|
+
* @param sql The SQL query to execute
|
|
103
|
+
* @param params Optional parameters for the query
|
|
104
|
+
* @returns Promise that resolves to the query results
|
|
109
105
|
*/
|
|
110
106
|
async query(sql, params = []) {
|
|
111
107
|
if (!this.sql) {
|
|
@@ -115,10 +111,9 @@ class PostgresJsAdapter {
|
|
|
115
111
|
}
|
|
116
112
|
/**
|
|
117
113
|
* Executes a SQL statement without returning results
|
|
118
|
-
*
|
|
119
|
-
* @param
|
|
120
|
-
* @
|
|
121
|
-
* @returns {Promise<void>}
|
|
114
|
+
* @param sql The SQL statement to execute
|
|
115
|
+
* @param params Optional parameters for the statement
|
|
116
|
+
* @returns Promise that resolves when the statement has been executed
|
|
122
117
|
*/
|
|
123
118
|
async execute(sql, params = []) {
|
|
124
119
|
if (!this.sql) {
|
|
@@ -131,8 +126,8 @@ exports.PostgresJsAdapter = PostgresJsAdapter;
|
|
|
131
126
|
/**
|
|
132
127
|
* Creates and initializes a PostgreSQL adapter
|
|
133
128
|
*
|
|
134
|
-
* @param
|
|
135
|
-
* @returns
|
|
129
|
+
* @param config The PostgreSQL connection configuration
|
|
130
|
+
* @returns An initialized PostgreSQL adapter
|
|
136
131
|
*/
|
|
137
132
|
async function createPostgresAdapter(config) {
|
|
138
133
|
const adapter = new PostgresJsAdapter(config);
|