@nocobase/database 0.7.0-alpha.33 → 0.7.0-alpha.34
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/esm/operators/index.js +1 -1
- package/esm/operators/index.js.map +1 -1
- package/esm/operators/notIn.d.ts +10 -0
- package/esm/operators/notIn.js +12 -0
- package/esm/operators/notIn.js.map +1 -0
- package/lib/operators/index.js +1 -1
- package/lib/operators/index.js.map +1 -1
- package/lib/operators/notIn.d.ts +10 -0
- package/lib/operators/notIn.js +14 -0
- package/lib/operators/notIn.js.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/operator/notIn.test.ts +33 -0
- package/src/operators/index.ts +1 -0
- package/src/operators/notIn.ts +12 -0
package/esm/operators/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, require('./association').default), require('./date').default), require('./array').default), require('./empty').default), require('./string').default), require('./ne').default);
|
|
1
|
+
export default Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, require('./association').default), require('./date').default), require('./array').default), require('./empty').default), require('./string').default), require('./ne').default), require('./notIn').default);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operators/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operators/index.ts"],"names":[],"mappings":"AAAA,qHACK,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,GAChC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,GACzB,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,GAC1B,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,GAC1B,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,GAC3B,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,GACvB,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAC7B","sourcesContent":["export default {\n ...require('./association').default,\n ...require('./date').default,\n ...require('./array').default,\n ...require('./empty').default,\n ...require('./string').default,\n ...require('./ne').default,\n ...require('./notIn').default,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notIn.js","sourceRoot":"","sources":["../../src/operators/notIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B,eAAe;IACb,MAAM,CAAC,GAAG,EAAE,GAAG;QACb,OAAO;YACL,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;gBACP,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG;gBACf,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI;aACd;SACF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { Op } from 'sequelize';\n\nexport default {\n $notIn(val, ctx) {\n return {\n [Op.or]: {\n [Op.notIn]: val,\n [Op.is]: null,\n },\n };\n },\n};\n"]}
|
package/lib/operators/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, require('./association').default), require('./date').default), require('./array').default), require('./empty').default), require('./string').default), require('./ne').default);
|
|
3
|
+
exports.default = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, require('./association').default), require('./date').default), require('./array').default), require('./empty').default), require('./string').default), require('./ne').default), require('./notIn').default);
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operators/index.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operators/index.ts"],"names":[],"mappings":";;AAAA,wHACK,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,GAChC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,GACzB,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,GAC1B,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,GAC1B,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,GAC3B,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,GACvB,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAC7B","sourcesContent":["export default {\n ...require('./association').default,\n ...require('./date').default,\n ...require('./array').default,\n ...require('./empty').default,\n ...require('./string').default,\n ...require('./ne').default,\n ...require('./notIn').default,\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sequelize_1 = require("sequelize");
|
|
4
|
+
exports.default = {
|
|
5
|
+
$notIn(val, ctx) {
|
|
6
|
+
return {
|
|
7
|
+
[sequelize_1.Op.or]: {
|
|
8
|
+
[sequelize_1.Op.notIn]: val,
|
|
9
|
+
[sequelize_1.Op.is]: null,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=notIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notIn.js","sourceRoot":"","sources":["../../src/operators/notIn.ts"],"names":[],"mappings":";;AAAA,yCAA+B;AAE/B,kBAAe;IACb,MAAM,CAAC,GAAG,EAAE,GAAG;QACb,OAAO;YACL,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE;gBACP,CAAC,cAAE,CAAC,KAAK,CAAC,EAAE,GAAG;gBACf,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,IAAI;aACd;SACF,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { Op } from 'sequelize';\n\nexport default {\n $notIn(val, ctx) {\n return {\n [Op.or]: {\n [Op.notIn]: val,\n [Op.is]: null,\n },\n };\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@nocobase/utils": "0.7.0-alpha.
|
|
20
|
+
"@nocobase/utils": "0.7.0-alpha.34",
|
|
21
21
|
"async-mutex": "^0.3.2",
|
|
22
22
|
"deepmerge": "^4.2.2",
|
|
23
23
|
"flat": "^5.0.2",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
30
30
|
"directory": "packages/database"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "48b2b4bc7bbc39533e461d34d7f026a4ad1a9b5c"
|
|
33
33
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { mockDatabase } from '../index';
|
|
2
|
+
import Database from '../../database';
|
|
3
|
+
|
|
4
|
+
describe('ne operator', () => {
|
|
5
|
+
let db: Database;
|
|
6
|
+
let Test;
|
|
7
|
+
beforeEach(async () => {
|
|
8
|
+
db = mockDatabase({});
|
|
9
|
+
|
|
10
|
+
Test = db.collection({
|
|
11
|
+
name: 'tests',
|
|
12
|
+
fields: [{ type: 'string', name: 'name' }],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
await db.sync();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
afterEach(async () => {
|
|
19
|
+
await db.close();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should notIn with null', async () => {
|
|
23
|
+
await db.getRepository('tests').create({});
|
|
24
|
+
|
|
25
|
+
const results = await db.getRepository('tests').count({
|
|
26
|
+
filter: {
|
|
27
|
+
'name.$notIn': ['123'],
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(results).toEqual(1);
|
|
32
|
+
});
|
|
33
|
+
});
|
package/src/operators/index.ts
CHANGED