mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-02 15:27:18 +00:00
fix: 代码结构调整
This commit is contained in:
parent
64a477cf35
commit
af4bc83cc3
@ -16,7 +16,7 @@ export function createMopenHandler<T = unknown>(
|
|||||||
appKey: MOPEN_APPKEY_XSPACE_PRE_ONLINE,
|
appKey: MOPEN_APPKEY_XSPACE_PRE_ONLINE,
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
return async function (options: RuntimeOptionsConfig): Promise<{ data: T }> {
|
return async function(options: RuntimeOptionsConfig): Promise<{ data: T }> {
|
||||||
const { data, response } = await MopenClient.request<T>({
|
const { data, response } = await MopenClient.request<T>({
|
||||||
config,
|
config,
|
||||||
...options,
|
...options,
|
||||||
|
|||||||
@ -9,9 +9,11 @@ export type DataType = 'jsonp' | 'json' | 'originaljsonp';
|
|||||||
// 考虑一下 mtop 类型的问题,官方没有提供 ts 文件
|
// 考虑一下 mtop 类型的问题,官方没有提供 ts 文件
|
||||||
export function createMtopHandler<T = unknown>(config?: MTopConfig) {
|
export function createMtopHandler<T = unknown>(config?: MTopConfig) {
|
||||||
if (config && Object.keys(config).length > 0) {
|
if (config && Object.keys(config).length > 0) {
|
||||||
Object.keys(config).forEach((key: string) => mtopRequest.config(key, config[key]));
|
Object.keys(config).forEach((key: string) =>
|
||||||
|
mtopRequest.config(key, config[key]),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return async function (options: RuntimeOptionsConfig): Promise<{ data: T }> {
|
return async function(options: RuntimeOptionsConfig): Promise<{ data: T }> {
|
||||||
const response = await mtopRequest.request<T>({
|
const response = await mtopRequest.request<T>({
|
||||||
api: options.uri,
|
api: options.uri,
|
||||||
v: (options.v as string) || '1.0',
|
v: (options.v as string) || '1.0',
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-types": "^1.0.10",
|
"@ali/lowcode-types": "^0.8.13",
|
||||||
"query-string": "^6.13.1",
|
"query-string": "^6.13.1",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^3.9.7"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import qs from 'query-string';
|
import qs from 'query-string';
|
||||||
import { UrlParamsHandler } from '@ali/lowcode-types';
|
import { UrlParamsHandler } from '@ali/lowcode-types';
|
||||||
|
|
||||||
export function createUrlParamsHandler<T = unknown>(
|
export function createUrlParamsHandler<T = unknown>(searchString: string | T = ''): UrlParamsHandler<T> {
|
||||||
searchString: string | T = '',
|
return async function(): Promise<T> {
|
||||||
): UrlParamsHandler<T> {
|
|
||||||
return async function (): Promise<T> {
|
|
||||||
if (typeof searchString === 'string') {
|
if (typeof searchString === 'string') {
|
||||||
const params = (qs.parse(searchString) as unknown) as T;
|
const params = (qs.parse(searchString) as unknown) as T;
|
||||||
return params;
|
return params;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user