@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.
Files changed (98) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/esm/common/flowcore.type.d.ts +3 -3
  3. package/esm/common/flowcore.type.d.ts.map +1 -1
  4. package/esm/common/index.d.ts +2 -0
  5. package/esm/common/index.d.ts.map +1 -1
  6. package/esm/common/index.js +2 -0
  7. package/esm/compatibility/flowcore-transformer-core.sdk.d.ts +4 -0
  8. package/esm/compatibility/flowcore-transformer-core.sdk.d.ts.map +1 -1
  9. package/esm/compatibility/flowcore-transformer-core.sdk.js +2 -0
  10. package/esm/contracts/index.d.ts +2 -0
  11. package/esm/contracts/index.d.ts.map +1 -1
  12. package/esm/contracts/index.js +2 -0
  13. package/esm/mod.d.ts +2 -0
  14. package/esm/mod.d.ts.map +1 -1
  15. package/esm/mod.js +2 -0
  16. package/esm/pathways/builder.d.ts +87 -0
  17. package/esm/pathways/builder.d.ts.map +1 -1
  18. package/esm/pathways/builder.js +83 -8
  19. package/esm/pathways/index.d.ts +2 -0
  20. package/esm/pathways/index.d.ts.map +1 -1
  21. package/esm/pathways/index.js +2 -0
  22. package/esm/pathways/internal-pathway.state.d.ts +5 -7
  23. package/esm/pathways/internal-pathway.state.d.ts.map +1 -1
  24. package/esm/pathways/internal-pathway.state.js +5 -7
  25. package/esm/pathways/kv/bun-kv-adapter.d.ts +5 -7
  26. package/esm/pathways/kv/bun-kv-adapter.d.ts.map +1 -1
  27. package/esm/pathways/kv/bun-kv-adapter.js +5 -7
  28. package/esm/pathways/kv/kv-adapter.d.ts +7 -7
  29. package/esm/pathways/kv/kv-adapter.js +1 -1
  30. package/esm/pathways/kv/node-kv-adapter.d.ts +6 -8
  31. package/esm/pathways/kv/node-kv-adapter.d.ts.map +1 -1
  32. package/esm/pathways/kv/node-kv-adapter.js +6 -8
  33. package/esm/pathways/logger.d.ts +46 -3
  34. package/esm/pathways/logger.d.ts.map +1 -1
  35. package/esm/pathways/logger.js +45 -3
  36. package/esm/pathways/postgres/index.d.ts +2 -0
  37. package/esm/pathways/postgres/index.d.ts.map +1 -1
  38. package/esm/pathways/postgres/index.js +2 -0
  39. package/esm/pathways/postgres/postgres-adapter.d.ts +20 -29
  40. package/esm/pathways/postgres/postgres-adapter.d.ts.map +1 -1
  41. package/esm/pathways/postgres/postgres-adapter.js +12 -17
  42. package/esm/pathways/postgres/postgres-pathway-state.d.ts +2 -6
  43. package/esm/pathways/postgres/postgres-pathway-state.d.ts.map +1 -1
  44. package/esm/pathways/postgres/postgres-pathway-state.js +2 -4
  45. package/esm/pathways/types.d.ts +48 -3
  46. package/esm/pathways/types.d.ts.map +1 -1
  47. package/esm/router/index.d.ts +17 -11
  48. package/esm/router/index.d.ts.map +1 -1
  49. package/esm/router/index.js +21 -24
  50. package/package.json +2 -2
  51. package/script/common/flowcore.type.d.ts +3 -3
  52. package/script/common/flowcore.type.d.ts.map +1 -1
  53. package/script/common/index.d.ts +2 -0
  54. package/script/common/index.d.ts.map +1 -1
  55. package/script/common/index.js +2 -0
  56. package/script/compatibility/flowcore-transformer-core.sdk.d.ts +4 -0
  57. package/script/compatibility/flowcore-transformer-core.sdk.d.ts.map +1 -1
  58. package/script/compatibility/flowcore-transformer-core.sdk.js +2 -0
  59. package/script/contracts/index.d.ts +2 -0
  60. package/script/contracts/index.d.ts.map +1 -1
  61. package/script/contracts/index.js +2 -0
  62. package/script/mod.d.ts +2 -0
  63. package/script/mod.d.ts.map +1 -1
  64. package/script/mod.js +2 -0
  65. package/script/pathways/builder.d.ts +87 -0
  66. package/script/pathways/builder.d.ts.map +1 -1
  67. package/script/pathways/builder.js +83 -8
  68. package/script/pathways/index.d.ts +2 -0
  69. package/script/pathways/index.d.ts.map +1 -1
  70. package/script/pathways/index.js +2 -0
  71. package/script/pathways/internal-pathway.state.d.ts +5 -7
  72. package/script/pathways/internal-pathway.state.d.ts.map +1 -1
  73. package/script/pathways/internal-pathway.state.js +5 -7
  74. package/script/pathways/kv/bun-kv-adapter.d.ts +5 -7
  75. package/script/pathways/kv/bun-kv-adapter.d.ts.map +1 -1
  76. package/script/pathways/kv/bun-kv-adapter.js +5 -7
  77. package/script/pathways/kv/kv-adapter.d.ts +7 -7
  78. package/script/pathways/kv/kv-adapter.js +1 -1
  79. package/script/pathways/kv/node-kv-adapter.d.ts +6 -8
  80. package/script/pathways/kv/node-kv-adapter.d.ts.map +1 -1
  81. package/script/pathways/kv/node-kv-adapter.js +6 -8
  82. package/script/pathways/logger.d.ts +46 -3
  83. package/script/pathways/logger.d.ts.map +1 -1
  84. package/script/pathways/logger.js +45 -3
  85. package/script/pathways/postgres/index.d.ts +2 -0
  86. package/script/pathways/postgres/index.d.ts.map +1 -1
  87. package/script/pathways/postgres/index.js +2 -0
  88. package/script/pathways/postgres/postgres-adapter.d.ts +20 -29
  89. package/script/pathways/postgres/postgres-adapter.d.ts.map +1 -1
  90. package/script/pathways/postgres/postgres-adapter.js +12 -17
  91. package/script/pathways/postgres/postgres-pathway-state.d.ts +2 -6
  92. package/script/pathways/postgres/postgres-pathway-state.d.ts.map +1 -1
  93. package/script/pathways/postgres/postgres-pathway-state.js +2 -4
  94. package/script/pathways/types.d.ts +48 -3
  95. package/script/pathways/types.d.ts.map +1 -1
  96. package/script/router/index.d.ts +17 -11
  97. package/script/router/index.d.ts.map +1 -1
  98. 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 {string} key The key to retrieve
13
- * @returns {(Promise<T | null> | T | null)} The stored value or null if not found
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 {string} key The key to store the value under
20
- * @param {unknown} value The value to store
21
- * @param {number} ttlMs Time-to-live in milliseconds
22
- * @returns {(Promise<void> | void)}
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 {Promise<KvAdapter>} A KV adapter instance
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 {Promise<KvAdapter>} A KV adapter instance
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 {string} key The key to retrieve
20
- * @returns {Promise<T | null>} The stored value or null if not found
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 {string} key The key to store the value under
27
- * @param {unknown} value The value to store
28
- * @param {number} ttlMs Time-to-live in milliseconds
29
- * @returns {Promise<void>}
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;;;;;;GAMG;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"}
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 {string} key The key to retrieve
27
- * @returns {Promise<T | null>} The stored value or null if not found
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 {string} key The key to store the value under
37
- * @param {unknown} value The value to store
38
- * @param {number} ttlMs Time-to-live in milliseconds
39
- * @returns {Promise<void>}
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));
@@ -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
- error(message: string, context?: Record<string, unknown>): void;
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
- error(_message: string, _context?: Record<string, unknown>): void;
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,EAA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C,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"}
@@ -2,25 +2,67 @@
2
2
  * A default console logger that logs to the console
3
3
  */
4
4
  export class ConsoleLogger {
5
+ /**
6
+ * Log debug information to the console
7
+ * @param message The message to log
8
+ * @param context Optional context data to include
9
+ */
5
10
  debug(message, context) {
6
11
  console.debug(message, context ? JSON.stringify(context) : '');
7
12
  }
13
+ /**
14
+ * Log informational messages to the console
15
+ * @param message The message to log
16
+ * @param context Optional context data to include
17
+ */
8
18
  info(message, context) {
9
19
  console.info(message, context ? JSON.stringify(context) : '');
10
20
  }
21
+ /**
22
+ * Log warning messages to the console
23
+ * @param message The message to log
24
+ * @param context Optional context data to include
25
+ */
11
26
  warn(message, context) {
12
27
  console.warn(message, context ? JSON.stringify(context) : '');
13
28
  }
14
- error(message, context) {
15
- console.error(message, context ? JSON.stringify(context) : '');
29
+ /**
30
+ * Log error messages to the console
31
+ * @param message The message to log
32
+ * @param error Optional error object
33
+ * @param context Optional context data to include
34
+ */
35
+ error(message, error, context) {
36
+ console.error(message, error, context ? JSON.stringify(context) : '');
16
37
  }
17
38
  }
18
39
  /**
19
40
  * A no-operation logger that does nothing
20
41
  */
21
42
  export class NoopLogger {
43
+ /**
44
+ * No-op debug log
45
+ * @param _message The message to log (ignored)
46
+ * @param _context Optional context data (ignored)
47
+ */
22
48
  debug(_message, _context) { }
49
+ /**
50
+ * No-op info log
51
+ * @param _message The message to log (ignored)
52
+ * @param _context Optional context data (ignored)
53
+ */
23
54
  info(_message, _context) { }
55
+ /**
56
+ * No-op warning log
57
+ * @param _message The message to log (ignored)
58
+ * @param _context Optional context data (ignored)
59
+ */
24
60
  warn(_message, _context) { }
25
- error(_message, _context) { }
61
+ /**
62
+ * No-op error log
63
+ * @param _message The message to log (ignored)
64
+ * @param _error Optional error object (ignored)
65
+ * @param _context Optional context data (ignored)
66
+ */
67
+ error(_message, _error, _context) { }
26
68
  }
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This module exports components for using PostgreSQL as a storage backend
5
5
  * for pathway state and other persistent data.
6
+ *
7
+ * @module
6
8
  */
7
9
  export * from "./postgres-adapter.js";
8
10
  export * from "./postgres-pathway-state.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
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"}
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This module exports components for using PostgreSQL as a storage backend
5
5
  * for pathway state and other persistent data.
6
+ *
7
+ * @module
6
8
  */
7
9
  export * from "./postgres-adapter.js";
8
10
  export * from "./postgres-pathway-state.js";
@@ -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 {Promise<void>}
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 {Promise<void>}
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 {string} sql The SQL query to execute
42
- * @param {unknown[]} [params] Optional parameters for the query
43
- * @returns {Promise<T>} The query results
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 {string} sql The SQL statement to execute
49
- * @param {unknown[]} [params] Optional parameters for the statement
50
- * @returns {Promise<void>}
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 {PostgresConfig} config The PostgreSQL connection configuration
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 {Promise<void>}
78
- * @throws {Error} If connection fails
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 {string} sql The SQL query to execute
92
- * @param {unknown[]} [params=[]] Optional parameters for the query
93
- * @returns {Promise<T>} The query results
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 {string} sql The SQL statement to execute
100
- * @param {unknown[]} [params=[]] Optional parameters for the statement
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 {PostgresConfig} config The PostgreSQL connection configuration
109
- * @returns {Promise<PostgresAdapter>} An initialized PostgreSQL adapter
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;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,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IG;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 {PostgresConfig} config The PostgreSQL connection configuration
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 {Promise<void>}
51
- * @throws {Error} If connection fails
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 {string} sql The SQL query to execute
80
- * @param {unknown[]} [params=[]] Optional parameters for the query
81
- * @returns {Promise<T>} The query results
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 {string} sql The SQL statement to execute
93
- * @param {unknown[]} [params=[]] Optional parameters for the statement
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 {PostgresConfig} config The PostgreSQL connection configuration
107
- * @returns {Promise<PostgresAdapter>} An initialized PostgreSQL adapter
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 {PostgresPathwayStateConfig} config The PostgreSQL configuration
110
- * @returns {PostgresPathwayState} A new PostgresPathwayState instance
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;;;;GAIG;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;;;;;;;GAOG;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"}
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 {PostgresPathwayStateConfig} config The PostgreSQL configuration
183
- * @returns {PostgresPathwayState} A new PostgresPathwayState instance
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);
@@ -2,19 +2,29 @@ import type { TSchema } from "@sinclair/typebox";
2
2
  import type { WebhookFileData, WebhookSendOptions } from "@flowcore/sdk-transformer-core";
3
3
  /**
4
4
  * Helper type to create a custom type error for non-writable pathways
5
+ * @template T The string type to create an error for
5
6
  */
6
7
  type NonWritablePathwayError<T extends string> = T & {
7
8
  readonly __nonWritablePathwayError: "This pathway is not writable. To make it writable, remove 'writable: false' from the pathway contract.";
8
9
  };
9
10
  /**
10
11
  * Contract for defining a pathway
11
- * @template F - The flow type
12
- * @template E - The event type
13
- * @template T - The schema type
12
+ * @template F The flow type
13
+ * @template E The event type
14
+ * @template T The schema type
14
15
  */
15
16
  export interface PathwayContract<F extends string, E extends string, T extends TSchema> {
17
+ /**
18
+ * The flow type for this pathway
19
+ */
16
20
  flowType: F;
21
+ /**
22
+ * The event type for this pathway
23
+ */
17
24
  eventType: E;
25
+ /**
26
+ * The schema that defines the structure of events for this pathway
27
+ */
18
28
  schema: T;
19
29
  /**
20
30
  * Whether the pathway is writable. Use `false as const` to make the pathway non-writable at compile time.
@@ -63,24 +73,59 @@ export interface PathwayContract<F extends string, E extends string, T extends T
63
73
  */
64
74
  isFilePathway?: boolean;
65
75
  }
76
+ /**
77
+ * Creates a string key from flow type and event type in the format `flowType/eventType`
78
+ * @template F The flow type
79
+ * @template E The event type
80
+ */
66
81
  export type PathwayKey<F extends string, E extends string> = `${F}/${E}`;
82
+ /**
83
+ * Interface for event metadata, extending Record<string, unknown>
84
+ */
67
85
  export interface EventMetadata extends Record<string, unknown> {
68
86
  }
87
+ /**
88
+ * Function type for sending an event to a webhook
89
+ * @template EventPayload The type of the event payload
90
+ */
69
91
  export type SendWebhook<EventPayload> = (payload: EventPayload, metadata?: EventMetadata, options?: WebhookSendOptions) => Promise<string>;
92
+ /**
93
+ * Function type for sending a file to a webhook
94
+ */
70
95
  export type SendFilehook = (payload: WebhookFileData, metadata?: EventMetadata, options?: WebhookSendOptions) => Promise<string[]>;
71
96
  /**
72
97
  * Helper type to create a better error message for non-writable pathways
98
+ * @template T The string type for the pathway
99
+ * @template IsWritable Boolean indicating if the pathway is writable
73
100
  */
74
101
  export type WritablePathway<T extends string, IsWritable extends boolean> = IsWritable extends false ? NonWritablePathwayError<T> : T;
102
+ /**
103
+ * Interface for managing pathway processing state
104
+ */
75
105
  export type PathwayState = {
106
+ /**
107
+ * Checks if an event has been processed
108
+ * @param eventId The ID of the event to check
109
+ * @returns Boolean indicating if the event has been processed
110
+ */
76
111
  isProcessed: (eventId: string) => (boolean | Promise<boolean>);
112
+ /**
113
+ * Marks an event as processed
114
+ * @param eventId The ID of the event to mark as processed
115
+ */
77
116
  setProcessed: (eventId: string) => (void | Promise<void>);
78
117
  };
79
118
  /**
80
119
  * Options for pathway writes, extending WebhookSendOptions
81
120
  */
82
121
  export type PathwayWriteOptions = WebhookSendOptions & {
122
+ /**
123
+ * If true, doesn't wait for confirmation of event delivery
124
+ */
83
125
  fireAndForget?: boolean;
126
+ /**
127
+ * Additional HTTP headers to include with the request
128
+ */
84
129
  headers?: Record<string, string>;
85
130
  };
86
131
  export {};