@steedos/service-object-mixin 2.6.1-beta.6 → 2.6.2-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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/package.service.js +53 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/service-object-mixin",
3
- "version": "2.6.1-beta.6",
3
+ "version": "2.6.2-beta.2",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -13,5 +13,5 @@
13
13
  "description": "steedos package",
14
14
  "repository": {},
15
15
  "license": "MIT",
16
- "gitHead": "d77961251196c5352622d977e554660796ed6208"
16
+ "gitHead": "ddef9fbc34afc7b57c59a31e9ed4f56818dc4c31"
17
17
  }
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2023-03-23 15:12:14
4
- * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2023-04-21 09:33:36
4
+ * @LastEditors: 孙浩林 sunhaolin@steedos.com
5
+ * @LastEditTime: 2023-11-14 10:27:19
6
6
  * @Description:
7
7
  */
8
8
  "use strict";
@@ -27,7 +27,7 @@ module.exports = {
27
27
  /**
28
28
  * Dependencies
29
29
  */
30
- dependencies: [],
30
+ dependencies: ['objectql'],
31
31
 
32
32
  /**
33
33
  * Actions
@@ -51,6 +51,17 @@ module.exports = {
51
51
  getObject: {
52
52
  handler: function (objectName) {
53
53
  return {
54
+ aggregate: async (query, externalPipeline, userSession) => {
55
+ return await this.broker.call("objectql.aggregate", {
56
+ objectName,
57
+ query,
58
+ externalPipeline
59
+ }, {
60
+ meta: {
61
+ user: userSession
62
+ }
63
+ })
64
+ },
54
65
  find: async (query, userSession) => {
55
66
  return await this.broker.call("objectql.find", {
56
67
  objectName,
@@ -222,8 +233,8 @@ module.exports = {
222
233
  }
223
234
  })
224
235
  },
225
- getUserObjectPermissions: async (userSession) => {
226
- return await this.broker.call("objectql.getUserObjectPermissions", {
236
+ getUserObjectPermission: async (userSession) => {
237
+ return await this.broker.call("objectql.getUserObjectPermission", {
227
238
  objectName,
228
239
  }, {
229
240
  meta: {
@@ -344,10 +355,47 @@ module.exports = {
344
355
  user: userSession
345
356
  }
346
357
  })
358
+ },
359
+ createIndex: async (fieldName) => {
360
+ return await this.broker.call("objectql.createIndex", {
361
+ objectName,
362
+ fieldName
363
+ })
364
+ },
365
+ dropIndex: async (fieldName) => {
366
+ return await this.broker.call("objectql.dropIndex", {
367
+ objectName,
368
+ fieldName
369
+ })
347
370
  }
348
371
 
349
372
  }
350
373
  }
374
+ },
375
+ /**
376
+ * 获取用户userSession
377
+ * 示例:const userSession = await this.getUser(userId, spaceId);
378
+ * @param string userId 必填
379
+ * @param string spaceId 非必填
380
+ * @returns {import('@steedos/objectql').SteedosUserSession} 用户的userSession
381
+ */
382
+ getUser: {
383
+ async handler(userId, spaceId) {
384
+ return await this.broker.call("@steedos/service-accounts.getUserSession", {
385
+ userId,
386
+ spaceId
387
+ })
388
+ }
389
+ },
390
+ /**
391
+ * 生成主键
392
+ * 示例:const newId = await this.makeNewID();
393
+ * @returns string id
394
+ */
395
+ makeNewID: {
396
+ async handler() {
397
+ return await this.broker.call("objectql.makeNewID")
398
+ }
351
399
  }
352
400
 
353
401
  },