@oneuptime/common 7.0.3707 → 7.0.3708
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Server/Services/WorkspaceNotificationRuleService.ts +205 -11
- package/Server/Services/WorkspaceProjectAuthTokenService.ts +1 -0
- package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +18 -7
- package/Server/Utils/Workspace/Slack/Slack.ts +352 -45
- package/Server/Utils/Workspace/Slack/app-manifest.json +9 -4
- package/Server/Utils/Workspace/WorkspaceBase.ts +31 -2
- package/Types/Workflow/Component.ts +1 -0
- package/Types/Workflow/Components/BaseModel.ts +30 -0
- package/Types/Workflow/Components/Manual.ts +10 -0
- package/Types/Workflow/Components/Schedule.ts +1 -0
- package/Types/Workflow/Components/Webhook.ts +26 -0
- package/UI/Components/Workflow/RunForm.tsx +23 -25
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +136 -8
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +1 -0
- package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +14 -5
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +251 -36
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +9 -4
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +12 -2
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
- package/build/dist/Types/Workflow/Components/BaseModel.js +30 -0
- package/build/dist/Types/Workflow/Components/BaseModel.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Manual.js +10 -0
- package/build/dist/Types/Workflow/Components/Manual.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Schedule.js +1 -0
- package/build/dist/Types/Workflow/Components/Schedule.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Webhook.js +26 -0
- package/build/dist/Types/Workflow/Components/Webhook.js.map +1 -1
- package/build/dist/UI/Components/Workflow/RunForm.js +16 -14
- package/build/dist/UI/Components/Workflow/RunForm.js.map +1 -1
- package/package.json +2 -2
- /package/Server/Utils/Workspace/Slack/{app-manifest-temp.json → app-manifest.example.json} +0 -0
|
@@ -21,6 +21,13 @@ export interface WorkspaceChannel {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export default class WorkspaceBase {
|
|
24
|
+
public static async joinChannel(_data: {
|
|
25
|
+
authToken: string;
|
|
26
|
+
channelId: string;
|
|
27
|
+
}): Promise<void> {
|
|
28
|
+
throw new NotImplementedException();
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
public static async sendPayloadBlocksToChannel(_data: {
|
|
25
32
|
authToken: string;
|
|
26
33
|
channelId: string;
|
|
@@ -50,7 +57,7 @@ export default class WorkspaceBase {
|
|
|
50
57
|
workspaceUserIds: Array<string>;
|
|
51
58
|
}): Promise<void> {
|
|
52
59
|
for (const userId of data.workspaceUserIds) {
|
|
53
|
-
await this.
|
|
60
|
+
await this.inviteUserToChannelByChannelName({
|
|
54
61
|
authToken: data.authToken,
|
|
55
62
|
channelName: data.channelName,
|
|
56
63
|
workspaceUserId: userId,
|
|
@@ -58,7 +65,7 @@ export default class WorkspaceBase {
|
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
public static async
|
|
68
|
+
public static async inviteUserToChannelByChannelName(_data: {
|
|
62
69
|
authToken: string;
|
|
63
70
|
channelName: string;
|
|
64
71
|
workspaceUserId: string;
|
|
@@ -66,6 +73,12 @@ export default class WorkspaceBase {
|
|
|
66
73
|
throw new NotImplementedException();
|
|
67
74
|
}
|
|
68
75
|
|
|
76
|
+
public static async inviteUserToChannelByChannelId(_data: {
|
|
77
|
+
authToken: string;
|
|
78
|
+
channelId: string;
|
|
79
|
+
workspaceUserId: string;
|
|
80
|
+
}): Promise<void> {}
|
|
81
|
+
|
|
69
82
|
public static async createChannelsIfDoesNotExist(_data: {
|
|
70
83
|
authToken: string;
|
|
71
84
|
channelNames: Array<string>;
|
|
@@ -83,6 +96,7 @@ export default class WorkspaceBase {
|
|
|
83
96
|
public static async sendMessage(_data: {
|
|
84
97
|
workspaceMessagePayload: WorkspaceMessagePayload;
|
|
85
98
|
authToken: string; // which auth token should we use to send.
|
|
99
|
+
userId: string;
|
|
86
100
|
}): Promise<void> {
|
|
87
101
|
throw new NotImplementedException();
|
|
88
102
|
}
|
|
@@ -93,6 +107,13 @@ export default class WorkspaceBase {
|
|
|
93
107
|
throw new NotImplementedException();
|
|
94
108
|
}
|
|
95
109
|
|
|
110
|
+
public static async getWorkspaceChannelFromChannelName(_data: {
|
|
111
|
+
authToken: string;
|
|
112
|
+
channelName: string;
|
|
113
|
+
}): Promise<WorkspaceChannel> {
|
|
114
|
+
throw new NotImplementedException();
|
|
115
|
+
}
|
|
116
|
+
|
|
96
117
|
public static async createChannel(_data: {
|
|
97
118
|
authToken: string;
|
|
98
119
|
channelName: string;
|
|
@@ -166,4 +187,12 @@ export default class WorkspaceBase {
|
|
|
166
187
|
}): Promise<HTTPResponse<JSONObject> | HTTPErrorResponse> {
|
|
167
188
|
throw new NotImplementedException();
|
|
168
189
|
}
|
|
190
|
+
|
|
191
|
+
public static async isUserInChannel(_data: {
|
|
192
|
+
authToken: string;
|
|
193
|
+
channelId: string;
|
|
194
|
+
userId: string;
|
|
195
|
+
}): Promise<boolean> {
|
|
196
|
+
throw new NotImplementedException();
|
|
197
|
+
}
|
|
169
198
|
}
|
|
@@ -157,6 +157,16 @@ export default class BaseModelComponent {
|
|
|
157
157
|
iconProp: IconProp.Bolt,
|
|
158
158
|
tableName: model.tableName!,
|
|
159
159
|
componentType: ComponentType.Trigger,
|
|
160
|
+
runWorkflowManuallyArguments: [
|
|
161
|
+
{
|
|
162
|
+
type: ComponentInputType.Text,
|
|
163
|
+
name: `${model.singularName} ID`,
|
|
164
|
+
description: `Please provide the ID of the ${model.singularName}, if you wish to run this workflow manually.`,
|
|
165
|
+
required: true,
|
|
166
|
+
id: "_id",
|
|
167
|
+
placeholder: `ID of the ${model.singularName}`,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
160
170
|
arguments: [],
|
|
161
171
|
returnValues: [
|
|
162
172
|
{
|
|
@@ -288,6 +298,16 @@ export default class BaseModelComponent {
|
|
|
288
298
|
iconProp: IconProp.Bolt,
|
|
289
299
|
tableName: model.tableName!,
|
|
290
300
|
componentType: ComponentType.Trigger,
|
|
301
|
+
runWorkflowManuallyArguments: [
|
|
302
|
+
{
|
|
303
|
+
type: ComponentInputType.Text,
|
|
304
|
+
name: `${model.singularName} ID`,
|
|
305
|
+
description: `Please provide the ID of the ${model.singularName}, if you wish to run this workflow manually.`,
|
|
306
|
+
required: true,
|
|
307
|
+
id: "_id",
|
|
308
|
+
placeholder: `ID of the ${model.singularName}`,
|
|
309
|
+
},
|
|
310
|
+
],
|
|
291
311
|
arguments: [
|
|
292
312
|
{
|
|
293
313
|
type: ComponentInputType.Select,
|
|
@@ -430,6 +450,16 @@ export default class BaseModelComponent {
|
|
|
430
450
|
iconProp: IconProp.Bolt,
|
|
431
451
|
tableName: model.tableName!,
|
|
432
452
|
componentType: ComponentType.Trigger,
|
|
453
|
+
runWorkflowManuallyArguments: [
|
|
454
|
+
{
|
|
455
|
+
type: ComponentInputType.Text,
|
|
456
|
+
name: `${model.singularName} ID`,
|
|
457
|
+
description: `Please provide the ID of the ${model.singularName}, if you wish to run this workflow manually.`,
|
|
458
|
+
required: true,
|
|
459
|
+
id: "_id",
|
|
460
|
+
placeholder: `ID of the ${model.singularName}`,
|
|
461
|
+
},
|
|
462
|
+
],
|
|
433
463
|
arguments: [
|
|
434
464
|
{
|
|
435
465
|
type: ComponentInputType.Select,
|
|
@@ -14,6 +14,16 @@ const components: Array<ComponentMetadata> = [
|
|
|
14
14
|
iconProp: IconProp.Play,
|
|
15
15
|
componentType: ComponentType.Trigger,
|
|
16
16
|
arguments: [],
|
|
17
|
+
runWorkflowManuallyArguments: [
|
|
18
|
+
{
|
|
19
|
+
type: ComponentInputType.JSON,
|
|
20
|
+
name: "JSON",
|
|
21
|
+
description: "Enter JSON value that you need to run this workflow",
|
|
22
|
+
required: false,
|
|
23
|
+
id: "value",
|
|
24
|
+
placeholder: '{"key1": "value1", "key2": "value2", ....}',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
17
27
|
returnValues: [
|
|
18
28
|
{
|
|
19
29
|
type: ComponentInputType.JSON,
|
|
@@ -13,6 +13,7 @@ const components: Array<ComponentMetadata> = [
|
|
|
13
13
|
description: "Run this workflow on particular schedule",
|
|
14
14
|
iconProp: IconProp.Clock,
|
|
15
15
|
componentType: ComponentType.Trigger,
|
|
16
|
+
runWorkflowManuallyArguments: [],
|
|
16
17
|
arguments: [
|
|
17
18
|
{
|
|
18
19
|
type: ComponentInputType.CronTab,
|
|
@@ -17,6 +17,32 @@ const components: Array<ComponentMetadata> = [
|
|
|
17
17
|
componentType: ComponentType.Trigger,
|
|
18
18
|
documentationLink: Route.fromString("/workflow/docs/Webhook.md"),
|
|
19
19
|
arguments: [],
|
|
20
|
+
runWorkflowManuallyArguments: [
|
|
21
|
+
{
|
|
22
|
+
id: "request-headers",
|
|
23
|
+
name: "Request Headers",
|
|
24
|
+
description: "Request Headers for this request",
|
|
25
|
+
type: ComponentInputType.StringDictionary,
|
|
26
|
+
required: false,
|
|
27
|
+
placeholder: '{"header1": "value1", "header2": "value2", ....}',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "request-params",
|
|
31
|
+
name: "Request Query Params",
|
|
32
|
+
description: "Request Query Params for this request",
|
|
33
|
+
type: ComponentInputType.StringDictionary,
|
|
34
|
+
required: false,
|
|
35
|
+
placeholder: '{"query1": "value1", "query2": "value2", ....}',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "request-body",
|
|
39
|
+
name: "Request Body",
|
|
40
|
+
description: "Request Body",
|
|
41
|
+
type: ComponentInputType.JSON,
|
|
42
|
+
required: false,
|
|
43
|
+
placeholder: '{"key1": "value1", "key2": "value2", ....}',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
20
46
|
returnValues: [
|
|
21
47
|
{
|
|
22
48
|
id: "request-headers",
|
|
@@ -3,7 +3,7 @@ import BasicForm, { FormProps } from "../Forms/BasicForm";
|
|
|
3
3
|
import FormValues from "../Forms/Types/FormValues";
|
|
4
4
|
import { componentInputTypeToFormFieldType } from "./Utils";
|
|
5
5
|
import { JSONObject } from "Common/Types/JSON";
|
|
6
|
-
import {
|
|
6
|
+
import { Argument, NodeDataProp } from "Common/Types/Workflow/Component";
|
|
7
7
|
import React, {
|
|
8
8
|
FunctionComponent,
|
|
9
9
|
ReactElement,
|
|
@@ -38,34 +38,32 @@ const RunForm: FunctionComponent<ComponentProps> = (
|
|
|
38
38
|
<div className="mb-3 mt-3">
|
|
39
39
|
<div className="mt-5 mb-5">
|
|
40
40
|
<h2 className="text-base font-medium text-gray-500">
|
|
41
|
-
|
|
41
|
+
Run {component.metadata.title}
|
|
42
42
|
</h2>
|
|
43
43
|
<p className="text-sm font-medium text-gray-400 mb-5">
|
|
44
|
-
|
|
45
|
-
returns some values to work. You can pass these return values from
|
|
46
|
-
trigger manually and test this workflow.
|
|
44
|
+
{component.metadata.description}
|
|
47
45
|
</p>
|
|
48
|
-
{component.metadata.
|
|
49
|
-
component.metadata.
|
|
46
|
+
{component.metadata.runWorkflowManuallyArguments &&
|
|
47
|
+
component.metadata.runWorkflowManuallyArguments.length === 0 && (
|
|
50
48
|
<ErrorMessage
|
|
51
49
|
message={
|
|
52
|
-
'This workflow trigger does not take any
|
|
50
|
+
'This workflow trigger does not take any values. You can run it by clicking the "Run" button below.'
|
|
53
51
|
}
|
|
54
52
|
/>
|
|
55
53
|
)}
|
|
56
|
-
{component.metadata.
|
|
57
|
-
component.metadata.
|
|
54
|
+
{component.metadata.runWorkflowManuallyArguments &&
|
|
55
|
+
component.metadata.runWorkflowManuallyArguments.length > 0 && (
|
|
58
56
|
<BasicForm
|
|
59
57
|
hideSubmitButton={true}
|
|
60
58
|
ref={formRef}
|
|
61
59
|
initialValues={{
|
|
62
|
-
...(component.
|
|
60
|
+
...(component.arguments || {}),
|
|
63
61
|
}}
|
|
64
62
|
onChange={(values: FormValues<JSONObject>) => {
|
|
65
63
|
setComponent({
|
|
66
64
|
...component,
|
|
67
|
-
|
|
68
|
-
...((component.
|
|
65
|
+
arguments: {
|
|
66
|
+
...((component.arguments as JSONObject) || {}),
|
|
69
67
|
...((values as JSONObject) || {}),
|
|
70
68
|
},
|
|
71
69
|
});
|
|
@@ -74,25 +72,25 @@ const RunForm: FunctionComponent<ComponentProps> = (
|
|
|
74
72
|
setHasFormValidationErrors(hasError);
|
|
75
73
|
}}
|
|
76
74
|
fields={
|
|
77
|
-
component.metadata.
|
|
78
|
-
component.metadata.
|
|
79
|
-
(
|
|
75
|
+
component.metadata.runWorkflowManuallyArguments &&
|
|
76
|
+
component.metadata.runWorkflowManuallyArguments.map(
|
|
77
|
+
(argument: Argument) => {
|
|
80
78
|
return {
|
|
81
|
-
title: `${
|
|
79
|
+
title: `${argument.name}`,
|
|
82
80
|
|
|
83
81
|
description: `${
|
|
84
|
-
|
|
85
|
-
}. ${
|
|
82
|
+
argument.required ? "Required" : "Optional"
|
|
83
|
+
}. ${argument.description}`,
|
|
86
84
|
field: {
|
|
87
|
-
[
|
|
85
|
+
[argument.id]: true,
|
|
88
86
|
},
|
|
89
|
-
required:
|
|
90
|
-
placeholder:
|
|
87
|
+
required: argument.required,
|
|
88
|
+
placeholder: argument.placeholder,
|
|
91
89
|
...componentInputTypeToFormFieldType(
|
|
92
|
-
|
|
90
|
+
argument.type,
|
|
93
91
|
component.returnValues &&
|
|
94
|
-
component.returnValues[
|
|
95
|
-
? component.returnValues[
|
|
92
|
+
component.returnValues[argument.id]
|
|
93
|
+
? component.returnValues[argument.id]
|
|
96
94
|
: null,
|
|
97
95
|
),
|
|
98
96
|
};
|