Merge branch 'fix-api-field' into 'release/1.0.0'

Fix api field



See merge request !1050673
This commit is contained in:
荣彬 2020-11-18 14:35:12 +08:00
commit 753bb7f277
5 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-datasource-mtop-handler",
"version": "1.0.21",
"version": "1.0.22-alpha.1",
"main": "lib/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
@ -16,7 +16,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@ali/lowcode-datasource-types": "^1.0.21",
"@ali/lowcode-datasource-types": "^1.0.22-alpha.2",
"@ali/universal-mtop": "^5.1.9",
"typescript": "^3.9.7"
},

View File

@ -16,7 +16,7 @@ export function createMtopHandler<T = unknown>(config?: MTopConfig) {
// eslint-disable-next-line space-before-function-paren
return async function(options: RuntimeOptionsConfig): Promise<{ data: T }> {
const response = await mtopRequest.request<T>({
api: options.uri,
api: options.uri || options.api, // 兼容老的结构
v: (options.v as string) || '1.0',
data: options.params,
type: (options.method as Method) || 'get',

View File

@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-datasource-types",
"version": "1.0.21",
"version": "1.0.22-alpha.2",
"main": "lib/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",

View File

@ -30,6 +30,7 @@ export interface InterpretDataSourceConfig {
shouldFetch?: JSFunction;
options?: {
uri: string | JSExpression;
api?: string | JSExpression; // 兼容
params?: JSONObject | JSExpression;
method?: string | JSExpression;
isCors?: boolean | JSExpression;

View File

@ -38,6 +38,7 @@ export type RuntimeOptions = () => RuntimeOptionsConfig;
export interface RuntimeOptionsConfig {
uri: string;
api?: string;
params?: Record<string, unknown>;
method?: string;
isCors?: boolean;