@byted-apaas/server-sdk-node 1.0.17 → 1.1.0-beta.11
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/README.md +11 -0
- package/application/application.d.ts +9 -7
- package/application/function/function.d.ts +1 -1
- package/application/function/function.js +0 -1
- package/application/impl/common.d.ts +1 -1
- package/application/impl/common.js +13 -12
- package/application/impl/impl.d.ts +8 -6
- package/application/impl/impl.js +6 -4
- package/common/structs.d.ts +15 -0
- package/common/structs.js +21 -0
- package/constants/constants.js +4 -4
- package/context/context.d.ts +8 -38
- package/context/context.js +2 -2
- package/context/db/db.d.ts +11 -19
- package/context/db/impl/IObject.d.ts +41 -40
- package/context/db/impl/db.d.ts +9 -9
- package/context/db/impl/db.js +6 -6
- package/context/db/impl/object.d.ts +4 -3
- package/context/db/impl/object.js +62 -50
- package/context/db/impl/oql/oql.d.ts +1 -1
- package/context/db/impl/oql/oql.js +1 -1
- package/context/db/impl/order.js +1 -1
- package/context/db/impl/propertiesStore.js +1 -1
- package/context/db/impl/transaction/index.d.ts +1 -1
- package/context/db/impl/transaction/index.js +51 -46
- package/context/db/impl/transaction.d.ts +0 -5
- package/context/integration/IIntegration.d.ts +30 -0
- package/context/integration/IIntegration.js +4 -0
- package/context/integration/impl/integration.d.ts +16 -0
- package/context/integration/impl/integration.js +62 -0
- package/context/metadata/components/common.js +3 -3
- package/context/metadata/components/components.d.ts +4 -4
- package/context/metadata/components/desktop/list.d.ts +3 -3
- package/context/metadata/components/desktop/list.js +23 -23
- package/context/metadata/components/desktop/recordDetail.d.ts +2 -2
- package/context/metadata/components/mobile/list.d.ts +4 -4
- package/context/metadata/components/mobile/list.js +1 -1
- package/context/metadata/metadata.d.ts +5 -6
- package/context/metadata/metadata.js +5 -6
- package/context/metadata/objects/fields.d.ts +6 -6
- package/context/metadata/objects/fields.js +57 -57
- package/context/metadata/objects/fields.util.d.ts +3 -3
- package/context/metadata/objects/fields.util.js +21 -21
- package/context/metadata/objects/objects.d.ts +1 -1
- package/context/metadata/objects/objects.js +1 -1
- package/context/metadata/types/components.d.ts +5 -5
- package/context/metadata/types/objects.d.ts +88 -88
- package/context/msg/msg.d.ts +2 -2
- package/context/resources/IResources.d.ts +6 -4
- package/context/resources/impl/resources.d.ts +6 -6
- package/context/resources/impl/resources.js +5 -5
- package/context/tasks/tasks.d.ts +3 -3
- package/context/tasks/tasks.js +5 -5
- package/data/index.d.ts +2 -2
- package/global/application/flow/flow.d.ts +85 -0
- package/global/application/flow/flow.js +2 -0
- package/global/application/globalVar/globalVar.d.ts +7 -0
- package/global/application/globalVar/globalVar.js +2 -0
- package/global/global.d.ts +64 -0
- package/global/global.js +3 -0
- package/hooks/api.d.ts +12 -7
- package/hooks/api.js +28 -23
- package/hooks/hooks.js +41 -0
- package/kunlun/kunlun.d.ts +5 -5
- package/kunlun/operator/IOperator.d.ts +16 -16
- package/kunlun/operator/impl/expression.d.ts +2 -2
- package/kunlun/operator/impl/expression.js +5 -5
- package/kunlun/operator/impl/logic.js +48 -31
- package/kunlun/operator/impl/logicV2.d.ts +2 -2
- package/kunlun/operator/impl/logicV2.js +12 -13
- package/kunlun/operator/impl/operator.d.ts +17 -17
- package/kunlun/operator/impl/operator.js +38 -38
- package/kunlun/operator/impl/operatorV2.d.ts +17 -17
- package/kunlun/operator/impl/operatorV2.js +38 -38
- package/lib/core.d.ts +3 -3
- package/package.json +2 -2
- package/request/common.d.ts +1 -1
- package/request/common.js +4 -3
- package/request/constants.d.ts +1 -1
- package/request/constants.js +6 -6
- package/request/faasinfra.d.ts +1 -1
- package/request/faasinfra.js +41 -253
- package/request/innerapi.d.ts +14 -10
- package/request/innerapi.js +220 -66
- package/request/interface.d.ts +68 -54
- package/request/interface.js +8 -9
- package/request/openapi.d.ts +15 -11
- package/request/openapi.js +266 -158
package/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## aPaaS @byted-apaas/server-sdk-node 版本说明:
|
|
2
2
|
|
|
3
|
+
### 版本:1.1.10|兼容升级
|
|
4
|
+
新功能:优化部分错误码
|
|
5
|
+
|
|
6
|
+
-------
|
|
7
|
+
### 版本:1.1.8|兼容升级
|
|
8
|
+
新功能:支持透传多分支标识
|
|
9
|
+
|
|
10
|
+
-------
|
|
11
|
+
### 版本:1.0.18|兼容升级
|
|
12
|
+
新功能:支持开发者获取飞书集成 app access token 及 tenant access token
|
|
13
|
+
|
|
3
14
|
-------
|
|
4
15
|
### 版本:1.0.17|兼容升级
|
|
5
16
|
优化:废弃 flow.variables & flow.updateVariable 相关 API
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { _IOpenSDKResources } from
|
|
2
|
-
import { ITool, IToolsExtra } from
|
|
3
|
-
import { AppCredential } from
|
|
4
|
-
import { IDBSync } from
|
|
5
|
-
import { IFunction } from
|
|
6
|
-
import { PlatformEnvType } from
|
|
1
|
+
import { _IOpenSDKResources } from '../context/resources/IResources';
|
|
2
|
+
import { ITool, IToolsExtra } from '@byted-apaas/server-common-node/kunlun/tool/Itool';
|
|
3
|
+
import { AppCredential } from '@byted-apaas/server-common-node/credential/credential';
|
|
4
|
+
import { IDBSync } from '../context/db/db';
|
|
5
|
+
import { IFunction } from './function/function';
|
|
6
|
+
import { PlatformEnvType } from '@byted-apaas/server-common-node/constants/constants';
|
|
7
|
+
import { _IIntegration } from '../context/integration/IIntegration';
|
|
7
8
|
/**
|
|
8
9
|
* IApplication 为 OpenSDK 能力的核心接口
|
|
9
10
|
* - data: 元数据相关能力
|
|
@@ -14,6 +15,7 @@ export interface IApplication {
|
|
|
14
15
|
data: IDBSync;
|
|
15
16
|
resources: _IOpenSDKResources;
|
|
16
17
|
tools: ITool & IToolsExtra;
|
|
18
|
+
integration: _IIntegration;
|
|
17
19
|
cloudfunction(funcName: string): IFunction;
|
|
18
20
|
env(platformEnvType: PlatformEnvType): IApplication;
|
|
19
21
|
localDebugMode(): IApplication;
|
|
@@ -24,6 +26,6 @@ export interface AppCtx {
|
|
|
24
26
|
mode: AppMode;
|
|
25
27
|
env?: PlatformEnvType;
|
|
26
28
|
credential: AppCredential;
|
|
27
|
-
debugType?:
|
|
29
|
+
debugType?: '0' | '2';
|
|
28
30
|
x_tt_env?: string;
|
|
29
31
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Function = void 0;
|
|
4
4
|
const interface_1 = require("../../request/interface");
|
|
5
5
|
const common_1 = require("../impl/common");
|
|
6
|
-
const crypto = require("crypto");
|
|
7
6
|
class Function {
|
|
8
7
|
constructor(appCtx, apiName) {
|
|
9
8
|
this.appCtx = appCtx;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppCtx } from
|
|
1
|
+
import { AppCtx } from '../application';
|
|
2
2
|
export declare function runCtxForOpenSDK(appCtx: AppCtx, promise: Function): Promise<any>;
|
|
@@ -4,9 +4,10 @@ exports.runCtxForOpenSDK = void 0;
|
|
|
4
4
|
const utils = require("@byted-apaas/server-common-node/utils/utils");
|
|
5
5
|
const nodeClsCtx = require("@byted-apaas/server-common-node/utils/nodeClsCtx");
|
|
6
6
|
const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions");
|
|
7
|
-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
8
|
+
const crypto = require('crypto'); //nolint:byted_s_ts_no_require_imports
|
|
8
9
|
async function runCtxForOpenSDK(appCtx, promise) {
|
|
9
|
-
if (appCtx && appCtx.mode ===
|
|
10
|
+
if (appCtx && appCtx.mode === 'openSDK') {
|
|
10
11
|
if (!appCtx.credential) {
|
|
11
12
|
throw new exceptions_1.InvalidParamError(`credential is empty for openSDK`);
|
|
12
13
|
}
|
|
@@ -16,28 +17,28 @@ async function runCtxForOpenSDK(appCtx, promise) {
|
|
|
16
17
|
utils.setDebugType(appCtx.debugType);
|
|
17
18
|
switch (appCtx.env) {
|
|
18
19
|
// @ts-ignore
|
|
19
|
-
case
|
|
20
|
+
case 'developmentboe':
|
|
20
21
|
utils.setEnv('development');
|
|
21
|
-
utils.setBoe(
|
|
22
|
+
utils.setBoe('boe');
|
|
22
23
|
break;
|
|
23
24
|
// @ts-ignore
|
|
24
|
-
case
|
|
25
|
+
case 'stagingboe':
|
|
25
26
|
utils.setEnv('staging');
|
|
26
|
-
utils.setBoe(
|
|
27
|
+
utils.setBoe('boe');
|
|
27
28
|
break;
|
|
28
|
-
case
|
|
29
|
+
case 'staging':
|
|
29
30
|
utils.setEnv('staging');
|
|
30
31
|
break;
|
|
31
|
-
case
|
|
32
|
-
utils.setEnv(
|
|
32
|
+
case 'gray':
|
|
33
|
+
utils.setEnv('gray');
|
|
33
34
|
break;
|
|
34
|
-
case
|
|
35
|
-
utils.setEnv(
|
|
35
|
+
case 'online':
|
|
36
|
+
utils.setEnv('online');
|
|
36
37
|
break;
|
|
37
38
|
default:
|
|
38
39
|
throw new exceptions_1.InvalidParamError(`platformEnvType is invalid for ${appCtx.env}`);
|
|
39
40
|
}
|
|
40
|
-
utils.setInvokeFuncName(
|
|
41
|
+
utils.setInvokeFuncName('openSDK');
|
|
41
42
|
utils.setTenant(await appCtx.credential.getTenantInfo());
|
|
42
43
|
utils.setXTTEnvOnlyDebug(appCtx.x_tt_env);
|
|
43
44
|
if (!utils.getLogID()) {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { ITool, IToolsExtra } from
|
|
2
|
-
import { IFunction } from
|
|
3
|
-
import { IApplication } from
|
|
4
|
-
import { _IOpenSDKResources } from
|
|
5
|
-
import { IDBSync } from
|
|
6
|
-
import { PlatformEnvType } from
|
|
1
|
+
import { ITool, IToolsExtra } from '@byted-apaas/server-common-node/kunlun/tool/Itool';
|
|
2
|
+
import { IFunction } from '../function/function';
|
|
3
|
+
import { IApplication } from '../application';
|
|
4
|
+
import { _IOpenSDKResources } from '../../context/resources/IResources';
|
|
5
|
+
import { IDBSync } from '../../context/db/db';
|
|
6
|
+
import { PlatformEnvType } from '@byted-apaas/server-common-node/constants/constants';
|
|
7
|
+
import { _IIntegration } from '../../context/integration/IIntegration';
|
|
7
8
|
export declare class Application implements IApplication {
|
|
8
9
|
private appCtx;
|
|
9
10
|
data: IDBSync;
|
|
10
11
|
resources: _IOpenSDKResources;
|
|
11
12
|
tools: ITool & IToolsExtra;
|
|
13
|
+
integration: _IIntegration;
|
|
12
14
|
constructor(clientID: string, clientSecret: string);
|
|
13
15
|
cloudfunction(funcName: string): IFunction;
|
|
14
16
|
env(platformEnvType: PlatformEnvType): IApplication;
|
package/application/impl/impl.js
CHANGED
|
@@ -8,16 +8,18 @@ const function_1 = require("../function/function");
|
|
|
8
8
|
const common_1 = require("../../request/common");
|
|
9
9
|
const resources_1 = require("../../context/resources/impl/resources");
|
|
10
10
|
const constants_1 = require("@byted-apaas/server-common-node/constants/constants");
|
|
11
|
+
const integration_1 = require("../../context/integration/impl/integration");
|
|
11
12
|
class Application {
|
|
12
13
|
constructor(clientID, clientSecret) {
|
|
13
14
|
this.appCtx = {
|
|
14
|
-
mode:
|
|
15
|
+
mode: 'openSDK',
|
|
15
16
|
credential: new credential_1.AppCredential(clientID, clientSecret),
|
|
16
|
-
debugType: constants_1.DefaultDebugType ? constants_1.DefaultDebugType :
|
|
17
|
-
env:
|
|
17
|
+
debugType: constants_1.DefaultDebugType ? constants_1.DefaultDebugType : '2',
|
|
18
|
+
env: 'online',
|
|
18
19
|
};
|
|
19
20
|
this.data = new db_1.ApplicationDB(this.appCtx);
|
|
20
21
|
this.resources = new resources_1._OpenSDKResources(this.appCtx);
|
|
22
|
+
this.integration = new integration_1._OpenSDKIntegration(this.appCtx);
|
|
21
23
|
this.tools = new tool_1.Tool();
|
|
22
24
|
this.tools.getTenantInfo = async () => {
|
|
23
25
|
return await (0, common_1.getTenantInfo)(this.appCtx);
|
|
@@ -32,7 +34,7 @@ class Application {
|
|
|
32
34
|
}
|
|
33
35
|
// 设置本地调试模式
|
|
34
36
|
localDebugMode() {
|
|
35
|
-
this.appCtx.debugType =
|
|
37
|
+
this.appCtx.debugType = '2';
|
|
36
38
|
return this;
|
|
37
39
|
}
|
|
38
40
|
setLaneName(laneName) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface BatchResult {
|
|
2
|
+
code: string;
|
|
3
|
+
msg: string;
|
|
4
|
+
data?: BatchResultData[];
|
|
5
|
+
hasError?: () => boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface BatchResultData {
|
|
8
|
+
success: boolean;
|
|
9
|
+
_id: number;
|
|
10
|
+
errors?: BatchResultDataError[];
|
|
11
|
+
}
|
|
12
|
+
export interface BatchResultDataError {
|
|
13
|
+
code: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function NewBatchResult(recordIDs: number[], errMap: Record<number, string>): BatchResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewBatchResult = void 0;
|
|
4
|
+
function NewBatchResult(recordIDs, errMap) {
|
|
5
|
+
const result = { code: "", msg: "success", data: [] };
|
|
6
|
+
let hasError = false;
|
|
7
|
+
recordIDs.forEach((id) => {
|
|
8
|
+
const d = { _id: id, success: true };
|
|
9
|
+
if (errMap && errMap[id]) {
|
|
10
|
+
hasError = true;
|
|
11
|
+
d.success = false;
|
|
12
|
+
d.errors = [{ code: errMap[id] }];
|
|
13
|
+
}
|
|
14
|
+
result.data.push(d);
|
|
15
|
+
});
|
|
16
|
+
result.hasError = () => {
|
|
17
|
+
return hasError;
|
|
18
|
+
};
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
exports.NewBatchResult = NewBatchResult;
|
package/constants/constants.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.triggerType = exports.httpStatusCodes = exports.httpHeaderKeys = exports.notifyModel = void 0;
|
|
6
6
|
exports.notifyModel = {
|
|
7
|
-
key:
|
|
7
|
+
key: 'ee.kunlun.cloudfunction.faas_buildin',
|
|
8
8
|
};
|
|
9
9
|
exports.httpHeaderKeys = {
|
|
10
|
-
statusCode:
|
|
11
|
-
location:
|
|
10
|
+
statusCode: 'X-Kunlun-Status-Code',
|
|
11
|
+
location: 'Location',
|
|
12
12
|
};
|
|
13
13
|
exports.httpStatusCodes = {
|
|
14
14
|
redirect: 302,
|
|
15
15
|
};
|
|
16
16
|
exports.triggerType = {
|
|
17
|
-
defaultTrigger:
|
|
17
|
+
defaultTrigger: 'default-trigger',
|
|
18
18
|
};
|
package/context/context.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { _Resources } from
|
|
2
|
-
import { Tasks } from
|
|
3
|
-
import { Message } from
|
|
4
|
-
import { IDBGetter } from
|
|
1
|
+
import { _Resources } from './resources/impl/resources';
|
|
2
|
+
import { Tasks } from './tasks/tasks';
|
|
3
|
+
import { Message } from './msg/msg';
|
|
4
|
+
import { IDBGetter } from './db/db';
|
|
5
5
|
import { Context as CommonContext } from '@byted-apaas/server-common-node';
|
|
6
|
-
import { IMetaData } from
|
|
6
|
+
import { IMetaData } from './metadata/metadata';
|
|
7
|
+
import { _IIntegration } from './integration/IIntegration';
|
|
7
8
|
export declare class Context<T, mt, cf, gv> extends CommonContext implements IContext<T, mt, cf, gv> {
|
|
8
9
|
/**
|
|
9
10
|
* 操作数据库中的记录数据
|
|
@@ -37,38 +38,7 @@ export declare class Context<T, mt, cf, gv> extends CommonContext implements ICo
|
|
|
37
38
|
* @param apiName 全局变量的 API Name
|
|
38
39
|
*/
|
|
39
40
|
getVar<Key extends keyof gv>(apiName: Key): Promise<gv[Key]>;
|
|
41
|
+
integration: _IIntegration;
|
|
40
42
|
}
|
|
41
|
-
export interface IContext<T, mt
|
|
42
|
-
/**
|
|
43
|
-
* 操作数据库中的记录数据
|
|
44
|
-
*/
|
|
45
|
-
db: IDBGetter<T, mt>;
|
|
46
|
-
/**
|
|
47
|
-
* 元数据读写
|
|
48
|
-
*/
|
|
49
|
-
metadata: IMetaData<mt>;
|
|
50
|
-
/**
|
|
51
|
-
* 静态资源类操作
|
|
52
|
-
*/
|
|
53
|
-
resources: _Resources;
|
|
54
|
-
/**
|
|
55
|
-
* 全局函数
|
|
56
|
-
* @param funcName 函数名
|
|
57
|
-
*/
|
|
58
|
-
function(funcName: cf): {
|
|
59
|
-
invoke: (params: any) => Promise<any>;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* 任务操作
|
|
63
|
-
*/
|
|
64
|
-
tasks: Tasks<cf>;
|
|
65
|
-
/**
|
|
66
|
-
* 向消息中心推送及更新消息
|
|
67
|
-
*/
|
|
68
|
-
msg: Message;
|
|
69
|
-
/**
|
|
70
|
-
* 根据 apiName 获取对应的全局变量
|
|
71
|
-
* @param apiName 全局变量的 API Name
|
|
72
|
-
*/
|
|
73
|
-
getVar<Key extends keyof gv>(apiName: Key): Promise<gv[Key]>;
|
|
43
|
+
export interface IContext<T, mt, cf, gv> {
|
|
74
44
|
}
|
package/context/context.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.Context = void 0;
|
|
6
6
|
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
7
|
-
// TODO MERGE cf
|
|
8
7
|
class Context extends server_common_node_1.Context {
|
|
9
8
|
/**
|
|
10
9
|
* 全局函数
|
|
11
10
|
* @param funcName 函数名
|
|
12
11
|
*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
function(funcName) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
@@ -17,9 +17,9 @@ class Context extends server_common_node_1.Context {
|
|
|
17
17
|
* 根据 apiName 获取对应的全局变量
|
|
18
18
|
* @param apiName 全局变量的 API Name
|
|
19
19
|
*/
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
21
|
async getVar(apiName) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
23
|
-
;
|
|
24
24
|
}
|
|
25
25
|
exports.Context = Context;
|
package/context/db/db.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { currentObjApiName } from '../../data';
|
|
2
1
|
import { _IKAllEndpoint, _IKSyncEndpoint, _IKQuery } from './impl/IObject';
|
|
3
2
|
import { ITransactionGetter } from './impl/transaction';
|
|
4
3
|
import { IOql } from './impl/oql/ioql';
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
* 应该直接使用 IDBGetter。
|
|
8
|
-
* - 目前 IDBGetter 支持的是 currentObject 方法的动态声明,使用泛型实现,期望传入的 T 是 Context 结构。
|
|
9
|
-
* - 如果 Context 有 objectApiName 属性,则拥有 .db.currentObject 和 .db.transaction.currentObject
|
|
5
|
+
* IDBGetter 是声明 DB interface 的顶级入口
|
|
10
6
|
*/
|
|
11
7
|
export type IDBGetter<T, mt> = T extends {
|
|
12
8
|
'objectApiName': string;
|
|
@@ -20,8 +16,8 @@ export interface IDB<T, mt> {
|
|
|
20
16
|
* @param objectApiName 指定对象的 ApiName
|
|
21
17
|
* @example
|
|
22
18
|
* ```
|
|
23
|
-
*
|
|
24
|
-
* gender:
|
|
19
|
+
* application.data.object('_user').where({
|
|
20
|
+
* gender: 'male'
|
|
25
21
|
* }).find()
|
|
26
22
|
* ```
|
|
27
23
|
*/
|
|
@@ -30,12 +26,12 @@ export interface IDB<T, mt> {
|
|
|
30
26
|
* 创建一个新的空事务
|
|
31
27
|
* @example
|
|
32
28
|
* ```
|
|
33
|
-
* let tx =
|
|
34
|
-
* let user = tx.object(
|
|
35
|
-
* _name: new
|
|
29
|
+
* let tx = application.data.newTransaction();
|
|
30
|
+
* let user = tx.object('_user').registerCreate({
|
|
31
|
+
* _name: new application.constants.type.Multilingual({ zh: '用户1', en: 'user1' }),
|
|
36
32
|
* });
|
|
37
|
-
* let contract = tx.object(
|
|
38
|
-
* _name: new
|
|
33
|
+
* let contract = tx.object('contract').registerCreate({
|
|
34
|
+
* _name: new application.constants.type.Multilingual({ zh: '用户1的合同', en: 'user1's contract' }),
|
|
39
35
|
* user: {id: user._id}
|
|
40
36
|
* });
|
|
41
37
|
* await tx.commit();
|
|
@@ -47,7 +43,7 @@ export interface IDB<T, mt> {
|
|
|
47
43
|
* @param oql OQL 语句
|
|
48
44
|
* @example
|
|
49
45
|
* ```
|
|
50
|
-
* let users = await
|
|
46
|
+
* let users = await application.data.oql('select _email from _user').execute();
|
|
51
47
|
* ```
|
|
52
48
|
*/
|
|
53
49
|
oql(oql: string): IOql;
|
|
@@ -57,8 +53,8 @@ export interface IDB<T, mt> {
|
|
|
57
53
|
* @param nameArgs 用于替换 OQL 语句中的占位符
|
|
58
54
|
* @example
|
|
59
55
|
* ```
|
|
60
|
-
* let employees = await
|
|
61
|
-
*
|
|
56
|
+
* let employees = await application.data.oql('select _email from _user where _type = $user_type',{
|
|
57
|
+
* 'user_type': '_employee',
|
|
62
58
|
* }).execute();
|
|
63
59
|
* ```
|
|
64
60
|
*/
|
|
@@ -68,10 +64,6 @@ export interface IDB<T, mt> {
|
|
|
68
64
|
* IDBWithCurrentObject 经由 IDBGetter 返回,是 DB 的动态增加的接口结构
|
|
69
65
|
*/
|
|
70
66
|
export interface IDBWithCurrentObject<T, mt> {
|
|
71
|
-
/**
|
|
72
|
-
* 无需入参,操作当前对象的记录数据
|
|
73
|
-
*/
|
|
74
|
-
currentObject(): _IKAllEndpoint<mt[currentObjApiName]> & _IKQuery<mt[currentObjApiName]>;
|
|
75
67
|
}
|
|
76
68
|
/**
|
|
77
69
|
* IDBSync 仅包含同步调用接口,当前应用场景为 OpenSDK
|