@naturalcycles/db-lib 9.4.2 → 9.6.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.
- package/dist/commondao/common.dao.d.ts +11 -18
- package/dist/commondao/common.dao.js +52 -118
- package/dist/commondao/common.dao.model.d.ts +4 -36
- package/dist/db.model.d.ts +1 -2
- package/dist/db.model.js +0 -1
- package/dist/query/dbQuery.d.ts +4 -6
- package/dist/query/dbQuery.js +0 -6
- package/dist/testing/daoTest.js +1 -3
- package/dist/testing/dbTest.js +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +1 -3
- package/dist/testing/test.model.d.ts +0 -2
- package/dist/testing/test.model.js +1 -21
- package/package.json +1 -1
- package/src/commondao/common.dao.model.ts +3 -43
- package/src/commondao/common.dao.ts +60 -157
- package/src/db.model.ts +0 -1
- package/src/query/dbQuery.ts +1 -11
- package/src/testing/daoTest.ts +2 -6
- package/src/testing/dbTest.ts +2 -2
- package/src/testing/index.ts +0 -4
- package/src/testing/test.model.ts +0 -22
package/src/testing/daoTest.ts
CHANGED
|
@@ -8,11 +8,9 @@ import { CommonDBImplementationQuirks, expectMatch } from './dbTest'
|
|
|
8
8
|
import {
|
|
9
9
|
createTestItemsBM,
|
|
10
10
|
testItemBMSchema,
|
|
11
|
-
testItemDBMSchema,
|
|
12
|
-
testItemTMSchema,
|
|
13
11
|
TEST_TABLE,
|
|
14
12
|
createTestItemBM,
|
|
15
|
-
|
|
13
|
+
testItemBMJsonSchema,
|
|
16
14
|
} from './test.model'
|
|
17
15
|
import { TestItemBM } from '.'
|
|
18
16
|
|
|
@@ -21,9 +19,7 @@ export function runCommonDaoTest(db: CommonDB, quirks: CommonDBImplementationQui
|
|
|
21
19
|
const dao = new CommonDao({
|
|
22
20
|
table: TEST_TABLE,
|
|
23
21
|
db,
|
|
24
|
-
dbmSchema: testItemDBMSchema,
|
|
25
22
|
bmSchema: testItemBMSchema,
|
|
26
|
-
tmSchema: testItemTMSchema,
|
|
27
23
|
logStarted: true,
|
|
28
24
|
logLevel: CommonDaoLogLevel.DATA_FULL,
|
|
29
25
|
})
|
|
@@ -45,7 +41,7 @@ export function runCommonDaoTest(db: CommonDB, quirks: CommonDBImplementationQui
|
|
|
45
41
|
// CREATE TABLE, DROP
|
|
46
42
|
if (support.createTable) {
|
|
47
43
|
test('createTable, dropIfExists=true', async () => {
|
|
48
|
-
await dao.createTable(
|
|
44
|
+
await dao.createTable(testItemBMJsonSchema, { dropIfExists: true })
|
|
49
45
|
})
|
|
50
46
|
}
|
|
51
47
|
|
package/src/testing/dbTest.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
createTestItemDBM,
|
|
8
8
|
createTestItemsDBM,
|
|
9
9
|
TEST_TABLE,
|
|
10
|
+
testItemBMJsonSchema,
|
|
10
11
|
TestItemDBM,
|
|
11
|
-
testItemDBMJsonSchema,
|
|
12
12
|
} from './test.model'
|
|
13
13
|
import { deepFreeze } from './test.util'
|
|
14
14
|
|
|
@@ -42,7 +42,7 @@ export function runCommonDBTest(db: CommonDB, quirks: CommonDBImplementationQuir
|
|
|
42
42
|
// CREATE TABLE, DROP
|
|
43
43
|
if (support.createTable) {
|
|
44
44
|
test('createTable, dropIfExists=true', async () => {
|
|
45
|
-
await db.createTable(TEST_TABLE,
|
|
45
|
+
await db.createTable(TEST_TABLE, testItemBMJsonSchema, { dropIfExists: true })
|
|
46
46
|
})
|
|
47
47
|
}
|
|
48
48
|
|
package/src/testing/index.ts
CHANGED
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
testItemBMJsonSchema,
|
|
11
11
|
testItemBMSchema,
|
|
12
12
|
TestItemDBM,
|
|
13
|
-
testItemDBMJsonSchema,
|
|
14
|
-
testItemDBMSchema,
|
|
15
13
|
TestItemTM,
|
|
16
14
|
testItemTMSchema,
|
|
17
15
|
TEST_TABLE,
|
|
@@ -25,11 +23,9 @@ export {
|
|
|
25
23
|
createTestItemBM,
|
|
26
24
|
createTestItemsDBM,
|
|
27
25
|
createTestItemsBM,
|
|
28
|
-
testItemDBMSchema,
|
|
29
26
|
testItemBMSchema,
|
|
30
27
|
testItemTMSchema,
|
|
31
28
|
testItemBMJsonSchema,
|
|
32
|
-
testItemDBMJsonSchema,
|
|
33
29
|
runCommonDBTest,
|
|
34
30
|
runCommonDaoTest,
|
|
35
31
|
runCommonKeyValueDBTest,
|
|
@@ -35,14 +35,6 @@ export const testItemBMSchema = objectSchema<TestItemBM>({
|
|
|
35
35
|
b1: binarySchema.optional(),
|
|
36
36
|
}).concat(baseDBEntitySchema as any)
|
|
37
37
|
|
|
38
|
-
export const testItemDBMSchema = objectSchema<TestItemDBM>({
|
|
39
|
-
k1: stringSchema,
|
|
40
|
-
k2: stringSchema.allow(null).optional(),
|
|
41
|
-
k3: numberSchema.optional(),
|
|
42
|
-
even: booleanSchema.optional(),
|
|
43
|
-
b1: binarySchema.optional(),
|
|
44
|
-
}).concat(baseDBEntitySchema as any)
|
|
45
|
-
|
|
46
38
|
export const testItemTMSchema = objectSchema<TestItemTM>({
|
|
47
39
|
k1: stringSchema,
|
|
48
40
|
even: booleanSchema.optional(),
|
|
@@ -63,20 +55,6 @@ export const testItemBMJsonSchema: JsonSchemaObject<TestItemBM> = jsonSchema
|
|
|
63
55
|
.baseDBEntity()
|
|
64
56
|
.build()
|
|
65
57
|
|
|
66
|
-
export const testItemDBMJsonSchema: JsonSchemaObject<TestItemDBM> = jsonSchema
|
|
67
|
-
.rootObject<TestItemDBM>({
|
|
68
|
-
// todo: figure out how to not copy-paste these 3 fields
|
|
69
|
-
id: jsonSchema.string(),
|
|
70
|
-
created: jsonSchema.unixTimestamp(),
|
|
71
|
-
updated: jsonSchema.unixTimestamp(),
|
|
72
|
-
k1: jsonSchema.string(),
|
|
73
|
-
k2: jsonSchema.string().optional(),
|
|
74
|
-
k3: jsonSchema.number().optional(),
|
|
75
|
-
even: jsonSchema.boolean().optional(),
|
|
76
|
-
b1: jsonSchema.buffer().optional(),
|
|
77
|
-
})
|
|
78
|
-
.build()
|
|
79
|
-
|
|
80
58
|
export function createTestItemDBM(num = 1): TestItemDBM {
|
|
81
59
|
return {
|
|
82
60
|
id: `id${num}`,
|