Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ab618b

Browse files
Merge branch 'dev' into fix/table-styles
2 parents4c316ea +8288a82 commit4ab618b

File tree

6 files changed

+186565
-41056
lines changed

6 files changed

+186565
-41056
lines changed

‎server/node-service/src/plugins/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import bigQueryPlugin from "./bigQuery";
3535
importappConfigPluginfrom"./appconfig";
3636
importtursoPluginfrom"./turso";
3737
importpostmanEchoPluginfrom"./postmanEcho";
38+
importlowcoderPluginfrom"./lowcoder";
3839

3940
letplugins:(DataSourcePlugin|DataSourcePluginFactory)[]=[
4041
s3Plugin,
@@ -73,6 +74,7 @@ let plugins: (DataSourcePlugin | DataSourcePluginFactory)[] = [
7374
appConfigPlugin,
7475
tursoPlugin,
7576
postmanEchoPlugin,
77+
lowcoderPlugin,
7678
];
7779

7880
try{
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import{readYaml}from"../../common/util";
2+
import_from"lodash";
3+
importpathfrom"path";
4+
import{OpenAPIV3,OpenAPI}from"openapi-types";
5+
import{ConfigToType,DataSourcePlugin}from"lowcoder-sdk/dataSource";
6+
import{runOpenApi}from"../openApi";
7+
import{parseOpenApi,ParseOpenApiOptions}from"../openApi/parse";
8+
9+
importspecfrom'./lowcoder.spec.json';
10+
11+
constdataSourceConfig={
12+
type:"dataSource",
13+
params:[
14+
{
15+
key:"serverURL",
16+
type:"textInput",
17+
label:"Lowcoder API Service URL",
18+
rules:[{required:true}],
19+
placeholder:"https://<your-lowcoder-api-service>:port",
20+
tooltip:"Input the server url of your self-hosting instance or api-service.lowcoder.cloud if you are running your apps on the free public Community Edition Cloud Service.",
21+
},
22+
{
23+
"type":"groupTitle",
24+
"key":"API Key",
25+
"label":"Api Key Auth"
26+
},
27+
{
28+
type:"password",
29+
key:"bearerAuth.value",
30+
label:"Authorization",
31+
"tooltip":"API Key Authentication with a Bearer token. Copy your API Key here. (e.g. 'Bearer eyJhbGciO...')",
32+
"placeholder":"API Key Authentication with a Bearer token. Copy your API Key here. (e.g. 'Bearer eyJhbGciO...')"
33+
}
34+
]
35+
}asconst;
36+
37+
constparseOptions:ParseOpenApiOptions={
38+
actionLabel:(method:string,path:string,operation:OpenAPI.Operation)=>{
39+
return_.upperFirst(operation.operationId||"");
40+
},
41+
};
42+
43+
typeDataSourceConfigType=ConfigToType<typeofdataSourceConfig>;
44+
45+
constlowcoderPlugin:DataSourcePlugin<any,DataSourceConfigType>={
46+
id:"lowcoder",
47+
name:"Lowcoder API",
48+
icon:"lowcoder.svg",
49+
category:"api",
50+
dataSourceConfig,
51+
queryConfig:async()=>{
52+
const{ actions, categories}=awaitparseOpenApi(specasunknownasOpenAPI.Document,parseOptions);
53+
return{
54+
type:"query",
55+
label:"Action",
56+
categories:{
57+
label:"Resources",
58+
items:categories,
59+
},
60+
actions,
61+
};
62+
},
63+
run:function(actionData,dataSourceConfig):Promise<any>{
64+
const{ serverURL, ...otherDataSourceConfig}=dataSourceConfig;
65+
console.log("Lowcoder API Plugin: run",serverURL,otherDataSourceConfig);
66+
construnApiDsConfig={
67+
url:"",
68+
serverURL:serverURL,
69+
dynamicParamsConfig:otherDataSourceConfig,
70+
};
71+
returnrunOpenApi(actionData,runApiDsConfig,specasOpenAPIV3.Document);
72+
},
73+
};
74+
75+
exportdefaultlowcoderPlugin;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp