Skip to content

Commit 8393147

Browse files
authoredOct 9, 2024··
Merge pull request #1237 from lowcoder-org/feature-boomi-datasource
Feature Boomi API Datasource
·
v2.4.102.4.11
2 parents 75fc901 + 08631d1 commit 8393147

File tree

5 files changed

+44516
-416
lines changed

5 files changed

+44516
-416
lines changed
 

‎server/node-service/src/plugins/boomi/boomi.spec.json

Lines changed: 43773 additions & 0 deletions
Large diffs are not rendered by default.
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+
import path from "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+
import spec from './boomi.spec.json';
10+
11+
const dataSourceConfig = {
12+
type: "dataSource",
13+
params: [
14+
{
15+
key: "serverURL",
16+
type: "textInput",
17+
label: "Boomi API URL",
18+
rules: [{ required: true, message: "The Boomi API url is required" }],
19+
placeholder: "https://api.boomi.com/api/rest/v1/<atomsphere_account_ID>/",
20+
},
21+
{
22+
"type": "groupTitle",
23+
"key": "basicAuth",
24+
"label": "HTTP Basic Auth"
25+
},
26+
{
27+
"type": "textInput",
28+
"key": "basicAuth.username",
29+
"label": "Username",
30+
"tooltip": "Basic auth username",
31+
"placeholder": "<Basic Auth Username>"
32+
},
33+
{
34+
"type": "password",
35+
"key": "basicAuth.password",
36+
"label": "Password",
37+
"tooltip": "Basic auth password",
38+
"placeholder": "<Basic Auth Password>"
39+
}
40+
]
41+
} as const;
42+
43+
const parseOptions: ParseOpenApiOptions = {
44+
actionLabel: (method: string, path: string, operation: OpenAPI.Operation) => {
45+
return _.upperFirst(operation.operationId || "");
46+
},
47+
};
48+
49+
type DataSourceConfigType = ConfigToType<typeof dataSourceConfig>;
50+
51+
const boomiPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
52+
id: "boomi",
53+
name: "Boomi",
54+
icon: "boomi.svg",
55+
category: "Workflow",
56+
dataSourceConfig,
57+
queryConfig: async () => {
58+
const { actions, categories } = await parseOpenApi(spec as unknown as OpenAPI.Document, parseOptions);
59+
return {
60+
type: "query",
61+
label: "Action",
62+
categories: {
63+
label: "Resources",
64+
items: categories,
65+
},
66+
actions,
67+
};
68+
},
69+
run: function (actionData, dataSourceConfig): Promise<any> {
70+
const { serverURL, ...otherDataSourceConfig } = dataSourceConfig;
71+
const runApiDsConfig = {
72+
url: "",
73+
serverURL: "",
74+
dynamicParamsConfig: otherDataSourceConfig,
75+
};
76+
return runOpenApi(actionData, runApiDsConfig, spec as OpenAPIV3.Document);
77+
},
78+
};
79+
80+
export default boomiPlugin;
81+

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import postmanEchoPlugin from "./postmanEcho";
3939
import lowcoderPlugin from "./lowcoder";
4040
import supabaseApiPlugin from "./supabaseApi";
4141
import firebirdsqlPlugin from "./firebirdsql";
42+
import boomiPlugin from "./boomi";
4243

4344
let plugins: (DataSourcePlugin | DataSourcePluginFactory)[] = [
4445

@@ -77,6 +78,7 @@ let plugins: (DataSourcePlugin | DataSourcePluginFactory)[] = [
7778

7879
// Workflow
7980
n8nPlugin,
81+
boomiPlugin,
8082

8183
// Messaging
8284
twilioPlugin,
Lines changed: 1 addition & 0 deletions
Loading

‎server/node-service/yarn.lock

Lines changed: 659 additions & 416 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.