@naturalcycles/db-lib 10.33.0 → 10.35.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.
@@ -2,9 +2,9 @@ import { Readable } from 'node:stream';
2
2
  import { _by, _sortBy } from '@naturalcycles/js-lib/array';
3
3
  import { _since, localTime } from '@naturalcycles/js-lib/datetime';
4
4
  import { _assert } from '@naturalcycles/js-lib/error/assert.js';
5
- import { generateJsonSchemaFromData } from '@naturalcycles/js-lib/json-schema';
6
5
  import { _deepEquals, _filterUndefinedValues, _sortObjectDeep } from '@naturalcycles/js-lib/object';
7
6
  import { _stringMapValues, } from '@naturalcycles/js-lib/types';
7
+ import { generateJsonSchemaFromData } from '@naturalcycles/nodejs-lib/ajv';
8
8
  import { dimGrey } from '@naturalcycles/nodejs-lib/colors';
9
9
  import { Pipeline } from '@naturalcycles/nodejs-lib/stream';
10
10
  import { BaseCommonDB } from '../../commondb/base.common.db.js';
@@ -1,8 +1,8 @@
1
1
  import { _isEmptyObject } from '@naturalcycles/js-lib';
2
2
  import { _assert } from '@naturalcycles/js-lib/error/assert.js';
3
- import { generateJsonSchemaFromData } from '@naturalcycles/js-lib/json-schema';
4
3
  import { _deepCopy, _sortObjectDeep } from '@naturalcycles/js-lib/object';
5
4
  import { _stringMapEntries, _stringMapValues, } from '@naturalcycles/js-lib/types';
5
+ import { generateJsonSchemaFromData } from '@naturalcycles/nodejs-lib/ajv';
6
6
  import { Pipeline } from '@naturalcycles/nodejs-lib/stream';
7
7
  import { bufferReviver } from '@naturalcycles/nodejs-lib/stream/ndjson/transformJsonParse.js';
8
8
  import { commonDBFullSupport, CommonDBType } from '../commondb/common.db.js';
@@ -18,8 +18,8 @@ export const testItemTMSchema = objectSchema({
18
18
  k1: stringSchema,
19
19
  even: booleanSchema.optional(),
20
20
  });
21
- export const testItemBMJsonSchema = j
22
- .object({
21
+ export const testItemBMJsonSchema = j.object
22
+ .dbEntity({
23
23
  // todo: figure out how to not copy-paste these 3 fields
24
24
  id: j.string(), // todo: not strictly needed here
25
25
  created: j.number().integer().unixTimestamp(),
@@ -31,7 +31,6 @@ export const testItemBMJsonSchema = j
31
31
  b1: j.buffer().optional(),
32
32
  nested: j.object.infer({ foo: j.number() }).optional(),
33
33
  })
34
- .dbEntity()
35
34
  .build();
36
35
  export function createTestItemDBM(num = 1) {
37
36
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/db-lib",
3
3
  "type": "module",
4
- "version": "10.33.0",
4
+ "version": "10.35.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@naturalcycles/nodejs-lib": "^15"
@@ -40,7 +40,7 @@
40
40
  "directory": "packages/db-lib"
41
41
  },
42
42
  "engines": {
43
- "node": ">=22.12.0"
43
+ "node": ">=24.10.0"
44
44
  },
45
45
  "description": "Lowest Common Denominator API to supported Databases",
46
46
  "keywords": [
package/readme.md CHANGED
@@ -314,10 +314,3 @@ Passing empty array will actually return an array of empty objects (documented e
314
314
  - Test models, utils, etc
315
315
  - `/validation`
316
316
  - Joi validation schemas for DBQuery, CommonDBOptions, CommonSchema, etc
317
-
318
- # Packaging
319
-
320
- - `engines.node >= LTS`
321
- - `main: dist/index.js`: commonjs, es2020
322
- - `types: dist/index.d.ts`: typescript types
323
- - `/src` folder with source `*.ts` files included
@@ -2,7 +2,6 @@ import { Readable } from 'node:stream'
2
2
  import { _by, _sortBy } from '@naturalcycles/js-lib/array'
3
3
  import { _since, localTime } from '@naturalcycles/js-lib/datetime'
4
4
  import { _assert } from '@naturalcycles/js-lib/error/assert.js'
5
- import { generateJsonSchemaFromData } from '@naturalcycles/js-lib/json-schema'
6
5
  import { _deepEquals, _filterUndefinedValues, _sortObjectDeep } from '@naturalcycles/js-lib/object'
7
6
  import {
8
7
  _stringMapValues,
@@ -10,6 +9,7 @@ import {
10
9
  type UnixTimestampMillis,
11
10
  } from '@naturalcycles/js-lib/types'
12
11
  import type { JsonSchema } from '@naturalcycles/nodejs-lib/ajv'
12
+ import { generateJsonSchemaFromData } from '@naturalcycles/nodejs-lib/ajv'
13
13
  import { dimGrey } from '@naturalcycles/nodejs-lib/colors'
14
14
  import { Pipeline } from '@naturalcycles/nodejs-lib/stream'
15
15
  import { BaseCommonDB } from '../../commondb/base.common.db.js'
@@ -1,6 +1,5 @@
1
1
  import { _isEmptyObject } from '@naturalcycles/js-lib'
2
2
  import { _assert } from '@naturalcycles/js-lib/error/assert.js'
3
- import { generateJsonSchemaFromData } from '@naturalcycles/js-lib/json-schema'
4
3
  import type { CommonLogger } from '@naturalcycles/js-lib/log'
5
4
  import { _deepCopy, _sortObjectDeep } from '@naturalcycles/js-lib/object'
6
5
  import {
@@ -11,6 +10,7 @@ import {
11
10
  type StringMap,
12
11
  } from '@naturalcycles/js-lib/types'
13
12
  import type { JsonSchema } from '@naturalcycles/nodejs-lib/ajv'
13
+ import { generateJsonSchemaFromData } from '@naturalcycles/nodejs-lib/ajv'
14
14
  import { Pipeline } from '@naturalcycles/nodejs-lib/stream'
15
15
  import { bufferReviver } from '@naturalcycles/nodejs-lib/stream/ndjson/transformJsonParse.js'
16
16
  import type { CommonDB, CommonDBSupport } from '../commondb/common.db.js'
@@ -50,8 +50,8 @@ export const testItemTMSchema: ObjectSchema<TestItemTM> = objectSchema<TestItemT
50
50
  even: booleanSchema.optional(),
51
51
  })
52
52
 
53
- export const testItemBMJsonSchema = j
54
- .object<TestItemBM>({
53
+ export const testItemBMJsonSchema = j.object
54
+ .dbEntity<TestItemBM>({
55
55
  // todo: figure out how to not copy-paste these 3 fields
56
56
  id: j.string(), // todo: not strictly needed here
57
57
  created: j.number().integer().unixTimestamp(),
@@ -63,7 +63,6 @@ export const testItemBMJsonSchema = j
63
63
  b1: j.buffer().optional(),
64
64
  nested: j.object.infer({ foo: j.number() }).optional(),
65
65
  })
66
- .dbEntity()
67
66
  .build()
68
67
 
69
68
  export function createTestItemDBM(num = 1): TestItemDBM {