postgrejs 3.10.0 → 3.10.1
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,6 +1,12 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
-
### [v3.10.
|
|
3
|
+
### [v3.10.1](https://github.com/panates/postgrejs/compare/v3.10.0...v3.10.1) -
|
|
4
|
+
|
|
5
|
+
#### 🚀 New Features
|
|
6
|
+
|
|
7
|
+
- feat: accept `connectionString`, and answer a key from another client @Eray Hanoğlu
|
|
8
|
+
|
|
9
|
+
### [v3.10.0](https://github.com/panates/postgrejs/compare/v3.9.0...v3.10.0) - 22 September 2026
|
|
4
10
|
|
|
5
11
|
#### Breaking Changes :warning:
|
|
6
12
|
|
|
@@ -21,6 +27,10 @@
|
|
|
21
27
|
- fix: sign only the interval components that have one, and add toPostgres() @Eray Hanoğlu
|
|
22
28
|
- fix: read the database out of a `postgresql://` URL @Eray Hanoğlu
|
|
23
29
|
|
|
30
|
+
#### 📖 Documentation Changes
|
|
31
|
+
|
|
32
|
+
- docs: name the migration note after the release it is for @Eray Hanoğlu
|
|
33
|
+
|
|
24
34
|
### [v3.9.0](https://github.com/panates/postgrejs/compare/v3.8.0...v3.9.0) - 22 September 2026
|
|
25
35
|
|
|
26
36
|
#### 🚀 New Features
|
|
@@ -5,6 +5,16 @@ import type { DebugLogger } from '../types.js';
|
|
|
5
5
|
import type { DataMappingOptions } from './data-mapping-options.js';
|
|
6
6
|
import type { QueryOptions } from './query-options.js';
|
|
7
7
|
export interface DatabaseConnectionParams {
|
|
8
|
+
/**
|
|
9
|
+
* A whole connection string, as an alternative to the fields below -
|
|
10
|
+
* `pg`'s spelling of what this client also accepts as a bare string
|
|
11
|
+
* (`new Connection('postgres://...')`).
|
|
12
|
+
*
|
|
13
|
+
* Like `pg`, what the string names wins over a field of the same name
|
|
14
|
+
* beside it, so a value the string carries is not quietly overridden
|
|
15
|
+
* by one that was left in the object.
|
|
16
|
+
*/
|
|
17
|
+
connectionString?: string;
|
|
8
18
|
host?: string;
|
|
9
19
|
port?: number;
|
|
10
20
|
user?: string;
|
package/package.json
CHANGED
|
@@ -1,12 +1,66 @@
|
|
|
1
1
|
import { merge } from '@jsopen/objects';
|
|
2
2
|
import { configFromEnv } from './config-from-env.js';
|
|
3
|
+
/**
|
|
4
|
+
* Spellings from other clients that mean something here under a
|
|
5
|
+
* different name.
|
|
6
|
+
*
|
|
7
|
+
* Nothing checks that a configuration's keys are keys this client knows,
|
|
8
|
+
* and it deliberately stays that way: a `PoolConfiguration` carries
|
|
9
|
+
* `lightning-pool`'s own options, which are not declared here, and
|
|
10
|
+
* callers pass configurations that carry their own fields. An allowlist
|
|
11
|
+
* would reject those, and would have to be kept current forever.
|
|
12
|
+
*
|
|
13
|
+
* What is caught instead is the short list of names that are *wrong* -
|
|
14
|
+
* each is the right idea under another client's spelling, so it can be
|
|
15
|
+
* answered with the name that works rather than merely refused.
|
|
16
|
+
*/
|
|
17
|
+
const FOREIGN_KEYS = {
|
|
18
|
+
connection_string: 'connectionString',
|
|
19
|
+
connectionUri: 'connectionString',
|
|
20
|
+
uri: 'connectionString',
|
|
21
|
+
url: 'connectionString',
|
|
22
|
+
dbname: 'database',
|
|
23
|
+
db: 'database',
|
|
24
|
+
username: 'user',
|
|
25
|
+
pass: 'password',
|
|
26
|
+
passwd: 'password',
|
|
27
|
+
hostname: 'host',
|
|
28
|
+
application_name: 'applicationName',
|
|
29
|
+
connect_timeout: 'connectTimeoutMs',
|
|
30
|
+
connectionTimeoutMillis: 'connectTimeoutMs',
|
|
31
|
+
};
|
|
32
|
+
function checkForeignKeys(config) {
|
|
33
|
+
let k;
|
|
34
|
+
for (k in config) {
|
|
35
|
+
const meant = FOREIGN_KEYS[k];
|
|
36
|
+
if (meant && config[k] !== undefined)
|
|
37
|
+
throw new TypeError(`"${k}" is not a connection option here - did you mean "${meant}"? ` +
|
|
38
|
+
'An option this client does not know is otherwise ignored, so a ' +
|
|
39
|
+
'name that is nearly right does nothing and says nothing.');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
3
42
|
export function getConnectionConfig(config) {
|
|
4
43
|
const cfg = configFromEnv();
|
|
5
44
|
if (typeof config === 'string') {
|
|
6
45
|
merge(cfg, parseConnectionString(config));
|
|
7
46
|
}
|
|
8
47
|
else if (typeof config === 'object') {
|
|
48
|
+
checkForeignKeys(config);
|
|
9
49
|
merge(cfg, config);
|
|
50
|
+
// `pg`'s spelling of the same thing, and what `drizzle-orm`'s first
|
|
51
|
+
// example writes - so it is the single most likely key someone
|
|
52
|
+
// moving from `pg` puts here. Ignored, it did not fail: it connected
|
|
53
|
+
// to whatever the environment defaults to, which in development is
|
|
54
|
+
// usually a database that exists, so the mistake surfaced as missing
|
|
55
|
+
// tables or as writes landing somewhere else. Applied after the
|
|
56
|
+
// merge and not before it, because `pg` lets the string win over the
|
|
57
|
+
// fields beside it.
|
|
58
|
+
const cs = cfg.connectionString;
|
|
59
|
+
if (cs !== undefined) {
|
|
60
|
+
delete cfg.connectionString;
|
|
61
|
+
if (cs)
|
|
62
|
+
merge(cfg, parseConnectionString('' + cs));
|
|
63
|
+
}
|
|
10
64
|
}
|
|
11
65
|
if (cfg.host) {
|
|
12
66
|
const explicitRequireSSL = cfg.requireSSL;
|