@byted-apaas/server-sdk-node 1.1.23-beta.8 → 1.1.23
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 +2 -2
- package/application/application.d.ts +0 -33
- package/application/application.js +0 -2
- package/application/function/function.d.ts +0 -14
- package/application/function/function.js +0 -20
- package/application/impl/common.d.ts +0 -2
- package/application/impl/common.js +0 -52
- package/application/impl/impl.d.ts +0 -19
- package/application/impl/impl.js +0 -45
- package/common/structs.d.ts +0 -15
- package/common/structs.js +0 -21
- package/constants/constants.d.ts +0 -13
- package/constants/constants.js +0 -18
- package/context/context.d.ts +0 -44
- package/context/context.js +0 -25
- package/context/db/db.d.ts +0 -110
- package/context/db/db.js +0 -2
- package/context/db/impl/IObject.d.ts +0 -303
- package/context/db/impl/IObject.js +0 -5
- package/context/db/impl/IObjectV3.d.ts +0 -239
- package/context/db/impl/IObjectV3.js +0 -5
- package/context/db/impl/db.d.ts +0 -62
- package/context/db/impl/db.js +0 -84
- package/context/db/impl/dbV3.d.ts +0 -35
- package/context/db/impl/dbV3.js +0 -50
- package/context/db/impl/object.d.ts +0 -123
- package/context/db/impl/object.js +0 -1008
- package/context/db/impl/oql/ioql.d.ts +0 -14
- package/context/db/impl/oql/ioql.js +0 -4
- package/context/db/impl/oql/oql.d.ts +0 -14
- package/context/db/impl/oql/oql.js +0 -39
- package/context/db/impl/order.d.ts +0 -9
- package/context/db/impl/order.js +0 -15
- package/context/db/impl/propertiesStore.d.ts +0 -8
- package/context/db/impl/propertiesStore.js +0 -29
- package/context/db/impl/queryBuilder.d.ts +0 -33
- package/context/db/impl/queryBuilder.js +0 -72
- package/context/db/impl/transaction/index.d.ts +0 -25
- package/context/db/impl/transaction/index.js +0 -300
- package/context/db/impl/transaction/operation.d.ts +0 -27
- package/context/db/impl/transaction/operation.js +0 -69
- package/context/db/impl/transaction.d.ts +0 -70
- package/context/db/impl/transaction.js +0 -4
- package/context/globalConfig/globalConfig.d.ts +0 -7
- package/context/globalConfig/globalConfig.js +0 -16
- package/context/integration/IIntegration.d.ts +0 -30
- package/context/integration/IIntegration.js +0 -4
- package/context/integration/impl/integration.d.ts +0 -16
- package/context/integration/impl/integration.js +0 -62
- package/context/metadata/components/common.d.ts +0 -6
- package/context/metadata/components/common.js +0 -17
- package/context/metadata/components/components.d.ts +0 -12
- package/context/metadata/components/components.js +0 -19
- package/context/metadata/components/desktop/list.d.ts +0 -16
- package/context/metadata/components/desktop/list.js +0 -402
- package/context/metadata/components/desktop/recordDetail.d.ts +0 -11
- package/context/metadata/components/desktop/recordDetail.js +0 -53
- package/context/metadata/components/mobile/list.d.ts +0 -24
- package/context/metadata/components/mobile/list.js +0 -145
- package/context/metadata/metadata.d.ts +0 -63
- package/context/metadata/metadata.js +0 -125
- package/context/metadata/objects/fields.d.ts +0 -158
- package/context/metadata/objects/fields.js +0 -369
- package/context/metadata/objects/fields.util.d.ts +0 -52
- package/context/metadata/objects/fields.util.js +0 -420
- package/context/metadata/objects/fieldsV3.d.ts +0 -159
- package/context/metadata/objects/fieldsV3.js +0 -369
- package/context/metadata/objects/objects.d.ts +0 -11
- package/context/metadata/objects/objects.js +0 -20
- package/context/metadata/types/common.d.ts +0 -11
- package/context/metadata/types/common.js +0 -33
- package/context/metadata/types/components.d.ts +0 -90
- package/context/metadata/types/components.js +0 -4
- package/context/metadata/types/objects.d.ts +0 -246
- package/context/metadata/types/objects.js +0 -4
- package/context/metadata/types/objectsV3.d.ts +0 -128
- package/context/metadata/types/objectsV3.js +0 -4
- package/context/msg/msg.d.ts +0 -38
- package/context/msg/msg.js +0 -35
- package/context/resources/IResources.d.ts +0 -68
- package/context/resources/IResources.js +0 -2
- package/context/resources/impl/resources.d.ts +0 -42
- package/context/resources/impl/resources.js +0 -161
- package/context/tasks/tasks.d.ts +0 -33
- package/context/tasks/tasks.js +0 -139
- package/data/index.d.ts +0 -27
- package/data/index.js +0 -4
- package/global/application/flow/flow.d.ts +0 -99
- package/global/application/flow/flow.js +0 -8
- package/global/application/flow/impl/flow.d.ts +0 -20
- package/global/application/flow/impl/flow.js +0 -56
- package/global/application/globalVar/globalVar.d.ts +0 -7
- package/global/application/globalVar/globalVar.js +0 -2
- package/global/global.d.ts +0 -70
- package/global/global.js +0 -3
- package/hooks/api.d.ts +0 -65
- package/hooks/api.js +0 -347
- package/hooks/hooks.d.ts +0 -1
- package/hooks/hooks.js +0 -107
- package/kunlun/kunlun.d.ts +0 -55
- package/kunlun/kunlun.js +0 -58
- package/kunlun/operator/IOperator.d.ts +0 -158
- package/kunlun/operator/IOperator.js +0 -4
- package/kunlun/operator/impl/expression.d.ts +0 -75
- package/kunlun/operator/impl/expression.js +0 -96
- package/kunlun/operator/impl/logic.d.ts +0 -68
- package/kunlun/operator/impl/logic.js +0 -573
- package/kunlun/operator/impl/logicV2.d.ts +0 -59
- package/kunlun/operator/impl/logicV2.js +0 -197
- package/kunlun/operator/impl/operator.d.ts +0 -179
- package/kunlun/operator/impl/operator.js +0 -222
- package/kunlun/operator/impl/operatorV2.d.ts +0 -180
- package/kunlun/operator/impl/operatorV2.js +0 -216
- package/lib/core.d.ts +0 -4
- package/lib/core.js +0 -19
- package/request/common.d.ts +0 -13
- package/request/common.js +0 -88
- package/request/constants.d.ts +0 -12
- package/request/constants.js +0 -29
- package/request/faasinfra.d.ts +0 -8
- package/request/faasinfra.js +0 -146
- package/request/interface.d.ts +0 -121
- package/request/interface.js +0 -30
- package/request/openapi.d.ts +0 -84
- package/request/openapi.js +0 -1529
- package/request/structs.d.ts +0 -99
- package/request/structs.js +0 -15
- package/types/types.d.ts +0 -79
- package/types/types.js +0 -4
- package/version/version.d.ts +0 -2
- package/version/version.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byted-apaas/server-sdk-node",
|
|
3
|
-
"version": "1.1.23
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"description": "aPaaS Server SDK",
|
|
5
5
|
"author": "zhouwexin <zhouwexin@bytedance.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"clean": "tsc --build --clean && rm -rf **/*.js.map"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@byted-apaas/server-common-node": "2.0.24
|
|
16
|
+
"@byted-apaas/server-common-node": "^2.0.24",
|
|
17
17
|
"@jorgeferrero/stream-to-buffer": "^2.0.6",
|
|
18
18
|
"dayjs": "^1.9.6",
|
|
19
19
|
"form-data": "^3.0.0",
|
|
@@ -1,33 +0,0 @@
|
|
|
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';
|
|
8
|
-
/**
|
|
9
|
-
* IApplication 为 OpenSDK 能力的核心接口
|
|
10
|
-
* - data: 元数据相关能力
|
|
11
|
-
* - resource: 资源相关能力
|
|
12
|
-
* - tools: 工具相关能力
|
|
13
|
-
*/
|
|
14
|
-
export interface IApplication {
|
|
15
|
-
data: IDBSync;
|
|
16
|
-
resources: _IOpenSDKResources;
|
|
17
|
-
tools: ITool & IToolsExtra;
|
|
18
|
-
integration: _IIntegration;
|
|
19
|
-
cloudfunction(funcName: string): IFunction;
|
|
20
|
-
env(platformEnvType: PlatformEnvType): IApplication;
|
|
21
|
-
localDebugMode(): IApplication;
|
|
22
|
-
setLaneName(laneName: string): IApplication;
|
|
23
|
-
}
|
|
24
|
-
export type AppMode = 'openSDK' | 'faasSDK';
|
|
25
|
-
export type DataVersion = 'v1' | 'v2' | 'v3';
|
|
26
|
-
export interface AppCtx {
|
|
27
|
-
mode?: AppMode;
|
|
28
|
-
env?: PlatformEnvType;
|
|
29
|
-
credential?: AppCredential;
|
|
30
|
-
debugType?: '0' | '2';
|
|
31
|
-
x_tt_env?: string;
|
|
32
|
-
dataVersion?: DataVersion;
|
|
33
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AppCtx } from '../application';
|
|
2
|
-
export interface IFunction {
|
|
3
|
-
/**
|
|
4
|
-
* 调用函数
|
|
5
|
-
* @param params 函数入参
|
|
6
|
-
*/
|
|
7
|
-
invoke(params: Record<string, any>): Promise<any>;
|
|
8
|
-
}
|
|
9
|
-
export declare class Function implements IFunction {
|
|
10
|
-
appCtx: AppCtx;
|
|
11
|
-
apiName: string;
|
|
12
|
-
constructor(appCtx: AppCtx, apiName: string);
|
|
13
|
-
invoke(params: Record<string, any>): Promise<any>;
|
|
14
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Function = void 0;
|
|
4
|
-
const interface_1 = require("../../request/interface");
|
|
5
|
-
const common_1 = require("../impl/common");
|
|
6
|
-
class Function {
|
|
7
|
-
constructor(appCtx, apiName) {
|
|
8
|
-
this.appCtx = appCtx;
|
|
9
|
-
this.apiName = apiName;
|
|
10
|
-
}
|
|
11
|
-
async invoke(params) {
|
|
12
|
-
return await (0, common_1.runCtxForOpenSDK)(this.appCtx, async () => {
|
|
13
|
-
return await (0, interface_1.GetInstance)().invokeFuncWithAuth({
|
|
14
|
-
APIName: this.apiName,
|
|
15
|
-
isInvokeByAPIName: true
|
|
16
|
-
}, params);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.Function = Function;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCtxForOpenSDK = void 0;
|
|
4
|
-
const utils = require("@byted-apaas/server-common-node/utils/utils");
|
|
5
|
-
const nodeClsCtx = require("@byted-apaas/server-common-node/utils/nodeClsCtx");
|
|
6
|
-
const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions");
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
8
|
-
const crypto = require('crypto'); //nolint:byted_s_ts_no_require_imports
|
|
9
|
-
async function runCtxForOpenSDK(appCtx, promise) {
|
|
10
|
-
if (appCtx && appCtx.mode === 'openSDK') {
|
|
11
|
-
if (!appCtx.credential) {
|
|
12
|
-
throw new exceptions_1.InvalidParamError(`credential is empty for openSDK`);
|
|
13
|
-
}
|
|
14
|
-
return nodeClsCtx.getReqCtx().run(async () => {
|
|
15
|
-
utils.setModeForOpenSDK(appCtx.mode);
|
|
16
|
-
utils.setCredential(appCtx.credential);
|
|
17
|
-
utils.setDebugType(appCtx.debugType);
|
|
18
|
-
switch (appCtx.env) {
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
case 'developmentboe':
|
|
21
|
-
utils.setEnv('development');
|
|
22
|
-
utils.setBoe('boe');
|
|
23
|
-
break;
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
case 'stagingboe':
|
|
26
|
-
utils.setEnv('staging');
|
|
27
|
-
utils.setBoe('boe');
|
|
28
|
-
break;
|
|
29
|
-
case 'staging':
|
|
30
|
-
utils.setEnv('staging');
|
|
31
|
-
break;
|
|
32
|
-
case 'gray':
|
|
33
|
-
utils.setEnv('gray');
|
|
34
|
-
break;
|
|
35
|
-
case 'online':
|
|
36
|
-
utils.setEnv('online');
|
|
37
|
-
break;
|
|
38
|
-
default:
|
|
39
|
-
throw new exceptions_1.InvalidParamError(`platformEnvType is invalid for ${appCtx.env}`);
|
|
40
|
-
}
|
|
41
|
-
utils.setInvokeFuncName('openSDK');
|
|
42
|
-
utils.setTenant(await appCtx.credential.getTenantInfo());
|
|
43
|
-
utils.setXTTEnvOnlyDebug(appCtx.x_tt_env);
|
|
44
|
-
if (!utils.getLogID()) {
|
|
45
|
-
utils.setLogID(crypto.randomBytes(16).toString('hex'));
|
|
46
|
-
}
|
|
47
|
-
return await promise();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return await promise();
|
|
51
|
-
}
|
|
52
|
-
exports.runCtxForOpenSDK = runCtxForOpenSDK;
|
|
@@ -1,19 +0,0 @@
|
|
|
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';
|
|
8
|
-
export declare class Application implements IApplication {
|
|
9
|
-
private appCtx;
|
|
10
|
-
data: IDBSync;
|
|
11
|
-
resources: _IOpenSDKResources;
|
|
12
|
-
tools: ITool & IToolsExtra;
|
|
13
|
-
integration: _IIntegration;
|
|
14
|
-
constructor(clientID: string, clientSecret: string);
|
|
15
|
-
cloudfunction(funcName: string): IFunction;
|
|
16
|
-
env(platformEnvType: PlatformEnvType): IApplication;
|
|
17
|
-
localDebugMode(): IApplication;
|
|
18
|
-
setLaneName(laneName: string): IApplication;
|
|
19
|
-
}
|
package/application/impl/impl.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Application = void 0;
|
|
4
|
-
const credential_1 = require("@byted-apaas/server-common-node/credential/credential");
|
|
5
|
-
const db_1 = require("../../context/db/impl/db");
|
|
6
|
-
const tool_1 = require("@byted-apaas/server-common-node/kunlun/tool/impl/tool");
|
|
7
|
-
const function_1 = require("../function/function");
|
|
8
|
-
const common_1 = require("../../request/common");
|
|
9
|
-
const resources_1 = require("../../context/resources/impl/resources");
|
|
10
|
-
const constants_1 = require("@byted-apaas/server-common-node/constants/constants");
|
|
11
|
-
const integration_1 = require("../../context/integration/impl/integration");
|
|
12
|
-
class Application {
|
|
13
|
-
constructor(clientID, clientSecret) {
|
|
14
|
-
this.appCtx = {
|
|
15
|
-
mode: 'openSDK',
|
|
16
|
-
credential: new credential_1.AppCredential(clientID, clientSecret),
|
|
17
|
-
debugType: constants_1.DefaultDebugType ? constants_1.DefaultDebugType : '2',
|
|
18
|
-
env: 'online',
|
|
19
|
-
};
|
|
20
|
-
this.data = new db_1.ApplicationDB(this.appCtx);
|
|
21
|
-
this.resources = new resources_1._OpenSDKResources(this.appCtx);
|
|
22
|
-
this.integration = new integration_1._OpenSDKIntegration(this.appCtx);
|
|
23
|
-
this.tools = new tool_1.Tool();
|
|
24
|
-
this.tools.getTenantInfo = async () => {
|
|
25
|
-
return await (0, common_1.getTenantInfo)(this.appCtx);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
cloudfunction(funcName) {
|
|
29
|
-
return new function_1.Function(this.appCtx, funcName);
|
|
30
|
-
}
|
|
31
|
-
env(platformEnvType) {
|
|
32
|
-
this.appCtx.env = platformEnvType;
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
// 设置本地调试模式
|
|
36
|
-
localDebugMode() {
|
|
37
|
-
this.appCtx.debugType = '2';
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
setLaneName(laneName) {
|
|
41
|
-
this.appCtx.x_tt_env = laneName;
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.Application = Application;
|
package/common/structs.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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 | string;
|
|
10
|
-
errors?: BatchResultDataError[];
|
|
11
|
-
}
|
|
12
|
-
export interface BatchResultDataError {
|
|
13
|
-
code: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function NewBatchResult(recordIDs: number[] | string[], errMap: Record<number | string, string>): BatchResult;
|
package/common/structs.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const notifyModel: {
|
|
2
|
-
key: string;
|
|
3
|
-
};
|
|
4
|
-
export declare const httpHeaderKeys: {
|
|
5
|
-
statusCode: string;
|
|
6
|
-
location: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const httpStatusCodes: {
|
|
9
|
-
redirect: number;
|
|
10
|
-
};
|
|
11
|
-
export declare const triggerType: {
|
|
12
|
-
defaultTrigger: string;
|
|
13
|
-
};
|
package/constants/constants.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2022 ByteDance Ltd. and/or its affiliates
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.triggerType = exports.httpStatusCodes = exports.httpHeaderKeys = exports.notifyModel = void 0;
|
|
6
|
-
exports.notifyModel = {
|
|
7
|
-
key: 'ee.kunlun.cloudfunction.faas_buildin',
|
|
8
|
-
};
|
|
9
|
-
exports.httpHeaderKeys = {
|
|
10
|
-
statusCode: 'X-Kunlun-Status-Code',
|
|
11
|
-
location: 'Location',
|
|
12
|
-
};
|
|
13
|
-
exports.httpStatusCodes = {
|
|
14
|
-
redirect: 302,
|
|
15
|
-
};
|
|
16
|
-
exports.triggerType = {
|
|
17
|
-
defaultTrigger: 'default-trigger',
|
|
18
|
-
};
|
package/context/context.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
import { Context as CommonContext } from '@byted-apaas/server-common-node';
|
|
6
|
-
import { IMetaData } from './metadata/metadata';
|
|
7
|
-
import { _IIntegration } from './integration/IIntegration';
|
|
8
|
-
export declare class Context<T, mt, cf, gv> extends CommonContext implements IContext<T, mt, cf, gv> {
|
|
9
|
-
/**
|
|
10
|
-
* 操作数据库中的记录数据
|
|
11
|
-
*/
|
|
12
|
-
db: IDBGetter<T, mt>;
|
|
13
|
-
/**
|
|
14
|
-
* 元数据读写
|
|
15
|
-
*/
|
|
16
|
-
metadata: IMetaData<mt>;
|
|
17
|
-
/**
|
|
18
|
-
* 静态资源类操作
|
|
19
|
-
*/
|
|
20
|
-
resources: _Resources;
|
|
21
|
-
/**
|
|
22
|
-
* 全局函数
|
|
23
|
-
* @param funcName 函数名
|
|
24
|
-
*/
|
|
25
|
-
function(funcName: cf): {
|
|
26
|
-
invoke: (params: any) => Promise<any>;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* 任务操作
|
|
30
|
-
*/
|
|
31
|
-
tasks: Tasks<cf>;
|
|
32
|
-
/**
|
|
33
|
-
* 向消息中心推送及更新消息
|
|
34
|
-
*/
|
|
35
|
-
msg: Message;
|
|
36
|
-
/**
|
|
37
|
-
* 根据 apiName 获取对应的全局变量
|
|
38
|
-
* @param apiName 全局变量的 API Name
|
|
39
|
-
*/
|
|
40
|
-
getVar<Key extends keyof gv>(apiName: Key): Promise<gv[Key]>;
|
|
41
|
-
integration: _IIntegration;
|
|
42
|
-
}
|
|
43
|
-
export interface IContext<T, mt, cf, gv> {
|
|
44
|
-
}
|
package/context/context.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2022 ByteDance Ltd. and/or its affiliates
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.Context = void 0;
|
|
6
|
-
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
7
|
-
class Context extends server_common_node_1.Context {
|
|
8
|
-
/**
|
|
9
|
-
* 全局函数
|
|
10
|
-
* @param funcName 函数名
|
|
11
|
-
*/
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
-
function(funcName) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* 根据 apiName 获取对应的全局变量
|
|
18
|
-
* @param apiName 全局变量的 API Name
|
|
19
|
-
*/
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
async getVar(apiName) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.Context = Context;
|
package/context/db/db.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { _IKAllEndpoint, _IKSyncEndpoint, _IKQuery } from './impl/IObject';
|
|
2
|
-
import { ITransactionGetter } from './impl/transaction';
|
|
3
|
-
import { IOql } from './impl/oql/ioql';
|
|
4
|
-
import { _IKAllEndpointV3, _IKQueryV3 } from './impl/IObjectV3';
|
|
5
|
-
/**
|
|
6
|
-
* IDBGetter 是声明 DB interface 的顶级入口
|
|
7
|
-
*/
|
|
8
|
-
export type IDBGetter<T, mt> = T extends {
|
|
9
|
-
'objectApiName': string;
|
|
10
|
-
} ? IDB<T, mt> & IDBWithCurrentObject<{}, mt> : IDB<{}, mt>;
|
|
11
|
-
/**
|
|
12
|
-
* IDB 经由 IDBGetter 返回,是 DB 的基础接口结构
|
|
13
|
-
*/
|
|
14
|
-
export interface IDB<T, mt> {
|
|
15
|
-
/**
|
|
16
|
-
* 操作指定对象的记录数据
|
|
17
|
-
* @param objectApiName 指定对象的 ApiName
|
|
18
|
-
* @example
|
|
19
|
-
* ```
|
|
20
|
-
* application.data.object('_user').where({
|
|
21
|
-
* gender: 'male'
|
|
22
|
-
* }).find()
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
object<T extends keyof mt>(objectApiName: T): _IKAllEndpoint<mt[T]> & _IKQuery<mt[T]>;
|
|
26
|
-
/**
|
|
27
|
-
* 创建一个新的空事务
|
|
28
|
-
* @example
|
|
29
|
-
* ```
|
|
30
|
-
* let tx = application.data.newTransaction();
|
|
31
|
-
* let user = tx.object('_user').registerCreate({
|
|
32
|
-
* _name: new application.constants.type.Multilingual({ zh: '用户1', en: 'user1' }),
|
|
33
|
-
* });
|
|
34
|
-
* let contract = tx.object('contract').registerCreate({
|
|
35
|
-
* _name: new application.constants.type.Multilingual({ zh: '用户1的合同', en: 'user1's contract' }),
|
|
36
|
-
* user: {id: user._id}
|
|
37
|
-
* });
|
|
38
|
-
* await tx.commit();
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
newTransaction(): ITransactionGetter<T, mt>;
|
|
42
|
-
/**
|
|
43
|
-
* OQL 操作
|
|
44
|
-
* @param oql OQL 语句
|
|
45
|
-
* @example
|
|
46
|
-
* ```
|
|
47
|
-
* let users = await application.data.oql('select _email from _user').execute();
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
oql(oql: string): IOql;
|
|
51
|
-
/**
|
|
52
|
-
* OQL 操作
|
|
53
|
-
* @param oql OQL 语句
|
|
54
|
-
* @param nameArgs 用于替换 OQL 语句中的占位符
|
|
55
|
-
* @example
|
|
56
|
-
* ```
|
|
57
|
-
* let employees = await application.data.oql('select _email from _user where _type = $user_type',{
|
|
58
|
-
* 'user_type': '_employee',
|
|
59
|
-
* }).execute();
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
oql(oql: string, nameArgs: Record<string, any>): IOql;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* IDB3 经由 IDBGetter 返回,是 DBV3 的基础接口结构
|
|
66
|
-
*/
|
|
67
|
-
export interface IDBV3<T, mt> {
|
|
68
|
-
/**
|
|
69
|
-
* 操作指定对象的记录数据
|
|
70
|
-
* @param objectApiName 指定对象的 ApiName
|
|
71
|
-
* @example
|
|
72
|
-
* ```
|
|
73
|
-
* application.data.object('_user').where({
|
|
74
|
-
* gender: 'male'
|
|
75
|
-
* }).find()
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
object: <T extends keyof mt>(objectApiName: T) => _IKAllEndpointV3<mt[T]> & _IKQueryV3<mt[T]>;
|
|
79
|
-
/**
|
|
80
|
-
* 创建一个新的空事务
|
|
81
|
-
* @example
|
|
82
|
-
* ```
|
|
83
|
-
* let tx = application.data.newTransaction();
|
|
84
|
-
* let user = tx.object('_user').registerCreate({
|
|
85
|
-
* _name: new application.constants.type.Multilingual({ zh: '用户1', en: 'user1' }),
|
|
86
|
-
* });
|
|
87
|
-
* let contract = tx.object('contract').registerCreate({
|
|
88
|
-
* _name: new application.constants.type.Multilingual({ zh: '用户1的合同', en: 'user1's contract' }),
|
|
89
|
-
* user: {id: user._id}
|
|
90
|
-
* });
|
|
91
|
-
* await tx.commit();
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
newTransaction(): ITransactionGetter<T, mt>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* IDBWithCurrentObject 经由 IDBGetter 返回,是 DB 的动态增加的接口结构
|
|
98
|
-
*/
|
|
99
|
-
export interface IDBWithCurrentObject<T, mt> {
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* IDBSync 仅包含同步调用接口,当前应用场景为 OpenSDK
|
|
103
|
-
*/
|
|
104
|
-
export interface IDBSync<mt = Record<string, never>> {
|
|
105
|
-
/**
|
|
106
|
-
* 操作指定对象的记录数据
|
|
107
|
-
* @param objectApiName 指定对象的 ApiName
|
|
108
|
-
*/
|
|
109
|
-
object(objectApiName: string): _IKSyncEndpoint<mt> & _IKQuery<mt>;
|
|
110
|
-
}
|
package/context/db/db.js
DELETED