@nymphjs/driver-postgresql 1.0.0-beta.11 → 1.0.0-beta.110
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 +502 -0
- package/README.md +1 -1
- package/dist/PostgreSQLDriver.d.ts +107 -20
- package/dist/PostgreSQLDriver.js +1665 -730
- package/dist/PostgreSQLDriver.js.map +1 -1
- package/dist/PostgreSQLDriver.test.js +12 -12
- package/dist/PostgreSQLDriver.test.js.map +1 -1
- package/dist/conf/d.d.ts +26 -0
- package/dist/conf/d.js +1 -2
- package/dist/conf/defaults.d.ts +1 -1
- package/dist/conf/defaults.js +1 -3
- package/dist/conf/defaults.js.map +1 -1
- package/dist/conf/index.d.ts +2 -2
- package/dist/conf/index.js +2 -8
- package/dist/conf/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -24
- package/dist/index.js.map +1 -1
- package/jest.config.js +11 -2
- package/package.json +24 -21
- package/src/PostgreSQLDriver.test.ts +9 -3
- package/src/PostgreSQLDriver.ts +2821 -1199
- package/src/conf/defaults.ts +1 -1
- package/src/conf/index.ts +2 -2
- package/src/index.ts +2 -2
- package/tsconfig.json +5 -3
- package/typedoc.json +4 -0
- package/dist/runPostgresqlSync.js +0 -35
- package/src/runPostgresqlSync.js +0 -35
- package/src/testpostgresql.js +0 -59
package/src/conf/defaults.ts
CHANGED
package/src/conf/index.ts
CHANGED
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"extends": "@tsconfig/recommended/tsconfig.json",
|
|
3
3
|
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"module": "ES2022",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"lib": ["ES2022"],
|
|
8
|
+
"target": "ES2022",
|
|
7
9
|
"noImplicitAny": true,
|
|
8
|
-
"removeComments":
|
|
10
|
+
"removeComments": false,
|
|
9
11
|
"sourceMap": true,
|
|
10
12
|
"outDir": "dist",
|
|
11
13
|
"resolveJsonModule": true,
|
package/typedoc.json
ADDED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const pg = require('pg');
|
|
2
|
-
|
|
3
|
-
let stdin = '';
|
|
4
|
-
|
|
5
|
-
process.stdin.on('data', (data) => {
|
|
6
|
-
if (data != null) {
|
|
7
|
-
stdin += data.toString();
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
process.stdin.on('end', () => {
|
|
12
|
-
run();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
async function run() {
|
|
16
|
-
try {
|
|
17
|
-
const { postgresqlConfig, query, params } = JSON.parse(stdin);
|
|
18
|
-
const pool = new pg.Pool(postgresqlConfig);
|
|
19
|
-
const results = await new Promise((resolve, reject) =>
|
|
20
|
-
pool.query(query, params).then(
|
|
21
|
-
(results) => resolve(results),
|
|
22
|
-
(error) => reject(error)
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
process.stdout.end(JSON.stringify(results), 'utf8', () => {
|
|
26
|
-
pool.end(() => {
|
|
27
|
-
process.exit(0);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
} catch (e) {
|
|
31
|
-
process.stderr.end(JSON.stringify(e), 'utf8', () => {
|
|
32
|
-
process.exit(1);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
package/src/runPostgresqlSync.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const pg = require('pg');
|
|
2
|
-
|
|
3
|
-
let stdin = '';
|
|
4
|
-
|
|
5
|
-
process.stdin.on('data', (data) => {
|
|
6
|
-
if (data != null) {
|
|
7
|
-
stdin += data.toString();
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
process.stdin.on('end', () => {
|
|
12
|
-
run();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
async function run() {
|
|
16
|
-
try {
|
|
17
|
-
const { postgresqlConfig, query, params } = JSON.parse(stdin);
|
|
18
|
-
const pool = new pg.Pool(postgresqlConfig);
|
|
19
|
-
const results = await new Promise((resolve, reject) =>
|
|
20
|
-
pool.query(query, params).then(
|
|
21
|
-
(results) => resolve(results),
|
|
22
|
-
(error) => reject(error)
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
process.stdout.end(JSON.stringify(results), 'utf8', () => {
|
|
26
|
-
pool.end(() => {
|
|
27
|
-
process.exit(0);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
} catch (e) {
|
|
31
|
-
process.stderr.end(JSON.stringify(e), 'utf8', () => {
|
|
32
|
-
process.exit(1);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
package/src/testpostgresql.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const cp = require('child_process');
|
|
2
|
-
|
|
3
|
-
const postgresqlConfig = {
|
|
4
|
-
host: 'localhost',
|
|
5
|
-
user: 'nymph',
|
|
6
|
-
password: 'nymph',
|
|
7
|
-
database: 'nymph',
|
|
8
|
-
insecureAuth: true,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const guid = '790274347f9b3a018c2cedee';
|
|
12
|
-
const guidBuf = Buffer.from(guid, 'hex');
|
|
13
|
-
|
|
14
|
-
// const query = 'SELECT $1 AS message;';
|
|
15
|
-
// const params = ['Hello, world.'];
|
|
16
|
-
|
|
17
|
-
const query = 'SELECT $1 AS message;';
|
|
18
|
-
const params = [['Hello, world.']];
|
|
19
|
-
|
|
20
|
-
// const query = "SELECT encode(decode($1, 'hex'), 'hex') AS message;";
|
|
21
|
-
// const params = [guid];
|
|
22
|
-
|
|
23
|
-
// const query = 'CREATE TABLE test ("id" INT NOT NULL, PRIMARY KEY ("id"));';
|
|
24
|
-
// const params = [];
|
|
25
|
-
|
|
26
|
-
// const query = 'CREATE TABLE test ("id" BYTEA NOT NULL, PRIMARY KEY ("id"));';
|
|
27
|
-
// const params = [];
|
|
28
|
-
|
|
29
|
-
// const query = 'INSERT INTO test ( "id" ) VALUES ( decode($1, \'hex\') );';
|
|
30
|
-
// const params = [guid];
|
|
31
|
-
|
|
32
|
-
// const query = 'SELECT encode("id", \'hex\') as "id" FROM test;';
|
|
33
|
-
// const params = [];
|
|
34
|
-
|
|
35
|
-
// const query = 'SELECT * FROM nonexist;';
|
|
36
|
-
// const params = [];
|
|
37
|
-
|
|
38
|
-
// const query = 'SELECT relname FROM pg_stat_user_tables ORDER BY relname;';
|
|
39
|
-
// const params = [];
|
|
40
|
-
|
|
41
|
-
const output = cp.spawnSync(
|
|
42
|
-
process.argv0,
|
|
43
|
-
[__dirname + '/runPostgresqlSync.js'],
|
|
44
|
-
{
|
|
45
|
-
input: JSON.stringify({ postgresqlConfig, query, params }),
|
|
46
|
-
timeout: 30000,
|
|
47
|
-
maxBuffer: 100 * 1024 * 1024,
|
|
48
|
-
encoding: 'utf8',
|
|
49
|
-
windowsHide: true,
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
try {
|
|
53
|
-
const result = JSON.parse(output.stdout);
|
|
54
|
-
console.log('Server reply: ', result);
|
|
55
|
-
} catch (e) {
|
|
56
|
-
// Do nothing.
|
|
57
|
-
}
|
|
58
|
-
const err = output.status === 0 ? null : JSON.parse(output.stderr);
|
|
59
|
-
if (err) console.error(err);
|