@byted-apaas/server-sdk-node 0.0.2-beta.1
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/LICENSE.md +0 -0
- package/README.md +1 -0
- package/application/application.d.ts +27 -0
- package/application/application.js +3 -0
- package/application/application.js.map +1 -0
- package/application/application.ts +40 -0
- package/application/function/function.d.ts +14 -0
- package/application/function/function.js +22 -0
- package/application/function/function.js.map +1 -0
- package/application/function/function.ts +37 -0
- package/application/impl/common.d.ts +2 -0
- package/application/impl/common.js +51 -0
- package/application/impl/common.js.map +1 -0
- package/application/impl/common.ts +50 -0
- package/application/impl/impl.d.ts +16 -0
- package/application/impl/impl.js +39 -0
- package/application/impl/impl.js.map +1 -0
- package/application/impl/impl.ts +48 -0
- package/constants/constants.d.ts +10 -0
- package/constants/constants.js +14 -0
- package/constants/constants.js.map +1 -0
- package/constants/constants.ts +12 -0
- package/context/context.d.ts +74 -0
- package/context/context.js +24 -0
- package/context/context.js.map +1 -0
- package/context/context.ts +127 -0
- package/context/db/db.d.ts +73 -0
- package/context/db/db.js +3 -0
- package/context/db/db.js.map +1 -0
- package/context/db/db.ts +77 -0
- package/context/db/impl/IObject.d.ts +251 -0
- package/context/db/impl/IObject.js +4 -0
- package/context/db/impl/IObject.js.map +1 -0
- package/context/db/impl/IObject.ts +244 -0
- package/context/db/impl/db.d.ts +61 -0
- package/context/db/impl/db.js +87 -0
- package/context/db/impl/db.js.map +1 -0
- package/context/db/impl/db.ts +95 -0
- package/context/db/impl/object.d.ts +92 -0
- package/context/db/impl/object.js +523 -0
- package/context/db/impl/object.js.map +1 -0
- package/context/db/impl/object.ts +628 -0
- package/context/db/impl/oql/ioql.d.ts +6 -0
- package/context/db/impl/oql/ioql.js +3 -0
- package/context/db/impl/oql/ioql.js.map +1 -0
- package/context/db/impl/oql/ioql.ts +6 -0
- package/context/db/impl/oql/oql.d.ts +8 -0
- package/context/db/impl/oql/oql.js +20 -0
- package/context/db/impl/oql/oql.js.map +1 -0
- package/context/db/impl/oql/oql.ts +22 -0
- package/context/db/impl/order.d.ts +9 -0
- package/context/db/impl/order.js +14 -0
- package/context/db/impl/order.js.map +1 -0
- package/context/db/impl/order.ts +16 -0
- package/context/db/impl/propertiesStore.d.ts +8 -0
- package/context/db/impl/propertiesStore.js +28 -0
- package/context/db/impl/propertiesStore.js.map +1 -0
- package/context/db/impl/propertiesStore.ts +28 -0
- package/context/db/impl/queryBuilder.d.ts +29 -0
- package/context/db/impl/queryBuilder.js +77 -0
- package/context/db/impl/queryBuilder.js.map +1 -0
- package/context/db/impl/queryBuilder.ts +103 -0
- package/context/db/impl/transaction/index.d.ts +20 -0
- package/context/db/impl/transaction/index.js +276 -0
- package/context/db/impl/transaction/index.js.map +1 -0
- package/context/db/impl/transaction/index.ts +337 -0
- package/context/db/impl/transaction/operation.d.ts +27 -0
- package/context/db/impl/transaction/operation.js +70 -0
- package/context/db/impl/transaction/operation.js.map +1 -0
- package/context/db/impl/transaction/operation.ts +72 -0
- package/context/db/impl/transaction.d.ts +67 -0
- package/context/db/impl/transaction.js +3 -0
- package/context/db/impl/transaction.js.map +1 -0
- package/context/db/impl/transaction.ts +76 -0
- package/context/globalConfig/globalConfig.d.ts +7 -0
- package/context/globalConfig/globalConfig.js +15 -0
- package/context/globalConfig/globalConfig.js.map +1 -0
- package/context/globalConfig/globalConfig.ts +11 -0
- package/context/metadata/components/common.d.ts +6 -0
- package/context/metadata/components/common.js +16 -0
- package/context/metadata/components/common.js.map +1 -0
- package/context/metadata/components/common.ts +19 -0
- package/context/metadata/components/components.d.ts +12 -0
- package/context/metadata/components/components.js +18 -0
- package/context/metadata/components/components.js.map +1 -0
- package/context/metadata/components/components.ts +19 -0
- package/context/metadata/components/desktop/list.d.ts +16 -0
- package/context/metadata/components/desktop/list.js +403 -0
- package/context/metadata/components/desktop/list.js.map +1 -0
- package/context/metadata/components/desktop/list.ts +457 -0
- package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
- package/context/metadata/components/desktop/recordDetail.js +52 -0
- package/context/metadata/components/desktop/recordDetail.js.map +1 -0
- package/context/metadata/components/desktop/recordDetail.ts +64 -0
- package/context/metadata/components/mobile/list.d.ts +24 -0
- package/context/metadata/components/mobile/list.js +144 -0
- package/context/metadata/components/mobile/list.js.map +1 -0
- package/context/metadata/components/mobile/list.ts +176 -0
- package/context/metadata/metadata.d.ts +61 -0
- package/context/metadata/metadata.js +102 -0
- package/context/metadata/metadata.js.map +1 -0
- package/context/metadata/metadata.ts +175 -0
- package/context/metadata/objects/fields.d.ts +130 -0
- package/context/metadata/objects/fields.js +333 -0
- package/context/metadata/objects/fields.js.map +1 -0
- package/context/metadata/objects/fields.ts +454 -0
- package/context/metadata/objects/fields.util.d.ts +40 -0
- package/context/metadata/objects/fields.util.js +320 -0
- package/context/metadata/objects/fields.util.js.map +1 -0
- package/context/metadata/objects/fields.util.ts +360 -0
- package/context/metadata/objects/objects.d.ts +11 -0
- package/context/metadata/objects/objects.js +19 -0
- package/context/metadata/objects/objects.js.map +1 -0
- package/context/metadata/objects/objects.ts +27 -0
- package/context/metadata/types/common.d.ts +6 -0
- package/context/metadata/types/common.js +8 -0
- package/context/metadata/types/common.js.map +1 -0
- package/context/metadata/types/common.ts +10 -0
- package/context/metadata/types/components.d.ts +90 -0
- package/context/metadata/types/components.js +3 -0
- package/context/metadata/types/components.js.map +1 -0
- package/context/metadata/types/components.ts +105 -0
- package/context/metadata/types/objects.d.ts +226 -0
- package/context/metadata/types/objects.js +3 -0
- package/context/metadata/types/objects.js.map +1 -0
- package/context/metadata/types/objects.ts +251 -0
- package/context/msg/msg.d.ts +38 -0
- package/context/msg/msg.js +34 -0
- package/context/msg/msg.js.map +1 -0
- package/context/msg/msg.ts +49 -0
- package/context/resources/IResources.d.ts +66 -0
- package/context/resources/IResources.js +3 -0
- package/context/resources/IResources.js.map +1 -0
- package/context/resources/IResources.ts +73 -0
- package/context/resources/impl/resources.d.ts +42 -0
- package/context/resources/impl/resources.js +149 -0
- package/context/resources/impl/resources.js.map +1 -0
- package/context/resources/impl/resources.ts +170 -0
- package/context/tasks/tasks.d.ts +33 -0
- package/context/tasks/tasks.js +140 -0
- package/context/tasks/tasks.js.map +1 -0
- package/context/tasks/tasks.ts +159 -0
- package/data/index.d.ts +27 -0
- package/data/index.js +5 -0
- package/data/index.js.map +1 -0
- package/data/index.ts +30 -0
- package/hooks/api.d.ts +61 -0
- package/hooks/api.js +328 -0
- package/hooks/api.js.map +1 -0
- package/hooks/api.ts +341 -0
- package/hooks/hooks.d.ts +1 -0
- package/hooks/hooks.js +89 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/hooks.ts +100 -0
- package/kunlun/kunlun.d.ts +55 -0
- package/kunlun/kunlun.js +57 -0
- package/kunlun/kunlun.js.map +1 -0
- package/kunlun/kunlun.ts +69 -0
- package/kunlun/operator/IOperator.d.ts +158 -0
- package/kunlun/operator/IOperator.js +3 -0
- package/kunlun/operator/IOperator.js.map +1 -0
- package/kunlun/operator/IOperator.ts +163 -0
- package/kunlun/operator/impl/expression.d.ts +47 -0
- package/kunlun/operator/impl/expression.js +55 -0
- package/kunlun/operator/impl/expression.js.map +1 -0
- package/kunlun/operator/impl/expression.ts +71 -0
- package/kunlun/operator/impl/logic.d.ts +50 -0
- package/kunlun/operator/impl/logic.js +508 -0
- package/kunlun/operator/impl/logic.js.map +1 -0
- package/kunlun/operator/impl/logic.ts +595 -0
- package/kunlun/operator/impl/logicV2.d.ts +58 -0
- package/kunlun/operator/impl/logicV2.js +201 -0
- package/kunlun/operator/impl/logicV2.js.map +1 -0
- package/kunlun/operator/impl/logicV2.ts +254 -0
- package/kunlun/operator/impl/operator.d.ts +179 -0
- package/kunlun/operator/impl/operator.js +221 -0
- package/kunlun/operator/impl/operator.js.map +1 -0
- package/kunlun/operator/impl/operator.ts +255 -0
- package/kunlun/operator/impl/operatorV2.d.ts +180 -0
- package/kunlun/operator/impl/operatorV2.js +217 -0
- package/kunlun/operator/impl/operatorV2.js.map +1 -0
- package/kunlun/operator/impl/operatorV2.ts +249 -0
- package/lib/core.d.ts +4 -0
- package/lib/core.js +18 -0
- package/lib/core.js.map +1 -0
- package/lib/core.ts +4 -0
- package/package.json +50 -0
- package/request/common.d.ts +13 -0
- package/request/common.js +88 -0
- package/request/common.js.map +1 -0
- package/request/common.ts +91 -0
- package/request/constants.d.ts +10 -0
- package/request/constants.js +26 -0
- package/request/constants.js.map +1 -0
- package/request/constants.ts +25 -0
- package/request/faasinfra.d.ts +8 -0
- package/request/faasinfra.js +359 -0
- package/request/faasinfra.js.map +1 -0
- package/request/faasinfra.ts +393 -0
- package/request/innerapi.d.ts +67 -0
- package/request/innerapi.js +1411 -0
- package/request/innerapi.js.map +1 -0
- package/request/innerapi.ts +1645 -0
- package/request/interface.d.ts +95 -0
- package/request/interface.js +40 -0
- package/request/interface.js.map +1 -0
- package/request/interface.ts +166 -0
- package/request/openapi.d.ts +69 -0
- package/request/openapi.js +1013 -0
- package/request/openapi.js.map +1 -0
- package/request/openapi.ts +1220 -0
- package/types/types.d.ts +79 -0
- package/types/types.js +3 -0
- package/types/types.js.map +1 -0
- package/types/types.ts +105 -0
package/LICENSE.md
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## aPaaS Server SDK 版本说明:
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* IApplication 为 OpenSDK 能力的核心接口
|
|
9
|
+
* - data: 元数据相关能力
|
|
10
|
+
* - resource: 资源相关能力
|
|
11
|
+
* - tools: 工具相关能力
|
|
12
|
+
*/
|
|
13
|
+
export interface IApplication {
|
|
14
|
+
data: IDBSync;
|
|
15
|
+
resources: _IOpenSDKResources;
|
|
16
|
+
tools: ITool & IToolsExtra;
|
|
17
|
+
cloudfunction(funcName: string): IFunction;
|
|
18
|
+
env(platformEnvType: PlatformEnvType): IApplication;
|
|
19
|
+
localDebugMode(): IApplication;
|
|
20
|
+
}
|
|
21
|
+
export declare type AppMode = 'openSDK' | 'faasSDK';
|
|
22
|
+
export interface AppCtx {
|
|
23
|
+
mode: AppMode;
|
|
24
|
+
env?: PlatformEnvType;
|
|
25
|
+
credential: AppCredential;
|
|
26
|
+
debugType?: "0" | "2";
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["application.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
|
|
8
|
+
/**
|
|
9
|
+
* IApplication 为 OpenSDK 能力的核心接口
|
|
10
|
+
* - data: 元数据相关能力
|
|
11
|
+
* - resource: 资源相关能力
|
|
12
|
+
* - tools: 工具相关能力
|
|
13
|
+
*/
|
|
14
|
+
export interface IApplication {
|
|
15
|
+
// data 相关能力
|
|
16
|
+
data: IDBSync;
|
|
17
|
+
// resource 相关能力
|
|
18
|
+
resources: _IOpenSDKResources;
|
|
19
|
+
// tools 相关能力
|
|
20
|
+
tools: ITool & IToolsExtra;
|
|
21
|
+
|
|
22
|
+
// 调用云函数能力
|
|
23
|
+
cloudfunction(funcName: string): IFunction;
|
|
24
|
+
|
|
25
|
+
// 设置平台环境类型
|
|
26
|
+
env(platformEnvType: PlatformEnvType): IApplication;
|
|
27
|
+
|
|
28
|
+
// 设置本地调试模式
|
|
29
|
+
localDebugMode(): IApplication;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type AppMode = 'openSDK' | 'faasSDK';
|
|
33
|
+
|
|
34
|
+
export interface AppCtx {
|
|
35
|
+
mode: AppMode
|
|
36
|
+
env?: PlatformEnvType
|
|
37
|
+
credential: AppCredential
|
|
38
|
+
debugType?: "0" | "2"
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const crypto = require("crypto");
|
|
7
|
+
class Function {
|
|
8
|
+
constructor(appCtx, apiName) {
|
|
9
|
+
this.appCtx = appCtx;
|
|
10
|
+
this.apiName = apiName;
|
|
11
|
+
}
|
|
12
|
+
async invoke(params) {
|
|
13
|
+
return await (0, common_1.runCtxForOpenSDK)(this.appCtx, async () => {
|
|
14
|
+
return await (0, interface_1.GetInstance)().invokeFuncWithAuth({
|
|
15
|
+
APIName: this.apiName,
|
|
16
|
+
isInvokeByAPIName: true
|
|
17
|
+
}, params);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Function = Function;
|
|
22
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["function.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAKnD,2CAAgD;AAEhD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAUhC,MAAa,QAAQ;IAIjB,YAAY,MAAc,EAAE,OAAe;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAA2B;QACpC,OAAO,MAAM,IAAA,yBAAgB,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;YAClD,OAAO,MAAM,IAAA,uBAAW,GAAE,CAAC,kBAAkB,CAAC;gBAC1C,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,iBAAiB,EAAE,IAAI;aAC1B,EAAE,MAAM,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAjBD,4BAiBC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {AppCtx} from "../application";
|
|
2
|
+
|
|
3
|
+
import {GetInstance} from "../../request/interface"
|
|
4
|
+
import * as nodeClsCtx from "@byted-apaas/server-common-node/utils/nodeClsCtx";
|
|
5
|
+
import * as utils from "@byted-apaas/server-common-node/utils/utils";
|
|
6
|
+
import {InvalidParamError} from "@byted-apaas/server-common-node/utils/exceptions";
|
|
7
|
+
import {setModeForOpenSDK} from "@byted-apaas/server-common-node/utils/utils";
|
|
8
|
+
import {runCtxForOpenSDK} from "../impl/common";
|
|
9
|
+
|
|
10
|
+
const crypto = require("crypto")
|
|
11
|
+
|
|
12
|
+
export interface IFunction {
|
|
13
|
+
/**
|
|
14
|
+
* 调用函数
|
|
15
|
+
* @param params 函数入参
|
|
16
|
+
*/
|
|
17
|
+
invoke(params: Record<string, any>): Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class Function implements IFunction {
|
|
21
|
+
appCtx: AppCtx
|
|
22
|
+
apiName: string
|
|
23
|
+
|
|
24
|
+
constructor(appCtx: AppCtx, apiName: string) {
|
|
25
|
+
this.appCtx = appCtx
|
|
26
|
+
this.apiName = apiName;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async invoke(params: Record<string, any>): Promise<any> {
|
|
30
|
+
return await runCtxForOpenSDK(this.appCtx, async () => {
|
|
31
|
+
return await GetInstance().invokeFuncWithAuth({
|
|
32
|
+
APIName: this.apiName,
|
|
33
|
+
isInvokeByAPIName: true
|
|
34
|
+
}, params);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
const crypto = require("crypto");
|
|
8
|
+
async function runCtxForOpenSDK(appCtx, promise) {
|
|
9
|
+
if (appCtx && appCtx.mode === "openSDK") {
|
|
10
|
+
if (!appCtx.credential) {
|
|
11
|
+
throw new exceptions_1.InvalidParamError(`credential is empty for openSDK`);
|
|
12
|
+
}
|
|
13
|
+
return nodeClsCtx.getReqCtx().run(async () => {
|
|
14
|
+
utils.setModeForOpenSDK(appCtx.mode);
|
|
15
|
+
utils.setCredential(appCtx.credential);
|
|
16
|
+
utils.setDebugType(appCtx.debugType);
|
|
17
|
+
switch (appCtx.env) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
case "developmentboe":
|
|
20
|
+
utils.setEnv('development');
|
|
21
|
+
utils.setBoe("boe");
|
|
22
|
+
break;
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
case "stagingboe":
|
|
25
|
+
utils.setEnv('staging');
|
|
26
|
+
utils.setBoe("boe");
|
|
27
|
+
break;
|
|
28
|
+
case "staging":
|
|
29
|
+
utils.setEnv('staging');
|
|
30
|
+
break;
|
|
31
|
+
case "gray":
|
|
32
|
+
utils.setEnv("gray");
|
|
33
|
+
break;
|
|
34
|
+
case "online":
|
|
35
|
+
utils.setEnv("online");
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
throw new exceptions_1.InvalidParamError(`platformEnvType is invalid for ${appCtx.env}`);
|
|
39
|
+
}
|
|
40
|
+
utils.setInvokeFuncName("openSDK");
|
|
41
|
+
utils.setTenant(await appCtx.credential.getTenantInfo());
|
|
42
|
+
if (!utils.getLogID()) {
|
|
43
|
+
utils.setLogID(crypto.randomBytes(16).toString('hex'));
|
|
44
|
+
}
|
|
45
|
+
return await promise();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return await promise();
|
|
49
|
+
}
|
|
50
|
+
exports.runCtxForOpenSDK = runCtxForOpenSDK;
|
|
51
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":";;;AACA,qEAAqE;AACrE,+EAA+E;AAC/E,iFAAmF;AAEnF,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE1B,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAiB;IACpE,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACpB,MAAM,IAAI,8BAAiB,CAAC,iCAAiC,CAAC,CAAC;SAClE;QACD,OAAO,UAAU,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;YACrC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACrC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACvC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACrC,QAAQ,MAAM,CAAC,GAAG,EAAE;gBAChB,aAAa;gBACb,KAAK,gBAAgB;oBACjB,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBAC5B,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACpB,MAAM;gBACV,aAAa;gBACb,KAAK,YAAY;oBACb,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACxB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACpB,MAAM;gBACV,KAAK,SAAS;oBACV,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACxB,MAAM;gBACV,KAAK,MAAM;oBACP,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBACrB,MAAM;gBACV,KAAK,QAAQ;oBACT,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACvB,MAAM;gBACV;oBACI,MAAM,IAAI,8BAAiB,CAAC,kCAAkC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;aACnF;YACD,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YACnC,KAAK,CAAC,SAAS,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC;YACzD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE;gBACnB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;aAC1D;YACD,OAAO,MAAM,OAAO,EAAE,CAAC;QAC3B,CAAC,CACJ,CAAA;KACJ;IACD,OAAO,MAAM,OAAO,EAAE,CAAC;AAC3B,CAAC;AA1CD,4CA0CC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {AppCtx} from "../application";
|
|
2
|
+
import * as utils from "@byted-apaas/server-common-node/utils/utils";
|
|
3
|
+
import * as nodeClsCtx from "@byted-apaas/server-common-node/utils/nodeClsCtx";
|
|
4
|
+
import {InvalidParamError} from "@byted-apaas/server-common-node/utils/exceptions";
|
|
5
|
+
|
|
6
|
+
const crypto = require("crypto");
|
|
7
|
+
|
|
8
|
+
export async function runCtxForOpenSDK(appCtx: AppCtx, promise: Function): Promise<any> {
|
|
9
|
+
if (appCtx && appCtx.mode === "openSDK") {
|
|
10
|
+
if (!appCtx.credential) {
|
|
11
|
+
throw new InvalidParamError(`credential is empty for openSDK`);
|
|
12
|
+
}
|
|
13
|
+
return nodeClsCtx.getReqCtx().run(async () => {
|
|
14
|
+
utils.setModeForOpenSDK(appCtx.mode);
|
|
15
|
+
utils.setCredential(appCtx.credential);
|
|
16
|
+
utils.setDebugType(appCtx.debugType);
|
|
17
|
+
switch (appCtx.env) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
case "developmentboe":
|
|
20
|
+
utils.setEnv('development');
|
|
21
|
+
utils.setBoe("boe");
|
|
22
|
+
break;
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
case "stagingboe":
|
|
25
|
+
utils.setEnv('staging');
|
|
26
|
+
utils.setBoe("boe");
|
|
27
|
+
break;
|
|
28
|
+
case "staging":
|
|
29
|
+
utils.setEnv('staging');
|
|
30
|
+
break;
|
|
31
|
+
case "gray":
|
|
32
|
+
utils.setEnv("gray");
|
|
33
|
+
break;
|
|
34
|
+
case "online":
|
|
35
|
+
utils.setEnv("online");
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
throw new InvalidParamError(`platformEnvType is invalid for ${appCtx.env}`);
|
|
39
|
+
}
|
|
40
|
+
utils.setInvokeFuncName("openSDK");
|
|
41
|
+
utils.setTenant(await appCtx.credential.getTenantInfo());
|
|
42
|
+
if (!utils.getLogID()) {
|
|
43
|
+
utils.setLogID(crypto.randomBytes(16).toString('hex'));
|
|
44
|
+
}
|
|
45
|
+
return await promise();
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
return await promise();
|
|
50
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export declare class Application implements IApplication {
|
|
8
|
+
private appCtx;
|
|
9
|
+
data: IDBSync;
|
|
10
|
+
resources: _IOpenSDKResources;
|
|
11
|
+
tools: ITool & IToolsExtra;
|
|
12
|
+
constructor(clientID: string, clientSecret: string);
|
|
13
|
+
cloudfunction(funcName: string): IFunction;
|
|
14
|
+
env(platformEnvType: PlatformEnvType): IApplication;
|
|
15
|
+
localDebugMode(): IApplication;
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
class Application {
|
|
11
|
+
constructor(clientID, clientSecret) {
|
|
12
|
+
this.appCtx = {
|
|
13
|
+
mode: "openSDK",
|
|
14
|
+
credential: new credential_1.AppCredential(clientID, clientSecret),
|
|
15
|
+
debugType: "0",
|
|
16
|
+
env: "online"
|
|
17
|
+
};
|
|
18
|
+
this.data = new db_1.ApplicationDB(this.appCtx);
|
|
19
|
+
this.resources = new resources_1._OpenSDKResources(this.appCtx);
|
|
20
|
+
this.tools = new tool_1.Tool();
|
|
21
|
+
this.tools.getTenantInfo = async () => {
|
|
22
|
+
return await (0, common_1.getTenantInfo)(this.appCtx);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
cloudfunction(funcName) {
|
|
26
|
+
return new function_1.Function(this.appCtx, funcName);
|
|
27
|
+
}
|
|
28
|
+
env(platformEnvType) {
|
|
29
|
+
this.appCtx.env = platformEnvType;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
// 设置本地调试模式
|
|
33
|
+
localDebugMode() {
|
|
34
|
+
this.appCtx.debugType = "2";
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Application = Application;
|
|
39
|
+
//# sourceMappingURL=impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl.js","sourceRoot":"","sources":["impl.ts"],"names":[],"mappings":";;;AACA,sFAAoF;AACpF,iDAAuD;AACvD,gFAA2E;AAC3E,mDAAyD;AAEzD,iDAAmD;AAGnD,sEAAyE;AAGzE,MAAa,WAAW;IAMpB,YAAY,QAAgB,EAAE,YAAoB;QAC9C,IAAI,CAAC,MAAM,GAAG;YACV,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,IAAI,0BAAa,CAAC,QAAQ,EAAE,YAAY,CAAC;YACrD,SAAS,EAAE,GAAG;YACd,GAAG,EAAE,QAAQ;SAChB,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,kBAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAI,6BAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,WAAI,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,IAAI,EAAE;YAClC,OAAO,MAAM,IAAA,sBAAa,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC,CAAA;IACL,CAAC;IAED,aAAa,CAAC,QAAgB;QAC1B,OAAO,IAAI,mBAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,GAAG,CAAC,eAAgC;QAChC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,eAAe,CAAC;QAClC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW;IACX,cAAc;QACV,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnCD,kCAmCC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {ITool, IToolsExtra} from "@byted-apaas/server-common-node/kunlun/tool/Itool";
|
|
2
|
+
import {AppCredential} from "@byted-apaas/server-common-node/credential/credential";
|
|
3
|
+
import {ApplicationDB} from "../../context/db/impl/db";
|
|
4
|
+
import {Tool} from "@byted-apaas/server-common-node/kunlun/tool/impl/tool";
|
|
5
|
+
import {Function, IFunction} from "../function/function";
|
|
6
|
+
import {AppCtx, IApplication} from "../application";
|
|
7
|
+
import {getTenantInfo} from "../../request/common";
|
|
8
|
+
import {_IOpenSDKResources} from "../../context/resources/IResources";
|
|
9
|
+
import {IDBSync} from "../../context/db/db";
|
|
10
|
+
import {_OpenSDKResources} from "../../context/resources/impl/resources";
|
|
11
|
+
import {PlatformEnvType} from "@byted-apaas/server-common-node/constants/constants";
|
|
12
|
+
|
|
13
|
+
export class Application implements IApplication {
|
|
14
|
+
private appCtx: AppCtx;
|
|
15
|
+
data: IDBSync;
|
|
16
|
+
resources: _IOpenSDKResources;
|
|
17
|
+
tools: ITool & IToolsExtra;
|
|
18
|
+
|
|
19
|
+
constructor(clientID: string, clientSecret: string) {
|
|
20
|
+
this.appCtx = {
|
|
21
|
+
mode: "openSDK",
|
|
22
|
+
credential: new AppCredential(clientID, clientSecret),
|
|
23
|
+
debugType: "0",
|
|
24
|
+
env: "online"
|
|
25
|
+
}
|
|
26
|
+
this.data = new ApplicationDB(this.appCtx);
|
|
27
|
+
this.resources = new _OpenSDKResources(this.appCtx);
|
|
28
|
+
this.tools = new Tool();
|
|
29
|
+
this.tools.getTenantInfo = async () => {
|
|
30
|
+
return await getTenantInfo(this.appCtx);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
cloudfunction(funcName: string): IFunction {
|
|
35
|
+
return new Function(this.appCtx, funcName);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
env(platformEnvType: PlatformEnvType): IApplication {
|
|
39
|
+
this.appCtx.env = platformEnvType;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 设置本地调试模式
|
|
44
|
+
localDebugMode(): IApplication {
|
|
45
|
+
this.appCtx.debugType = "2";
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.httpStatusCodes = exports.httpHeaderKeys = exports.notifyModel = void 0;
|
|
4
|
+
exports.notifyModel = {
|
|
5
|
+
key: "ee.kunlun.cloudfunction.faas_buildin",
|
|
6
|
+
};
|
|
7
|
+
exports.httpHeaderKeys = {
|
|
8
|
+
statusCode: "X-Kunlun-Status-Code",
|
|
9
|
+
location: "Location",
|
|
10
|
+
};
|
|
11
|
+
exports.httpStatusCodes = {
|
|
12
|
+
redirect: 302,
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACvB,GAAG,EAAE,sCAAsC;CAC9C,CAAA;AAEY,QAAA,cAAc,GAAG;IAC1B,UAAU,EAAE,sBAAsB;IAClC,QAAQ,EAAE,UAAU;CACvB,CAAA;AAEY,QAAA,eAAe,GAAG;IAC3B,QAAQ,EAAE,GAAG;CAChB,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
export declare class Context<T, mt, cf, gv> extends CommonContext<T> implements IContext<T, mt, cf, gv> {
|
|
8
|
+
/**
|
|
9
|
+
* 操作数据库中的记录数据
|
|
10
|
+
*/
|
|
11
|
+
db: IDBGetter<T, mt>;
|
|
12
|
+
/**
|
|
13
|
+
* 元数据读写
|
|
14
|
+
*/
|
|
15
|
+
metadata: IMetaData<mt>;
|
|
16
|
+
/**
|
|
17
|
+
* 静态资源类操作
|
|
18
|
+
*/
|
|
19
|
+
resources: _Resources;
|
|
20
|
+
/**
|
|
21
|
+
* 全局函数
|
|
22
|
+
* @param funcName 函数名
|
|
23
|
+
*/
|
|
24
|
+
function(funcName: cf): {
|
|
25
|
+
invoke: (params: any) => Promise<any>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 任务操作
|
|
29
|
+
*/
|
|
30
|
+
tasks: Tasks<cf>;
|
|
31
|
+
/**
|
|
32
|
+
* 向消息中心推送及更新消息
|
|
33
|
+
*/
|
|
34
|
+
msg: Message;
|
|
35
|
+
/**
|
|
36
|
+
* 根据 apiName 获取对应的全局变量
|
|
37
|
+
* @param apiName 全局变量的 API Name
|
|
38
|
+
*/
|
|
39
|
+
getVar<Key extends keyof gv>(apiName: Key): Promise<gv[Key]>;
|
|
40
|
+
}
|
|
41
|
+
export interface IContext<T, mt = {}, cf = "", gv = {}> {
|
|
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]>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Context = void 0;
|
|
4
|
+
const server_common_node_1 = require("@byted-apaas/server-common-node");
|
|
5
|
+
// TODO MERGE cf
|
|
6
|
+
class Context extends server_common_node_1.Context {
|
|
7
|
+
/**
|
|
8
|
+
* 全局函数
|
|
9
|
+
* @param funcName 函数名
|
|
10
|
+
*/
|
|
11
|
+
function(funcName) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 根据 apiName 获取对应的全局变量
|
|
16
|
+
* @param apiName 全局变量的 API Name
|
|
17
|
+
*/
|
|
18
|
+
async getVar(apiName) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
}
|
|
23
|
+
exports.Context = Context;
|
|
24
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["context.ts"],"names":[],"mappings":";;;AAIA,wEAA0E;AAE1E,gBAAgB;AAEhB,MAAa,OAAuB,SAAQ,4BAAgB;IAcxD;;;OAGG;IACH,QAAQ,CAAC,QAAY;QACjB,OAAO,IAAI,CAAC;IAChB,CAAC;IAWD;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAuB,OAAY;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAAA,CAAC;CAwBL;AA7DD,0BA6DC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
// TODO MERGE cf
|
|
8
|
+
|
|
9
|
+
export class Context<T, mt, cf, gv> extends CommonContext<T> implements IContext<T, mt, cf, gv> {
|
|
10
|
+
/**
|
|
11
|
+
* 操作数据库中的记录数据
|
|
12
|
+
*/
|
|
13
|
+
db: IDBGetter<T, mt>;
|
|
14
|
+
/**
|
|
15
|
+
* 元数据读写
|
|
16
|
+
*/
|
|
17
|
+
metadata: IMetaData<mt>;
|
|
18
|
+
/**
|
|
19
|
+
* 静态资源类操作
|
|
20
|
+
*/
|
|
21
|
+
resources: _Resources;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 全局函数
|
|
25
|
+
* @param funcName 函数名
|
|
26
|
+
*/
|
|
27
|
+
function(funcName: cf): { invoke: (params: any) => Promise<any>; } {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 任务操作
|
|
33
|
+
*/
|
|
34
|
+
tasks: Tasks<cf>;
|
|
35
|
+
/**
|
|
36
|
+
* 向消息中心推送及更新消息
|
|
37
|
+
*/
|
|
38
|
+
msg: Message;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 根据 apiName 获取对应的全局变量
|
|
42
|
+
* @param apiName 全局变量的 API Name
|
|
43
|
+
*/
|
|
44
|
+
async getVar<Key extends keyof gv>(apiName: Key): Promise<gv[Key]> {
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// /**
|
|
49
|
+
// * 微服务
|
|
50
|
+
// * @param apiName 微服务的名称
|
|
51
|
+
// */
|
|
52
|
+
// microservice(apiName: string): {
|
|
53
|
+
// /**
|
|
54
|
+
// * 同步调用微服务
|
|
55
|
+
// * @param path 请求路径,如:/ping
|
|
56
|
+
// * @param method 请求方法,默认为 GET
|
|
57
|
+
// * @param params 请求参数,默认为 undefined
|
|
58
|
+
// */
|
|
59
|
+
// invoke: (path: string, method?: string, params?: any) => Promise<any>;
|
|
60
|
+
// /**
|
|
61
|
+
// * 异步调用微服务
|
|
62
|
+
// * @param path 请求路径,如:/ping
|
|
63
|
+
// * @param method 请求方法,默认为 GET
|
|
64
|
+
// * @param params 请求参数,默认为 undefined
|
|
65
|
+
// */
|
|
66
|
+
// invokeAsync: (path: string, method?: string, params?: any) => Promise<any>;
|
|
67
|
+
// } {
|
|
68
|
+
// return undefined;
|
|
69
|
+
// };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface IContext<T, mt = {}, cf = "", gv = {}> {
|
|
73
|
+
/**
|
|
74
|
+
* 操作数据库中的记录数据
|
|
75
|
+
*/
|
|
76
|
+
db: IDBGetter<T, mt>;
|
|
77
|
+
/**
|
|
78
|
+
* 元数据读写
|
|
79
|
+
*/
|
|
80
|
+
metadata: IMetaData<mt>;
|
|
81
|
+
/**
|
|
82
|
+
* 静态资源类操作
|
|
83
|
+
*/
|
|
84
|
+
resources: _Resources;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 全局函数
|
|
88
|
+
* @param funcName 函数名
|
|
89
|
+
*/
|
|
90
|
+
function(funcName: cf): { invoke: (params: any) => Promise<any>; };
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 任务操作
|
|
94
|
+
*/
|
|
95
|
+
tasks: Tasks<cf>;
|
|
96
|
+
/**
|
|
97
|
+
* 向消息中心推送及更新消息
|
|
98
|
+
*/
|
|
99
|
+
msg: Message;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 根据 apiName 获取对应的全局变量
|
|
103
|
+
* @param apiName 全局变量的 API Name
|
|
104
|
+
*/
|
|
105
|
+
getVar<Key extends keyof gv>(apiName: Key): Promise<gv[Key]>;
|
|
106
|
+
|
|
107
|
+
// /**
|
|
108
|
+
// * 微服务
|
|
109
|
+
// * @param apiName 微服务的名称
|
|
110
|
+
// */
|
|
111
|
+
// microservice(apiName: string): {
|
|
112
|
+
// /**
|
|
113
|
+
// * 同步调用微服务
|
|
114
|
+
// * @param path 请求路径,如:/ping
|
|
115
|
+
// * @param method 请求方法,默认为 GET
|
|
116
|
+
// * @param params 请求参数,默认为 undefined
|
|
117
|
+
// */
|
|
118
|
+
// invoke: (path: string, method?: string, params?: any) => Promise<any>;
|
|
119
|
+
// /**
|
|
120
|
+
// * 异步调用微服务
|
|
121
|
+
// * @param path 请求路径,如:/ping
|
|
122
|
+
// * @param method 请求方法,默认为 GET
|
|
123
|
+
// * @param params 请求参数,默认为 undefined
|
|
124
|
+
// */
|
|
125
|
+
// invokeAsync: (path: string, method?: string, params?: any) => Promise<any>;
|
|
126
|
+
// };
|
|
127
|
+
}
|