-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
50 lines (45 loc) · 1.59 KB
/
Copy pathmod.rs
File metadata and controls
50 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crate::analyser::core::Analyser;
use crate::command::push::data_type_client_impl::SagittariusDataTypeServiceClient;
use crate::command::push::flow_type_client_impl::SagittariusFlowTypeServiceClient;
use crate::command::push::function_client_impl::SagittariusRuntimeFunctionServiceClient;
mod auth;
mod data_type_client_impl;
mod flow_type_client_impl;
mod function_client_impl;
pub async fn push(token: String, url: String, path: Option<String>) {
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());
let mut analyzer = Analyser::new(dir_path.as_str());
let mut data_type_client =
SagittariusDataTypeServiceClient::new(url.clone(), token.clone()).await;
let mut flow_type_client =
SagittariusFlowTypeServiceClient::new(url.clone(), token.clone()).await;
let mut function_client = SagittariusRuntimeFunctionServiceClient::new(url, token).await;
analyzer.report(false, true);
data_type_client
.update_data_types(
analyzer
.data_types
.iter()
.map(|d| d.definition_data_type.clone())
.collect(),
)
.await;
flow_type_client
.update_flow_types(
analyzer
.flow_types
.iter()
.map(|d| d.flow_type.clone())
.collect(),
)
.await;
function_client
.update_runtime_function_definitions(
analyzer
.functions
.iter()
.map(|d| d.function.clone())
.collect(),
)
.await;
}