@natlibfi/melinda-rest-api-commons 6.2.0-alpha.1 → 6.2.0-alpha.3
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/README.md +7 -5
- package/dist/amqp.d.ts.map +1 -1
- package/dist/amqp.js +10 -3
- package/dist/amqp.js.map +1 -1
- package/dist/helpers/fix-strip-f884s.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/mongo.d.ts +1 -0
- package/dist/mongo.d.ts.map +1 -1
- package/dist/mongo.js +25 -2
- package/dist/mongo.js.map +1 -1
- package/dist/mongoLog.d.ts +14 -1
- package/dist/mongoLog.d.ts.map +1 -1
- package/dist/mongoLog.js +11 -2
- package/dist/mongoLog.js.map +1 -1
- package/package.json +2 -2
- package/test/amqp-error-branches.test.ts +122 -33
- package/test/mongo-add-blob-size.test.ts +6 -0
- package/test/mongo-check-and-check-state.test.ts +6 -0
- package/test/mongo-check-and-set-import-job-state.test.ts +6 -0
- package/test/mongo-check-timeout.test.ts +6 -0
- package/test/mongo-create-bulk.test.ts +6 -0
- package/test/mongo-create-prio.test.ts +6 -0
- package/test/mongo-error-branches.test.ts +129 -3
- package/test/mongo-get-one.test.ts +6 -0
- package/test/mongo-get-stream.test.ts +6 -0
- package/test/mongo-push-ids.test.ts +6 -0
- package/test/mongo-push-messages.test.ts +6 -0
- package/test/mongo-query-by-id.test.ts +6 -0
- package/test/mongo-query.test.ts +6 -0
- package/test/mongo-read-content.test.ts +6 -0
- package/test/mongo-remove.test.ts +6 -0
- package/test/mongo-set-blob-size.test.ts +6 -0
- package/test/mongo-set-import-job-state.test.ts +6 -0
- package/test/mongo-set-operation.test.ts +6 -0
- package/test/mongo-set-operations.test.ts +6 -0
- package/test/mongo-set-state.test.ts +6 -0
- package/test/mongoLog-protect.test.ts +1 -0
- package/test/mongoLog.test.ts +6 -0
package/test/mongo-query.test.ts
CHANGED
|
@@ -7,6 +7,7 @@ import createDebugLogger from 'debug';
|
|
|
7
7
|
import {getMongoOperator, handleError} from './testUtils.ts';
|
|
8
8
|
|
|
9
9
|
let mongoFixtures: any;
|
|
10
|
+
const openedOperators: any[] = [];
|
|
10
11
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:test');
|
|
11
12
|
|
|
12
13
|
generateTests({
|
|
@@ -33,6 +34,10 @@ generateTests({
|
|
|
33
34
|
},
|
|
34
35
|
after: async () => {
|
|
35
36
|
//debug(`<< After`);
|
|
37
|
+
// close the operators the tests opened (one per test) before the server
|
|
38
|
+
for (const op of openedOperators) {
|
|
39
|
+
await op.close();
|
|
40
|
+
}
|
|
36
41
|
await mongoFixtures.close();
|
|
37
42
|
}
|
|
38
43
|
}
|
|
@@ -59,6 +64,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
59
64
|
} = callbackParams;
|
|
60
65
|
|
|
61
66
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
67
|
+
openedOperators.push(mongoOperator);
|
|
62
68
|
//const expectedResult = await getFixture('expectedResult.json');
|
|
63
69
|
|
|
64
70
|
await doPreFillDb(preFillDb);
|
|
@@ -8,6 +8,7 @@ import {getMongoOperator, handleError, streamToString} from './testUtils.ts';
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
let mongoFixtures: any;
|
|
11
|
+
const openedOperators: any[] = [];
|
|
11
12
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:read-content:test');
|
|
12
13
|
|
|
13
14
|
generateTests({
|
|
@@ -34,6 +35,10 @@ generateTests({
|
|
|
34
35
|
},
|
|
35
36
|
after: async () => {
|
|
36
37
|
//debug(`<< After`);
|
|
38
|
+
// close the operators the tests opened (one per test) before the server
|
|
39
|
+
for (const op of openedOperators) {
|
|
40
|
+
await op.close();
|
|
41
|
+
}
|
|
37
42
|
await mongoFixtures.close();
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -61,6 +66,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
61
66
|
} = callbackParams;
|
|
62
67
|
|
|
63
68
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
69
|
+
openedOperators.push(mongoOperator);
|
|
64
70
|
//const expectedResult = await getFixture('expectedResult.json');
|
|
65
71
|
|
|
66
72
|
await doPreFillDb(preFillDb);
|
|
@@ -8,6 +8,7 @@ import {getMongoOperator, handleError, compareToFirstDbEntry} from './testUtils.
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
let mongoFixtures: any;
|
|
11
|
+
const openedOperators: any[] = [];
|
|
11
12
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:remove:test');
|
|
12
13
|
|
|
13
14
|
generateTests({
|
|
@@ -34,6 +35,10 @@ generateTests({
|
|
|
34
35
|
},
|
|
35
36
|
after: async () => {
|
|
36
37
|
//debug(`<< After`);
|
|
38
|
+
// close the operators the tests opened (one per test) before the server
|
|
39
|
+
for (const op of openedOperators) {
|
|
40
|
+
await op.close();
|
|
41
|
+
}
|
|
37
42
|
await mongoFixtures.close();
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -64,6 +69,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
64
69
|
} = callbackParams;
|
|
65
70
|
|
|
66
71
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
72
|
+
openedOperators.push(mongoOperator);
|
|
67
73
|
const expectedResult = await getFixture('expectedResult.json');
|
|
68
74
|
|
|
69
75
|
await doPreFillDb(preFillDb);
|
|
@@ -7,6 +7,7 @@ import createDebugLogger from 'debug';
|
|
|
7
7
|
import {getMongoOperator, handleError, compareToFirstDbEntry} from './testUtils.ts';
|
|
8
8
|
|
|
9
9
|
let mongoFixtures: any;
|
|
10
|
+
const openedOperators: any[] = [];
|
|
10
11
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:set-blob-size:test');
|
|
11
12
|
|
|
12
13
|
generateTests({
|
|
@@ -33,6 +34,10 @@ generateTests({
|
|
|
33
34
|
},
|
|
34
35
|
after: async () => {
|
|
35
36
|
//debug(`<< After`);
|
|
37
|
+
// close the operators the tests opened (one per test) before the server
|
|
38
|
+
for (const op of openedOperators) {
|
|
39
|
+
await op.close();
|
|
40
|
+
}
|
|
36
41
|
await mongoFixtures.close();
|
|
37
42
|
}
|
|
38
43
|
}
|
|
@@ -59,6 +64,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
59
64
|
} = callbackParams;
|
|
60
65
|
|
|
61
66
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
67
|
+
openedOperators.push(mongoOperator);
|
|
62
68
|
const expectedResult = await getFixture('expectedResult.json');
|
|
63
69
|
|
|
64
70
|
await doPreFillDb(preFillDb);
|
|
@@ -8,6 +8,7 @@ import {getMongoOperator, handleError, compareToFirstDbEntry} from './testUtils.
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
let mongoFixtures: any;
|
|
11
|
+
const openedOperators: any[] = [];
|
|
11
12
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:set-import-job-state:test');
|
|
12
13
|
|
|
13
14
|
generateTests({
|
|
@@ -34,6 +35,10 @@ generateTests({
|
|
|
34
35
|
},
|
|
35
36
|
after: async () => {
|
|
36
37
|
//debug(`<< After`);
|
|
38
|
+
// close the operators the tests opened (one per test) before the server
|
|
39
|
+
for (const op of openedOperators) {
|
|
40
|
+
await op.close();
|
|
41
|
+
}
|
|
37
42
|
await mongoFixtures.close();
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -60,6 +65,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
60
65
|
} = callbackParams;
|
|
61
66
|
|
|
62
67
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
68
|
+
openedOperators.push(mongoOperator);
|
|
63
69
|
const expectedResult = await getFixture('expectedResult.json');
|
|
64
70
|
|
|
65
71
|
await doPreFillDb(preFillDb);
|
|
@@ -7,6 +7,7 @@ import createDebugLogger from 'debug';
|
|
|
7
7
|
import {getMongoOperator, handleError, compareToFirstDbEntry} from './testUtils.ts';
|
|
8
8
|
|
|
9
9
|
let mongoFixtures: any;
|
|
10
|
+
const openedOperators: any[] = [];
|
|
10
11
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:set-operation:test');
|
|
11
12
|
|
|
12
13
|
generateTests({
|
|
@@ -33,6 +34,10 @@ generateTests({
|
|
|
33
34
|
},
|
|
34
35
|
after: async () => {
|
|
35
36
|
//debug(`<< After`);
|
|
37
|
+
// close the operators the tests opened (one per test) before the server
|
|
38
|
+
for (const op of openedOperators) {
|
|
39
|
+
await op.close();
|
|
40
|
+
}
|
|
36
41
|
await mongoFixtures.close();
|
|
37
42
|
}
|
|
38
43
|
}
|
|
@@ -59,6 +64,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
59
64
|
} = callbackParams;
|
|
60
65
|
|
|
61
66
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
67
|
+
openedOperators.push(mongoOperator);
|
|
62
68
|
const expectedResult = await getFixture('expectedResult.json');
|
|
63
69
|
|
|
64
70
|
await doPreFillDb(preFillDb);
|
|
@@ -7,6 +7,7 @@ import createDebugLogger from 'debug';
|
|
|
7
7
|
import {getMongoOperator, handleError, compareToFirstDbEntry} from './testUtils.ts';
|
|
8
8
|
|
|
9
9
|
let mongoFixtures: any;
|
|
10
|
+
const openedOperators: any[] = [];
|
|
10
11
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:set-operations:test');
|
|
11
12
|
|
|
12
13
|
generateTests({
|
|
@@ -33,6 +34,10 @@ generateTests({
|
|
|
33
34
|
},
|
|
34
35
|
after: async () => {
|
|
35
36
|
//debug(`<< After`);
|
|
37
|
+
// close the operators the tests opened (one per test) before the server
|
|
38
|
+
for (const op of openedOperators) {
|
|
39
|
+
await op.close();
|
|
40
|
+
}
|
|
36
41
|
await mongoFixtures.close();
|
|
37
42
|
}
|
|
38
43
|
}
|
|
@@ -59,6 +64,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
59
64
|
} = callbackParams;
|
|
60
65
|
|
|
61
66
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
67
|
+
openedOperators.push(mongoOperator);
|
|
62
68
|
const expectedResult = await getFixture('expectedResult.json');
|
|
63
69
|
|
|
64
70
|
await doPreFillDb(preFillDb);
|
|
@@ -8,6 +8,7 @@ import {getMongoOperator, handleError, compareToFirstDbEntry} from './testUtils.
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
let mongoFixtures: any;
|
|
11
|
+
const openedOperators: any[] = [];
|
|
11
12
|
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons/mongo:set-state:test');
|
|
12
13
|
|
|
13
14
|
generateTests({
|
|
@@ -34,6 +35,10 @@ generateTests({
|
|
|
34
35
|
},
|
|
35
36
|
after: async () => {
|
|
36
37
|
//debug(`<< After`);
|
|
38
|
+
// close the operators the tests opened (one per test) before the server
|
|
39
|
+
for (const op of openedOperators) {
|
|
40
|
+
await op.close();
|
|
41
|
+
}
|
|
37
42
|
await mongoFixtures.close();
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -60,6 +65,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
60
65
|
} = callbackParams;
|
|
61
66
|
|
|
62
67
|
const mongoOperator = await getMongoOperator(mongoFixtures);
|
|
68
|
+
openedOperators.push(mongoOperator);
|
|
63
69
|
const expectedResult = await getFixture('expectedResult.json');
|
|
64
70
|
|
|
65
71
|
await doPreFillDb(preFillDb);
|
package/test/mongoLog.test.ts
CHANGED
|
@@ -6,6 +6,7 @@ import mongoFixturesFactory from '@natlibfi/fixura-mongo';
|
|
|
6
6
|
import createMongoLogOperator from '../src/mongoLog.ts';
|
|
7
7
|
|
|
8
8
|
let mongoFixtures: any;
|
|
9
|
+
const openedOperators: any[] = [];
|
|
9
10
|
|
|
10
11
|
generateTests({
|
|
11
12
|
callback,
|
|
@@ -23,6 +24,10 @@ generateTests({
|
|
|
23
24
|
beforeEach: () => mongoFixtures.clear(),
|
|
24
25
|
afterEach: () => mongoFixtures.clear(),
|
|
25
26
|
after: async () => {
|
|
27
|
+
// close the operators the tests opened (one per test) before the server
|
|
28
|
+
for (const op of openedOperators) {
|
|
29
|
+
await op.close();
|
|
30
|
+
}
|
|
26
31
|
await mongoFixtures.close();
|
|
27
32
|
}
|
|
28
33
|
}
|
|
@@ -58,6 +63,7 @@ async function callback(callbackParams: Record<string, any>) {
|
|
|
58
63
|
} = callbackParams;
|
|
59
64
|
const mongoUri = await mongoFixtures.getUri();
|
|
60
65
|
const mongoLogOperator = await createMongoLogOperator(mongoUri, '');
|
|
66
|
+
openedOperators.push(mongoLogOperator);
|
|
61
67
|
const expectedResult = expectError ? undefined : await getFixture('expectedResult.json');
|
|
62
68
|
|
|
63
69
|
if (expectError) {
|