@naturalcycles/db-lib 10.40.0 → 10.40.1
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseDBEntity } from '@naturalcycles/js-lib/types';
|
|
2
|
+
import { type JsonSchemaObjectBuilder } from '@naturalcycles/nodejs-lib/ajv';
|
|
2
3
|
export declare const TEST_TABLE = "TEST_TABLE";
|
|
3
4
|
export declare const TEST_TABLE_2 = "TEST_TABLE_2";
|
|
4
5
|
export interface TestItemBM extends BaseDBEntity {
|
|
@@ -18,7 +19,7 @@ export interface TestItemTM {
|
|
|
18
19
|
even?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare const testItemTMSchema: any;
|
|
21
|
-
export declare const testItemBMSchema:
|
|
22
|
+
export declare const testItemBMSchema: JsonSchemaObjectBuilder<TestItemBM, TestItemBM, false>;
|
|
22
23
|
export declare function createTestItemDBM(num?: number): TestItemDBM;
|
|
23
24
|
export declare function createTestItemBM(num?: number): TestItemBM;
|
|
24
25
|
export declare function createTestItemsDBM(count?: number): TestItemDBM[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _range } from '@naturalcycles/js-lib/array/range.js'
|
|
2
2
|
import type { BaseDBEntity, UnixTimestamp } from '@naturalcycles/js-lib/types'
|
|
3
|
-
import { j } from '@naturalcycles/nodejs-lib/ajv'
|
|
3
|
+
import { j, type JsonSchemaObjectBuilder } from '@naturalcycles/nodejs-lib/ajv'
|
|
4
4
|
|
|
5
5
|
const MOCK_TS_2018_06_21 = 1529539200 as UnixTimestamp
|
|
6
6
|
|
|
@@ -30,18 +30,19 @@ export const testItemTMSchema = j.object<TestItemTM>({
|
|
|
30
30
|
even: j.boolean().optional(),
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
export const testItemBMSchema
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})
|
|
33
|
+
export const testItemBMSchema: JsonSchemaObjectBuilder<TestItemBM, TestItemBM, false> =
|
|
34
|
+
j.object.dbEntity<TestItemBM>({
|
|
35
|
+
// todo: figure out how to not copy-paste these 3 fields
|
|
36
|
+
id: j.string(), // todo: not strictly needed here
|
|
37
|
+
created: j.number().integer().unixTimestamp(),
|
|
38
|
+
updated: j.number().integer().unixTimestamp(),
|
|
39
|
+
k1: j.string(),
|
|
40
|
+
k2: j.string().nullable().optional(),
|
|
41
|
+
k3: j.number().optional(),
|
|
42
|
+
even: j.boolean().optional(),
|
|
43
|
+
b1: j.buffer().optional(),
|
|
44
|
+
nested: j.object.infer({ foo: j.number() }).optional(),
|
|
45
|
+
})
|
|
45
46
|
|
|
46
47
|
export function createTestItemDBM(num = 1): TestItemDBM {
|
|
47
48
|
return {
|