@boxyhq/saml-jackson 0.2.3-beta.225 → 0.2.3-beta.226
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/db/mem.ts +2 -2
- package/src/db/mongo.ts +3 -3
- package/src/db/redis.ts +2 -2
- package/src/db/sql/model/JacksonStore.ts +3 -3
- package/src/db/sql/sql.ts +3 -7
- package/src/typings.ts +2 -2
package/package.json
CHANGED
package/src/db/mem.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// This is an in-memory implementation to be used with testing and prototyping only
|
2
2
|
|
3
|
-
import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
|
3
|
+
import { DatabaseDriver, DatabaseOption, Index, Encrypted } from 'saml-jackson';
|
4
4
|
import * as dbutils from './utils';
|
5
5
|
|
6
6
|
class Mem implements DatabaseDriver {
|
@@ -65,7 +65,7 @@ class Mem implements DatabaseDriver {
|
|
65
65
|
async put(
|
66
66
|
namespace: string,
|
67
67
|
key: string,
|
68
|
-
val:
|
68
|
+
val: Encrypted,
|
69
69
|
ttl: number = 0,
|
70
70
|
...indexes: any[]
|
71
71
|
): Promise<any> {
|
package/src/db/mongo.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { MongoClient } from 'mongodb';
|
2
|
-
import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
|
2
|
+
import { DatabaseDriver, DatabaseOption, Encrypted, Index } from 'saml-jackson';
|
3
3
|
import * as dbutils from './utils';
|
4
4
|
|
5
5
|
type Document = {
|
6
|
-
value:
|
6
|
+
value: Encrypted;
|
7
7
|
expiresAt: Date;
|
8
8
|
indexes: string[];
|
9
9
|
};
|
@@ -64,7 +64,7 @@ class Mongo implements DatabaseDriver {
|
|
64
64
|
async put(
|
65
65
|
namespace: string,
|
66
66
|
key: string,
|
67
|
-
val:
|
67
|
+
val: Encrypted,
|
68
68
|
ttl: number = 0,
|
69
69
|
...indexes: any[]
|
70
70
|
): Promise<void> {
|
package/src/db/redis.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as redis from 'redis';
|
2
|
-
import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
|
2
|
+
import { DatabaseDriver, DatabaseOption, Encrypted, Index } from 'saml-jackson';
|
3
3
|
import * as dbutils from './utils';
|
4
4
|
|
5
5
|
class Redis implements DatabaseDriver {
|
@@ -54,7 +54,7 @@ class Redis implements DatabaseDriver {
|
|
54
54
|
async put(
|
55
55
|
namespace: string,
|
56
56
|
key: string,
|
57
|
-
val:
|
57
|
+
val: Encrypted,
|
58
58
|
ttl: number = 0,
|
59
59
|
...indexes: any[]
|
60
60
|
): Promise<void> {
|
package/src/db/sql/sql.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require('reflect-metadata');
|
4
4
|
|
5
|
-
import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
|
5
|
+
import { DatabaseDriver, DatabaseOption, Index, Encrypted } from 'saml-jackson';
|
6
6
|
import { Connection, createConnection } from 'typeorm';
|
7
7
|
import * as dbutils from '../utils';
|
8
8
|
import { JacksonIndex } from './model/JacksonIndex';
|
@@ -29,8 +29,6 @@ class Sql implements DatabaseDriver {
|
|
29
29
|
async init(): Promise<Sql> {
|
30
30
|
while (true) {
|
31
31
|
try {
|
32
|
-
// TODO: Fix it
|
33
|
-
// @ts-ignore
|
34
32
|
this.connection = await createConnection({
|
35
33
|
name: this.options.type + Math.floor(Math.random() * 100000),
|
36
34
|
type: this.options.type,
|
@@ -116,11 +114,10 @@ class Sql implements DatabaseDriver {
|
|
116
114
|
key: dbutils.keyForIndex(namespace, idx),
|
117
115
|
});
|
118
116
|
|
119
|
-
const ret:
|
117
|
+
const ret: Encrypted[] = [];
|
120
118
|
|
121
119
|
if (res) {
|
122
120
|
res.forEach((r) => {
|
123
|
-
// @ts-ignore
|
124
121
|
ret.push({
|
125
122
|
value: r.store.value,
|
126
123
|
iv: r.store.iv,
|
@@ -135,14 +132,13 @@ class Sql implements DatabaseDriver {
|
|
135
132
|
async put(
|
136
133
|
namespace: string,
|
137
134
|
key: string,
|
138
|
-
val:
|
135
|
+
val: Encrypted,
|
139
136
|
ttl: number = 0,
|
140
137
|
...indexes: any[]
|
141
138
|
): Promise<void> {
|
142
139
|
await this.connection.transaction(async (transactionalEntityManager) => {
|
143
140
|
const dbKey = dbutils.key(namespace, key);
|
144
141
|
|
145
|
-
// @ts-ignore
|
146
142
|
const store = new JacksonStore(dbKey, val.value, val.iv, val.tag);
|
147
143
|
|
148
144
|
await transactionalEntityManager.save(store);
|