@naturalcycles/db-lib 10.42.2 → 10.43.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.
@@ -173,8 +173,8 @@ export declare class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity
173
173
  * Validates (unless `skipValidation=true` passed).
174
174
  */
175
175
  private validateAndConvert;
176
- getTableSchema(): Promise<JsonSchema<any, DBM>>;
177
- createTable(schema: JsonSchema<any, DBM>, opt?: CommonDaoCreateOptions): Promise<void>;
176
+ getTableSchema(): Promise<JsonSchema<DBM>>;
177
+ createTable(schema: JsonSchema<DBM>, opt?: CommonDaoCreateOptions): Promise<void>;
178
178
  /**
179
179
  * Proxy to this.cfg.db.ping
180
180
  */
@@ -89,7 +89,7 @@ export interface CommonDaoCfg<BM extends BaseDBEntity, DBM extends BaseDBEntity
89
89
  * It removes the knowledge from CommonDao about the validation library used
90
90
  * and abstracts it away.
91
91
  */
92
- validateBM?: ValidationFunction<BM, BM, any>;
92
+ validateBM?: ValidationFunction<BM, any>;
93
93
  /**
94
94
  * Used by e.g Datastore.
95
95
  */
@@ -19,7 +19,7 @@ export interface TestItemTM {
19
19
  even?: boolean;
20
20
  }
21
21
  export declare const testItemTMSchema: any;
22
- export declare const testItemBMSchema: JsonSchemaObjectBuilder<TestItemBM, TestItemBM, false>;
22
+ export declare const testItemBMSchema: JsonSchemaObjectBuilder<TestItemBM, false>;
23
23
  export declare function createTestItemDBM(num?: number): TestItemDBM;
24
24
  export declare function createTestItemBM(num?: number): TestItemBM;
25
25
  export declare function createTestItemsDBM(count?: number): TestItemDBM[];
@@ -1,5 +1,5 @@
1
1
  import type { CommonDBOptions } from '../db.model.js';
2
- export declare const commonDBOptionsSchema: () => JsonSchemaObjectBuilder<CommonDBOptions, CommonDBOptions>;
2
+ export declare const commonDBOptionsSchema: () => JsonSchemaObjectBuilder<CommonDBOptions, false>;
3
3
  export declare const commonDBSaveOptionsSchema: <ROW extends ObjectWithId>() => any;
4
4
  export declare const dbQueryFilterOperatorSchema: any;
5
5
  export declare const dbQueryFilterSchema: <ROW extends ObjectWithId>() => any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/db-lib",
3
3
  "type": "module",
4
- "version": "10.42.2",
4
+ "version": "10.43.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@naturalcycles/nodejs-lib": "^15"
package/readme.md CHANGED
@@ -303,14 +303,6 @@ Passing empty array will actually return an array of empty objects (documented e
303
303
  .select(['id']) //=> [ { id: 'id1' }, { id: 'id2' }, ... ]
304
304
  ```
305
305
 
306
- # Exports
307
-
308
- - `/` root
309
- - `/adapter/file`
310
- - `/adapter/cachedb`
311
- - `/testing`
312
- - dbTest
313
- - daoTest
314
- - Test models, utils, etc
315
- - `/validation`
316
- - Joi validation schemas for DBQuery, CommonDBOptions, CommonSchema, etc
306
+ ## chore-counter
307
+
308
+ 1
@@ -109,7 +109,7 @@ export interface CommonDaoCfg<
109
109
  * It removes the knowledge from CommonDao about the validation library used
110
110
  * and abstracts it away.
111
111
  */
112
- validateBM?: ValidationFunction<BM, BM, any>
112
+ validateBM?: ValidationFunction<BM, any>
113
113
 
114
114
  /**
115
115
  * Used by e.g Datastore.
@@ -926,11 +926,11 @@ export class CommonDao<
926
926
  return convertedValue
927
927
  }
928
928
 
929
- async getTableSchema(): Promise<JsonSchema<any, DBM>> {
929
+ async getTableSchema(): Promise<JsonSchema<DBM>> {
930
930
  return await this.cfg.db.getTableSchema<DBM>(this.cfg.table)
931
931
  }
932
932
 
933
- async createTable(schema: JsonSchema<any, DBM>, opt?: CommonDaoCreateOptions): Promise<void> {
933
+ async createTable(schema: JsonSchema<DBM>, opt?: CommonDaoCreateOptions): Promise<void> {
934
934
  this.requireWriteAccess()
935
935
  await this.cfg.db.createTable(this.cfg.table, schema, opt)
936
936
  }
@@ -31,7 +31,7 @@ export const testItemTMSchema = j.object<TestItemTM>({
31
31
  even: j.boolean().optional(),
32
32
  })
33
33
 
34
- export const testItemBMSchema: JsonSchemaObjectBuilder<TestItemBM, TestItemBM, false> =
34
+ export const testItemBMSchema: JsonSchemaObjectBuilder<TestItemBM, false> =
35
35
  j.object.dbEntity<TestItemBM>({
36
36
  // todo: figure out how to not copy-paste these 3 fields
37
37
  id: j.string(), // todo: not strictly needed here
@@ -11,12 +11,9 @@ import type { DBQueryFilter, DBQueryOrder } from '../query/dbQuery.js'
11
11
  const dbTransactionSchema = j.object.any().castAs<DBTransaction>()
12
12
 
13
13
  // Schema that accepts any value (string, number, boolean, object, array, null)
14
- const anyValueSchema = new JsonSchemaAnyBuilder<any, any, false>({})
14
+ const anyValueSchema = new JsonSchemaAnyBuilder<any, false>({})
15
15
 
16
- export const commonDBOptionsSchema = (): JsonSchemaObjectBuilder<
17
- CommonDBOptions,
18
- CommonDBOptions
19
- > =>
16
+ export const commonDBOptionsSchema = (): JsonSchemaObjectBuilder<CommonDBOptions, false> =>
20
17
  j.object<CommonDBOptions>({
21
18
  tx: dbTransactionSchema.optional(),
22
19
  })