@boxyhq/saml-jackson 0.1.5-beta.94 → 0.1.5-beta.98
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/package.json +10 -10
- package/src/db/sql/entity/JacksonIndex.js +2 -0
- package/src/db/sql/entity/JacksonStore.js +32 -16
- package/src/db/sql/sql.js +25 -12
- package/src/db/utils.js +5 -4
- package/src/index.js +2 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@boxyhq/saml-jackson",
|
3
|
-
"version": "0.1.5-beta.
|
3
|
+
"version": "0.1.5-beta.98",
|
4
4
|
"license": "Apache 2.0",
|
5
5
|
"description": "SAML 2.0 service",
|
6
6
|
"main": "src/index.js",
|
@@ -32,27 +32,27 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@boxyhq/saml20": "0.2.0",
|
35
|
-
"@peculiar/webcrypto": "1.
|
36
|
-
"@peculiar/x509": "1.
|
35
|
+
"@peculiar/webcrypto": "1.2.2",
|
36
|
+
"@peculiar/x509": "1.6.0",
|
37
37
|
"cors": "2.8.5",
|
38
38
|
"express": "4.17.1",
|
39
|
-
"mongodb": "4.
|
40
|
-
"mysql2": "
|
39
|
+
"mongodb": "4.2.0",
|
40
|
+
"mysql2": "2.3.3",
|
41
41
|
"pg": "8.7.1",
|
42
42
|
"rambda": "6.9.0",
|
43
|
-
"redis": "4.0.0-rc.
|
43
|
+
"redis": "4.0.0-rc.4",
|
44
44
|
"reflect-metadata": "0.1.13",
|
45
45
|
"ripemd160": "2.0.2",
|
46
46
|
"thumbprint": "0.0.1",
|
47
|
-
"typeorm": "0.2.
|
47
|
+
"typeorm": "0.2.41",
|
48
48
|
"xml-crypto": "2.1.3",
|
49
49
|
"xml2js": "0.4.23",
|
50
50
|
"xmlbuilder": "15.1.1"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"cross-env": "7.0.3",
|
54
|
-
"eslint": "
|
55
|
-
"nodemon": "2.0.
|
56
|
-
"tap": "15.
|
54
|
+
"eslint": "8.3.0",
|
55
|
+
"nodemon": "2.0.15",
|
56
|
+
"tap": "15.1.2"
|
57
57
|
}
|
58
58
|
}
|
@@ -1,20 +1,36 @@
|
|
1
1
|
const EntitySchema = require('typeorm').EntitySchema;
|
2
2
|
const JacksonStore = require('../model/JacksonStore.js');
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
const valueType = (type) => {
|
5
|
+
switch (type) {
|
6
|
+
case 'postgres':
|
7
|
+
case 'cockroachdb':
|
8
|
+
return 'text';
|
9
|
+
case 'mysql':
|
10
|
+
case 'mariadb':
|
11
|
+
return 'mediumtext';
|
12
|
+
default:
|
13
|
+
return 'varchar';
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
module.exports = (type) => {
|
18
|
+
return new EntitySchema({
|
19
|
+
name: 'JacksonStore',
|
20
|
+
target: JacksonStore,
|
21
|
+
columns: {
|
22
|
+
key: {
|
23
|
+
primary: true,
|
24
|
+
type: 'varchar',
|
25
|
+
length: 1500,
|
26
|
+
},
|
27
|
+
value: {
|
28
|
+
type: valueType(type),
|
29
|
+
},
|
30
|
+
expiresAt: {
|
31
|
+
type: 'bigint',
|
32
|
+
nullable: true,
|
33
|
+
},
|
14
34
|
},
|
15
|
-
|
16
|
-
|
17
|
-
nullable: true,
|
18
|
-
}
|
19
|
-
},
|
20
|
-
});
|
35
|
+
});
|
36
|
+
};
|
package/src/db/sql/sql.js
CHANGED
@@ -8,17 +8,28 @@ const dbutils = require('../utils.js');
|
|
8
8
|
class Sql {
|
9
9
|
constructor(options) {
|
10
10
|
return (async () => {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
while (true) {
|
12
|
+
try {
|
13
|
+
this.connection = await typeorm.createConnection({
|
14
|
+
name: options.type,
|
15
|
+
type: options.type,
|
16
|
+
url: options.url,
|
17
|
+
synchronize: true,
|
18
|
+
migrationsTableName: '_jackson_migrations',
|
19
|
+
logging: false,
|
20
|
+
entities: [
|
21
|
+
require('./entity/JacksonStore.js')(options.type),
|
22
|
+
require('./entity/JacksonIndex.js'),
|
23
|
+
],
|
24
|
+
});
|
25
|
+
|
26
|
+
break;
|
27
|
+
} catch (err) {
|
28
|
+
console.error(`error connecting to ${options.type} db: ${err}`);
|
29
|
+
await dbutils.sleep(1000);
|
30
|
+
continue;
|
31
|
+
}
|
32
|
+
}
|
22
33
|
|
23
34
|
this.storeRepository = this.connection.getRepository(JacksonStore);
|
24
35
|
this.indexRepository = this.connection.getRepository(JacksonIndex);
|
@@ -45,7 +56,9 @@ class Sql {
|
|
45
56
|
|
46
57
|
this.timerId = setTimeout(this.ttlCleanup, options.ttl * 1000);
|
47
58
|
} else {
|
48
|
-
console.log(
|
59
|
+
console.log(
|
60
|
+
'Warning: ttl cleanup not enabled, set both "ttl" and "limit" options to enable it!'
|
61
|
+
);
|
49
62
|
}
|
50
63
|
|
51
64
|
return this;
|
package/src/db/utils.js
CHANGED
@@ -16,14 +16,15 @@ const keyFromParts = (...parts) => {
|
|
16
16
|
return parts.join(':'); // TODO: pick a better strategy, keys can collide now
|
17
17
|
};
|
18
18
|
|
19
|
+
const sleep = (ms) => {
|
20
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
21
|
+
};
|
22
|
+
|
19
23
|
module.exports = {
|
20
24
|
key,
|
21
|
-
|
22
25
|
keyForIndex,
|
23
|
-
|
24
26
|
keyDigest,
|
25
|
-
|
26
27
|
keyFromParts,
|
27
|
-
|
28
|
+
sleep,
|
28
29
|
indexPrefix: '_index',
|
29
30
|
};
|
package/src/index.js
CHANGED
@@ -56,7 +56,8 @@ module.exports = async function (opts) {
|
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
|
-
|
59
|
+
const type = opts.db.type ? ' Type: ' + opts.db.type : '';
|
60
|
+
console.log(`Using engine: ${opts.db.engine}.${type}`);
|
60
61
|
|
61
62
|
return {
|
62
63
|
apiController,
|