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

Commitdfd71b5

Browse files
author
FalkWolsky
committed
Supabase Management API as Data Source
1 parenta62f1f2 commitdfd71b5

File tree

3 files changed

+7603
-0
lines changed

3 files changed

+7603
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import appConfigPlugin from "./appconfig";
3636
importtursoPluginfrom"./turso";
3737
importpostmanEchoPluginfrom"./postmanEcho";
3838
importlowcoderPluginfrom"./lowcoder";
39+
importsupabaseApiPluginfrom"./supabaseApi";
3940

4041
letplugins:(DataSourcePlugin|DataSourcePluginFactory)[]=[
4142
s3Plugin,
@@ -75,6 +76,7 @@ let plugins: (DataSourcePlugin | DataSourcePluginFactory)[] = [
7576
tursoPlugin,
7677
postmanEchoPlugin,
7778
lowcoderPlugin,
79+
supabaseApiPlugin,
7880
];
7981

8082
try{
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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'./supabaseApi.spec.json';
10+
11+
constdataSourceConfig={
12+
type:"dataSource",
13+
params:[
14+
{
15+
"type":"groupTitle",
16+
"key":"serverURL",
17+
"label":"Supabase API Url"
18+
},
19+
{
20+
key:"serverURL",
21+
type:"textInput",
22+
label:"Server URL",
23+
rules:[{required:true,message:"The server url is required"}],
24+
placeholder:"https://<your couchdb server host>",
25+
},
26+
{
27+
"type":"groupTitle",
28+
"key":"bearerAuth",
29+
"label":"Api Token Auth"
30+
},
31+
{
32+
"type":"password",
33+
"key":"bearerAuth.value",
34+
"label":"Token",
35+
"tooltip":"API Key Authentication with a Bearer token. Copy your API Key from Supabase here. (e.g. 'eyJhbGciO...'",
36+
"placeholder":"API Key Authentication with a Bearer token. Copy your API Key from Supabase here. (e.g. 'eyJhbGciO...'"
37+
}
38+
]
39+
}asconst;
40+
41+
constparseOptions:ParseOpenApiOptions={
42+
actionLabel:(method:string,path:string,operation:OpenAPI.Operation)=>{
43+
return_.upperFirst(operation.operationId||"");
44+
},
45+
};
46+
47+
typeDataSourceConfigType=ConfigToType<typeofdataSourceConfig>;
48+
49+
constsupabaseApiPlugin:DataSourcePlugin<any,DataSourceConfigType>={
50+
id:"supabaseApi",
51+
name:"Supabase Mgmt API",
52+
icon:"supabase.svg",
53+
category:"api",
54+
dataSourceConfig,
55+
queryConfig:async()=>{
56+
const{ actions, categories}=awaitparseOpenApi(specasunknownasOpenAPI.Document,parseOptions);
57+
return{
58+
type:"query",
59+
label:"Action",
60+
categories:{
61+
label:"Resources",
62+
items:categories,
63+
},
64+
actions,
65+
};
66+
},
67+
run:function(actionData,dataSourceConfig):Promise<any>{
68+
const{ serverURL, ...otherDataSourceConfig}=dataSourceConfig;
69+
construnApiDsConfig={
70+
url:"",
71+
serverURL:serverURL,
72+
dynamicParamsConfig:otherDataSourceConfig,
73+
};
74+
75+
console.log("runApiDsConfig",runApiDsConfig);
76+
77+
returnrunOpenApi(actionData,runApiDsConfig,specasOpenAPIV3.Document);
78+
},
79+
};
80+
81+
exportdefaultsupabaseApiPlugin;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp