@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.
@@ -1,5 +1,5 @@
1
1
  import { _range } from '@naturalcycles/js-lib/array/range.js';
2
- import { jsonSchema } from '@naturalcycles/js-lib/json-schema';
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 = jsonSchema
20
+ export const testItemBMJsonSchema = j
21
21
  .rootObject({
22
22
  // todo: figure out how to not copy-paste these 3 fields
23
- id: jsonSchema.string(), // todo: not strictly needed here
24
- created: jsonSchema.unixTimestamp(),
25
- updated: jsonSchema.unixTimestamp(),
26
- k1: jsonSchema.string(),
27
- k2: jsonSchema.oneOf([jsonSchema.string(), jsonSchema.null()]).optional(),
28
- k3: jsonSchema.number().optional(),
29
- even: jsonSchema.boolean().optional(),
30
- b1: jsonSchema.buffer().optional(),
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/db-lib",
3
3
  "type": "module",
4
- "version": "10.13.0",
4
+ "version": "10.14.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@naturalcycles/nodejs-lib": "^15"
@@ -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 { jsonSchema } from '@naturalcycles/js-lib/json-schema'
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> = jsonSchema
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: jsonSchema.string(), // todo: not strictly needed here
57
- created: jsonSchema.unixTimestamp(),
58
- updated: jsonSchema.unixTimestamp(),
59
- k1: jsonSchema.string(),
60
- k2: jsonSchema.oneOf<string | null>([jsonSchema.string(), jsonSchema.null()]).optional(),
61
- k3: jsonSchema.number().optional(),
62
- even: jsonSchema.boolean().optional(),
63
- b1: jsonSchema.buffer().optional(),
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()