@steedos/service-objectql 2.5.19 → 2.5.20-beta.2
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/package.json +3 -3
- package/package.service.js +26 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-objectql",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.20-beta.2",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"description": "steedos package",
|
|
14
14
|
"repository": {},
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "b9fc3773ae163df5d0062113bf6b21635c898b13",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@steedos/objectql": "2.5.
|
|
18
|
+
"@steedos/objectql": "2.5.20-beta.2"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/package.service.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: sunhaolin@hotoa.com
|
|
3
3
|
* @Date: 2023-03-23 15:12:14
|
|
4
4
|
* @LastEditors: 孙浩林 sunhaolin@steedos.com
|
|
5
|
-
* @LastEditTime: 2023-11-
|
|
5
|
+
* @LastEditTime: 2023-11-14 10:43:21
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
"use strict";
|
|
@@ -535,6 +535,11 @@ module.exports = {
|
|
|
535
535
|
return await obj.dropIndex(fieldName);
|
|
536
536
|
}
|
|
537
537
|
},
|
|
538
|
+
getPrimarySpaceId: {
|
|
539
|
+
async handler(ctx) {
|
|
540
|
+
return await this.getPrimarySpaceId()
|
|
541
|
+
}
|
|
542
|
+
}
|
|
538
543
|
|
|
539
544
|
},
|
|
540
545
|
|
|
@@ -592,6 +597,26 @@ module.exports = {
|
|
|
592
597
|
console.error(`[字段级加密] 对象${objectName}中字段加密失败:`, error);
|
|
593
598
|
}
|
|
594
599
|
return doc;
|
|
600
|
+
},
|
|
601
|
+
getPrimarySpaceId: async function () {
|
|
602
|
+
const steedosConfig = objectql.getSteedosConfig();
|
|
603
|
+
let spaceId;
|
|
604
|
+
if (steedosConfig && steedosConfig.tenant && steedosConfig.tenant._id) {
|
|
605
|
+
spaceId = steedosConfig.tenant._id
|
|
606
|
+
}
|
|
607
|
+
if (!spaceId) {
|
|
608
|
+
const datasource = objectql.getDataSource('default');
|
|
609
|
+
if (datasource) {
|
|
610
|
+
const adapter = datasource.adapter;
|
|
611
|
+
await adapter.connect()
|
|
612
|
+
const collection = adapter.collection('spaces');
|
|
613
|
+
const space = await collection.findOne()
|
|
614
|
+
if (space) {
|
|
615
|
+
spaceId = space._id;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return spaceId
|
|
595
620
|
}
|
|
596
621
|
},
|
|
597
622
|
|