wakflo_core/connector/schema.rs
1use crate::prelude::JsonValue;
2use serde::{Deserialize, Serialize};
3use wakflo_common::{
4 plugin::{PluginCompiler, PluginLanguage},
5 ConnectorPlatform, ConnectorType,
6};
7
8/// # [TaskMetadata]
9///
10/// Plugin generated metadata
11#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
12pub struct PluginMetadata {
13 /// Plugin written language
14 pub language: PluginLanguage,
15 pub compiler: PluginCompiler,
16}
17
18/// # [ConnectorProperties]
19///
20/// Plugin generated metadata
21#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug, Default)]
22pub struct ConnectorProperties {
23 pub input: serde_json::Value,
24 pub output: serde_json::Value,
25 pub authentication: Option<serde_json::Value>,
26}
27
28/// #[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
29/// ## Connector
30///
31/// Struct representing a connector.
32///
33/// ### Fields
34///
35/// - `id`: Unique identifier of a schema.
36/// - `name`: Name of the schema.
37/// - `display_name`: Display name of the schema.
38/// - `description`: Description of the schema.
39/// - `connector_type`: Connector type of the schema.
40/// - `platform`: Platform of the schema.
41/// - `namespace`: Optional human-readable identity of a schema.
42/// - `category_id`: Optional human-readable identity of a category.
43/// - `icon`: Icon of the schema.
44/// - `published`: Flag indicating if the schema is published.
45/// - `approved`: Flag indicating if the schema is approved.
46/// - `created_at`: Date the entity was created.
47/// - `updated_at`: Date the entity was updated.
48/// - `metadata`: Optional metadata associated with the plugin.
49/// - `operations`: List of operations supported by the connector.
50/// - `tags`: Optional list of tags associated with the connector.
51/// - `file_url`: Optional URL of the connector's file.
52/// - `file_hash`: Optional hash value of the connector's file.
53///
54/// ```
55#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
56pub struct Connector {
57 /// Unique identifier of a schema
58 pub id: String,
59
60 /// Name of the the schema
61 pub name: String,
62
63 /// Name of the the schema
64 pub display_name: String,
65
66 /// Name of the the schema
67 pub description: String,
68
69 /// ConnectorType of the the schema
70 pub connector_type: ConnectorType,
71
72 /// ConnectorType of the the schema
73 pub platform: ConnectorPlatform,
74
75 /// Human readable identity of a schema
76 pub namespace: Option<String>,
77
78 /// Human readable identity of a category
79 pub category_id: Option<String>,
80
81 pub icon: String,
82
83 pub published: bool,
84
85 pub approved: bool,
86
87 /// Date the entity was created
88 pub created_at: chrono::DateTime<chrono::FixedOffset>,
89
90 /// Date the entity was updated
91 pub updated_at: chrono::DateTime<chrono::FixedOffset>,
92
93 pub metadata: Option<PluginMetadata>,
94
95 pub tags: Option<Vec<String>>,
96}
97
98/// # ConnectorOperation
99///
100/// ConnectorOperation contract represent an ant schema that takes in
101/// operators and actions to be performed on a dataset
102#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
103pub struct ConnectorOperation {
104 /// ID of the ent.
105 pub id: String,
106
107 /// Name of the the schema
108 pub name: String,
109
110 /// key of the the schema
111 pub key: String,
112
113 /// Name of the the schema
114 pub description: String,
115
116 /// Name of the the schema
117 pub version: String,
118
119 /// Name of the the schema
120 pub connector_id: String,
121
122 /// Name of the the schema
123 pub input: wakflo_form::FormSchema,
124
125 /// Name of the the schema
126 pub output: wakflo_form::FormSchema,
127
128 /// CreatedAt holds the value of the "created_at" field.
129 pub created_at: chrono::DateTime<chrono::FixedOffset>,
130
131 /// UpdatedAt holds the value of the "updated_at" field.
132 pub updated_at: chrono::DateTime<chrono::FixedOffset>,
133}
134
135/// # ConnectorVersion
136///
137/// ConnectorVersion contract represent an ant schema that takes in
138/// operators and actions to be performed on a dataset
139#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
140pub struct ConnectorVersion {
141 /// ID of the ent.
142 pub id: String,
143
144 /// Name of the the schema
145 pub name: String,
146
147 /// Name of the the schema
148 pub connector_id: String,
149
150 /// CreatedAt holds the value of the "created_at" field.
151 pub created_at: chrono::DateTime<chrono::FixedOffset>,
152
153 /// UpdatedAt holds the value of the "updated_at" field.
154 pub updated_at: chrono::DateTime<chrono::FixedOffset>,
155
156 pub documentation: Option<String>,
157
158 pub auth: Option<JsonValue>,
159
160 pub file_url: Option<String>,
161
162 pub file_hash: Option<String>,
163
164 pub operations: Vec<ConnectorOperation>,
165
166 pub connector: Connector,
167}