@flowcore/pathways 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0](https://github.com/flowcore-io/flowcore-pathways/compare/v0.2.4...v0.3.0) (2025-03-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * **postgres:** :sparkles: Enhance PostgreSQL configuration with connection string support ([9b51155](https://github.com/flowcore-io/flowcore-pathways/commit/9b51155eaa8f11c5ca3e8f6422d2b4268c4f27ea))
9
+
10
+ ## [0.2.4](https://github.com/flowcore-io/flowcore-pathways/compare/v0.2.3...v0.2.4) (2025-03-15)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **logger:** :art: Update error method signatures and improve JSDoc documentation ([07ab772](https://github.com/flowcore-io/flowcore-pathways/commit/07ab77237c7aa88f6bc5999ff95148873c2e45d0))
16
+
3
17
  ## [0.2.3](https://github.com/flowcore-io/flowcore-pathways/compare/v0.2.2...v0.2.3) (2025-03-15)
4
18
 
5
19
 
@@ -31,12 +31,15 @@ export interface Logger {
31
31
  */
32
32
  warn(message: string, context?: LoggerMeta): void;
33
33
  /**
34
- * Log error messages
35
- * @param message The message to log
36
- * @param error Optional error object
37
- * @param context Optional context data to include
34
+ * Log error messages - supports two different method signatures:
35
+ * 1. error(message: string, error?: Error, context?: LoggerMeta)
36
+ * 2. error(messageOrError: string | Error, meta?: LoggerMeta)
37
+ *
38
+ * @param messageOrError The message to log or Error object
39
+ * @param errorOrContext Optional error object or context data
40
+ * @param context Optional context data (only for signature 1)
38
41
  */
39
- error(message: string, error?: Error, context?: LoggerMeta): void;
42
+ error(messageOrError: string | Error, errorOrContext?: Error | LoggerMeta, context?: LoggerMeta): void;
40
43
  }
41
44
  /**
42
45
  * A default console logger that logs to the console
@@ -62,11 +65,15 @@ export declare class ConsoleLogger implements Logger {
62
65
  warn(message: string, context?: LoggerMeta): void;
63
66
  /**
64
67
  * 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
+ * Supports both signature formats:
69
+ * 1. error(message: string, error?: Error, context?: LoggerMeta)
70
+ * 2. error(messageOrError: string | Error, meta?: LoggerMeta)
71
+ *
72
+ * @param messageOrError The message to log or Error object
73
+ * @param errorOrContext Optional error object or context data
74
+ * @param context Optional context data (only for signature 1)
68
75
  */
69
- error(message: string, error?: Error, context?: LoggerMeta): void;
76
+ error(messageOrError: string | Error, errorOrContext?: Error | LoggerMeta, context?: LoggerMeta): void;
70
77
  }
71
78
  /**
72
79
  * A no-operation logger that does nothing
@@ -92,10 +99,12 @@ export declare class NoopLogger implements Logger {
92
99
  warn(_message: string, _context?: LoggerMeta): void;
93
100
  /**
94
101
  * No-op error log
95
- * @param _message The message to log (ignored)
96
- * @param _error Optional error object (ignored)
102
+ * Supports both signature formats
103
+ *
104
+ * @param _messageOrError The message to log or Error object (ignored)
105
+ * @param _errorOrContext Optional error object or context data (ignored)
97
106
  * @param _context Optional context data (ignored)
98
107
  */
99
- error(_message: string, _error?: Error, _context?: LoggerMeta): void;
108
+ error(_messageOrError: string | Error, _errorOrContext?: Error | LoggerMeta, _context?: LoggerMeta): void;
100
109
  }
101
110
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
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,MAA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K,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;CAcvG;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;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,KAAK,GAAG,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;CAC1G"}
@@ -31,12 +31,29 @@ export class ConsoleLogger {
31
31
  }
32
32
  /**
33
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
34
+ * Supports both signature formats:
35
+ * 1. error(message: string, error?: Error, context?: LoggerMeta)
36
+ * 2. error(messageOrError: string | Error, meta?: LoggerMeta)
37
+ *
38
+ * @param messageOrError The message to log or Error object
39
+ * @param errorOrContext Optional error object or context data
40
+ * @param context Optional context data (only for signature 1)
37
41
  */
38
- error(message, error, context) {
39
- console.error(message, error, context ? JSON.stringify(context) : '');
42
+ error(messageOrError, errorOrContext, context) {
43
+ if (typeof messageOrError === 'string') {
44
+ if (errorOrContext instanceof Error) {
45
+ // Signature 1: error(message: string, error: Error, context?: LoggerMeta)
46
+ console.error(messageOrError, errorOrContext, context ? JSON.stringify(context) : '');
47
+ }
48
+ else {
49
+ // Signature 1 (no error) or Signature 2: error(message: string, context?: LoggerMeta)
50
+ console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : '');
51
+ }
52
+ }
53
+ else {
54
+ // Signature 2: error(error: Error, context?: LoggerMeta)
55
+ console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : '');
56
+ }
40
57
  }
41
58
  }
42
59
  /**
@@ -63,9 +80,11 @@ export class NoopLogger {
63
80
  warn(_message, _context) { }
64
81
  /**
65
82
  * No-op error log
66
- * @param _message The message to log (ignored)
67
- * @param _error Optional error object (ignored)
83
+ * Supports both signature formats
84
+ *
85
+ * @param _messageOrError The message to log or Error object (ignored)
86
+ * @param _errorOrContext Optional error object or context data (ignored)
68
87
  * @param _context Optional context data (ignored)
69
88
  */
70
- error(_message, _error, _context) { }
89
+ error(_messageOrError, _errorOrContext, _context) { }
71
90
  }
@@ -1,7 +1,23 @@
1
1
  /**
2
- * Configuration options for PostgreSQL connection
2
+ * Configuration for PostgreSQL connection using a connection string
3
+ */
4
+ export interface PostgresConnectionStringConfig {
5
+ /** Complete PostgreSQL connection string (e.g., postgres://user:password@host:port/database?sslmode=require) */
6
+ connectionString: string;
7
+ /** These properties are not used when a connection string is provided */
8
+ host?: never;
9
+ port?: never;
10
+ user?: never;
11
+ password?: never;
12
+ database?: never;
13
+ ssl?: never;
14
+ }
15
+ /**
16
+ * Configuration for PostgreSQL connection using individual parameters
3
17
  */
4
- export interface PostgresConfig {
18
+ export interface PostgresParametersConfig {
19
+ /** Not used when individual parameters are provided */
20
+ connectionString?: never;
5
21
  /** PostgreSQL server hostname */
6
22
  host: string;
7
23
  /** PostgreSQL server port */
@@ -15,6 +31,14 @@ export interface PostgresConfig {
15
31
  /** Whether to use SSL for the connection */
16
32
  ssl?: boolean;
17
33
  }
34
+ /**
35
+ * Configuration options for PostgreSQL connection
36
+ *
37
+ * Can provide either:
38
+ * 1. A complete connection string, or
39
+ * 2. Individual connection parameters (host, port, user, etc.)
40
+ */
41
+ export type PostgresConfig = PostgresConnectionStringConfig | PostgresParametersConfig;
18
42
  /**
19
43
  * Interface for PostgreSQL database operations
20
44
  *
@@ -96,7 +120,7 @@ export declare class PostgresJsAdapter implements PostgresAdapter {
96
120
  /**
97
121
  * Creates and initializes a PostgreSQL adapter
98
122
  *
99
- * @param config The PostgreSQL connection configuration
123
+ * @param config The PostgreSQL connection configuration (either connectionString or individual parameters)
100
124
  * @returns An initialized PostgreSQL adapter
101
125
  */
102
126
  export declare function createPostgresAdapter(config: PostgresConfig): Promise<PostgresAdapter>;
@@ -1 +1 @@
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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;;;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"}
@@ -37,9 +37,16 @@ export class PostgresJsAdapter {
37
37
  value: void 0
38
38
  });
39
39
  this.config = config;
40
- this.connectionString = `postgres://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;
41
- if (config.ssl) {
42
- this.connectionString += "?sslmode=require";
40
+ if ('connectionString' in config && config.connectionString) {
41
+ // Use the provided connection string directly
42
+ this.connectionString = config.connectionString;
43
+ }
44
+ else {
45
+ // Build connection string from individual parameters
46
+ this.connectionString = `postgres://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;
47
+ if (config.ssl) {
48
+ this.connectionString += "?sslmode=require";
49
+ }
43
50
  }
44
51
  }
45
52
  /**
@@ -98,7 +105,7 @@ export class PostgresJsAdapter {
98
105
  /**
99
106
  * Creates and initializes a PostgreSQL adapter
100
107
  *
101
- * @param config The PostgreSQL connection configuration
108
+ * @param config The PostgreSQL connection configuration (either connectionString or individual parameters)
102
109
  * @returns An initialized PostgreSQL adapter
103
110
  */
104
111
  export async function createPostgresAdapter(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/pathways",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "A TypeScript Library for creating Flowcore Pathways, simplifying the integration with the flowcore platform",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -31,12 +31,15 @@ export interface Logger {
31
31
  */
32
32
  warn(message: string, context?: LoggerMeta): void;
33
33
  /**
34
- * Log error messages
35
- * @param message The message to log
36
- * @param error Optional error object
37
- * @param context Optional context data to include
34
+ * Log error messages - supports two different method signatures:
35
+ * 1. error(message: string, error?: Error, context?: LoggerMeta)
36
+ * 2. error(messageOrError: string | Error, meta?: LoggerMeta)
37
+ *
38
+ * @param messageOrError The message to log or Error object
39
+ * @param errorOrContext Optional error object or context data
40
+ * @param context Optional context data (only for signature 1)
38
41
  */
39
- error(message: string, error?: Error, context?: LoggerMeta): void;
42
+ error(messageOrError: string | Error, errorOrContext?: Error | LoggerMeta, context?: LoggerMeta): void;
40
43
  }
41
44
  /**
42
45
  * A default console logger that logs to the console
@@ -62,11 +65,15 @@ export declare class ConsoleLogger implements Logger {
62
65
  warn(message: string, context?: LoggerMeta): void;
63
66
  /**
64
67
  * 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
+ * Supports both signature formats:
69
+ * 1. error(message: string, error?: Error, context?: LoggerMeta)
70
+ * 2. error(messageOrError: string | Error, meta?: LoggerMeta)
71
+ *
72
+ * @param messageOrError The message to log or Error object
73
+ * @param errorOrContext Optional error object or context data
74
+ * @param context Optional context data (only for signature 1)
68
75
  */
69
- error(message: string, error?: Error, context?: LoggerMeta): void;
76
+ error(messageOrError: string | Error, errorOrContext?: Error | LoggerMeta, context?: LoggerMeta): void;
70
77
  }
71
78
  /**
72
79
  * A no-operation logger that does nothing
@@ -92,10 +99,12 @@ export declare class NoopLogger implements Logger {
92
99
  warn(_message: string, _context?: LoggerMeta): void;
93
100
  /**
94
101
  * No-op error log
95
- * @param _message The message to log (ignored)
96
- * @param _error Optional error object (ignored)
102
+ * Supports both signature formats
103
+ *
104
+ * @param _messageOrError The message to log or Error object (ignored)
105
+ * @param _errorOrContext Optional error object or context data (ignored)
97
106
  * @param _context Optional context data (ignored)
98
107
  */
99
- error(_message: string, _error?: Error, _context?: LoggerMeta): void;
108
+ error(_messageOrError: string | Error, _errorOrContext?: Error | LoggerMeta, _context?: LoggerMeta): void;
100
109
  }
101
110
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../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EG;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;;;;;;;;;OASG;IACH,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;CAcvG;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;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,KAAK,GAAG,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;CAC1G"}
@@ -34,12 +34,29 @@ class ConsoleLogger {
34
34
  }
35
35
  /**
36
36
  * Log error messages to the console
37
- * @param message The message to log
38
- * @param error Optional error object
39
- * @param context Optional context data to include
37
+ * Supports both signature formats:
38
+ * 1. error(message: string, error?: Error, context?: LoggerMeta)
39
+ * 2. error(messageOrError: string | Error, meta?: LoggerMeta)
40
+ *
41
+ * @param messageOrError The message to log or Error object
42
+ * @param errorOrContext Optional error object or context data
43
+ * @param context Optional context data (only for signature 1)
40
44
  */
41
- error(message, error, context) {
42
- console.error(message, error, context ? JSON.stringify(context) : '');
45
+ error(messageOrError, errorOrContext, context) {
46
+ if (typeof messageOrError === 'string') {
47
+ if (errorOrContext instanceof Error) {
48
+ // Signature 1: error(message: string, error: Error, context?: LoggerMeta)
49
+ console.error(messageOrError, errorOrContext, context ? JSON.stringify(context) : '');
50
+ }
51
+ else {
52
+ // Signature 1 (no error) or Signature 2: error(message: string, context?: LoggerMeta)
53
+ console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : '');
54
+ }
55
+ }
56
+ else {
57
+ // Signature 2: error(error: Error, context?: LoggerMeta)
58
+ console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : '');
59
+ }
43
60
  }
44
61
  }
45
62
  exports.ConsoleLogger = ConsoleLogger;
@@ -67,10 +84,12 @@ class NoopLogger {
67
84
  warn(_message, _context) { }
68
85
  /**
69
86
  * No-op error log
70
- * @param _message The message to log (ignored)
71
- * @param _error Optional error object (ignored)
87
+ * Supports both signature formats
88
+ *
89
+ * @param _messageOrError The message to log or Error object (ignored)
90
+ * @param _errorOrContext Optional error object or context data (ignored)
72
91
  * @param _context Optional context data (ignored)
73
92
  */
74
- error(_message, _error, _context) { }
93
+ error(_messageOrError, _errorOrContext, _context) { }
75
94
  }
76
95
  exports.NoopLogger = NoopLogger;
@@ -1,7 +1,23 @@
1
1
  /**
2
- * Configuration options for PostgreSQL connection
2
+ * Configuration for PostgreSQL connection using a connection string
3
+ */
4
+ export interface PostgresConnectionStringConfig {
5
+ /** Complete PostgreSQL connection string (e.g., postgres://user:password@host:port/database?sslmode=require) */
6
+ connectionString: string;
7
+ /** These properties are not used when a connection string is provided */
8
+ host?: never;
9
+ port?: never;
10
+ user?: never;
11
+ password?: never;
12
+ database?: never;
13
+ ssl?: never;
14
+ }
15
+ /**
16
+ * Configuration for PostgreSQL connection using individual parameters
3
17
  */
4
- export interface PostgresConfig {
18
+ export interface PostgresParametersConfig {
19
+ /** Not used when individual parameters are provided */
20
+ connectionString?: never;
5
21
  /** PostgreSQL server hostname */
6
22
  host: string;
7
23
  /** PostgreSQL server port */
@@ -15,6 +31,14 @@ export interface PostgresConfig {
15
31
  /** Whether to use SSL for the connection */
16
32
  ssl?: boolean;
17
33
  }
34
+ /**
35
+ * Configuration options for PostgreSQL connection
36
+ *
37
+ * Can provide either:
38
+ * 1. A complete connection string, or
39
+ * 2. Individual connection parameters (host, port, user, etc.)
40
+ */
41
+ export type PostgresConfig = PostgresConnectionStringConfig | PostgresParametersConfig;
18
42
  /**
19
43
  * Interface for PostgreSQL database operations
20
44
  *
@@ -96,7 +120,7 @@ export declare class PostgresJsAdapter implements PostgresAdapter {
96
120
  /**
97
121
  * Creates and initializes a PostgreSQL adapter
98
122
  *
99
- * @param config The PostgreSQL connection configuration
123
+ * @param config The PostgreSQL connection configuration (either connectionString or individual parameters)
100
124
  * @returns An initialized PostgreSQL adapter
101
125
  */
102
126
  export declare function createPostgresAdapter(config: PostgresConfig): Promise<PostgresAdapter>;
@@ -1 +1 @@
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,C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,CAA+B;IAC1C,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAiB;IAC/B,yDAAyD;IACzD,OAAO,CAAC,gBAAgB,CAAS;IAEjC;;;;OAIG;gBACS,MAAM,EAAE,cAAc;IAelC;;;;;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"}
@@ -64,9 +64,16 @@ class PostgresJsAdapter {
64
64
  value: void 0
65
65
  });
66
66
  this.config = config;
67
- this.connectionString = `postgres://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;
68
- if (config.ssl) {
69
- this.connectionString += "?sslmode=require";
67
+ if ('connectionString' in config && config.connectionString) {
68
+ // Use the provided connection string directly
69
+ this.connectionString = config.connectionString;
70
+ }
71
+ else {
72
+ // Build connection string from individual parameters
73
+ this.connectionString = `postgres://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;
74
+ if (config.ssl) {
75
+ this.connectionString += "?sslmode=require";
76
+ }
70
77
  }
71
78
  }
72
79
  /**
@@ -126,7 +133,7 @@ exports.PostgresJsAdapter = PostgresJsAdapter;
126
133
  /**
127
134
  * Creates and initializes a PostgreSQL adapter
128
135
  *
129
- * @param config The PostgreSQL connection configuration
136
+ * @param config The PostgreSQL connection configuration (either connectionString or individual parameters)
130
137
  * @returns An initialized PostgreSQL adapter
131
138
  */
132
139
  async function createPostgresAdapter(config) {