.
- * #L%
- */
-
-
-import lombok.Data;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * The class that configures a servlet that adds a key to the Mapped Diagnostic Context (MDC) to each request so you can print a unique id in the logg
- * messages of each request. It also add the key as a header in the response so the caller of the request can provide you the id to browse the logs.
- * Set the response header name to null/blank if you want the response to NOT include such header.
- *
- * If you provide a request header name, the filter will check first if the request contains a header with that name and will use the ID it provides.
- * This is useful if your application chain has already assigned an id to the "transaction". (Microservices, apps behind a proxy/gateway service...)
- *
- * The MDC key and the header names are configurable.
- *
- * Here's a configuration sample with the default values:
- *
- *
- * summer:
- * slf4jfilter:
- * response_header: Response_Token
- * mdc_token_key: Slf4jMDCFilter.UUID
- * mdc_client_ip_key: Slf4jMDCFilter.ClientIP
- * request_header:
- *
- **/
-@Data
-@Configuration
-@ConfigurationProperties(prefix = "summer.slf4jfilter")
-public class Slf4jMDCFilterConfiguration {
-
- public static final String DEFAULT_RESPONSE_TOKEN_HEADER = "Request-id";
-
- private String responseHeader = DEFAULT_RESPONSE_TOKEN_HEADER;
- private String requestHeader = null;
- private String mdcTokenKey;
- private String mcTokenPrefix;
-
- @Autowired
- public Slf4jMDCFilterConfiguration(@Value("${logging.request-id-header}") String mdcTokenKey,
- @Value("${logging.api-pattern}") String mcTokenPrefix){
- this.mdcTokenKey = mdcTokenKey;
- this.mcTokenPrefix = mcTokenPrefix;
- }
-
- @Bean
- public FilterRegistrationBean servletRegistrationBean() {
- final FilterRegistrationBean registrationBean = new FilterRegistrationBean<>();
- final Slf4jMDCFilter log4jMDCFilterFilter = new Slf4jMDCFilter(responseHeader, mdcTokenKey, mcTokenPrefix, requestHeader);
- registrationBean.setFilter(log4jMDCFilterFilter);
- registrationBean.setOrder(2);
- return registrationBean;
- }
-}
diff --git a/src/backend/backend-loader/src/main/java/com/activepieces/security/WebSecurity.java b/src/backend/backend-loader/src/main/java/com/activepieces/security/WebSecurity.java
deleted file mode 100644
index cea6a5da15..0000000000
--- a/src/backend/backend-loader/src/main/java/com/activepieces/security/WebSecurity.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.activepieces.security;
-
-import com.activepieces.authentication.client.JWTService;
-import com.activepieces.authentication.server.security.JWTAuthorizationFilter;
-import lombok.NonNull;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpMethod;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.config.http.SessionCreationPolicy;
-import org.springframework.web.cors.CorsConfiguration;
-import org.springframework.web.cors.CorsConfigurationSource;
-import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
-import org.springframework.web.servlet.HandlerExceptionResolver;
-
-@Configuration
-@EnableWebSecurity
-public class WebSecurity extends WebSecurityConfigurerAdapter {
-
- public static final String AUTHORIZATION_HEADER_NAME = "Authorization";
-
- private final HandlerExceptionResolver resolver;
- private final JWTService jwtService;
-
- @Autowired
- public WebSecurity(
- @Qualifier("handlerExceptionResolver") HandlerExceptionResolver resolver,
- @NonNull final JWTService jwtService) {
- this.resolver = resolver;
- this.jwtService = jwtService;
- }
-
- @Override
- protected void configure(HttpSecurity httpSecurity) throws Exception {
- httpSecurity.httpBasic();
- httpSecurity
- .cors()
- .and()
- .csrf()
- .disable()
- .authorizeRequests()
- .antMatchers(HttpMethod.GET, "/files/*")
- .permitAll()
- .antMatchers(HttpMethod.GET, "/api-docs")
- .permitAll()
- .antMatchers(HttpMethod.GET, "/health")
- .permitAll()
- .antMatchers(HttpMethod.POST, "/webhook")
- .permitAll()
- .antMatchers(HttpMethod.POST, "/authentication/*")
- .permitAll()
- .antMatchers(HttpMethod.GET, "/components")
- .permitAll()
- .antMatchers(HttpMethod.POST, "/components/*/actions/*/configs/*/options")
- .permitAll()
- .antMatchers(HttpMethod.POST, "/instances/*/flows/*/runs")
- .permitAll()
- .anyRequest()
- .authenticated()
- .and()
- .addFilter(
- new JWTAuthorizationFilter(
- jwtService,
- authenticationManager()))
- .sessionManagement()
- .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
- }
-
-
- @Bean
- CorsConfigurationSource corsConfigurationSource() {
- CorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues();
- configuration.addExposedHeader(AUTHORIZATION_HEADER_NAME);
- configuration.addAllowedOrigin("*");
- configuration.addAllowedHeader("*");
- configuration.addAllowedMethod("*");
- final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
- source.registerCorsConfiguration("/**", configuration);
- return source;
- }
-}
diff --git a/src/backend/backend-loader/src/main/resources/application-default.properties b/src/backend/backend-loader/src/main/resources/application-default.properties
deleted file mode 100644
index 6ce605791a..0000000000
--- a/src/backend/backend-loader/src/main/resources/application-default.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-
-spring.datasource.hikari.idle-timeout=600000
-spring.datasource.hikari.validationTimeout=300000
-spring.datasource.hikari.connectionTimeout=30000
-spring.datasource.hikari.idleTimeout=600000
-spring.datasource.hikari.maxLifetime=1800000
-
-spring.jpa.hibernate.ddl-auto=update
-spring.datasource.initialization-mode=always
-spring.datasource.platform=postgres
-spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:7432/activepieces}
-spring.datasource.username=postgres
-spring.datasource.password=A79Vm5D4p2VQHOp2gd5
-spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
-
-## General
-com.activepieces.api-prefix=http://localhost:8000
-com.activepieces.redirect-url=http://localhost:8080/redirect
diff --git a/src/backend/backend-loader/src/main/resources/application.properties b/src/backend/backend-loader/src/main/resources/application.properties
deleted file mode 100644
index 2015fe4cc5..0000000000
--- a/src/backend/backend-loader/src/main/resources/application.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-server.port=8000
-spring.output.ansi.enabled=ALWAYS
-logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} |%X{Slf4jMDCFilter.UUID}| %highlight(%-5level) %yellow(%C{1.}): %msg%n%throwable
-logging.request-id-header=Slf4jMDCFilter.UUID
-logging.run-pattern=RUN_%S
-logging.api-pattern=API_%S
-logging.level.root=INFO
-
-## QuartzProperties
-spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
-spring.quartz.job-store-type=jdbc
-spring.quartz.jdbc.schema=classpath:schema.sql
-spring.quartz.jdbc.initialize-schema=always
-spring.quartz.jdbc.comment-prefix=QRTZ
-spring.quartz.properties.org.quartz.threadPool.threadCount=10
-spring.servlet.multipart.max-file-size=25MB
-spring.servlet.multipart.max-request-size=25MB
-
-springdoc.api-docs.path=/api-docs
-spring.flyway.baseline-on-migrate=true
-spring.flyway.locations=classpath:sql
-spring.flyway.sql-migration-prefix=v
diff --git a/src/backend/backend-loader/src/main/resources/artifact.zip b/src/backend/backend-loader/src/main/resources/artifact.zip
deleted file mode 100644
index 9293ac4196..0000000000
Binary files a/src/backend/backend-loader/src/main/resources/artifact.zip and /dev/null differ
diff --git a/src/backend/backend-loader/src/main/resources/code-executor.js b/src/backend/backend-loader/src/main/resources/code-executor.js
deleted file mode 100644
index 0e5d7b993f..0000000000
--- a/src/backend/backend-loader/src/main/resources/code-executor.js
+++ /dev/null
@@ -1,15 +0,0 @@
-const handler = require("./index");
-const fs = require('fs');
-
-async function main(){
- let rawdata = fs.readFileSync('_input.txt');
- let input = JSON.parse(rawdata);
- try{
- let output = await handler.code(input);
- fs.writeFileSync('_functionOutput.txt', output == undefined ? "" : JSON.stringify(output));
- }catch (exception){
- throw exception
- }
-}
-
-main();
diff --git a/src/backend/backend-loader/src/main/resources/invalid-code.js b/src/backend/backend-loader/src/main/resources/invalid-code.js
deleted file mode 100644
index 3a2cbacc85..0000000000
--- a/src/backend/backend-loader/src/main/resources/invalid-code.js
+++ /dev/null
@@ -1,3 +0,0 @@
-exports.code = async (params) => {
- throw new Error("${ERROR_MESSAGE}");
-};
diff --git a/src/backend/backend-loader/src/main/resources/schema.sql b/src/backend/backend-loader/src/main/resources/schema.sql
deleted file mode 100644
index d28633a8b8..0000000000
--- a/src/backend/backend-loader/src/main/resources/schema.sql
+++ /dev/null
@@ -1,190 +0,0 @@
-
-CREATE TABLE IF NOT EXISTS QRTZ_JOB_DETAILS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- JOB_NAME VARCHAR(200) NOT NULL,
- JOB_GROUP VARCHAR(200) NOT NULL,
- DESCRIPTION VARCHAR(250) NULL,
- JOB_CLASS_NAME VARCHAR(250) NOT NULL,
- IS_DURABLE BOOL NOT NULL,
- IS_NONCONCURRENT BOOL NOT NULL,
- IS_UPDATE_DATA BOOL NOT NULL,
- REQUESTS_RECOVERY BOOL NOT NULL,
- JOB_DATA BYTEA NULL,
- PRIMARY KEY (SCHED_NAME, JOB_NAME, JOB_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_TRIGGERS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- JOB_NAME VARCHAR(200) NOT NULL,
- JOB_GROUP VARCHAR(200) NOT NULL,
- DESCRIPTION VARCHAR(250) NULL,
- NEXT_FIRE_TIME BIGINT NULL,
- PREV_FIRE_TIME BIGINT NULL,
- PRIORITY INTEGER NULL,
- TRIGGER_STATE VARCHAR(16) NOT NULL,
- TRIGGER_TYPE VARCHAR(8) NOT NULL,
- START_TIME BIGINT NOT NULL,
- END_TIME BIGINT NULL,
- CALENDAR_NAME VARCHAR(200) NULL,
- MISFIRE_INSTR SMALLINT NULL,
- JOB_DATA BYTEA NULL,
- PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME, JOB_NAME, JOB_GROUP)
- REFERENCES QRTZ_JOB_DETAILS (SCHED_NAME, JOB_NAME, JOB_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_SIMPLE_TRIGGERS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- REPEAT_COUNT BIGINT NOT NULL,
- REPEAT_INTERVAL BIGINT NOT NULL,
- TIMES_TRIGGERED BIGINT NOT NULL,
- PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_CRON_TRIGGERS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- CRON_EXPRESSION VARCHAR(120) NOT NULL,
- TIME_ZONE_ID VARCHAR(80),
- PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_SIMPROP_TRIGGERS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- STR_PROP_1 VARCHAR(512) NULL,
- STR_PROP_2 VARCHAR(512) NULL,
- STR_PROP_3 VARCHAR(512) NULL,
- INT_PROP_1 INT NULL,
- INT_PROP_2 INT NULL,
- LONG_PROP_1 BIGINT NULL,
- LONG_PROP_2 BIGINT NULL,
- DEC_PROP_1 NUMERIC(13, 4) NULL,
- DEC_PROP_2 NUMERIC(13, 4) NULL,
- BOOL_PROP_1 BOOL NULL,
- BOOL_PROP_2 BOOL NULL,
- PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_BLOB_TRIGGERS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- BLOB_DATA BYTEA NULL,
- PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_CALENDARS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- CALENDAR_NAME VARCHAR(200) NOT NULL,
- CALENDAR BYTEA NOT NULL,
- PRIMARY KEY (SCHED_NAME, CALENDAR_NAME)
- );
-
-
-CREATE TABLE IF NOT EXISTS QRTZ_PAUSED_TRIGGER_GRPS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- PRIMARY KEY (SCHED_NAME, TRIGGER_GROUP)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_FIRED_TRIGGERS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- ENTRY_ID VARCHAR(95) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- INSTANCE_NAME VARCHAR(200) NOT NULL,
- FIRED_TIME BIGINT NOT NULL,
- SCHED_TIME BIGINT NOT NULL,
- PRIORITY INTEGER NOT NULL,
- STATE VARCHAR(16) NOT NULL,
- JOB_NAME VARCHAR(200) NULL,
- JOB_GROUP VARCHAR(200) NULL,
- IS_NONCONCURRENT BOOL NULL,
- REQUESTS_RECOVERY BOOL NULL,
- PRIMARY KEY (SCHED_NAME, ENTRY_ID)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_SCHEDULER_STATE
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- INSTANCE_NAME VARCHAR(200) NOT NULL,
- LAST_CHECKIN_TIME BIGINT NOT NULL,
- CHECKIN_INTERVAL BIGINT NOT NULL,
- PRIMARY KEY (SCHED_NAME, INSTANCE_NAME)
- );
-
-CREATE TABLE IF NOT EXISTS QRTZ_LOCKS
-(
- SCHED_NAME VARCHAR(120) NOT NULL,
- LOCK_NAME VARCHAR(40) NOT NULL,
- PRIMARY KEY (SCHED_NAME, LOCK_NAME)
- );
-
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_J_REQ_RECOVERY
- ON QRTZ_JOB_DETAILS (SCHED_NAME, REQUESTS_RECOVERY);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_J_GRP
- ON QRTZ_JOB_DETAILS (SCHED_NAME, JOB_GROUP);
-
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_J
- ON QRTZ_TRIGGERS (SCHED_NAME, JOB_NAME, JOB_GROUP);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_JG
- ON QRTZ_TRIGGERS (SCHED_NAME, JOB_GROUP);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_C
- ON QRTZ_TRIGGERS (SCHED_NAME, CALENDAR_NAME);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_G
- ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_GROUP);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_STATE
- ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_STATE);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_N_STATE
- ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, TRIGGER_STATE);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_N_G_STATE
- ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_GROUP, TRIGGER_STATE);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_NEXT_FIRE_TIME
- ON QRTZ_TRIGGERS (SCHED_NAME, NEXT_FIRE_TIME);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_NFT_ST
- ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_STATE, NEXT_FIRE_TIME);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_NFT_MISFIRE
- ON QRTZ_TRIGGERS (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_NFT_ST_MISFIRE
- ON QRTZ_TRIGGERS (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_STATE);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_T_NFT_ST_MISFIRE_GRP
- ON QRTZ_TRIGGERS (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_GROUP, TRIGGER_STATE);
-
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_FT_TRIG_INST_NAME
- ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, INSTANCE_NAME);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_FT_INST_JOB_REQ_RCVRY
- ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, INSTANCE_NAME, REQUESTS_RECOVERY);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_FT_J_G
- ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, JOB_NAME, JOB_GROUP);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_FT_JG
- ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, JOB_GROUP);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_FT_T_G
- ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP);
-CREATE INDEX IF NOT EXISTS IDX_QRTZ_FT_TG
- ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, TRIGGER_GROUP);
-
-
diff --git a/src/backend/backend-loader/src/main/resources/sql/v2__init.sql b/src/backend/backend-loader/src/main/resources/sql/v2__init.sql
deleted file mode 100644
index bfac7c6d2c..0000000000
--- a/src/backend/backend-loader/src/main/resources/sql/v2__init.sql
+++ /dev/null
@@ -1,60 +0,0 @@
-CREATE TABLE INT_MESSAGE (
- MESSAGE_ID CHAR(36) NOT NULL,
- REGION VARCHAR(100) NOT NULL,
- CREATED_DATE TIMESTAMP NOT NULL,
- MESSAGE_BYTES BYTEA,
- constraint INT_MESSAGE_PK primary key (MESSAGE_ID, REGION)
-);
-
-CREATE INDEX INT_MESSAGE_IX1 ON INT_MESSAGE (CREATED_DATE);
-
-CREATE TABLE INT_GROUP_TO_MESSAGE (
- GROUP_KEY CHAR(36) NOT NULL,
- MESSAGE_ID CHAR(36) NOT NULL,
- REGION VARCHAR(100),
- constraint INT_GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION)
-);
-
-CREATE TABLE INT_MESSAGE_GROUP (
- GROUP_KEY CHAR(36) NOT NULL,
- REGION VARCHAR(100) NOT NULL,
- MARKED BIGINT,
- COMPLETE BIGINT,
- LAST_RELEASED_SEQUENCE BIGINT,
- CREATED_DATE TIMESTAMP NOT NULL,
- UPDATED_DATE TIMESTAMP DEFAULT NULL,
- constraint INT_MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION)
-);
-
-CREATE TABLE INT_LOCK (
- LOCK_KEY CHAR(36) NOT NULL,
- REGION VARCHAR(100) NOT NULL,
- CLIENT_ID CHAR(36),
- CREATED_DATE TIMESTAMP NOT NULL,
- constraint INT_LOCK_PK primary key (LOCK_KEY, REGION)
-);
-
-CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CYCLE;
-
-CREATE TABLE INT_CHANNEL_MESSAGE (
- MESSAGE_ID CHAR(36) NOT NULL,
- GROUP_KEY CHAR(36) NOT NULL,
- CREATED_DATE BIGINT NOT NULL,
- MESSAGE_PRIORITY BIGINT,
- MESSAGE_SEQUENCE BIGINT NOT NULL DEFAULT nextval('INT_MESSAGE_SEQ'),
- MESSAGE_BYTES BYTEA,
- REGION VARCHAR(100) NOT NULL,
- constraint INT_CHANNEL_MESSAGE_PK primary key (REGION, GROUP_KEY, CREATED_DATE, MESSAGE_SEQUENCE)
-);
-
-CREATE INDEX INT_CHANNEL_MSG_DELETE_IDX ON INT_CHANNEL_MESSAGE (REGION, GROUP_KEY, MESSAGE_ID);
--- This is only needed if the message group store property 'priorityEnabled' is true
--- CREATE UNIQUE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (REGION, GROUP_KEY, MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE);
-
-
-CREATE TABLE INT_METADATA_STORE (
- METADATA_KEY VARCHAR(255) NOT NULL,
- METADATA_VALUE VARCHAR(4000),
- REGION VARCHAR(100) NOT NULL,
- constraint INT_METADATA_STORE_PK primary key (METADATA_KEY, REGION)
-);
\ No newline at end of file
diff --git a/src/backend/collection-service/collection-client/pom.xml b/src/backend/collection-service/collection-client/pom.xml
deleted file mode 100644
index b60744dbbf..0000000000
--- a/src/backend/collection-service/collection-client/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
- collection-client
-
-
- authentication-client
- com.activepieces
- compile
- 1.0
-
-
- com.activepieces
- guardian-client
- 1.0
- compile
-
-
- com.activepieces
- flow-client
- 1.0
- compile
-
-
- 4.0.0
-
-
- collection-service
- com.activepieces
- 1.0
-
-
-
-
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/CollectionService.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/CollectionService.java
deleted file mode 100644
index 91d7e1492e..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/CollectionService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.activepieces.piece.client;
-
-import com.activepieces.common.error.exception.InvalidCodeArtifactException;
-import com.activepieces.common.error.exception.collection.CollectionNotFoundException;
-import com.activepieces.common.error.exception.collection.CollectionVersionAlreadyLockedException;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.common.pagination.SeekPage;
-import com.activepieces.common.pagination.SeekPageRequest;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.guardian.client.exception.ResourceNotFoundException;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.activepieces.piece.client.model.CollectionView;
-import com.activepieces.piece.client.model.CreatePieceRequest;
-import com.github.ksuid.Ksuid;
-
-import java.io.IOException;
-import java.util.Optional;
-
-public interface CollectionService {
-
- SeekPage listByProjectId(Ksuid projectId, SeekPageRequest pageRequest) throws CollectionNotFoundException, PermissionDeniedException;
-
- CollectionView create(Ksuid projectId, CreatePieceRequest view) throws PermissionDeniedException, ResourceNotFoundException, IOException, CollectionVersionNotFoundException, InvalidCodeArtifactException;
-
- Optional getOptional(Ksuid id) throws PermissionDeniedException;
-
- CollectionView get(Ksuid id) throws CollectionNotFoundException, PermissionDeniedException;
-
- CollectionView update(Ksuid id, CollectionVersionView view)
- throws CollectionNotFoundException, PermissionDeniedException, ResourceNotFoundException, IOException, CollectionVersionNotFoundException, InvalidCodeArtifactException, CollectionVersionAlreadyLockedException;
-
- void delete(Ksuid id) throws CollectionNotFoundException, PermissionDeniedException, ResourceNotFoundException;
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/CollectionVersionService.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/CollectionVersionService.java
deleted file mode 100644
index 63d0879f6f..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/CollectionVersionService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.activepieces.piece.client;
-
-
-import com.activepieces.common.error.exception.collection.CollectionInvalidStateException;
-import com.activepieces.common.error.exception.collection.CollectionNotFoundException;
-import com.activepieces.common.error.exception.collection.CollectionVersionAlreadyLockedException;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.common.error.exception.flow.FlowNotFoundException;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.guardian.client.exception.ResourceNotFoundException;
-import com.activepieces.piece.client.model.CollectionMetaVersionView;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.github.ksuid.Ksuid;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-public interface CollectionVersionService {
-
- CollectionVersionView create(Ksuid collectionId, CollectionVersionView view) throws ResourceNotFoundException, PermissionDeniedException, CollectionVersionNotFoundException;
-
- CollectionVersionView getLatest(Ksuid collectionId) throws PermissionDeniedException;
-
- CollectionVersionView get(Ksuid id) throws CollectionVersionNotFoundException, PermissionDeniedException;
-
- Map commit(Ksuid id) throws PermissionDeniedException, CollectionVersionNotFoundException, CollectionVersionAlreadyLockedException, FlowNotFoundException, CollectionInvalidStateException;
-
- CollectionVersionView update(Ksuid id, CollectionVersionView view) throws PermissionDeniedException, CollectionVersionNotFoundException, CollectionVersionAlreadyLockedException, CollectionVersionAlreadyLockedException;
-
- List listByCollectionId(Ksuid collectionId) throws CollectionNotFoundException, PermissionDeniedException;
-
- Optional getOptional(Ksuid id) throws PermissionDeniedException;
-
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/mapper/CollectionMapper.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/mapper/CollectionMapper.java
deleted file mode 100644
index 9e06d9bffa..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/mapper/CollectionMapper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.activepieces.piece.client.mapper;
-
-import com.activepieces.common.error.ErrorServiceHandler;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.entity.sql.Collection;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.piece.client.CollectionVersionService;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.activepieces.piece.client.model.CollectionView;
-import com.github.ksuid.Ksuid;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.Mappings;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.UUID;
-
-import static org.mapstruct.SubclassExhaustiveStrategy.COMPILE_ERROR;
-
-@Mapper(subclassExhaustiveStrategy = COMPILE_ERROR, componentModel = "spring")
-public abstract class CollectionMapper {
-
- @Autowired
- private CollectionVersionService collectionVersionService;
-
- @Mappings({})
- public abstract Collection fromView(CollectionView entity);
-
- @Mappings({
- @Mapping(target = "lastVersion", expression = "java(map(entity.getId()))"),
- })
- public abstract CollectionView toView(Collection entity);
-
- public CollectionVersionView map(Ksuid collectionId) {
- try {
- return collectionVersionService.getLatest(collectionId);
- } catch (PermissionDeniedException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/mapper/CollectionVersionMapper.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/mapper/CollectionVersionMapper.java
deleted file mode 100644
index f8138ca79b..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/mapper/CollectionVersionMapper.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.activepieces.piece.client.mapper;
-
-import com.activepieces.entity.sql.CollectionVersion;
-import com.activepieces.entity.subdocuments.field.Variable;
-import com.activepieces.piece.client.model.CollectionMetaVersionView;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.Mappings;
-
-import java.util.List;
-
-import static org.mapstruct.SubclassExhaustiveStrategy.COMPILE_ERROR;
-
-@Mapper(subclassExhaustiveStrategy = COMPILE_ERROR, componentModel = "spring")
-public abstract class CollectionVersionMapper {
-
- @Mappings({})
- public abstract CollectionMetaVersionView toMeta(CollectionVersionView entity);
- @Mappings({})
- public abstract CollectionVersion fromView(CollectionVersionView entity);
-
- @Mappings({})
- public abstract CollectionVersionView toView(CollectionVersion entity);
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionMetaVersionView.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionMetaVersionView.java
deleted file mode 100644
index bbdeaff138..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionMetaVersionView.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.activepieces.piece.client.model;
-
-import com.activepieces.common.EntityMetadata;
-import com.activepieces.entity.enums.EditState;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.ksuid.Ksuid;
-import lombok.*;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.util.UUID;
-
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-@Builder(toBuilder = true)
-public class CollectionMetaVersionView implements EntityMetadata {
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private Ksuid id;
-
- @JsonProperty @NotEmpty @NotNull private String displayName;
-
- @JsonIgnore private Ksuid collectionId;
-
- @JsonProperty @NotEmpty private String description;
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private long created;
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private long updated;
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private EditState state;
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionVersionView.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionVersionView.java
deleted file mode 100644
index a887bb92db..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionVersionView.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.activepieces.piece.client.model;
-
-import com.activepieces.entity.enums.EditState;
-import com.activepieces.entity.subdocuments.field.Variable;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.ksuid.Ksuid;
-import lombok.*;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-@Builder(toBuilder = true)
-public class CollectionVersionView {
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private Ksuid id;
-
- @JsonProperty @NotEmpty private String displayName;
-
- @JsonProperty @NotNull private List<@Valid Variable> configs;
-
- @JsonIgnore private Ksuid collectionId;
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private long created;
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private long updated;
-
- @JsonProperty(access= JsonProperty.Access.READ_ONLY)
- private EditState state;
-
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionView.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionView.java
deleted file mode 100644
index 5160604f67..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CollectionView.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.activepieces.piece.client.model;
-
-import com.activepieces.common.EntityMetadata;
-import com.activepieces.entity.enums.EditState;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.github.ksuid.Ksuid;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.experimental.SuperBuilder;
-
-import java.time.Instant;
-import java.util.List;
-import java.util.UUID;
-
-@NoArgsConstructor
-@Getter
-@Setter
-@AllArgsConstructor
-@SuperBuilder(toBuilder = true)
-public class CollectionView implements EntityMetadata {
-
- @JsonProperty(access= JsonProperty.Access.READ_ONLY) private Ksuid id;
-
- @JsonProperty(access= JsonProperty.Access.READ_ONLY)
- private Ksuid projectId;
-
- @JsonProperty(access = JsonProperty.Access.READ_ONLY)
- private CollectionVersionView lastVersion;
-
- @JsonProperty(access= JsonProperty.Access.READ_ONLY) private long created;
-
- @JsonProperty(access= JsonProperty.Access.READ_ONLY) private long updated;
-
- public void updateOrCreateDraft(CollectionVersionView newDraft) {
- lastVersion = newDraft;
- }
-
-}
diff --git a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CreatePieceRequest.java b/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CreatePieceRequest.java
deleted file mode 100644
index df99b45337..0000000000
--- a/src/backend/collection-service/collection-client/src/main/java/com/activepieces/piece/client/model/CreatePieceRequest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.activepieces.piece.client.model;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.*;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-
-
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-@Builder(toBuilder = true)
-public class CreatePieceRequest {
-
- @JsonProperty @NotEmpty
- private String displayName;
-
-
-}
diff --git a/src/backend/collection-service/collection-server/pom.xml b/src/backend/collection-service/collection-server/pom.xml
deleted file mode 100644
index ff67f21580..0000000000
--- a/src/backend/collection-service/collection-server/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
- collection-server
-
-
- guardian-client
- com.activepieces
- compile
- 1.0
-
-
- authentication-client
- com.activepieces
- compile
- 1.0
-
-
- com.activepieces
- project-client
- 1.0
- compile
-
-
- junit
- junit
- test
-
-
- com.activepieces
- flow-client
- 1.0
- compile
-
-
- com.activepieces
- instance-client
- 1.0
- compile
-
-
- com.activepieces
- collection-client
- 1.0
- compile
-
-
- 4.0.0
-
- collection-service
- com.activepieces
- 1.0
-
-
-
- 11
- 11
-
-
-
-
diff --git a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/controller/CollectionController.java b/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/controller/CollectionController.java
deleted file mode 100644
index 1ed7d2511f..0000000000
--- a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/controller/CollectionController.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.activepieces.piece.server.controller;
-
-import com.activepieces.common.error.exception.InvalidCodeArtifactException;
-import com.activepieces.common.error.exception.collection.CollectionNotFoundException;
-import com.activepieces.common.error.exception.collection.CollectionVersionAlreadyLockedException;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.common.pagination.Cursor;
-import com.activepieces.common.pagination.SeekPage;
-import com.activepieces.common.pagination.SeekPageRequest;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.guardian.client.exception.ResourceNotFoundException;
-import com.activepieces.piece.client.CollectionService;
-import com.activepieces.piece.client.CollectionVersionService;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.activepieces.piece.client.model.CollectionView;
-import com.activepieces.piece.client.model.CreatePieceRequest;
-import com.github.ksuid.Ksuid;
-import io.swagger.v3.oas.annotations.Hidden;
-import lombok.NonNull;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.annotation.Secured;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.io.IOException;
-
-@RestController
-@RequestMapping
-@Hidden
-public class CollectionController {
-
- private final CollectionService collectionService;
- private final CollectionVersionService collectionVersionService;
-
- @Autowired
- public CollectionController(
- @NonNull final CollectionService collectionService,
- @NonNull final CollectionVersionService collectionVersionService) {
- this.collectionService = collectionService;
- this.collectionVersionService = collectionVersionService;
- }
-
- @Secured(value = {"ROLE_API_KEY", "ROLE_USER"})
- @GetMapping("/collections/{collectionId}")
- public ResponseEntity get(@PathVariable("collectionId") Ksuid collectionId)
- throws CollectionNotFoundException, PermissionDeniedException {
- CollectionView collectionView = collectionService.get(collectionId);
- return ResponseEntity.ok(collectionView);
- }
-
- @Secured(value = {"ROLE_API_KEY", "ROLE_USER"})
- @GetMapping({"/projects/{projectId}/collections"})
- public ResponseEntity> list(
- @PathVariable("projectId") Ksuid projectId,
- @RequestParam(value = "cursor", required = false) Cursor cursor,
- @RequestParam(value = "limit", defaultValue = "10", required = false) int limit)
- throws PermissionDeniedException, CollectionNotFoundException {
- return ResponseEntity.ok(
- collectionService.listByProjectId(
- projectId, new SeekPageRequest(cursor, limit)));
- }
-
- @PostMapping("/projects/{projectId}/collections")
- public ResponseEntity create(
- @PathVariable("projectId") Ksuid projectId,
- @RequestBody @Valid CreatePieceRequest request)
- throws PermissionDeniedException, ResourceNotFoundException,
- IOException, CollectionVersionNotFoundException, InvalidCodeArtifactException {
- return ResponseEntity.ok(collectionService.create(projectId, request));
- }
-
- @PutMapping("/collections/{collectionId}")
- public ResponseEntity update(
- @PathVariable("collectionId") Ksuid collectionId,
- @RequestBody @Valid CollectionVersionView request)
- throws PermissionDeniedException, CollectionNotFoundException, ResourceNotFoundException,
- IOException, CollectionVersionNotFoundException,
- CollectionVersionAlreadyLockedException, InvalidCodeArtifactException {
- return ResponseEntity.ok(collectionService.update(collectionId, request));
- }
-
- @DeleteMapping("/collections/{collectionId}")
- public void delete(@PathVariable("collectionId") Ksuid collectionId)
- throws PermissionDeniedException, CollectionNotFoundException, ResourceNotFoundException {
- collectionService.delete(collectionId);
- }
-}
diff --git a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/controller/CollectionVersionController.java b/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/controller/CollectionVersionController.java
deleted file mode 100644
index 4a04e3438e..0000000000
--- a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/controller/CollectionVersionController.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.activepieces.piece.server.controller;
-
-import com.activepieces.common.error.exception.collection.CollectionNotFoundException;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.piece.client.CollectionVersionService;
-import com.activepieces.piece.client.model.CollectionMetaVersionView;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.github.ksuid.Ksuid;
-import io.swagger.v3.oas.annotations.Hidden;
-import lombok.NonNull;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.annotation.Secured;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-import java.util.UUID;
-
-@RestController
-@Hidden
-@RequestMapping
-public class CollectionVersionController {
-
- private final CollectionVersionService collectionVersionService;
-
- @Autowired
- public CollectionVersionController(
- @NonNull final CollectionVersionService collectionVersionService) {
- this.collectionVersionService = collectionVersionService;
- }
-
- @GetMapping( "/collection-versions/{versionId}")
- public ResponseEntity get(@PathVariable("versionId") Ksuid versionId)
- throws PermissionDeniedException, CollectionVersionNotFoundException {
- CollectionVersionView pieceView = collectionVersionService.get(versionId);
- return ResponseEntity.ok(pieceView);
- }
-
- @Secured(value = {"ROLE_API_KEY", "ROLE_USER"})
- @GetMapping( "/collections/{collectionId}/versions")
- public ResponseEntity> list(@PathVariable("collectionId") Ksuid collectionId)
- throws PermissionDeniedException, CollectionNotFoundException {
- return ResponseEntity.ok(collectionVersionService.listByCollectionId(collectionId));
- }
-
-
-}
diff --git a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/repository/CollectionRepository.java b/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/repository/CollectionRepository.java
deleted file mode 100644
index b871d124c9..0000000000
--- a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/repository/CollectionRepository.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.activepieces.piece.server.repository;
-
-import com.activepieces.common.pagination.PaginationRepository;
-import com.activepieces.entity.sql.Collection;
-import com.github.ksuid.Ksuid;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.UUID;
-
-@Repository("CollectionRepository")
-public interface CollectionRepository extends CrudRepository, PaginationRepository {
-
-
-}
diff --git a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/repository/CollectionVersionRepository.java b/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/repository/CollectionVersionRepository.java
deleted file mode 100644
index aa1017688b..0000000000
--- a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/repository/CollectionVersionRepository.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.activepieces.piece.server.repository;
-
-import com.activepieces.entity.sql.CollectionVersion;
-import com.github.ksuid.Ksuid;
-import org.springframework.data.repository.CrudRepository;
-
-import java.util.List;
-
-public interface CollectionVersionRepository extends CrudRepository {
-
- List findAllByCollectionId(Ksuid collectionId);
-
- CollectionVersion findFirstByCollectionIdOrderByIdDesc(Ksuid collectionId);
-
-}
diff --git a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/service/CollectionServiceImpl.java b/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/service/CollectionServiceImpl.java
deleted file mode 100644
index 9943d7e2e0..0000000000
--- a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/service/CollectionServiceImpl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.activepieces.piece.server.service;
-
-
-import com.activepieces.common.error.exception.collection.CollectionNotFoundException;
-import com.activepieces.common.error.exception.collection.CollectionVersionAlreadyLockedException;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.common.pagination.PageFilter;
-import com.activepieces.common.pagination.PageOperator;
-import com.activepieces.common.pagination.SeekPage;
-import com.activepieces.common.pagination.SeekPageRequest;
-import com.activepieces.entity.enums.EditState;
-import com.activepieces.entity.enums.Permission;
-import com.activepieces.entity.enums.ResourceType;
-import com.activepieces.entity.sql.Collection;
-import com.activepieces.guardian.client.PermissionService;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.guardian.client.exception.ResourceNotFoundException;
-import com.activepieces.piece.client.CollectionService;
-import com.activepieces.piece.client.CollectionVersionService;
-import com.activepieces.piece.client.mapper.CollectionMapper;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.activepieces.piece.client.model.CollectionView;
-import com.activepieces.piece.client.model.CreatePieceRequest;
-import com.activepieces.piece.server.repository.CollectionRepository;
-import com.github.ksuid.Ksuid;
-import lombok.NonNull;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-
-@Service
-public class CollectionServiceImpl implements CollectionService {
-
- private final CollectionRepository collectionRepository;
- private final CollectionVersionService collectionVersionService;
- private final CollectionMapper collectionMapper;
- private final PermissionService permissionService;
-
- @Autowired
- public CollectionServiceImpl(
- @NonNull final CollectionRepository collectionRepository,
- @NonNull final CollectionMapper collectionMapper,
- @NonNull final CollectionVersionService collectionVersionService,
- @NonNull final PermissionService permissionService) {
- this.collectionRepository = collectionRepository;
- this.collectionVersionService = collectionVersionService;
- this.permissionService = permissionService;
- this.collectionMapper = collectionMapper;
- }
-
- @Override
- public SeekPage listByProjectId(Ksuid projectId, SeekPageRequest request)
- throws PermissionDeniedException {
- permissionService.requiresPermission(projectId, Permission.READ_COLLECTION);
- final List filters = List.of(new PageFilter(Collection.PROJECT_ID, PageOperator.EQUAL, projectId));
- return collectionRepository.findPageAsc( filters, request).convert(collectionMapper::toView);
- }
-
-
- @Override
- public CollectionView create(Ksuid projectId, CreatePieceRequest view)
- throws PermissionDeniedException, ResourceNotFoundException, CollectionVersionNotFoundException {
- permissionService.requiresPermission(projectId, Permission.WRITE_COLLECTION);
- Ksuid collectionId = Ksuid.newKsuid();
-
- Collection metadata = Collection.builder().id(collectionId).projectId(projectId).build();
- Collection result = collectionRepository.save(metadata);
- permissionService.createResourceWithParent(result.getId(), projectId, ResourceType.COLLECTION);
-
- CollectionVersionView collectionVersionView =
- collectionVersionService.create(
- collectionId,
- CollectionVersionView.builder()
- .configs(Collections.emptyList())
- .displayName(view.getDisplayName())
- .build());
- return collectionMapper.toView(result);
- }
-
- @Override
- public Optional getOptional(Ksuid id) throws PermissionDeniedException {
- Optional optional = collectionRepository.findById(id);
- if (optional.isEmpty()) {
- return Optional.empty();
- }
- permissionService.requiresPermission(optional.get().getId(), Permission.READ_COLLECTION);
- CollectionView collectionView = collectionMapper.toView(optional.get());
- return Optional.of(collectionView);
- }
-
- @Override
- public CollectionView get(Ksuid id) throws CollectionNotFoundException, PermissionDeniedException {
- Optional optional = getOptional(id);
- if (optional.isEmpty()) {
- throw new CollectionNotFoundException(id);
- }
- return optional.get();
- }
-
- @Override
- public CollectionView update(Ksuid id, CollectionVersionView view)
- throws CollectionNotFoundException, PermissionDeniedException, ResourceNotFoundException, CollectionVersionNotFoundException, CollectionVersionAlreadyLockedException {
- Optional optional = collectionRepository.findById(id);
- if (optional.isEmpty()) {
- throw new CollectionNotFoundException(id);
- }
- permissionService.requiresPermission(id, Permission.WRITE_COLLECTION);
- CollectionView collectionView = get(id);
- CollectionVersionView draft;
- if (collectionView.getLastVersion().getState().equals(EditState.LOCKED)) {
- draft = collectionVersionService.create(id, view);
- } else {
- draft = collectionVersionService.update(collectionView.getLastVersion().getId(), view);
- }
- collectionView.updateOrCreateDraft(draft);
- return collectionMapper.toView(collectionRepository.save(collectionMapper.fromView(collectionView)));
- }
-
-
- public void delete(Ksuid id)
- throws CollectionNotFoundException, PermissionDeniedException {
- Optional pieceOptional = collectionRepository.findById(id);
- if (pieceOptional.isEmpty()) {
- throw new CollectionNotFoundException(id);
- }
- permissionService.requiresPermission(id, Permission.WRITE_COLLECTION);
- collectionRepository.delete(pieceOptional.get());
- }
-}
diff --git a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/service/CollectionVersionServiceImpl.java b/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/service/CollectionVersionServiceImpl.java
deleted file mode 100644
index 0db2e68112..0000000000
--- a/src/backend/collection-service/collection-server/src/main/java/com/activepieces/piece/server/service/CollectionVersionServiceImpl.java
+++ /dev/null
@@ -1,191 +0,0 @@
-package com.activepieces.piece.server.service;
-
-import com.activepieces.cache.ConditionalCache;
-import com.activepieces.common.error.ErrorServiceHandler;
-import com.activepieces.common.error.exception.collection.CollectionInvalidStateException;
-import com.activepieces.common.error.exception.collection.CollectionNotFoundException;
-import com.activepieces.common.error.exception.collection.CollectionVersionAlreadyLockedException;
-import com.activepieces.common.error.exception.collection.CollectionVersionNotFoundException;
-import com.activepieces.common.error.exception.flow.FlowNotFoundException;
-import com.activepieces.common.error.exception.flow.FlowVersionAlreadyLockedException;
-import com.activepieces.common.error.exception.flow.FlowVersionNotFoundException;
-import com.activepieces.common.pagination.SeekPageRequest;
-import com.activepieces.entity.enums.EditState;
-import com.activepieces.entity.enums.Permission;
-import com.activepieces.entity.enums.ResourceType;
-import com.activepieces.entity.sql.Collection;
-import com.activepieces.entity.sql.CollectionVersion;
-import com.activepieces.flow.FlowService;
-import com.activepieces.flow.FlowVersionService;
-import com.activepieces.flow.model.FlowVersionView;
-import com.activepieces.flow.model.FlowView;
-import com.activepieces.guardian.client.PermissionService;
-import com.activepieces.guardian.client.exception.PermissionDeniedException;
-import com.activepieces.guardian.client.exception.ResourceNotFoundException;
-import com.activepieces.piece.client.CollectionVersionService;
-import com.activepieces.piece.client.mapper.CollectionVersionMapper;
-import com.activepieces.piece.client.model.CollectionMetaVersionView;
-import com.activepieces.piece.client.model.CollectionVersionView;
-import com.activepieces.piece.server.repository.CollectionRepository;
-import com.activepieces.piece.server.repository.CollectionVersionRepository;
-import com.github.ksuid.Ksuid;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-@Service
-public class CollectionVersionServiceImpl implements CollectionVersionService {
-
- private final CollectionVersionRepository collectionVersionRepository;
- private final CollectionVersionMapper collectionVersionMapper;
- private final FlowVersionService flowVersionService;
- private final PermissionService permissionService;
- private final FlowService flowService;
- private final CollectionRepository collectionRepository;
- private final ErrorServiceHandler errorServiceHandler;
- private final ConditionalCache> conditionalCache;
-
- @Autowired
- public CollectionVersionServiceImpl(
- final CollectionVersionRepository collectionVersionRepository,
- final FlowVersionService flowVersionService,
- final PermissionService permissionService,
- final ErrorServiceHandler errorServiceHandler,
- final CollectionRepository collectionRepository,
- final FlowService flowService,
- final CollectionVersionMapper collectionVersionMapper) {
- Function> generatorFunction =
- collectionVersionRepository::findById;
- Function, Boolean> cacheCondition =
- pieceVersionOptional ->
- pieceVersionOptional.isPresent()
- && pieceVersionOptional.get().getState().equals(EditState.LOCKED);
- this.conditionalCache = new ConditionalCache<>(generatorFunction, cacheCondition);
-
- this.collectionVersionMapper = collectionVersionMapper;
- this.permissionService = permissionService;
- this.collectionRepository = collectionRepository;
- this.errorServiceHandler = errorServiceHandler;
- this.flowService = flowService;
- this.flowVersionService = flowVersionService;
- this.collectionVersionRepository = collectionVersionRepository;
- }
-
- @Override
- public CollectionVersionView create(
- Ksuid collectionId,
- CollectionVersionView view)
- throws ResourceNotFoundException,
- PermissionDeniedException {
- permissionService.requiresPermission(collectionId, Permission.WRITE_COLLECTION);
- Ksuid newVersionIUd = Ksuid.newKsuid();
- CollectionVersionView savedView =
- saveFromView(
- view.toBuilder()
- .collectionId(collectionId)
- .id(newVersionIUd)
- .state(EditState.DRAFT)
- .build());
- permissionService.createResourceWithParent(
- savedView.getId(), savedView.getCollectionId(), ResourceType.COLLECTION_VERSION);
- return savedView;
- }
-
- @Override
- public CollectionVersionView getLatest(Ksuid collectionId) throws PermissionDeniedException {
- permissionService.requiresPermission(collectionId, Permission.READ_COLLECTION);
- return collectionVersionMapper.toView(collectionVersionRepository.findFirstByCollectionIdOrderByIdDesc(collectionId));
- }
-
- @Override
- public Optional getOptional(Ksuid id) throws PermissionDeniedException {
- Optional optional = conditionalCache.get(id);
- if (optional.isEmpty()) {
- return Optional.empty();
- }
- permissionService.requiresPermission(optional.get().getId(), Permission.READ_COLLECTION);
- return optional.map(collectionVersionMapper::toView);
- }
-
- @Override
- public CollectionVersionView get(Ksuid id)
- throws CollectionVersionNotFoundException, PermissionDeniedException {
- return getOptional(id).orElseThrow(() -> new CollectionVersionNotFoundException(id));
- }
-
- @Override
- public CollectionVersionView update(
- Ksuid id, CollectionVersionView view)
- throws PermissionDeniedException, CollectionVersionNotFoundException, CollectionVersionAlreadyLockedException {
- permissionService.requiresPermission(id, Permission.WRITE_COLLECTION);
- CollectionVersionView currentVersion = get(id);
- if (currentVersion.getState().equals(EditState.LOCKED)) {
- throw new CollectionVersionAlreadyLockedException(id);
- }
- CollectionVersionView savedView =
- saveFromView(
- currentVersion.toBuilder()
- .displayName(view.getDisplayName())
- .configs(view.getConfigs())
- .build());
- return saveFromView(savedView);
- }
-
- @Override
- public List listByCollectionId(Ksuid collectionId)
- throws CollectionNotFoundException, PermissionDeniedException {
- permissionService.requiresPermission(collectionId, Permission.READ_COLLECTION);
- Optional collection = collectionRepository.findById(collectionId);
- if (collection.isEmpty()) {
- throw new CollectionNotFoundException(collectionId);
- }
- return collectionVersionRepository.findAllByCollectionId(collectionId).stream()
- .map(version -> collectionVersionMapper.toMeta(collectionVersionMapper.toView(version)))
- .collect(Collectors.toList());
- }
-
- @Override
- public Map commit(Ksuid collectionVersionId)
- throws PermissionDeniedException, CollectionVersionNotFoundException, FlowNotFoundException,
- CollectionInvalidStateException {
- permissionService.requiresPermission(collectionVersionId, Permission.WRITE_COLLECTION);
- CollectionVersionView currentVersion = get(collectionVersionId);
- List flowViews = flowService.listByCollectionId(currentVersion.getCollectionId(), new SeekPageRequest(null, Integer.MAX_VALUE)).getData();
- for (FlowView flowView : flowViews) {
- if (!flowView.getLastVersion().isValid()) {
- throw new CollectionInvalidStateException(currentVersion.getDisplayName());
- }
- }
- Map flowVersionIds = flowViews.stream()
- .map(f -> Map.entry( f.getId(), f.getLastVersion().getId()))
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
-
- commitFlows(new ArrayList<>(flowVersionIds.values()));
- saveFromView(
- currentVersion.toBuilder().state(EditState.LOCKED).build());
- return flowVersionIds;
- }
-
- private void commitFlows(List versionsList) {
- versionsList.forEach(
- f -> {
- try {
- FlowVersionView flowVersionView = flowVersionService.get(f);
- try {
- flowVersionService.lock(flowVersionView.getId());
- } catch (FlowVersionAlreadyLockedException ignored) {
- }
- } catch (FlowVersionNotFoundException | PermissionDeniedException e) {
- throw errorServiceHandler.createInternalError(CollectionVersionServiceImpl.class, e);
- }
- });
- }
-
- private CollectionVersionView saveFromView(CollectionVersionView versionView) {
- return collectionVersionMapper.toView(
- collectionVersionRepository.save(collectionVersionMapper.fromView(versionView)));
- }
-}
diff --git a/src/backend/collection-service/pom.xml b/src/backend/collection-service/pom.xml
deleted file mode 100644
index 8d1bade3a7..0000000000
--- a/src/backend/collection-service/pom.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- collection-service
- 4.0.0
- pom
-
- backend
- com.activepieces
- 1.0
-
-
-
- collection-client
- collection-server
-
-
diff --git a/src/backend/component-service/pom.xml b/src/backend/component-service/pom.xml
deleted file mode 100644
index 9923fbde5d..0000000000
--- a/src/backend/component-service/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- backend
- com.activepieces
- 1.0
-
- 4.0.0
-
- component-service
-
-
- com.activepieces
- entities
- 1.0
- compile
-
-
- com.activepieces
- flow-client
- 1.0
- compile
-
-
-
-
- 11
- 11
-
-
-
\ No newline at end of file
diff --git a/src/backend/component-service/src/main/java/com/activepieces/component/ComponentService.java b/src/backend/component-service/src/main/java/com/activepieces/component/ComponentService.java
deleted file mode 100644
index f52a2b5b42..0000000000
--- a/src/backend/component-service/src/main/java/com/activepieces/component/ComponentService.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.activepieces.component;
-
-import com.activepieces.common.Constants;
-import com.activepieces.common.utils.ArtifactUtils;
-import com.activepieces.entity.enums.ComponentTriggerHook;
-import com.activepieces.entity.enums.ComponentTriggerType;
-import com.activepieces.flow.model.FlowVersionView;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.PropertyNamingStrategies;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import lombok.NonNull;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-@Service
-public class ComponentService {
-
- private final ObjectMapper objectMapper;
- private final String apiPrefix;
-
- @Autowired
- public ComponentService(@Value("${com.activepieces.api-prefix}") final String apiPrefix,
- @NonNull final ObjectMapper objectMapper) {
- this.objectMapper = objectMapper.copy().setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE);
- this.apiPrefix = apiPrefix;
- }
-
- public List getApps() throws IOException, InterruptedException {
- final String result = runJs(Constants.WORKER_APPS_ARG, null);
- return objectMapper.readValue(result, new TypeReference<>() {
- });
- }
-
- public boolean validateConfig(
- @NonNull final String componentName,
- final String actionName,
- final String triggerName,
- @NonNull final Map input) {
- try {
- final ObjectNode objectNode = objectMapper.createObjectNode();
- objectNode.put("componentName", componentName);
- objectNode.put("actionName", actionName);
- objectNode.put("triggerName", triggerName);
- objectNode.put("input", objectMapper.convertValue(input, ObjectNode.class));
- final String result = runJs(Constants.WORKER_VALIDATE_CONFIGS_ARG, objectMapper.writeValueAsString(objectNode)).trim();
- return Boolean.parseBoolean(result);
- }catch (IOException | InterruptedException e){
- throw new RuntimeException(e);
- }
- }
-
- public void executeTriggerHook(
- @NonNull final ComponentTriggerHook componentTriggerHook,
- @NonNull final FlowVersionView flowVersion,
- @NonNull final Map configs) throws IOException, InterruptedException {
- final ObjectNode objectNode = objectMapper.createObjectNode();
- objectNode.put("flowVersion", objectMapper.convertValue(flowVersion, ObjectNode.class));
- objectNode.put("method", componentTriggerHook.equals(ComponentTriggerHook.ENABLED) ? "on-enable" : "on-disable");
- objectNode.put("configs", objectMapper.convertValue(configs, ObjectNode.class));
- objectNode.put("webhookUrl", String.format("%s/flows/%s/webhook", apiPrefix, flowVersion.getFlowId()));
- runJs(Constants.WORKER_EXECUTE_TRIGGER_ARG, objectMapper.writeValueAsString(objectNode));
- }
-
- public List