Compare commits
2 Commits
wmill-scri
...
di/ee-refa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd70e59f8b | ||
|
|
20c8bda33a |
32
backend/windmill-api/src/agent_workers_oss.rs
Normal file
32
backend/windmill-api/src/agent_workers_oss.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use crate::db::DB;
|
||||
use axum::Router;
|
||||
|
||||
pub struct AgentAuth {
|
||||
pub worker_group: String,
|
||||
pub suffix: Option<String>,
|
||||
pub tags: Vec<String>,
|
||||
pub exp: Option<usize>,
|
||||
}
|
||||
|
||||
pub struct AgentCache {}
|
||||
|
||||
impl AgentCache {
|
||||
pub fn new() -> Self {
|
||||
crate::agent_workers_ee::AgentCache::new()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::agent_workers_ee::global_service()
|
||||
}
|
||||
|
||||
pub fn workspaced_service(
|
||||
db: DB,
|
||||
base_internal_url: String,
|
||||
) -> (
|
||||
Router,
|
||||
Vec<tokio::task::JoinHandle<()>>,
|
||||
Option<windmill_worker::JobCompletedSender>,
|
||||
) {
|
||||
crate::agent_workers_ee::workspaced_service(db, base_internal_url)
|
||||
}
|
||||
5
backend/windmill-api/src/apps_oss.rs
Normal file
5
backend/windmill-api/src/apps_oss.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use axum::Router;
|
||||
|
||||
pub fn global_unauthed_service() -> Router {
|
||||
crate::apps_ee::global_unauthed_service()
|
||||
}
|
||||
126
backend/windmill-api/src/gcp_triggers_oss.rs
Normal file
126
backend/windmill-api/src/gcp_triggers_oss.rs
Normal file
@@ -0,0 +1,126 @@
|
||||
use crate::db::DB;
|
||||
use axum::Router;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::value::RawValue;
|
||||
use sqlx_json::Json as SqlxJson;
|
||||
use std::collections::HashMap;
|
||||
use windmill_common::{error::WindmillError, utils::TriggerJobArgs, error::Result as WindmillResult};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum DeliveryType {
|
||||
Pull,
|
||||
Push,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum SubscriptionMode {
|
||||
Existing,
|
||||
CreateUpdate,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct PushConfig {
|
||||
route_path: Option<String>,
|
||||
audience: Option<String>,
|
||||
authenticate: bool,
|
||||
base_endpoint: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct CreateUpdateConfig {
|
||||
pub delivery_type: DeliveryType,
|
||||
pub subscription_id: Option<String>,
|
||||
pub delivery_config: Option<SqlxJson<PushConfig>>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ExistingGcpSubscription {
|
||||
pub subscription_id: String,
|
||||
pub base_endpoint: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct GcpTrigger {
|
||||
pub workspace_id: String,
|
||||
pub path: String,
|
||||
pub gcp_resource_path: String,
|
||||
pub project_id: String,
|
||||
pub topic_id: String,
|
||||
pub subscription_mode: SubscriptionMode,
|
||||
pub existing_subscription: Option<ExistingGcpSubscription>,
|
||||
pub create_update_config: Option<CreateUpdateConfig>,
|
||||
pub script_path: String,
|
||||
pub is_flow: bool,
|
||||
pub edited_by: String,
|
||||
pub email: String,
|
||||
pub edited_at: chrono::DateTime<chrono::Utc>,
|
||||
pub server_id: Option<String>,
|
||||
pub last_server_ping: Option<chrono::DateTime<chrono::Utc>>,
|
||||
pub extra_perms: serde_json::Value,
|
||||
pub error: Option<String>,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
impl TriggerJobArgs<String> for GcpTrigger {
|
||||
fn get_workspace_id(&self) -> &str {
|
||||
&self.workspace_id
|
||||
}
|
||||
|
||||
fn get_path(&self) -> &str {
|
||||
&self.path
|
||||
}
|
||||
|
||||
fn get_script_path(&self) -> &str {
|
||||
&self.script_path
|
||||
}
|
||||
|
||||
fn get_is_flow(&self) -> bool {
|
||||
self.is_flow
|
||||
}
|
||||
|
||||
fn get_extra_perms(&self) -> &serde_json::Value {
|
||||
&self.extra_perms
|
||||
}
|
||||
|
||||
fn get_args(&self) -> &String {
|
||||
&String::new()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::gcp_triggers_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub fn start_consuming_gcp_pubsub_event(
|
||||
_db: DB,
|
||||
mut _killpill_rx: tokio::sync::broadcast::Receiver<()>,
|
||||
) -> () {
|
||||
crate::gcp_triggers_ee::start_consuming_gcp_pubsub_event(_db, _killpill_rx)
|
||||
}
|
||||
|
||||
pub async fn manage_google_subscription(
|
||||
_authed: windmill_common::users::Authed,
|
||||
_path: axum::extract::Path<String>,
|
||||
_axum::extract::Json(_trigger): axum::extract::Json<GcpTrigger>,
|
||||
) -> WindmillResult<CreateUpdateConfig> {
|
||||
crate::gcp_triggers_ee::manage_google_subscription(_authed, _path, axum::extract::Json(_trigger)).await
|
||||
}
|
||||
|
||||
pub async fn process_google_push_request(
|
||||
_headers: axum::http::HeaderMap,
|
||||
_body: axum::body::Bytes,
|
||||
_base_endpoint: String,
|
||||
) -> Result<(String, HashMap<String, Box<RawValue>>), WindmillError> {
|
||||
crate::gcp_triggers_ee::process_google_push_request(_headers, _body, _base_endpoint).await
|
||||
}
|
||||
|
||||
pub async fn validate_jwt_token(
|
||||
_audience: &str,
|
||||
_jwt_token: &str,
|
||||
) -> Result<(), windmill_common::error::Error> {
|
||||
crate::gcp_triggers_ee::validate_jwt_token(_audience, _jwt_token).await
|
||||
}
|
||||
|
||||
pub fn gcp_push_route_handler() -> Router {
|
||||
crate::gcp_triggers_ee::gcp_push_route_handler()
|
||||
}
|
||||
9
backend/windmill-api/src/git_sync_oss.rs
Normal file
9
backend/windmill-api/src/git_sync_oss.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use axum::Router;
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::git_sync_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::git_sync_ee::global_service()
|
||||
}
|
||||
9
backend/windmill-api/src/indexer_oss.rs
Normal file
9
backend/windmill-api/src/indexer_oss.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use axum::Router;
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::indexer_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::indexer_ee::global_service()
|
||||
}
|
||||
89
backend/windmill-api/src/job_helpers_oss.rs
Normal file
89
backend/windmill-api/src/job_helpers_oss.rs
Normal file
@@ -0,0 +1,89 @@
|
||||
use crate::db::DB;
|
||||
use axum::{Router, response::Response};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use windmill_common::{error, object_store::ObjectStoreResource};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct UploadFileResponse {
|
||||
pub file_key: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct LoadImagePreviewQuery;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct DownloadFileQuery;
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::job_helpers_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub async fn get_workspace_s3_resource(
|
||||
_authed: &windmill_common::users::Authed,
|
||||
_w_id: &str,
|
||||
_db: &DB,
|
||||
) -> windmill_common::error::Result<(Option<bool>, Option<ObjectStoreResource>)> {
|
||||
crate::job_helpers_ee::get_workspace_s3_resource(_authed, _w_id, _db).await
|
||||
}
|
||||
|
||||
pub fn get_random_file_name(_file_extension: Option<String>) -> String {
|
||||
crate::job_helpers_ee::get_random_file_name(_file_extension)
|
||||
}
|
||||
|
||||
pub async fn get_s3_resource(
|
||||
_authed: &windmill_common::users::Authed,
|
||||
_w_id: &str,
|
||||
_db: &DB,
|
||||
_disable_s3_internal: bool,
|
||||
) -> error::Result<ObjectStoreResource> {
|
||||
crate::job_helpers_ee::get_s3_resource(_authed, _w_id, _db, _disable_s3_internal).await
|
||||
}
|
||||
|
||||
pub async fn upload_file_from_req(
|
||||
_authed: windmill_common::users::Authed,
|
||||
_w_id: axum::extract::Path<String>,
|
||||
_db: DB,
|
||||
_req: axum::extract::Request,
|
||||
) -> error::Result<()> {
|
||||
crate::job_helpers_ee::upload_file_from_req(_authed, _w_id, _db, _req).await
|
||||
}
|
||||
|
||||
pub async fn upload_file_internal(
|
||||
_authed: &windmill_common::users::Authed,
|
||||
_w_id: &str,
|
||||
_db: &DB,
|
||||
_file_content: bytes::Bytes,
|
||||
_file_extension: Option<String>,
|
||||
_file_name: Option<String>,
|
||||
_s3_resource_opt: Option<ObjectStoreResource>,
|
||||
_disable_s3_internal: bool,
|
||||
) -> error::Result<()> {
|
||||
crate::job_helpers_ee::upload_file_internal(
|
||||
_authed,
|
||||
_w_id,
|
||||
_db,
|
||||
_file_content,
|
||||
_file_extension,
|
||||
_file_name,
|
||||
_s3_resource_opt,
|
||||
_disable_s3_internal,
|
||||
).await
|
||||
}
|
||||
|
||||
pub async fn download_s3_file_internal(
|
||||
_authed: &windmill_common::users::Authed,
|
||||
_w_id: &str,
|
||||
_db: &DB,
|
||||
_file_key: &str,
|
||||
_s3_resource_opt: Option<ObjectStoreResource>,
|
||||
_disable_s3_internal: bool,
|
||||
) -> error::Result<Response> {
|
||||
crate::job_helpers_ee::download_s3_file_internal(
|
||||
_authed,
|
||||
_w_id,
|
||||
_db,
|
||||
_file_key,
|
||||
_s3_resource_opt,
|
||||
_disable_s3_internal,
|
||||
).await
|
||||
}
|
||||
13
backend/windmill-api/src/kafka_triggers_oss.rs
Normal file
13
backend/windmill-api/src/kafka_triggers_oss.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use crate::db::DB;
|
||||
use axum::Router;
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::kafka_triggers_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub fn start_kafka_consumers(
|
||||
_db: DB,
|
||||
mut _killpill_rx: tokio::sync::broadcast::Receiver<()>,
|
||||
) -> () {
|
||||
crate::kafka_triggers_ee::start_kafka_consumers(_db, _killpill_rx)
|
||||
}
|
||||
38
backend/windmill-api/src/nats_triggers_oss.rs
Normal file
38
backend/windmill-api/src/nats_triggers_oss.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
use crate::db::DB;
|
||||
use axum::Router;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct NatsResourceAuth {}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum NatsTriggerConfigConnection {}
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct NatsTrigger {
|
||||
pub workspace_id: String,
|
||||
pub path: String,
|
||||
pub nats_resource_path: String,
|
||||
pub subject: String,
|
||||
pub script_path: String,
|
||||
pub is_flow: bool,
|
||||
pub edited_by: String,
|
||||
pub email: String,
|
||||
pub edited_at: chrono::DateTime<chrono::Utc>,
|
||||
pub server_id: Option<String>,
|
||||
pub last_server_ping: Option<chrono::DateTime<chrono::Utc>>,
|
||||
pub extra_perms: serde_json::Value,
|
||||
pub error: Option<String>,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::nats_triggers_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub fn start_nats_consumers(
|
||||
_db: DB,
|
||||
mut _killpill_rx: tokio::sync::broadcast::Receiver<()>,
|
||||
) -> () {
|
||||
crate::nats_triggers_ee::start_nats_consumers(_db, _killpill_rx)
|
||||
}
|
||||
60
backend/windmill-api/src/oauth2_oss.rs
Normal file
60
backend/windmill-api/src/oauth2_oss.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
use crate::db::DB;
|
||||
use axum::Router;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use windmill_common::error;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ClientWithScopes;
|
||||
|
||||
pub type BasicClientsMap = HashMap<String, ClientWithScopes>;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct OAuthConfig;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct OAuthClient;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct AllClients;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct TokenResponse;
|
||||
|
||||
pub struct SlackVerifier;
|
||||
|
||||
impl SlackVerifier {
|
||||
pub fn new<S: AsRef<[u8]>>(secret: S) -> anyhow::Result<SlackVerifier> {
|
||||
crate::oauth2_ee::SlackVerifier::new(secret)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::oauth2_ee::global_service()
|
||||
}
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::oauth2_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub async fn build_oauth_clients(
|
||||
_db: &DB,
|
||||
_w_id: &str,
|
||||
_base_url: &str,
|
||||
) -> anyhow::Result<AllClients> {
|
||||
crate::oauth2_ee::build_oauth_clients(_db, _w_id, _base_url).await
|
||||
}
|
||||
|
||||
pub async fn _refresh_token(
|
||||
_workspace_id: &str,
|
||||
_path: &str,
|
||||
_db: &DB,
|
||||
_token: &str,
|
||||
_http_client: &reqwest::Client,
|
||||
) -> error::Result<String> {
|
||||
crate::oauth2_ee::_refresh_token(_workspace_id, _path, _db, _token, _http_client).await
|
||||
}
|
||||
|
||||
pub async fn check_nb_of_user(db: &DB) -> error::Result<()> {
|
||||
crate::oauth2_ee::check_nb_of_user(db).await
|
||||
}
|
||||
9
backend/windmill-api/src/oidc_oss.rs
Normal file
9
backend/windmill-api/src/oidc_oss.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use axum::Router;
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::oidc_ee::global_service()
|
||||
}
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::oidc_ee::workspaced_service()
|
||||
}
|
||||
15
backend/windmill-api/src/saml_oss.rs
Normal file
15
backend/windmill-api/src/saml_oss.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use axum::Router;
|
||||
|
||||
pub struct ServiceProviderExt();
|
||||
|
||||
pub async fn build_sp_extension() -> anyhow::Result<ServiceProviderExt> {
|
||||
crate::saml_ee::build_sp_extension().await
|
||||
}
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::saml_ee::global_service()
|
||||
}
|
||||
|
||||
pub async fn acs() -> String {
|
||||
crate::saml_ee::acs().await
|
||||
}
|
||||
13
backend/windmill-api/src/scim_oss.rs
Normal file
13
backend/windmill-api/src/scim_oss.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use axum::{http::Request, middleware::Next, response::Response, Router};
|
||||
|
||||
pub fn global_service() -> Router {
|
||||
crate::scim_ee::global_service()
|
||||
}
|
||||
|
||||
pub async fn ee() -> String {
|
||||
crate::scim_ee::ee().await
|
||||
}
|
||||
|
||||
pub async fn has_scim_token<B>(_request: Request<B>, _next: Next) -> Response {
|
||||
crate::scim_ee::has_scim_token(_request, _next).await
|
||||
}
|
||||
23
backend/windmill-api/src/smtp_server_oss.rs
Normal file
23
backend/windmill-api/src/smtp_server_oss.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use crate::{db::DB, users::AuthCache, users::UserDB};
|
||||
use std::{net::SocketAddr, sync::Arc};
|
||||
|
||||
pub struct SmtpServer {
|
||||
pub auth_cache: Arc<AuthCache>,
|
||||
pub db: DB,
|
||||
pub user_db: UserDB,
|
||||
pub base_internal_url: String,
|
||||
}
|
||||
|
||||
impl SmtpServer {
|
||||
pub async fn start_listener_thread(
|
||||
self: Arc<Self>,
|
||||
_addr: SocketAddr,
|
||||
) -> anyhow::Result<()> {
|
||||
crate::smtp_server_ee::SmtpServer {
|
||||
auth_cache: self.auth_cache,
|
||||
db: self.db,
|
||||
user_db: self.user_db,
|
||||
base_internal_url: self.base_internal_url,
|
||||
}.start_listener_thread(_addr).await
|
||||
}
|
||||
}
|
||||
32
backend/windmill-api/src/sqs_triggers_oss.rs
Normal file
32
backend/windmill-api/src/sqs_triggers_oss.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use crate::db::DB;
|
||||
use axum::Router;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct SqsTrigger {
|
||||
pub workspace_id: String,
|
||||
pub path: String,
|
||||
pub sqs_resource_path: String,
|
||||
pub queue_url: String,
|
||||
pub script_path: String,
|
||||
pub is_flow: bool,
|
||||
pub edited_by: String,
|
||||
pub email: String,
|
||||
pub edited_at: chrono::DateTime<chrono::Utc>,
|
||||
pub server_id: Option<String>,
|
||||
pub last_server_ping: Option<chrono::DateTime<chrono::Utc>>,
|
||||
pub extra_perms: serde_json::Value,
|
||||
pub error: Option<String>,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
pub fn workspaced_service() -> Router {
|
||||
crate::sqs_triggers_ee::workspaced_service()
|
||||
}
|
||||
|
||||
pub fn start_sqs(
|
||||
_db: DB,
|
||||
mut _killpill_rx: tokio::sync::broadcast::Receiver<()>,
|
||||
) -> () {
|
||||
crate::sqs_triggers_ee::start_sqs(_db, _killpill_rx)
|
||||
}
|
||||
5
backend/windmill-api/src/stripe_oss.rs
Normal file
5
backend/windmill-api/src/stripe_oss.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use axum::Router;
|
||||
|
||||
pub fn add_stripe_routes(router: Router) -> Router {
|
||||
crate::stripe_ee::add_stripe_routes(router)
|
||||
}
|
||||
6
backend/windmill-api/src/teams_approvals_oss.rs
Normal file
6
backend/windmill-api/src/teams_approvals_oss.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use axum::http::StatusCode;
|
||||
use windmill_common::error::Error;
|
||||
|
||||
pub async fn request_teams_approval() -> Result<StatusCode, Error> {
|
||||
crate::teams_approvals_ee::request_teams_approval().await
|
||||
}
|
||||
26
backend/windmill-api/src/teams_oss.rs
Normal file
26
backend/windmill-api/src/teams_oss.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use axum::{http::StatusCode, Router};
|
||||
use windmill_common::error::Error;
|
||||
|
||||
pub async fn edit_teams_command() -> Result<StatusCode, Error> {
|
||||
crate::teams_ee::edit_teams_command().await
|
||||
}
|
||||
|
||||
pub async fn workspaces_list_available_teams_ids() -> Result<StatusCode, Error> {
|
||||
crate::teams_ee::workspaces_list_available_teams_ids().await
|
||||
}
|
||||
|
||||
pub async fn connect_teams() -> Result<StatusCode, Error> {
|
||||
crate::teams_ee::connect_teams().await
|
||||
}
|
||||
|
||||
pub async fn run_teams_message_test_job() -> Result<StatusCode, Error> {
|
||||
crate::teams_ee::run_teams_message_test_job().await
|
||||
}
|
||||
|
||||
pub async fn workspaces_list_available_teams_channels() -> Result<StatusCode, Error> {
|
||||
crate::teams_ee::workspaces_list_available_teams_channels().await
|
||||
}
|
||||
|
||||
pub fn teams_service() -> Router {
|
||||
crate::teams_ee::teams_service()
|
||||
}
|
||||
24
backend/windmill-api/src/users_oss.rs
Normal file
24
backend/windmill-api/src/users_oss.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use axum::http::StatusCode;
|
||||
use windmill_common::error::Error;
|
||||
|
||||
pub async fn create_user(
|
||||
_authed: windmill_common::users::Authed,
|
||||
_extract_path: axum::extract::Path<String>,
|
||||
_db: crate::db::DB,
|
||||
_new_user: axum::extract::Json<serde_json::Value>,
|
||||
) -> Result<(StatusCode, String), Error> {
|
||||
crate::users_ee::create_user(_authed, _extract_path, _db, _new_user).await
|
||||
}
|
||||
|
||||
pub async fn set_password(
|
||||
_authed: windmill_common::users::Authed,
|
||||
_extract_path: axum::extract::Path<String>,
|
||||
_db: crate::db::DB,
|
||||
_set_password: axum::extract::Json<serde_json::Value>,
|
||||
) -> Result<String, Error> {
|
||||
crate::users_ee::set_password(_authed, _extract_path, _db, _set_password).await
|
||||
}
|
||||
|
||||
pub fn send_email_if_possible(_subject: &str, _content: &str, _to: &str) {
|
||||
crate::users_ee::send_email_if_possible(_subject, _content, _to)
|
||||
}
|
||||
15
backend/windmill-api/src/workspaces_oss.rs
Normal file
15
backend/windmill-api/src/workspaces_oss.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use crate::db::DB;
|
||||
use windmill_common::users::ApiAuthed;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct EditAutoInvite;
|
||||
|
||||
pub async fn edit_auto_invite(
|
||||
_authed: ApiAuthed,
|
||||
_db: DB,
|
||||
_w_id: String,
|
||||
_ea: EditAutoInvite,
|
||||
) -> windmill_common::error::Result<String> {
|
||||
crate::workspaces_ee::edit_auto_invite(_authed, _db, _w_id, _ea).await
|
||||
}
|
||||
67
backend/windmill-audit/src/audit_oss.rs
Normal file
67
backend/windmill-audit/src/audit_oss.rs
Normal file
@@ -0,0 +1,67 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{Postgres, Transaction};
|
||||
use windmill_common::error::Result;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct AuditAuthor {
|
||||
pub username: String,
|
||||
pub email: String,
|
||||
pub username_override: Option<String>,
|
||||
}
|
||||
|
||||
pub trait AuditAuthorable {
|
||||
fn username(&self) -> &str;
|
||||
fn email(&self) -> &str;
|
||||
fn username_override(&self) -> Option<&str>;
|
||||
}
|
||||
|
||||
impl AuditAuthorable for AuditAuthor {
|
||||
fn username(&self) -> &str {
|
||||
&self.username
|
||||
}
|
||||
|
||||
fn email(&self) -> &str {
|
||||
&self.email
|
||||
}
|
||||
|
||||
fn username_override(&self) -> Option<&str> {
|
||||
self.username_override.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AuditLog;
|
||||
|
||||
pub async fn audit_log<A: AuditAuthorable>(
|
||||
_tx: &mut Transaction<'_, Postgres>,
|
||||
_author: &A,
|
||||
_operation: &str,
|
||||
_action_kind: &str,
|
||||
_workspace_id: &str,
|
||||
_resource: Option<&str>,
|
||||
_parameters: Option<serde_json::Map<String, serde_json::Value>>,
|
||||
) -> Result<()> {
|
||||
crate::audit_ee::audit_log(_tx, _author, _operation, _action_kind, _workspace_id, _resource, _parameters).await
|
||||
}
|
||||
|
||||
pub async fn list_audit(
|
||||
_tx: Transaction<'_, Postgres>,
|
||||
_workspace_id: &str,
|
||||
_username: Option<String>,
|
||||
_operation: Option<String>,
|
||||
_action_kind: Option<String>,
|
||||
_resource: Option<String>,
|
||||
_before: Option<chrono::DateTime<chrono::Utc>>,
|
||||
_after: Option<chrono::DateTime<chrono::Utc>>,
|
||||
_per_page: usize,
|
||||
_offset: usize,
|
||||
) -> Result<Vec<AuditLog>> {
|
||||
crate::audit_ee::list_audit(_tx, _workspace_id, _username, _operation, _action_kind, _resource, _before, _after, _per_page, _offset).await
|
||||
}
|
||||
|
||||
pub async fn get_audit(
|
||||
tx: Transaction<'_, Postgres>,
|
||||
_id: i32,
|
||||
_w_id: &str,
|
||||
) -> Result<AuditLog> {
|
||||
crate::audit_ee::get_audit(tx, _id, _w_id).await
|
||||
}
|
||||
5
backend/windmill-autoscaling/src/autoscaling_oss.rs
Normal file
5
backend/windmill-autoscaling/src/autoscaling_oss.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use windmill_common::DB;
|
||||
|
||||
pub async fn apply_all_autoscaling(_db: &DB) -> anyhow::Result<()> {
|
||||
crate::autoscaling_ee::apply_all_autoscaling(_db).await
|
||||
}
|
||||
12
backend/windmill-common/src/email_oss.rs
Normal file
12
backend/windmill-common/src/email_oss.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use crate::{error::Result, DB};
|
||||
|
||||
pub async fn send_email(
|
||||
_to: &str,
|
||||
_subject: &str,
|
||||
_body: &str,
|
||||
_html_body: Option<&str>,
|
||||
_workspace_id: &str,
|
||||
_db: &DB,
|
||||
) -> Result<()> {
|
||||
crate::email_ee::send_email(_to, _subject, _body, _html_body, _workspace_id, _db).await
|
||||
}
|
||||
32
backend/windmill-common/src/job_s3_helpers_oss.rs
Normal file
32
backend/windmill-common/src/job_s3_helpers_oss.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use crate::{error::Result, object_store::ObjectStoreResource, DB};
|
||||
|
||||
pub enum TokenGenerator<'c> {
|
||||
AsClient(&'c crate::client::AuthedClient),
|
||||
AsServerInstance(),
|
||||
}
|
||||
|
||||
impl<'c> TokenGenerator<'c> {
|
||||
pub async fn gen_token(&self, _audience: &str, _db: Option<&DB>) -> anyhow::Result<String> {
|
||||
crate::job_s3_helpers_ee::TokenGenerator::gen_token(self, _audience, _db).await
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_s3_resource_internal(
|
||||
_token_generator: &TokenGenerator<'_>,
|
||||
_audience: &str,
|
||||
_workspace_id: &str,
|
||||
_resource_path: &str,
|
||||
_db: Option<&DB>,
|
||||
) -> Result<ObjectStoreResource> {
|
||||
crate::job_s3_helpers_ee::get_s3_resource_internal(_token_generator, _audience, _workspace_id, _resource_path, _db).await
|
||||
}
|
||||
|
||||
pub(crate) async fn generate_s3_aws_oidc_resource(
|
||||
_token_generator: &TokenGenerator<'_>,
|
||||
_audience: &str,
|
||||
_role_arn: &str,
|
||||
_region: &str,
|
||||
_db: Option<&DB>,
|
||||
) -> Result<ObjectStoreResource> {
|
||||
crate::job_s3_helpers_ee::generate_s3_aws_oidc_resource(_token_generator, _audience, _role_arn, _region, _db).await
|
||||
}
|
||||
46
backend/windmill-common/src/oidc_oss.rs
Normal file
46
backend/windmill-common/src/oidc_oss.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
use crate::{error::Result as WindmillResult, DB};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub trait AdditionalClaims: Serialize + for<'de> Deserialize<'de> {}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct WorkspaceClaim {
|
||||
pub workspace: String,
|
||||
}
|
||||
|
||||
impl AdditionalClaims for WorkspaceClaim {}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct InstanceClaim {}
|
||||
|
||||
impl AdditionalClaims for InstanceClaim {}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct JobClaim {
|
||||
pub workspace: String,
|
||||
pub job: String,
|
||||
pub path: Option<String>,
|
||||
pub groups: Vec<String>,
|
||||
pub email: String,
|
||||
pub username: String,
|
||||
pub is_operator: bool,
|
||||
pub is_admin: bool,
|
||||
pub is_super_admin: bool,
|
||||
pub folders: Vec<String>,
|
||||
}
|
||||
|
||||
impl AdditionalClaims for JobClaim {}
|
||||
|
||||
pub struct WindmillIdToken;
|
||||
|
||||
pub async fn generate_id_token<T: AdditionalClaims>(
|
||||
_additional_claims: T,
|
||||
_audience: &str,
|
||||
_db: Option<&DB>,
|
||||
) -> anyhow::Result<WindmillIdToken> {
|
||||
crate::oidc_ee::generate_id_token(_additional_claims, _audience, _db).await
|
||||
}
|
||||
|
||||
pub async fn get_private_key(db: Option<&DB>) -> anyhow::Result<String> {
|
||||
crate::oidc_ee::get_private_key(db).await
|
||||
}
|
||||
34
backend/windmill-common/src/otel_oss.rs
Normal file
34
backend/windmill-common/src/otel_oss.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use crate::{jobs::QueuedJob, server::Mode};
|
||||
use std::future::Future;
|
||||
use tracing_subscriber::filter::EnvFilter;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub(crate) type OtelProvider = Option<()>;
|
||||
|
||||
pub fn set_span_parent(_span: &tracing::Span, _rj: &Uuid) {
|
||||
crate::otel_ee::set_span_parent(_span, _rj)
|
||||
}
|
||||
|
||||
pub fn otel_ctx() -> () {
|
||||
crate::otel_ee::otel_ctx()
|
||||
}
|
||||
|
||||
pub(crate) fn init_logs_bridge(_mode: &Mode, _hostname: &str, _env: &str) -> Option<EnvFilter> {
|
||||
crate::otel_ee::init_logs_bridge(_mode, _hostname, _env)
|
||||
}
|
||||
|
||||
pub(crate) fn init_meter_provider(_mode: &Mode, _hostname: &str, _env: &str) -> OtelProvider {
|
||||
crate::otel_ee::init_meter_provider(_mode, _hostname, _env)
|
||||
}
|
||||
|
||||
pub fn add_root_flow_job_to_otlp(_queued_job: &QueuedJob, _success: bool) {
|
||||
crate::otel_ee::add_root_flow_job_to_otlp(_queued_job, _success)
|
||||
}
|
||||
|
||||
pub trait FutureExt: Sized {
|
||||
fn with_context(self, _otel_cx: ()) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Future> FutureExt for T {}
|
||||
40
backend/windmill-common/src/stats_oss.rs
Normal file
40
backend/windmill-common/src/stats_oss.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use crate::DB;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct ActiveUserUsage {
|
||||
pub author_count: Option<i32>,
|
||||
pub operator_count: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum SendStatsReason {
|
||||
Manual,
|
||||
Schedule,
|
||||
OnStart,
|
||||
}
|
||||
|
||||
pub async fn get_disable_stats_setting(_db: &DB) -> bool {
|
||||
crate::stats_ee::get_disable_stats_setting(_db).await
|
||||
}
|
||||
|
||||
pub async fn schedule_stats(_db: &DB, _http_client: &reqwest::Client) -> () {
|
||||
crate::stats_ee::schedule_stats(_db, _http_client).await
|
||||
}
|
||||
|
||||
pub async fn send_stats(
|
||||
_db: &DB,
|
||||
_http_client: &reqwest::Client,
|
||||
_reason: SendStatsReason,
|
||||
_basic_auth: Option<String>,
|
||||
) -> anyhow::Result<()> {
|
||||
crate::stats_ee::send_stats(_db, _http_client, _reason, _basic_auth).await
|
||||
}
|
||||
|
||||
pub async fn get_user_usage(
|
||||
_db: &DB,
|
||||
_workspace_id: Option<&str>,
|
||||
_days: Option<i32>,
|
||||
) -> anyhow::Result<ActiveUserUsage> {
|
||||
crate::stats_ee::get_user_usage(_db, _workspace_id, _days).await
|
||||
}
|
||||
1
backend/windmill-common/src/teams_oss.rs
Normal file
1
backend/windmill-common/src/teams_oss.rs
Normal file
@@ -0,0 +1 @@
|
||||
// Empty OSS implementation for teams_ee
|
||||
10
backend/windmill-git-sync/src/git_sync_oss.rs
Normal file
10
backend/windmill-git-sync/src/git_sync_oss.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use sqlx::{Postgres, Transaction};
|
||||
|
||||
pub async fn handle_deployment_metadata(
|
||||
_tx: &mut Transaction<'_, Postgres>,
|
||||
_workspace_id: &str,
|
||||
_path: &str,
|
||||
_raw_value: &serde_json::Value,
|
||||
) -> anyhow::Result<()> {
|
||||
crate::git_sync_ee::handle_deployment_metadata(_tx, _workspace_id, _path, _raw_value).await
|
||||
}
|
||||
16
backend/windmill-indexer/src/completed_runs_oss.rs
Normal file
16
backend/windmill-indexer/src/completed_runs_oss.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use sqlx::{Pool, Postgres};
|
||||
|
||||
pub struct IndexReader;
|
||||
pub struct IndexWriter;
|
||||
|
||||
pub async fn init_index(_db: &Pool<Postgres>) -> Result<(IndexReader, IndexWriter), anyhow::Error> {
|
||||
crate::completed_runs_ee::init_index(_db).await
|
||||
}
|
||||
|
||||
pub async fn run_indexer(
|
||||
_db: Pool<Postgres>,
|
||||
_writer: IndexWriter,
|
||||
_mut killpill_rx: tokio::sync::broadcast::Receiver<()>,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
crate::completed_runs_ee::run_indexer(_db, _writer, _mut killpill_rx).await
|
||||
}
|
||||
1
backend/windmill-indexer/src/indexer_oss.rs
Normal file
1
backend/windmill-indexer/src/indexer_oss.rs
Normal file
@@ -0,0 +1 @@
|
||||
// Empty OSS implementation for indexer_ee
|
||||
21
backend/windmill-indexer/src/service_logs_oss.rs
Normal file
21
backend/windmill-indexer/src/service_logs_oss.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use sqlx::{Pool, Postgres};
|
||||
|
||||
pub struct ServiceLogIndexReader;
|
||||
pub struct ServiceLogIndexWriter;
|
||||
|
||||
pub async fn init_index(
|
||||
_db: &Pool<Postgres>,
|
||||
_index_name: &str,
|
||||
_index_location: &str,
|
||||
_tantivy_buffer_size_mb: usize,
|
||||
) -> Result<(ServiceLogIndexReader, ServiceLogIndexWriter), anyhow::Error> {
|
||||
crate::service_logs_ee::init_index(_db, _index_name, _index_location, _tantivy_buffer_size_mb).await
|
||||
}
|
||||
|
||||
pub async fn run_indexer(
|
||||
_db: Pool<Postgres>,
|
||||
_writer: ServiceLogIndexWriter,
|
||||
_mut killpill_rx: tokio::sync::broadcast::Receiver<()>,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
crate::service_logs_ee::run_indexer(_db, _writer, _mut killpill_rx).await
|
||||
}
|
||||
11
backend/windmill-queue/src/jobs_oss.rs
Normal file
11
backend/windmill-queue/src/jobs_oss.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
pub(crate) async fn update_concurrency_counter(
|
||||
_tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
|
||||
_w_id: &str,
|
||||
_job_id: uuid::Uuid,
|
||||
_concurrency_key: &str,
|
||||
_cancel: bool,
|
||||
) -> anyhow::Result<(bool, Option<DateTime<Utc>>)> {
|
||||
crate::jobs_ee::update_concurrency_counter(_tx, _w_id, _job_id, _concurrency_key, _cancel).await
|
||||
}
|
||||
30
backend/windmill-worker/src/job_logger_oss.rs
Normal file
30
backend/windmill-worker/src/job_logger_oss.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use std::io;
|
||||
|
||||
pub(crate) async fn s3_storage(
|
||||
_value: &str,
|
||||
_job_id: &uuid::Uuid,
|
||||
_w_id: &str,
|
||||
_db: &windmill_common::DB,
|
||||
_offset: usize,
|
||||
) {
|
||||
crate::job_logger_ee::s3_storage(_value, _job_id, _w_id, _db, _offset).await
|
||||
}
|
||||
|
||||
pub(crate) async fn default_disk_log_storage(
|
||||
_value: &str,
|
||||
_job_id: &uuid::Uuid,
|
||||
_w_id: &str,
|
||||
_offset: usize,
|
||||
) {
|
||||
crate::job_logger_ee::default_disk_log_storage(_value, _job_id, _w_id, _offset).await
|
||||
}
|
||||
|
||||
pub(crate) fn process_streaming_log_lines(
|
||||
_line: &str,
|
||||
_job_id: &uuid::Uuid,
|
||||
_w_id: &str,
|
||||
_logs: &[String],
|
||||
_offset: usize,
|
||||
) -> Option<Result<String, io::Error>> {
|
||||
crate::job_logger_ee::process_streaming_log_lines(_line, _job_id, _w_id, _logs, _offset)
|
||||
}
|
||||
5
backend/windmill-worker/src/otel_oss.rs
Normal file
5
backend/windmill-worker/src/otel_oss.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use windmill_queue::MiniPulledJob;
|
||||
|
||||
pub fn add_root_flow_job_to_otlp(_queued_job: &MiniPulledJob, _success: bool) {
|
||||
crate::otel_ee::add_root_flow_job_to_otlp(_queued_job, _success)
|
||||
}
|
||||
Reference in New Issue
Block a user