Skip to content

Commit cff9363

Browse files
authored
Merge pull request #360 from code0-tech/feat/#359
Rework rest flow type, rest and http functions
2 parents b05a165 + 92f88e1 commit cff9363

16 files changed

Lines changed: 507 additions & 47 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"identifier": "REST_AUTH_TYPE",
3+
"name": [
4+
{
5+
"code": "en-US",
6+
"content": "Webhook credential variant"
7+
}
8+
],
9+
"alias": [
10+
{
11+
"code": "en-US",
12+
"content": "webhook;rest;auth;credential;type;variant;bearer;basic;jwt"
13+
}
14+
],
15+
"displayMessage": [
16+
{
17+
"code": "en-US",
18+
"content": "Webhook credential variant"
19+
}
20+
],
21+
"type": "'Bearer JWT' | 'Bearer static' | 'Basic'",
22+
"linkedDataTypeIdentifiers": [],
23+
"rules": []
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"identifier": "REST_AUTH_VALUE",
3+
"name": [
4+
{
5+
"code": "en-US",
6+
"content": "Webhook credential value"
7+
}
8+
],
9+
"alias": [
10+
{
11+
"code": "en-US",
12+
"content": "webhook;rest;auth;credential;value;bearer;basic;username;password;token"
13+
}
14+
],
15+
"displayMessage": [
16+
{
17+
"code": "en-US",
18+
"content": "Webhook credential value"
19+
}
20+
],
21+
"genericKeys": ["T"],
22+
"type": "T extends 'Basic' ? { username: string, password: string } : T extends undefined ? undefined : string",
23+
"linkedDataTypeIdentifiers": [],
24+
"rules": []
25+
}

definitions/draco_rest/data_types/rest_adapter_input.proto.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
"linkedDataTypeIdentifiers": [
2626
"OBJECT"
2727
],
28-
"type": "{ payload: T, headers: OBJECT<{}> }"
28+
"type": "{ payload: T, headers: OBJECT<{}>, query_params: OBJECT<{}>, path_params: OBJECT<{}> }"
2929
}

definitions/draco_rest/flow_types/rest.proto.json

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,52 @@
55
"name": [
66
{
77
"code": "en-US",
8-
"content": "Rest Endpoint"
8+
"content": "Webhook"
99
}
1010
],
1111
"description": [
1212
{
1313
"code": "en-US",
14-
"content": "A REST API is a web service that lets clients interact with data on a server using standard HTTP methods like GET, POST, PUT, and DELETE usually returning results in JSON format."
14+
"content": "A Webhook is an HTTP endpoint that listens for incoming requests from external services or clients, allowing you to react to events in real time using standard HTTP methods like GET, POST, PUT, and DELETE."
1515
}
1616
],
1717
"documentation": [],
1818
"displayMessage": [
1919
{
2020
"code": "en-US",
21-
"content": "Trigger Rest-Flow on ${httpMethod} with a Request to ${httpURL}"
21+
"content": "Webhook on ${httpMethod} at ${httpURL}"
2222
}
2323
],
2424
"alias": [
2525
{
2626
"code": "en-US",
27-
"content": "http;rest;route;web;webhook"
27+
"content": "webhook;http;rest;route;web"
2828
}
2929
],
3030
"displayIcon": "tabler:world-www",
31-
"signature": "<T>(input_schema: TYPE<T>, httpURL: HTTP_URL, httpMethod: HTTP_METHOD): REST_ADAPTER_INPUT<T>",
31+
"signature": "<A extends REST_AUTH_TYPE, T>(httpSchema: HTTP_SCHEMA, httpURL: HTTP_URL, httpMethod: HTTP_METHOD, httpAuth: A, httpAuthValue: REST_AUTH_VALUE<A>, input_schema: TYPE<T>): REST_ADAPTER_INPUT<T>",
3232
"linkedDataTypeIdentifiers": [
33+
"HTTP_SCHEMA",
3334
"HTTP_URL",
3435
"HTTP_METHOD",
36+
"REST_AUTH_TYPE",
37+
"REST_AUTH_VALUE",
3538
"REST_ADAPTER_INPUT"
3639
],
3740
"settings": [
3841
{
39-
"identifier": "input_schema",
42+
"identifier": "httpSchema",
4043
"unique": "NONE",
4144
"name": [
4245
{
4346
"code": "en-US",
44-
"content": "Input schema"
47+
"content": "Content Type"
4548
}
4649
],
4750
"description": [
4851
{
4952
"code": "en-US",
50-
"content": "Input schema which defines the expected structure of the incoming request data."
53+
"content": "Specifies the MIME type of the incoming request payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter."
5154
}
5255
]
5356
},
@@ -82,6 +85,54 @@
8285
"content": "Specifies the HTTP request method (e.g., GET, POST, PUT, DELETE)."
8386
}
8487
]
88+
},
89+
{
90+
"identifier": "httpAuth",
91+
"unique": "NONE",
92+
"name": [
93+
{
94+
"code": "en-US",
95+
"content": "Authentication type"
96+
}
97+
],
98+
"description": [
99+
{
100+
"code": "en-US",
101+
"content": "Specifies the authentication mechanism used for the incoming Webhook request (e.g., Bearer JWT, Bearer static, Basic)."
102+
}
103+
]
104+
},
105+
{
106+
"identifier": "httpAuthValue",
107+
"unique": "NONE",
108+
"name": [
109+
{
110+
"code": "en-US",
111+
"content": "Authentication value"
112+
}
113+
],
114+
"description": [
115+
{
116+
"code": "en-US",
117+
"content": "Provides the credential value matching the selected authentication type (e.g., token string or username/password pair)."
118+
}
119+
]
120+
},
121+
{
122+
"identifier": "input_schema",
123+
"unique": "NONE",
124+
"name": [
125+
{
126+
"code": "en-US",
127+
"content": "Input schema"
128+
}
129+
],
130+
"description": [
131+
{
132+
"code": "en-US",
133+
"content": "Input schema which defines the expected structure of the incoming request data."
134+
}
135+
]
85136
}
86137
]
87138
}

definitions/draco_rest/functions/rest_control_respond.proto.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@
3636
],
3737
"documentation": []
3838
},
39+
{
40+
"runtimeName": "http_schema",
41+
"defaultValue": null,
42+
"name": [
43+
{
44+
"code": "en-US",
45+
"content": "Content Type"
46+
}
47+
],
48+
"description": [
49+
{
50+
"code": "en-US",
51+
"content": "Specifies the MIME type of the response payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter."
52+
}
53+
],
54+
"documentation": []
55+
},
3956
{
4057
"runtimeName": "payload",
4158
"defaultValue": null,
@@ -48,7 +65,7 @@
4865
"description": [
4966
{
5067
"code": "en-US",
51-
"content": "Contains the response payload, such as JSON, XML, form data, or binary content, depending on the Content-Type header."
68+
"content": "Contains the response payload. For application/json the value must be an OBJECT, for all other content types a plain string is expected."
5269
}
5370
],
5471
"documentation": []
@@ -82,9 +99,11 @@
8299
}
83100
],
84101
"displayIcon": "tabler:cube-send",
85-
"signature": "<T>(http_status_code: HTTP_STATUS_CODE, headers: OBJECT<{}>, payload: T): void",
102+
"signature": "<S extends HTTP_SCHEMA>(http_status_code: HTTP_STATUS_CODE, headers: OBJECT<{}>, http_schema: S, payload: HTTP_PAYLOAD<S>): void",
86103
"linkedDataTypeIdentifiers": [
87104
"HTTP_STATUS_CODE",
88-
"OBJECT"
105+
"OBJECT",
106+
"HTTP_SCHEMA",
107+
"HTTP_PAYLOAD"
89108
]
90109
}

definitions/draco_rest/module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"name": [
44
{
55
"code": "en-US",
6-
"content": "REST"
6+
"content": "Webhook"
77
}
88
],
99
"description": [
1010
{
1111
"code": "en-US",
12-
"content": "Trigger Flows unsing a HTTP-Server."
12+
"content": "Trigger webhook on a specified endpoint."
1313
}
1414
],
1515
"documentation": "",

definitions/draco_rest/runtime_flow_types/rest.proto.json

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,52 @@
44
"name": [
55
{
66
"code": "en-US",
7-
"content": "Rest Endpoint"
7+
"content": "Webhook"
88
}
99
],
1010
"description": [
1111
{
1212
"code": "en-US",
13-
"content": "A REST API is a web service that lets clients interact with data on a server using standard HTTP methods like GET, POST, PUT, and DELETE usually returning results in JSON format."
13+
"content": "A Webhook is an HTTP endpoint that listens for incoming requests from external services or clients, allowing you to react to events in real time using standard HTTP methods like GET, POST, PUT, and DELETE."
1414
}
1515
],
1616
"documentation": [],
1717
"displayMessage": [
1818
{
1919
"code": "en-US",
20-
"content": "Trigger Rest-Flow on ${httpMethod} with a Request to ${httpURL}"
20+
"content": "Webhook on ${httpMethod} at ${httpURL}"
2121
}
2222
],
2323
"alias": [
2424
{
2525
"code": "en-US",
26-
"content": "http;rest;route;web;webhook"
26+
"content": "webhook;http;rest;route;web"
2727
}
2828
],
2929
"displayIcon": "tabler:world-www",
30-
"signature": "<T>(input_schema: TYPE<T>, httpURL: HTTP_URL, httpMethod: HTTP_METHOD): REST_ADAPTER_INPUT<T>",
30+
"signature": "<A extends REST_AUTH_TYPE, T>(httpSchema: HTTP_SCHEMA, httpURL: HTTP_URL, httpMethod: HTTP_METHOD, httpAuth: A, httpAuthValue: REST_AUTH_VALUE<A>, input_schema: TYPE<T>): REST_ADAPTER_INPUT<T>",
3131
"linkedDataTypeIdentifiers": [
32+
"HTTP_SCHEMA",
3233
"HTTP_URL",
3334
"HTTP_METHOD",
35+
"REST_AUTH_TYPE",
36+
"REST_AUTH_VALUE",
3437
"REST_ADAPTER_INPUT"
3538
],
3639
"runtimeSettings": [
3740
{
38-
"identifier": "input_schema",
41+
"identifier": "httpSchema",
3942
"unique": "NONE",
4043
"name": [
4144
{
4245
"code": "en-US",
43-
"content": "Input schema"
46+
"content": "Content Type"
4447
}
4548
],
4649
"description": [
4750
{
4851
"code": "en-US",
49-
"content": "Input schema which defines the expected structure of the incoming request data."
52+
"content": "Specifies the MIME type of the incoming request payload, such as application/json, application/xml, or text/plain. This determines the expected format of the payload parameter."
5053
}
5154
]
5255
},
@@ -81,6 +84,54 @@
8184
"content": "Specifies the HTTP request method (e.g., GET, POST, PUT, DELETE)."
8285
}
8386
]
87+
},
88+
{
89+
"identifier": "httpAuth",
90+
"unique": "NONE",
91+
"name": [
92+
{
93+
"code": "en-US",
94+
"content": "Authentication type"
95+
}
96+
],
97+
"description": [
98+
{
99+
"code": "en-US",
100+
"content": "Specifies the authentication mechanism used for the incoming Webhook request (e.g., Bearer JWT, Bearer static, Basic)."
101+
}
102+
]
103+
},
104+
{
105+
"identifier": "httpAuthValue",
106+
"unique": "NONE",
107+
"name": [
108+
{
109+
"code": "en-US",
110+
"content": "Authentication value"
111+
}
112+
],
113+
"description": [
114+
{
115+
"code": "en-US",
116+
"content": "Provides the credential value matching the selected authentication type (e.g., token string or username/password pair)."
117+
}
118+
]
119+
},
120+
{
121+
"identifier": "input_schema",
122+
"unique": "NONE",
123+
"name": [
124+
{
125+
"code": "en-US",
126+
"content": "Input schema"
127+
}
128+
],
129+
"description": [
130+
{
131+
"code": "en-US",
132+
"content": "Input schema which defines the expected structure of the incoming request data."
133+
}
134+
]
84135
}
85136
]
86137
}

0 commit comments

Comments
 (0)