Skip to content

Commit c5cd98f

Browse files
committed
build ts
1 parent b07a006 commit c5cd98f

File tree

9 files changed

+148
-127
lines changed

9 files changed

+148
-127
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,9 @@ $RECYCLE.BIN/
186186

187187
node_modules
188188

189-
lib
189+
lib
190+
191+
**/*.d.ts
192+
**/*.js
193+
**/*.js.map
194+
!**/initdb/*.js

docker/sharded/config.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

docker/sharded/config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const path = require("path");
2+
3+
export default {
4+
dockerCompose: {
5+
projectName: path.basename(__dirname),
6+
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
7+
},
8+
waitOn: ["tcp:28004"],
9+
connections: {
10+
default: {
11+
connectionString:
12+
"mongodb://root:password123@localhost:28004/db1?authSource=admin",
13+
},
14+
},
15+
};

docker/ssh/config.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

docker/ssh/config.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const path = require("path");
2+
3+
export default {
4+
dockerCompose: {
5+
projectName: path.basename(__dirname),
6+
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
7+
},
8+
waitOn: ["tcp:28006"],
9+
connections: {
10+
password: {
11+
connectionString: "mongodb://mongo:27017",
12+
sshTunnel: {
13+
host: "localhost",
14+
port: 22222,
15+
username: "root",
16+
password: "password",
17+
},
18+
},
19+
identityKey: {
20+
connectionString: "mongodb://mongo:27017",
21+
sshTunnel: {
22+
host: "localhost",
23+
port: 22222,
24+
username: "root",
25+
identityKeyFile: path.resolve(
26+
__dirname,
27+
"keys",
28+
"key-without-passphrase"
29+
),
30+
},
31+
},
32+
identityKeyWithPassphrase: {
33+
connectionString: "mongodb://mongo:27017",
34+
sshTunnel: {
35+
host: "localhost",
36+
port: 22222,
37+
username: "root",
38+
identityKeyFile: path.resolve(__dirname, "keys", "key-with-passphrase"),
39+
identityKeyPassphrase: "passphrase",
40+
},
41+
},
42+
},
43+
};

docker/tls/config.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

docker/tls/config.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const path = require("path");
2+
3+
const { default: ConnectionString } = require("mongodb-connection-string-url");
4+
5+
const unvalidated = new ConnectionString("mongodb://localhost:27029");
6+
unvalidated.searchParams.set("tls", "true");
7+
unvalidated.searchParams.set("tlsInsecure", "true");
8+
9+
const serverValidation = new ConnectionString("mongodb://localhost:27029");
10+
serverValidation.searchParams.set("tls", "true");
11+
serverValidation.searchParams.set(
12+
"tlsCAFile",
13+
path.resolve(__dirname, "tls", "ca.pem")
14+
);
15+
16+
const serverAndClientValidation = new ConnectionString(
17+
"mongodb://localhost:27030"
18+
);
19+
serverAndClientValidation.searchParams.set("tls", "true");
20+
serverAndClientValidation.searchParams.set(
21+
"tlsCAFile",
22+
path.resolve(__dirname, "tls", "ca.pem")
23+
);
24+
serverAndClientValidation.searchParams.set(
25+
"tlsCertificateKeyFile",
26+
path.resolve(__dirname, "tls", "client.pem")
27+
);
28+
29+
const x509 = new ConnectionString("mongodb://localhost:27031");
30+
x509.searchParams.set("tls", "true");
31+
x509.searchParams.set("tlsCAFile", path.resolve(__dirname, "tls", "ca.pem"));
32+
x509.searchParams.set(
33+
"tlsCertificateKeyFile",
34+
path.resolve(__dirname, "tls", "client.pem")
35+
);
36+
x509.searchParams.set("authMechanism", "MONGODB-X509");
37+
38+
const x509WithSsh = new ConnectionString("mongodb://mongodb-tls-x509:27017");
39+
x509WithSsh.searchParams.set("tls", "true");
40+
x509WithSsh.searchParams.set("tlsAllowInvalidHostnames", "true");
41+
x509WithSsh.searchParams.set(
42+
"tlsCAFile",
43+
path.resolve(__dirname, "tls", "ca.pem")
44+
);
45+
x509WithSsh.searchParams.set(
46+
"tlsCertificateKeyFile",
47+
path.resolve(__dirname, "tls", "client.pem")
48+
);
49+
x509WithSsh.searchParams.set("authMechanism", "MONGODB-X509");
50+
51+
export default {
52+
dockerCompose: {
53+
projectName: path.basename(__dirname),
54+
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
55+
},
56+
waitOn: ["tcp:27029", "tcp:27030", "tcp:27031", "tcp:22223"],
57+
connections: {
58+
unvalidated: {
59+
connectionString: unvalidated.href,
60+
},
61+
serverValidation: {
62+
connectionString: serverValidation.href,
63+
},
64+
serverAndClientValidation: {
65+
connectionString: serverAndClientValidation.href,
66+
},
67+
x509: {
68+
connectionString: x509.href,
69+
},
70+
x509WithSsh: {
71+
connectionString: x509WithSsh.href,
72+
sshTunnel: {
73+
host: "localhost",
74+
port: 22223,
75+
username: "root",
76+
password: "password",
77+
},
78+
},
79+
},
80+
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"clean": "rimraf lib",
1212
"precompile": "npm run clean",
1313
"compile": "npm run compile-ts",
14-
"compile-ts": "tsc -p tsconfig.json"
14+
"compile-ts": "tsc -p tsconfig.json",
15+
"prepare": "npm run compile"
1516
},
1617
"repository": {
1718
"type": "git",

tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"allowJs": true,
3+
"allowJs": false,
44
"esModuleInterop": true,
55
"downlevelIteration": true,
66
"declaration": true,
@@ -11,8 +11,7 @@
1111
"skipLibCheck": true,
1212
"sourceMap": true,
1313
"strict": true,
14-
"target": "es2018",
15-
"outDir": "lib"
14+
"target": "es2018"
1615
},
1716
"include": ["**/*"],
1817
"exclude": ["./src/**/*.spec.*"]

0 commit comments

Comments
 (0)