@naturalcycles/db-lib 10.45.0 → 10.45.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.
package/dist/validation/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import { j, JBuilder } from '@naturalcycles/nodejs-lib/ajv';
|
|
|
2
2
|
import { dbQueryFilterOperatorValues } from '../query/dbQuery.js';
|
|
3
3
|
// oxlint-disable typescript/explicit-function-return-type
|
|
4
4
|
// DBTransaction schema - validates presence without deep validation
|
|
5
|
-
const dbTransactionSchema = j.object.any()
|
|
5
|
+
const dbTransactionSchema = j.object.any();
|
|
6
6
|
// Schema that accepts any value (string, number, boolean, object, array, null)
|
|
7
7
|
const anyValueSchema = new JBuilder({});
|
|
8
8
|
export const commonDBOptionsSchema = () => j.object({
|
|
9
|
-
tx: dbTransactionSchema.optional(),
|
|
9
|
+
tx: dbTransactionSchema.optional().castAs(),
|
|
10
10
|
});
|
|
11
11
|
export const commonDBSaveOptionsSchema = () => j.object({
|
|
12
|
-
tx: dbTransactionSchema.optional(),
|
|
12
|
+
tx: dbTransactionSchema.optional().castAs(),
|
|
13
13
|
excludeFromIndexes: j.array(j.string().castAs()).optional(),
|
|
14
14
|
saveMethod: j.enum(['upsert', 'insert', 'update']).optional(),
|
|
15
15
|
assignGeneratedIds: j.boolean().optional(),
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/db-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "10.45.
|
|
4
|
+
"version": "10.45.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@naturalcycles/js-lib": "^15",
|
|
7
7
|
"@naturalcycles/nodejs-lib": "^15"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@typescript/native-preview": "7.0.0-dev.20260201.1",
|
|
11
|
-
"@naturalcycles/dev-lib": "
|
|
11
|
+
"@naturalcycles/dev-lib": "18.4.2"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
package/src/validation/index.ts
CHANGED
|
@@ -7,19 +7,19 @@ import { dbQueryFilterOperatorValues } from '../query/dbQuery.js'
|
|
|
7
7
|
// oxlint-disable typescript/explicit-function-return-type
|
|
8
8
|
|
|
9
9
|
// DBTransaction schema - validates presence without deep validation
|
|
10
|
-
const dbTransactionSchema = j.object.any()
|
|
10
|
+
const dbTransactionSchema = j.object.any()
|
|
11
11
|
|
|
12
12
|
// Schema that accepts any value (string, number, boolean, object, array, null)
|
|
13
13
|
const anyValueSchema = new JBuilder<any, false>({})
|
|
14
14
|
|
|
15
15
|
export const commonDBOptionsSchema = (): JBuilder<CommonDBOptions, false> =>
|
|
16
16
|
j.object<CommonDBOptions>({
|
|
17
|
-
tx: dbTransactionSchema.optional(),
|
|
17
|
+
tx: dbTransactionSchema.optional().castAs<DBTransaction | undefined>(),
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
export const commonDBSaveOptionsSchema = <ROW extends ObjectWithId>() =>
|
|
21
21
|
j.object<CommonDBSaveOptions<ROW>>({
|
|
22
|
-
tx: dbTransactionSchema.optional(),
|
|
22
|
+
tx: dbTransactionSchema.optional().castAs<DBTransaction | undefined>(),
|
|
23
23
|
excludeFromIndexes: j.array(j.string().castAs<keyof ROW>()).optional(),
|
|
24
24
|
saveMethod: j.enum(['upsert', 'insert', 'update'] as const).optional(),
|
|
25
25
|
assignGeneratedIds: j.boolean().optional(),
|