@naturalcycles/db-lib 10.13.0 → 10.14.0
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/dist/testing/test.model.js +10 -10
- package/package.json +1 -1
- package/src/testing/test.model.ts +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _range } from '@naturalcycles/js-lib/array/range.js';
|
|
2
|
-
import {
|
|
2
|
+
import { j } from '@naturalcycles/js-lib/json-schema';
|
|
3
3
|
import { baseDBEntitySchema, binarySchema, booleanSchema, numberSchema, objectSchema, stringSchema, } from '@naturalcycles/nodejs-lib/joi';
|
|
4
4
|
const MOCK_TS_2018_06_21 = 1529539200;
|
|
5
5
|
export const TEST_TABLE = 'TEST_TABLE';
|
|
@@ -17,17 +17,17 @@ export const testItemTMSchema = objectSchema({
|
|
|
17
17
|
k1: stringSchema,
|
|
18
18
|
even: booleanSchema.optional(),
|
|
19
19
|
});
|
|
20
|
-
export const testItemBMJsonSchema =
|
|
20
|
+
export const testItemBMJsonSchema = j
|
|
21
21
|
.rootObject({
|
|
22
22
|
// todo: figure out how to not copy-paste these 3 fields
|
|
23
|
-
id:
|
|
24
|
-
created:
|
|
25
|
-
updated:
|
|
26
|
-
k1:
|
|
27
|
-
k2:
|
|
28
|
-
k3:
|
|
29
|
-
even:
|
|
30
|
-
b1:
|
|
23
|
+
id: j.string(), // todo: not strictly needed here
|
|
24
|
+
created: j.unixTimestamp(),
|
|
25
|
+
updated: j.unixTimestamp(),
|
|
26
|
+
k1: j.string(),
|
|
27
|
+
k2: j.oneOf([j.string(), j.null()]).optional(),
|
|
28
|
+
k3: j.number().optional(),
|
|
29
|
+
even: j.boolean().optional(),
|
|
30
|
+
b1: j.buffer().optional(),
|
|
31
31
|
})
|
|
32
32
|
.baseDBEntity()
|
|
33
33
|
.build();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _range } from '@naturalcycles/js-lib/array/range.js'
|
|
2
2
|
import type { JsonSchemaObject } from '@naturalcycles/js-lib/json-schema'
|
|
3
|
-
import {
|
|
3
|
+
import { j } from '@naturalcycles/js-lib/json-schema'
|
|
4
4
|
import type { BaseDBEntity, UnixTimestamp } from '@naturalcycles/js-lib/types'
|
|
5
5
|
import {
|
|
6
6
|
baseDBEntitySchema,
|
|
@@ -50,17 +50,17 @@ export const testItemTMSchema: ObjectSchema<TestItemTM> = objectSchema<TestItemT
|
|
|
50
50
|
even: booleanSchema.optional(),
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
export const testItemBMJsonSchema: JsonSchemaObject<TestItemBM> =
|
|
53
|
+
export const testItemBMJsonSchema: JsonSchemaObject<TestItemBM> = j
|
|
54
54
|
.rootObject<TestItemBM>({
|
|
55
55
|
// todo: figure out how to not copy-paste these 3 fields
|
|
56
|
-
id:
|
|
57
|
-
created:
|
|
58
|
-
updated:
|
|
59
|
-
k1:
|
|
60
|
-
k2:
|
|
61
|
-
k3:
|
|
62
|
-
even:
|
|
63
|
-
b1:
|
|
56
|
+
id: j.string(), // todo: not strictly needed here
|
|
57
|
+
created: j.unixTimestamp(),
|
|
58
|
+
updated: j.unixTimestamp(),
|
|
59
|
+
k1: j.string(),
|
|
60
|
+
k2: j.oneOf<string | null>([j.string(), j.null()]).optional(),
|
|
61
|
+
k3: j.number().optional(),
|
|
62
|
+
even: j.boolean().optional(),
|
|
63
|
+
b1: j.buffer().optional(),
|
|
64
64
|
})
|
|
65
65
|
.baseDBEntity()
|
|
66
66
|
.build()
|