w-orm-reladb 1.0.32 → 1.0.36
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/.eslintrc.js +53 -49
- package/.github/workflows/ci-test.yml +2 -1
- package/README.md +40 -34
- package/SECURITY.md +5 -0
- package/dist/w-orm-reladb.umd.js +3 -3
- package/dist/w-orm-reladb.umd.js.map +1 -1
- package/docs/WOrmReladb.html +1 -1
- package/docs/WOrmReladb.mjs.html +5 -5
- package/docs/index.html +1 -1
- package/{sp-genModelsByTabs.mjs → g-genModelsByTabs.mjs} +1 -1
- package/{sp-mssql-concurrency.mjs → g-mssql-concurrency.mjs} +1 -1
- package/{sp-mssql-timerQuery.mjs → g-mssql-timerQuery.mjs} +1 -1
- package/{sp-mssql-transaction-commit.mjs → g-mssql-transaction-commit.mjs} +4 -3
- package/{sp-mssql-transaction-rollback.mjs → g-mssql-transaction-rollback.mjs} +5 -4
- package/{sp-mssql.mjs → g-mssql.mjs} +6 -5
- package/{sp-sqlite-concurrency.mjs → g-sqlite-concurrency.mjs} +2 -2
- package/g-sqlite-encryption-transaction-commit.mjs +196 -0
- package/{sp-sqlite-encryption-transaction-rollback.mjs → g-sqlite-encryption-transaction-rollback.mjs} +1 -1
- package/{sp-sqlite-encryption.mjs → g-sqlite-encryption.mjs} +6 -5
- package/{sp-sqlite-transaction-commit.mjs → g-sqlite-transaction-commit.mjs} +6 -5
- package/{sp-sqlite-transaction-rollback.mjs → g-sqlite-transaction-rollback.mjs} +6 -5
- package/{sp-sqlite.mjs → g-sqlite.mjs} +6 -5
- package/package.json +11 -11
- package/src/WOrmReladb.mjs +4 -4
- package/test/{all.test.js → all.test.mjs} +0 -0
- package/worm.sqlite +0 -0
- package/sp-sqlite-encryption-transaction-commit.mjs +0 -195
package/.eslintrc.js
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es6": true,
|
|
5
|
-
"mocha": true
|
|
6
|
-
},
|
|
7
|
-
"extends": ["plugin:vue/base", "plugin:vue/essential", "standard"],
|
|
8
|
-
"plugins": [
|
|
9
|
-
"vue"
|
|
10
|
-
],
|
|
11
|
-
"globals": {
|
|
12
|
-
"Atomics": "readonly",
|
|
13
|
-
"SharedArrayBuffer": "readonly"
|
|
14
|
-
},
|
|
15
|
-
"parser": "vue-eslint-parser",
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"parser": "babel-eslint",
|
|
18
|
-
"ecmaVersion": 2019,
|
|
19
|
-
"sourceType": "module",
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
'generator-star-spacing': 'off',
|
|
23
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
24
|
-
'indent': ['error', 4],
|
|
25
|
-
'no-console': 'off',
|
|
26
|
-
'comma-dangle': ['error', {
|
|
27
|
-
'arrays': 'ignore',
|
|
28
|
-
'objects': 'ignore',
|
|
29
|
-
'imports': 'never',
|
|
30
|
-
'exports': 'never',
|
|
31
|
-
'functions': 'ignore'
|
|
32
|
-
}],
|
|
33
|
-
'no-multiple-empty-lines': ['error', { 'max': 2, 'maxEOF': 2 }],
|
|
34
|
-
//'space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never' }],
|
|
35
|
-
'space-before-function-paren': 'off',
|
|
36
|
-
'spaced-comment': 'off',
|
|
37
|
-
'brace-style': ['error', 'stroustrup'],
|
|
38
|
-
'padded-blocks': 'off',
|
|
39
|
-
'no-constant-condition': 'off',
|
|
40
|
-
'camelcase': 'off',
|
|
41
|
-
'no-new': 'off',
|
|
42
|
-
'prefer-const': 'off',
|
|
43
|
-
'quote-props': ['error', 'consistent'],
|
|
44
|
-
'dot-notation': 'off',
|
|
45
|
-
'standard/no-callback-literal': 'off',
|
|
46
|
-
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
|
|
47
|
-
'prefer-promise-reject-errors': 'off',
|
|
48
|
-
'no-unused-vars': ['error', { 'args': 'none', 'ignoreRestSiblings': true, 'argsIgnorePattern': '^_' }],
|
|
49
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es6": true,
|
|
5
|
+
"mocha": true
|
|
6
|
+
},
|
|
7
|
+
"extends": ["plugin:vue/base", "plugin:vue/essential", "standard"],
|
|
8
|
+
"plugins": [
|
|
9
|
+
"vue"
|
|
10
|
+
],
|
|
11
|
+
"globals": {
|
|
12
|
+
"Atomics": "readonly",
|
|
13
|
+
"SharedArrayBuffer": "readonly"
|
|
14
|
+
},
|
|
15
|
+
"parser": "vue-eslint-parser",
|
|
16
|
+
"parserOptions": {
|
|
17
|
+
"parser": "babel-eslint",
|
|
18
|
+
"ecmaVersion": 2019,
|
|
19
|
+
"sourceType": "module",
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
'generator-star-spacing': 'off',
|
|
23
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
24
|
+
'indent': ['error', 4],
|
|
25
|
+
'no-console': 'off',
|
|
26
|
+
'comma-dangle': ['error', {
|
|
27
|
+
'arrays': 'ignore',
|
|
28
|
+
'objects': 'ignore',
|
|
29
|
+
'imports': 'never',
|
|
30
|
+
'exports': 'never',
|
|
31
|
+
'functions': 'ignore'
|
|
32
|
+
}],
|
|
33
|
+
'no-multiple-empty-lines': ['error', { 'max': 2, 'maxEOF': 2 }],
|
|
34
|
+
//'space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never' }],
|
|
35
|
+
'space-before-function-paren': 'off',
|
|
36
|
+
'spaced-comment': 'off',
|
|
37
|
+
'brace-style': ['error', 'stroustrup'],
|
|
38
|
+
'padded-blocks': 'off',
|
|
39
|
+
'no-constant-condition': 'off',
|
|
40
|
+
'camelcase': 'off',
|
|
41
|
+
'no-new': 'off',
|
|
42
|
+
'prefer-const': 'off',
|
|
43
|
+
'quote-props': ['error', 'consistent'],
|
|
44
|
+
'dot-notation': 'off',
|
|
45
|
+
'standard/no-callback-literal': 'off',
|
|
46
|
+
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
|
|
47
|
+
'prefer-promise-reject-errors': 'off',
|
|
48
|
+
'no-unused-vars': ['error', { 'args': 'none', 'ignoreRestSiblings': true, 'argsIgnorePattern': '^_' }],
|
|
49
|
+
'node/no-callback-literal': 'off',
|
|
50
|
+
'prefer-regex-literals': 'off',
|
|
51
|
+
'array-callback-return': 'off',
|
|
52
|
+
'no-unreachable-loop': 'off',
|
|
53
|
+
}
|
|
50
54
|
};
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
node-version: [
|
|
12
|
+
node-version: [16.x]
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
15
|
- uses: actions/checkout@v2
|
|
@@ -17,6 +17,7 @@ jobs:
|
|
|
17
17
|
uses: actions/setup-node@v1
|
|
18
18
|
with:
|
|
19
19
|
node-version: ${{ matrix.node-version }}
|
|
20
|
+
- run: npm cache clean -f
|
|
20
21
|
- run: npm install
|
|
21
22
|
- run: npm test
|
|
22
23
|
env:
|
package/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# w-orm-reladb
|
|
2
|
-
An object of operator for relational database in nodejs
|
|
2
|
+
An object of operator for relational database in nodejs.
|
|
3
3
|
|
|
4
4
|

|
|
5
5
|
[](https://npmjs.org/package/w-orm-reladb)
|
|
6
|
-
[](https://travis-ci.org/yuda-lyu/w-orm-reladb)
|
|
7
6
|
[](https://npmjs.org/package/w-orm-reladb)
|
|
8
7
|
[](https://github.com/yuda-lyu/w-orm-reladb)
|
|
9
8
|
[](https://npmjs.org/package/w-orm-reladb)
|
|
@@ -21,7 +20,7 @@ To view documentation or get support, visit [docs](https://yuda-lyu.github.io/w-
|
|
|
21
20
|
|
|
22
21
|
## Installation
|
|
23
22
|
### Using npm(ES6 module):
|
|
24
|
-
> **Note:** `w-orm-reladb`
|
|
23
|
+
> **Note:** `w-orm-reladb` is mainly dependent on `sequelize`, `mssql`, `sqlite3` and `w-auto-sequelize`.
|
|
25
24
|
|
|
26
25
|
> **Note:** `@journeyapps/sqlcipher` is not compiled into the *.umd file by default, and it is not tied to the dependents for general use in package.json.
|
|
27
26
|
|
|
@@ -30,7 +29,7 @@ npm i w-orm-reladb
|
|
|
30
29
|
```
|
|
31
30
|
|
|
32
31
|
#### Example for mssql
|
|
33
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
32
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-mssql.mjs)]
|
|
34
33
|
```alias
|
|
35
34
|
import wo from 'w-orm-reladb'
|
|
36
35
|
|
|
@@ -192,14 +191,15 @@ async function test() {
|
|
|
192
191
|
test()
|
|
193
192
|
// createStorage
|
|
194
193
|
// change delAll
|
|
195
|
-
// delAll then { n: 0, ok: 1 }
|
|
194
|
+
// delAll then { n: 0, nDeleted: 0, ok: 1 }
|
|
196
195
|
// change insert
|
|
197
|
-
// insert then { n: 3, ok: 1 }
|
|
196
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
198
197
|
// change save
|
|
199
198
|
// save then [
|
|
200
199
|
// { n: 1, nModified: 1, ok: 1 },
|
|
201
200
|
// { n: 1, nModified: 1, ok: 1 },
|
|
202
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
201
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
202
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
203
203
|
// ]
|
|
204
204
|
// select all [
|
|
205
205
|
// { id: 'id-peter', name: 'peter(modify)', value: 123 },
|
|
@@ -230,7 +230,7 @@ test()
|
|
|
230
230
|
```
|
|
231
231
|
|
|
232
232
|
#### Example of commit transaction for mssql
|
|
233
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
233
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-mssql-transaction-commit.mjs)]
|
|
234
234
|
```alias
|
|
235
235
|
import wo from 'w-orm-reladb'
|
|
236
236
|
|
|
@@ -421,12 +421,13 @@ testCommit()
|
|
|
421
421
|
// delAll then { n: 2, ok: 1 }
|
|
422
422
|
// init
|
|
423
423
|
// change insert
|
|
424
|
-
// insert then { n: 3, ok: 1 }
|
|
424
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
425
425
|
// change save
|
|
426
426
|
// save then [
|
|
427
427
|
// { n: 1, nModified: 1, ok: 1 },
|
|
428
428
|
// { n: 1, nModified: 1, ok: 1 },
|
|
429
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
429
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
430
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
430
431
|
// ]
|
|
431
432
|
// change del
|
|
432
433
|
// del then [
|
|
@@ -446,7 +447,7 @@ testCommit()
|
|
|
446
447
|
```
|
|
447
448
|
|
|
448
449
|
#### Example of rollback transaction for mssql
|
|
449
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
450
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-mssql-transaction-rollback.mjs)]
|
|
450
451
|
```alias
|
|
451
452
|
import wo from 'w-orm-reladb'
|
|
452
453
|
|
|
@@ -631,15 +632,16 @@ async function testRollback() {
|
|
|
631
632
|
testRollback()
|
|
632
633
|
// createStorage
|
|
633
634
|
// change delAll
|
|
634
|
-
// delAll then { n: 0, ok: 1 }
|
|
635
|
+
// delAll then { n: 0, nDeleted: 0, ok: 1 }
|
|
635
636
|
// init
|
|
636
637
|
// change insert
|
|
637
|
-
// insert then { n: 3, ok: 1 }
|
|
638
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
638
639
|
// change save
|
|
639
640
|
// save then [
|
|
640
641
|
// { n: 1, nModified: 1, ok: 1 },
|
|
641
642
|
// { n: 1, nModified: 1, ok: 1 },
|
|
642
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
643
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
644
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
643
645
|
// ]
|
|
644
646
|
// change del
|
|
645
647
|
// del then [
|
|
@@ -656,10 +658,10 @@ testRollback()
|
|
|
656
658
|
```
|
|
657
659
|
|
|
658
660
|
#### Example for sqlite
|
|
659
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
661
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-sqlite.mjs)]
|
|
660
662
|
```alias
|
|
661
|
-
import wo from 'w-orm-reladb'
|
|
662
663
|
import fs from 'fs'
|
|
664
|
+
import wo from 'w-orm-reladb'
|
|
663
665
|
|
|
664
666
|
|
|
665
667
|
let username = 'username'
|
|
@@ -826,14 +828,15 @@ async function test() {
|
|
|
826
828
|
test()
|
|
827
829
|
// createStorage
|
|
828
830
|
// change delAll
|
|
829
|
-
// delAll then { n: 0, ok: 1 }
|
|
831
|
+
// delAll then { n: 0, nDeleted: 0, ok: 1 }
|
|
830
832
|
// change insert
|
|
831
|
-
// insert then { n: 3, ok: 1 }
|
|
833
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
832
834
|
// change save
|
|
833
835
|
// save then [
|
|
834
836
|
// { n: 1, nModified: 1, ok: 1 },
|
|
835
837
|
// { n: 1, nModified: 1, ok: 1 },
|
|
836
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
838
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
839
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
837
840
|
// ]
|
|
838
841
|
// select all [
|
|
839
842
|
// { id: 'id-peter', name: 'peter(modify)', value: 123 },
|
|
@@ -864,10 +867,10 @@ test()
|
|
|
864
867
|
```
|
|
865
868
|
|
|
866
869
|
#### Example commit transaction for sqlite
|
|
867
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
870
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-sqlite-transaction-commit.mjs)]
|
|
868
871
|
```alias
|
|
869
|
-
import wo from 'w-orm-reladb'
|
|
870
872
|
import fs from 'fs'
|
|
873
|
+
import wo from 'w-orm-reladb'
|
|
871
874
|
|
|
872
875
|
|
|
873
876
|
let username = 'username'
|
|
@@ -1059,15 +1062,16 @@ async function testCommit() {
|
|
|
1059
1062
|
testCommit()
|
|
1060
1063
|
// createStorage
|
|
1061
1064
|
// change delAll
|
|
1062
|
-
// delAll then { n: 0, ok: 1 }
|
|
1065
|
+
// delAll then { n: 0, nDeleted: 0, ok: 1 }
|
|
1063
1066
|
// init
|
|
1064
1067
|
// change insert
|
|
1065
|
-
// insert then { n: 3, ok: 1 }
|
|
1068
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
1066
1069
|
// change save
|
|
1067
1070
|
// save then [
|
|
1068
1071
|
// { n: 1, nModified: 1, ok: 1 },
|
|
1069
1072
|
// { n: 1, nModified: 1, ok: 1 },
|
|
1070
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
1073
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
1074
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
1071
1075
|
// ]
|
|
1072
1076
|
// change del
|
|
1073
1077
|
// del then [
|
|
@@ -1087,10 +1091,10 @@ testCommit()
|
|
|
1087
1091
|
```
|
|
1088
1092
|
|
|
1089
1093
|
#### Example rollback transaction for sqlite
|
|
1090
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
1094
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-sqlite-transaction-rollback.mjs)]
|
|
1091
1095
|
```alias
|
|
1092
|
-
import wo from 'w-orm-reladb'
|
|
1093
1096
|
import fs from 'fs'
|
|
1097
|
+
import wo from 'w-orm-reladb'
|
|
1094
1098
|
|
|
1095
1099
|
|
|
1096
1100
|
let username = 'username'
|
|
@@ -1279,15 +1283,16 @@ async function testRollback() {
|
|
|
1279
1283
|
testRollback()
|
|
1280
1284
|
// createStorage
|
|
1281
1285
|
// change delAll
|
|
1282
|
-
// delAll then { n: 0, ok: 1 }
|
|
1286
|
+
// delAll then { n: 0, nDeleted: 0, ok: 1 }
|
|
1283
1287
|
// init
|
|
1284
1288
|
// change insert
|
|
1285
|
-
// insert then { n: 3, ok: 1 }
|
|
1289
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
1286
1290
|
// change save
|
|
1287
1291
|
// save then [
|
|
1288
1292
|
// { n: 1, nModified: 1, ok: 1 },
|
|
1289
1293
|
// { n: 1, nModified: 1, ok: 1 },
|
|
1290
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
1294
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
1295
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
1291
1296
|
// ]
|
|
1292
1297
|
// change del
|
|
1293
1298
|
// del then [
|
|
@@ -1304,10 +1309,10 @@ testRollback()
|
|
|
1304
1309
|
```
|
|
1305
1310
|
|
|
1306
1311
|
#### Example of sqlcipher for sqlite
|
|
1307
|
-
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/
|
|
1312
|
+
> **Link:** [[dev source code](https://github.com/yuda-lyu/w-orm-reladb/blob/master/g-sqlite-encryption.mjs)]
|
|
1308
1313
|
```alias
|
|
1309
|
-
import wo from 'w-orm-reladb'
|
|
1310
1314
|
import fs from 'fs'
|
|
1315
|
+
import wo from 'w-orm-reladb'
|
|
1311
1316
|
|
|
1312
1317
|
|
|
1313
1318
|
let username = 'username'
|
|
@@ -1481,14 +1486,15 @@ async function test() {
|
|
|
1481
1486
|
test()
|
|
1482
1487
|
// createStorage
|
|
1483
1488
|
// change delAll
|
|
1484
|
-
// delAll then { n: 0, ok: 1 }
|
|
1489
|
+
// delAll then { n: 0, nDeleted: 0, ok: 1 }
|
|
1485
1490
|
// change insert
|
|
1486
|
-
// insert then { n: 3, ok: 1 }
|
|
1491
|
+
// insert then { n: 3, nInserted: 3, ok: 1 }
|
|
1487
1492
|
// change save
|
|
1488
1493
|
// save then [
|
|
1489
1494
|
// { n: 1, nModified: 1, ok: 1 },
|
|
1490
1495
|
// { n: 1, nModified: 1, ok: 1 },
|
|
1491
|
-
// { n: 0, nModified: 0, ok: 1 }
|
|
1496
|
+
// { n: 0, nModified: 0, ok: 1 } //autoInsert=false
|
|
1497
|
+
// { n: 1, nInserted: 1, ok: 1 } //autoInsert=true
|
|
1492
1498
|
// ]
|
|
1493
1499
|
// select all [
|
|
1494
1500
|
// { id: 'id-peter', name: 'peter(modify)', value: 123 },
|