@flowcore/pathways 0.2.4 → 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 +7 -0
- package/esm/pathways/postgres/postgres-adapter.d.ts +27 -3
- package/esm/pathways/postgres/postgres-adapter.d.ts.map +1 -1
- package/esm/pathways/postgres/postgres-adapter.js +11 -4
- package/package.json +1 -1
- package/script/pathways/postgres/postgres-adapter.d.ts +27 -3
- package/script/pathways/postgres/postgres-adapter.d.ts.map +1 -1
- package/script/pathways/postgres/postgres-adapter.js +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## [0.2.4](https://github.com/flowcore-io/flowcore-pathways/compare/v0.2.3...v0.2.4) (2025-03-15)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Configuration
|
|
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
|
|
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,
|
|
1
|
+
{"version":3,"file":"postgres-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW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AA8C;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;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"}
|
|
@@ -37,9 +37,16 @@ export class PostgresJsAdapter {
|
|
|
37
37
|
value: void 0
|
|
38
38
|
});
|
|
39
39
|
this.config = config;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.connectionString
|
|
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.
|
|
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": {
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Configuration
|
|
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
|
|
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,
|
|
1
|
+
{"version":3,"file":"postgres-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,gHAAgH;IAChH,gBAAgB,EAAE,MAAM,CAAC;IAEzB,yEAAyE;IACzE,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,GAAG,CAAC,EAAE,KAAK,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,gBAAgB,CA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AAK,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
|
-
|
|
68
|
-
|
|
69
|
-
this.connectionString
|
|
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) {
|