Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22b00f5

Browse files
committed
format code styles
1 parent 88e18a3 commit 22b00f5

File tree

8 files changed

+90
-84
lines changed

8 files changed

+90
-84
lines changed
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { ConfigToType } from "openblocks-sdk/dataSource";
22

33
export const dataSourceConfig = {
4-
type: "dataSource",
5-
params: [
6-
{
7-
key: "privateKey",
8-
label: "Private Key",
9-
type: "password",
10-
tooltip:
11-
"The private key associated with a Service Account with Big Query privileges, [Documentation](https://cloud.google.com/iam/docs/service-accounts) for service accounts.",
12-
rules: [
13-
{ required: true, message: "Please input your private key of google Service Account" },
14-
],
15-
},
16-
{
17-
key: "region",
18-
type: "textInput",
19-
label: "Region",
20-
tooltip: '[Documentation](https://cloud.google.com/bigquery/docs/locations)'
21-
}
22-
],
4+
type: "dataSource",
5+
params: [
6+
{
7+
key: "privateKey",
8+
label: "Private Key",
9+
type: "password",
10+
tooltip:
11+
"The private key associated with a Service Account with Big Query privileges, [Documentation](https://cloud.google.com/iam/docs/service-accounts) for service accounts.",
12+
rules: [
13+
{ required: true, message: "Please input your private key of google Service Account" },
14+
],
15+
},
16+
{
17+
key: "region",
18+
type: "textInput",
19+
label: "Region",
20+
tooltip: "[Documentation](https://cloud.google.com/bigquery/docs/locations)",
21+
},
22+
],
2323
} as const;
2424

2525
export type DataSourceDataType = ConfigToType<typeof dataSourceConfig>;

server/node-service/src/plugins/bigQuery/queryConfig.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { ConfigToType } from "openblocks-sdk/dataSource";
22

33
const queryConfig = {
4-
type: "query",
5-
label: "Action",
6-
actions: [
7-
{
8-
actionName: "Query",
9-
label: "Query",
10-
params: [
11-
{
12-
label: "Google SQL",
13-
key: "googleSQL",
14-
type: "sqlInput",
15-
},
16-
],
17-
},
18-
],
4+
type: "query",
5+
label: "Action",
6+
actions: [
7+
{
8+
actionName: "Query",
9+
label: "Query",
10+
params: [
11+
{
12+
label: "Google SQL",
13+
key: "googleSQL",
14+
type: "sqlInput",
15+
},
16+
],
17+
},
18+
],
1919
} as const;
2020

2121
export type ActionDataType = ConfigToType<typeof queryConfig>;
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
import { DataSourceDataType } from "./dataSourceConfig";
22
import { ActionDataType } from "./queryConfig";
33
import { BigQuery } from "@google-cloud/bigquery";
4-
import log from "loglevel";
54

65
function getClient(params: DataSourceDataType) {
7-
return new BigQuery({
8-
credentials: JSON.parse(params.privateKey),
9-
location: params.region
10-
});
6+
return new BigQuery({
7+
credentials: JSON.parse(params.privateKey),
8+
location: params.region,
9+
});
1110
}
1211

1312
export async function validateDataSourceConfig(dataSourceConfig: DataSourceDataType) {
14-
try {
15-
const client = getClient(dataSourceConfig);
16-
await client.getDatasets();
17-
return {
18-
success: true,
19-
};
20-
} catch (e) {
21-
throw e;
22-
}
13+
try {
14+
const client = getClient(dataSourceConfig);
15+
await client.getDatasets();
16+
return {
17+
success: true,
18+
};
19+
} catch (e) {
20+
throw e;
21+
}
2322
}
2423

2524
export default async function run(action: ActionDataType, dataSourceConfig: DataSourceDataType) {
26-
const client = getClient(dataSourceConfig);
27-
if (action.actionName === 'Query') {
28-
const [results] = await client.query(action.googleSQL)
29-
return results;
30-
}
25+
const client = getClient(dataSourceConfig);
26+
if (action.actionName === "Query") {
27+
const [results] = await client.query(action.googleSQL);
28+
return results;
29+
}
3130
}

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ const dataSourceConfig = {
1010
type: "dataSource",
1111
params: [
1212
{
13-
"type": "password",
14-
"key": "app_key.value",
15-
"label": "REST API Key",
16-
'tooltip': 'Private key used for most API calls like sending push notifications and updating users. [Documentation](https://documentation.onesignal.com/docs/accounts-and-keys#rest-api-key)'
13+
type: "password",
14+
key: "app_key.value",
15+
label: "REST API Key",
16+
tooltip:
17+
"Private key used for most API calls like sending push notifications and updating users. [Documentation](https://documentation.onesignal.com/docs/accounts-and-keys#rest-api-key)",
1718
},
1819
{
19-
"type": "password",
20-
"key": "user_key.value",
21-
"label": "User Auth Key",
22-
'tooltip': 'Another type of REST API key used for viewing Apps and related updates. [Documentation](https://documentation.onesignal.com/docs/accounts-and-keys#user-auth-key)'
23-
}
24-
]
20+
type: "password",
21+
key: "user_key.value",
22+
label: "User Auth Key",
23+
tooltip:
24+
"Another type of REST API key used for viewing Apps and related updates. [Documentation](https://documentation.onesignal.com/docs/accounts-and-keys#user-auth-key)",
25+
},
26+
],
2527
} as const;
2628

2729
const parseOptions: ParseOpenApiOptions = {
@@ -39,7 +41,10 @@ const oneSignalPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
3941
category: "api",
4042
dataSourceConfig,
4143
queryConfig: async () => {
42-
const { actions, categories } = await parseOpenApi(spec as unknown as OpenAPI.Document, parseOptions);
44+
const { actions, categories } = await parseOpenApi(
45+
spec as unknown as OpenAPI.Document,
46+
parseOptions
47+
);
4348
return {
4449
type: "query",
4550
label: "Action",

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ const dataSourceConfig = {
1010
type: "dataSource",
1111
params: [
1212
{
13-
"type": "password",
14-
"key": "Authorization.value",
15-
"label": "API Key",
16-
"tooltip": "[Documentation](https://docs.sendgrid.com/ui/account-and-settings/api-keys#creating-an-api-key)"
17-
}
18-
]
13+
type: "password",
14+
key: "Authorization.value",
15+
label: "API Key",
16+
tooltip:
17+
"[Documentation](https://docs.sendgrid.com/ui/account-and-settings/api-keys#creating-an-api-key)",
18+
},
19+
],
1920
} as const;
2021

2122
const parseOptions: ParseOpenApiOptions = {
22-
actionLabel: (method: string, path: string, operation: OpenAPI.Operation) => operation.operationId?.replace('_', ' ') || "",
23+
actionLabel: (method: string, path: string, operation: OpenAPI.Operation) =>
24+
operation.operationId?.replace("_", " ") || "",
2325
};
2426

2527
type DataSourceConfigType = ConfigToType<typeof dataSourceConfig>;
@@ -31,7 +33,10 @@ const sendGridPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
3133
category: "api",
3234
dataSourceConfig,
3335
queryConfig: async () => {
34-
const { actions, categories } = await parseOpenApi(spec as unknown as OpenAPI.Document, parseOptions);
36+
const { actions, categories } = await parseOpenApi(
37+
spec as unknown as OpenAPI.Document,
38+
parseOptions
39+
);
3540
return {
3641
type: "query",
3742
label: "Action",
@@ -48,10 +53,10 @@ const sendGridPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
4853
serverURL: "https://api.sendgrid.com/v3",
4954
dynamicParamsConfig: {
5055
...dataSourceConfig,
51-
'Authorization.value': 'Bearer ' + dataSourceConfig['Authorization.value']
56+
"Authorization.value": "Bearer " + dataSourceConfig["Authorization.value"],
5257
},
5358
};
54-
return runOpenApi(actionData, runApiDsConfig, spec as OpenAPIV3.Document);
59+
return runOpenApi(actionData, runApiDsConfig, spec as unknown as OpenAPIV3.Document);
5560
},
5661
};
5762

server/node-service/src/plugins/slack/dataSourceConfig.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ export const dataSourceConfig = {
77
key: "webhookURL",
88
label: "Webhook URL",
99
type: "password",
10-
tooltip:
11-
"[Documentation](https://my.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks)",
12-
rules: [
13-
{ required: true, message: "Please input your webhook URL" },
14-
],
15-
}
10+
tooltip: "[Documentation](https://my.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks)",
11+
rules: [{ required: true, message: "Please input your webhook URL" }],
12+
},
1613
],
1714
} as const;
1815

server/node-service/src/plugins/slack/queryConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const queryConfig = {
1717
label: "Channel",
1818
key: "channel",
1919
type: "textInput",
20-
}
20+
},
2121
],
2222
},
2323
],

server/node-service/src/plugins/slack/run.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { fetch } from "../../common/fetch";
44

55
export default async function run(action: ActionDataType, dataSourceConfig: DataSourceDataType) {
66
const params = new URLSearchParams();
7-
params.append('payload', JSON.stringify({ channel: action.channel, text: action.message }));
7+
params.append("payload", JSON.stringify({ channel: action.channel, text: action.message }));
88

99
return await fetch(dataSourceConfig.webhookURL, {
10-
method: 'POST',
10+
method: "POST",
1111
body: params,
12-
}).then(value => value.text())
12+
}).then((value) => value.text());
1313
}

0 commit comments

Comments
 (0)