diff --git a/docs/customer-portal/activity.mdx b/docs/customer-portal/activity.mdx deleted file mode 100644 index 9b0026db7d..0000000000 --- a/docs/customer-portal/activity.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Activity" -description: "" -icon: "book-open" ---- - -To save time for both customers and agencies ⌛, we created a table where customers can track their automations at any time they want, providing them with essential information in 4 columns (Event, Message, Status and Occurred on). - -The table will be updated by the agency creating/maintaining the automation in their own preferred manner using an **Activity piece** within the flows they build. - -![Activity Started](../resources/screenshots/activity-started.png) - -![Activity Finished](../resources/screenshots/activity-finished.png) \ No newline at end of file diff --git a/docs/customer-portal/connections.mdx b/docs/customer-portal/connections.mdx deleted file mode 100644 index 227e3a01de..0000000000 --- a/docs/customer-portal/connections.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Connections" -description: "" -icon: "link" ---- - - -This feature is available through out all plans not just the agency pricing plan, but because of how crucial it is to the customer portal, it was explained here. - - -In this page users are able to add/remove their connections in addition to checking their status, these connections can then be used by the agency to build automations for their customers. - -![Add Connection](../resources/screenshots/new-connection.png) - -![Connections Table](../resources/screenshots/connections-table.png) \ No newline at end of file diff --git a/docs/customer-portal/inviting-customer.mdx b/docs/customer-portal/inviting-customer.mdx deleted file mode 100644 index 2221ce9e30..0000000000 --- a/docs/customer-portal/inviting-customer.mdx +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Inviting Customer" -description: "" -icon: "user-plus" ---- -Agencies can invite their customers through their Project Members page, and assign them the “**External Customer**” role so they can be redirected to the Customer Portal once they proceed with the authentication process. - -![Invite Customer](../resources/screenshots/invite-customer.png) - diff --git a/docs/customer-portal/overview.mdx b/docs/customer-portal/overview.mdx deleted file mode 100644 index b65e9f6ba0..0000000000 --- a/docs/customer-portal/overview.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Overview" -description: "" -icon: "cube" ---- - - -This feature is available in our Agency plan. you can check it [here](https://www.activepieces.com/pricing)! - -You can also book a call [here](https://calendly.com/activepieces/demo). - - -The Customer Portal is a space for agency customers to see details about their automations as easy and accessible as possible, keeping it simple and intuitive, without having to view flows. -Its aim is empowering agencies to seamlessly invite customers to projects while providing a sleek, user-friendly portal for them, without the need to view flows. -The Portal is composed of two pages: - -1. **Activity**: Includes a table where customers would be able to get the latest updates about their automations. -2. **Connections**: A page where customers can add/remove their connections that are used in automations built by the agency. diff --git a/packages/ee/shared/src/index.ts b/packages/ee/shared/src/index.ts index b2b2821a94..5bff6e5d0d 100644 --- a/packages/ee/shared/src/index.ts +++ b/packages/ee/shared/src/index.ts @@ -17,6 +17,5 @@ export * from './lib/managed-authn' export * from './lib/oauth-apps' export * from './lib/otp' export * from './lib/authn' -export * from './lib/activity' export * from './lib/issues' \ No newline at end of file diff --git a/packages/ee/shared/src/lib/activity/activity-model.ts b/packages/ee/shared/src/lib/activity/activity-model.ts deleted file mode 100644 index 77ad41ba9c..0000000000 --- a/packages/ee/shared/src/lib/activity/activity-model.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Static, Type } from "@sinclair/typebox"; -import { ApId, BaseModelSchema } from "@activepieces/shared"; - -export type ActivityId = ApId - -export const ACTIVITY_EVENT_LENGTH = 200 -export const ACTIVITY_MESSAGE_LENGTH = 2000 -export const ACTIVITY_STATUS_LENGTH = 100 - -export const Activity = Type.Object({ - ...BaseModelSchema, - projectId: ApId, - event: Type.String({ maxLength: ACTIVITY_EVENT_LENGTH }), - message: Type.String({ maxLength: ACTIVITY_MESSAGE_LENGTH }), - status: Type.String({ maxLength: ACTIVITY_STATUS_LENGTH }), -}) - -export type Activity = Static diff --git a/packages/ee/shared/src/lib/activity/activity-requests.ts b/packages/ee/shared/src/lib/activity/activity-requests.ts deleted file mode 100644 index 4d0c1b0886..0000000000 --- a/packages/ee/shared/src/lib/activity/activity-requests.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Type, Static } from '@sinclair/typebox' -import { ApId } from '@activepieces/shared' -import { ACTIVITY_EVENT_LENGTH, ACTIVITY_MESSAGE_LENGTH, ACTIVITY_STATUS_LENGTH } from './activity-model' - - - -export const ListActivityParams = Type.Object({ - projectId:ApId, - cursor: Type.Optional(Type.String()), - limit: Type.Optional(Type.Integer({minimum: 1, maximum: 100})), -}) -export type ListActivityParams = Static - -export const AddActivityRequestBody = Type.Object({ - projectId:ApId, - event: Type.String({ maxLength: ACTIVITY_EVENT_LENGTH }), - message: Type.String({ maxLength: ACTIVITY_MESSAGE_LENGTH }), - status: Type.String({ maxLength: ACTIVITY_STATUS_LENGTH }), -}) - -export type AddActivityRequestBody = Static - -export const UpdateActivityRequestBody = Type.Composite([ - Type.Object({ - projectId: ApId, - }), - Type.Partial( - Type.Omit(AddActivityRequestBody, ['projectId']), - { - minProperties: 1, - } - ), -]) - -export type UpdateActivityRequestBody = Static diff --git a/packages/ee/shared/src/lib/activity/index.ts b/packages/ee/shared/src/lib/activity/index.ts deleted file mode 100644 index 522732b367..0000000000 --- a/packages/ee/shared/src/lib/activity/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './activity-model' -export * from './activity-requests' diff --git a/packages/ee/ui/project-members/src/lib/dialogs/invite-project-member-dialog/invite-project-member.component.ts b/packages/ee/ui/project-members/src/lib/dialogs/invite-project-member-dialog/invite-project-member.component.ts index a9dfb06c25..270fa8ec50 100644 --- a/packages/ee/ui/project-members/src/lib/dialogs/invite-project-member-dialog/invite-project-member.component.ts +++ b/packages/ee/ui/project-members/src/lib/dialogs/invite-project-member-dialog/invite-project-member.component.ts @@ -10,8 +10,8 @@ import { catchError, map, Observable, of, tap } from 'rxjs'; import { ProjectMemberService } from '../../service/project-members.service'; import { DialogRef } from '@angular/cdk/dialog'; import { HttpStatusCode } from '@angular/common/http'; -import { ApFlagId, ProjectMemberRole } from '@activepieces/shared'; -import { AuthenticationService, FlagService } from '@activepieces/ui/common'; +import { ProjectMemberRole } from '@activepieces/shared'; +import { AuthenticationService } from '@activepieces/ui/common'; import { RolesDisplayNames } from '../../utils'; @Component({ @@ -30,10 +30,7 @@ export class InviteProjectMemberDialogComponent { ProjectMemberRole = Object.values(ProjectMemberRole).map((role) => { return { role, - condition$: - role === ProjectMemberRole.EXTERNAL_CUSTOMER - ? this.flagService.isFlagEnabled(ApFlagId.SHOW_ACTIVITY_LOG) - : of(true), + condition$: of(true), }; }); constructor( @@ -41,8 +38,7 @@ export class InviteProjectMemberDialogComponent { private snackbar: MatSnackBar, private projectMemberService: ProjectMemberService, private authenticationService: AuthenticationService, - private dialogRef: DialogRef, - private flagService: FlagService + private dialogRef: DialogRef ) { this.invitationForm = this.formBuilder.group({ email: new FormControl('', { diff --git a/packages/pieces/community/activity/.eslintrc.json b/packages/pieces/community/activity/.eslintrc.json deleted file mode 100644 index 632e9b0e22..0000000000 --- a/packages/pieces/community/activity/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["../../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/packages/pieces/community/activity/README.md b/packages/pieces/community/activity/README.md deleted file mode 100644 index 8149c0a4d9..0000000000 --- a/packages/pieces/community/activity/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# pieces-activity - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build pieces-activity` to build the library. diff --git a/packages/pieces/community/activity/package.json b/packages/pieces/community/activity/package.json deleted file mode 100644 index e0b9d31676..0000000000 --- a/packages/pieces/community/activity/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "@activepieces/piece-activity", - "version": "0.0.4" -} \ No newline at end of file diff --git a/packages/pieces/community/activity/project.json b/packages/pieces/community/activity/project.json deleted file mode 100644 index 3d5947bab3..0000000000 --- a/packages/pieces/community/activity/project.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "pieces-activity", - "$schema": "../../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/pieces/community/activity/src", - "projectType": "library", - "targets": { - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/pieces/community/activity", - "tsConfig": "packages/pieces/community/activity/tsconfig.lib.json", - "packageJson": "packages/pieces/community/activity/package.json", - "main": "packages/pieces/community/activity/src/index.ts", - "assets": ["packages/pieces/community/activity/*.md"], - "buildableProjectDepsInPackageJsonType": "dependencies", - "updateBuildableProjectDepsInPackageJson": true - } - }, - "publish": { - "command": "node tools/scripts/publish.mjs pieces-activity {args.ver} {args.tag}", - "dependsOn": ["build"] - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - }, - "tags": [] -} diff --git a/packages/pieces/community/activity/src/index.ts b/packages/pieces/community/activity/src/index.ts deleted file mode 100644 index c98e6e0191..0000000000 --- a/packages/pieces/community/activity/src/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { createPiece, PieceAuth } from '@activepieces/pieces-framework'; -import { createActivity } from './lib/actions/create-activity'; -import { updateActivity } from './lib/actions/update-activity'; - -export const activity = createPiece({ - displayName: 'Activity', - description: - 'Log activities to display for your customers within their customer portal on Activepieces.', - auth: PieceAuth.None(), - minimumSupportedRelease: '0.20.0', - logoUrl: 'https://cdn.activepieces.com/pieces/activity.svg', - authors: ["AbdulTheActivePiecer","abuaboud"], - actions: [createActivity, updateActivity], - triggers: [], -}); diff --git a/packages/pieces/community/activity/src/lib/actions/create-activity.ts b/packages/pieces/community/activity/src/lib/actions/create-activity.ts deleted file mode 100644 index 76402f432b..0000000000 --- a/packages/pieces/community/activity/src/lib/actions/create-activity.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createAction } from '@activepieces/pieces-framework'; -import axios from 'axios'; -import { props } from './shared'; - -export const createActivity = createAction({ - name: 'create_activity', - displayName: 'Create Activity', - description: '', - props: props, - async run(context) { - const response = await axios({ - method: 'POST', - url: `${context.server.apiUrl}v1/worker/activities`, - headers: { - Authorization: `Bearer ${context.server.token}`, - }, - data: { - projectId: context.project.id, - event: context.propsValue.event, - message: context.propsValue.message, - status: context.propsValue.status, - }, - }); - - return response.data; - }, -}); diff --git a/packages/pieces/community/activity/src/lib/actions/shared.ts b/packages/pieces/community/activity/src/lib/actions/shared.ts deleted file mode 100644 index 081258338c..0000000000 --- a/packages/pieces/community/activity/src/lib/actions/shared.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Property } from "@activepieces/pieces-framework" - - export const activityTextContent = { - id:{ - description: 'ID of the activity to update.', - displayName: 'ID', - }, - event:{ - description: 'Name to show in your customer activity table. i.e "Invoices Sync"', - displayName: 'Activity Name', - }, - status:{ - description: 'Status of user activity. i.e "Pending"', - displayName: 'Status', - }, - message:{ - description: 'Describes the activity in a more detailed way. i.e "Synced 10 invoices, 20 remain"', - displayName: 'Message', - }, - } - - -export const props= { - event: Property.ShortText({ - displayName: activityTextContent.event.displayName, - description: activityTextContent.event.description, - required: true, - }), - message: Property.LongText({ - displayName: activityTextContent.message.displayName, - description: activityTextContent.message.description, - required: true, - }), - status: Property.ShortText({ - displayName: activityTextContent.status.displayName, - description: activityTextContent.status.description, - required: true, - }), - } \ No newline at end of file diff --git a/packages/pieces/community/activity/src/lib/actions/update-activity.ts b/packages/pieces/community/activity/src/lib/actions/update-activity.ts deleted file mode 100644 index 1a82878794..0000000000 --- a/packages/pieces/community/activity/src/lib/actions/update-activity.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createAction, Property } from '@activepieces/pieces-framework'; -import axios from 'axios'; -import { activityTextContent, props } from './shared'; - -export const updateActivity = createAction({ - name: 'update_activity', - displayName: 'Update Activity', - description: '', - props: { - id: Property.ShortText({ - displayName: activityTextContent.id.displayName, - description: activityTextContent.id.description, - required: true, - }), - ...props - }, - async run(context) { - const response = await axios({ - method: 'POST', - url: `${context.server.apiUrl}v1/worker/activities/${context.propsValue.id}`, - headers: { - Authorization: `Bearer ${context.server.token}`, - }, - data: { - projectId: context.project.id, - event: context.propsValue.event, - message: context.propsValue.message, - status: context.propsValue.status, - }, - }); - - return response.data; - }, -}); diff --git a/packages/pieces/community/activity/tsconfig.json b/packages/pieces/community/activity/tsconfig.json deleted file mode 100644 index 059cd81661..0000000000 --- a/packages/pieces/community/activity/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../tsconfig.base.json", - "compilerOptions": { - "module": "commonjs", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - } - ] -} diff --git a/packages/pieces/community/activity/tsconfig.lib.json b/packages/pieces/community/activity/tsconfig.lib.json deleted file mode 100644 index 28369ef762..0000000000 --- a/packages/pieces/community/activity/tsconfig.lib.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "../../../../dist/out-tsc", - "declaration": true, - "types": ["node"] - }, - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], - "include": ["src/**/*.ts"] -} diff --git a/packages/server/api/src/app/app.ts b/packages/server/api/src/app/app.ts index 3dd18d32a6..f21d17102d 100644 --- a/packages/server/api/src/app/app.ts +++ b/packages/server/api/src/app/app.ts @@ -18,7 +18,6 @@ import { accessTokenManager } from './authentication/lib/access-token-manager' import { copilotModule } from './copilot/copilot.module' import { rateLimitModule } from './core/security/rate-limit' import { securityHandlerChain } from './core/security/security-handler-chain' -import { activityModule } from './ee/activity/activity-module' import { analyticsModule } from './ee/analytics/analytics-module' import { apiKeyModule } from './ee/api-keys/api-key-module' import { cloudAppConnectionsHooks } from './ee/app-connections/cloud-app-connection-service' @@ -312,7 +311,6 @@ export const setupApp = async (): Promise => { await app.register(platformFlowTemplateModule) await app.register(gitRepoModule) await app.register(auditEventModule) - await app.register(activityModule) await app.register(usageTrackerModule) await app.register(adminPlatformPieceModule) await app.register(analyticsModule) @@ -346,7 +344,6 @@ export const setupApp = async (): Promise => { await app.register(platformFlowTemplateModule) await app.register(gitRepoModule) await app.register(auditEventModule) - await app.register(activityModule) await app.register(usageTrackerModule) await app.register(analyticsModule) setPlatformOAuthService({ diff --git a/packages/server/api/src/app/database/database-connection.ts b/packages/server/api/src/app/database/database-connection.ts index 05e111e070..fbce17a7cf 100644 --- a/packages/server/api/src/app/database/database-connection.ts +++ b/packages/server/api/src/app/database/database-connection.ts @@ -6,7 +6,6 @@ import { } from 'typeorm' import { AppConnectionEntity } from '../app-connection/app-connection.entity' import { AppEventRoutingEntity } from '../app-event-routing/app-event-routing.entity' -import { ActivityEntity } from '../ee/activity/activity-entity' import { ApiKeyEntity } from '../ee/api-keys/api-key-entity' import { AppCredentialEntity } from '../ee/app-credentials/app-credentials.entity' import { AuditEventEntity } from '../ee/audit-logs/audit-event-entity' @@ -86,8 +85,6 @@ function getEntities(): EntitySchema[] { FlowTemplateEntity, GitRepoEntity, AuditEventEntity, - ActivityEntity, - // CLOUD AppSumoEntity, ReferralEntity, diff --git a/packages/server/api/src/app/database/migration/common/1716105958530-RemoveShowActivityLog.ts b/packages/server/api/src/app/database/migration/common/1716105958530-RemoveShowActivityLog.ts new file mode 100644 index 0000000000..854a28ebbe --- /dev/null +++ b/packages/server/api/src/app/database/migration/common/1716105958530-RemoveShowActivityLog.ts @@ -0,0 +1,29 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class RemoveShowActivityLog1716105958530 implements MigrationInterface { + name = 'RemoveShowActivityLog1716105958530' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE platform + DROP COLUMN "showActivityLog"; + `); + } + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE platform + ADD COLUMN "showActivityLog" BOOLEAN; + `); + + await queryRunner.query(` + UPDATE platform + SET "showActivityLog" = false; + `); + + await queryRunner.query(` + ALTER TABLE platform + ALTER COLUMN "showActivityLog" SET NOT NULL; + `); + } + +} diff --git a/packages/server/api/src/app/database/postgres-connection.ts b/packages/server/api/src/app/database/postgres-connection.ts index f5dc906579..bc2b6dfb44 100644 --- a/packages/server/api/src/app/database/postgres-connection.ts +++ b/packages/server/api/src/app/database/postgres-connection.ts @@ -133,6 +133,7 @@ import { UnifyEnterpriseWithCloud1714249840058 } from './migration/postgres/1714 import { AddIssueEntityPostgres1714904516114 } from './migration/postgres/1714904516114-AddIssueEntityPostgres' import { system, SystemProp } from '@activepieces/server-shared' import { ApEdition, ApEnvironment, isNil } from '@activepieces/shared' +import { RemoveShowActivityLog1716105958530 } from './migration/common/1716105958530-RemoveShowActivityLog' const getSslConfig = (): boolean | TlsOptions => { const useSsl = system.get(SystemProp.POSTGRES_USE_SSL) @@ -217,6 +218,7 @@ const getMigrations = (): (new () => MigrationInterface)[] => { AddUniqueNameToFolder1713643694049, AddFeaturesToPlatform1714145914415, AddIssueEntityPostgres1714904516114, + RemoveShowActivityLog1716105958530, ] const edition = getEdition() diff --git a/packages/server/api/src/app/database/sqlite-connection.ts b/packages/server/api/src/app/database/sqlite-connection.ts index 678a5483cb..6122b5b362 100644 --- a/packages/server/api/src/app/database/sqlite-connection.ts +++ b/packages/server/api/src/app/database/sqlite-connection.ts @@ -45,6 +45,7 @@ import { AddFeatureFlagsToPlatform1714137103728 } from './migration/sqlite/17141 import { AddIssueEntitySqlite1714900626443 } from './migration/sqlite/1714900626443-AddIssueEntitySqlite' import { system, SystemProp } from '@activepieces/server-shared' import { ApEdition, ApEnvironment } from '@activepieces/shared' +import { RemoveShowActivityLog1716105958530 } from './migration/common/1716105958530-RemoveShowActivityLog' const getSqliteDatabaseFilePath = (): string => { @@ -108,6 +109,7 @@ const getMigrations = (): (new () => MigrationInterface)[] => { AddUniqueNameToFolderSqlite1713645171373, AddFeatureFlagsToPlatform1714137103728, AddIssueEntitySqlite1714900626443, + RemoveShowActivityLog1716105958530, ] const edition = getEdition() if (edition !== ApEdition.COMMUNITY) { diff --git a/packages/server/api/src/app/ee/activity/activity-controller.ts b/packages/server/api/src/app/ee/activity/activity-controller.ts deleted file mode 100644 index 09d9313e39..0000000000 --- a/packages/server/api/src/app/ee/activity/activity-controller.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox' -import { activityService } from './activity-service' -import { ListActivityParams } from '@activepieces/ee-shared' -import { Permission, PrincipalType } from '@activepieces/shared' - -export const activityController: FastifyPluginAsyncTypebox = async (app) => { - app.get('/', ListActivitiesRequest, async (req) => { - return activityService.list({ - projectId: req.query.projectId, - cursor: req.query.cursor, - limit: req.query.limit ?? 10, - }) - }) -} - -const ListActivitiesRequest = { - config: { - allowedPrincipals: [ - PrincipalType.USER, - ], - permission: Permission.READ_ACTIVITY, - }, - schema: { - querystring: ListActivityParams, - }, -} diff --git a/packages/server/api/src/app/ee/activity/activity-entity.ts b/packages/server/api/src/app/ee/activity/activity-entity.ts deleted file mode 100644 index d650c12ab7..0000000000 --- a/packages/server/api/src/app/ee/activity/activity-entity.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { EntitySchema } from 'typeorm' -import { ApIdSchema, BaseColumnSchemaPart } from '../../database/database-common' -import { Activity, ACTIVITY_EVENT_LENGTH, ACTIVITY_MESSAGE_LENGTH, ACTIVITY_STATUS_LENGTH } from '@activepieces/ee-shared' -import { Project } from '@activepieces/shared' - -type ActivitySchema = Activity & { - project: Project -} - -export const ActivityEntity = new EntitySchema({ - name: 'activity', - columns: { - ...BaseColumnSchemaPart, - projectId: { - ...ApIdSchema, - nullable: false, - }, - event: { - type: String, - nullable: false, - length: ACTIVITY_EVENT_LENGTH, - }, - message: { - type: String, - nullable: false, - length: ACTIVITY_MESSAGE_LENGTH, - }, - status: { - type: String, - nullable: false, - length: ACTIVITY_STATUS_LENGTH, - }, - }, - indices: [ - { - name: 'idx_activity_project_id_created_desc', - columns: ['projectId', 'created'], - unique: false, - }, - ], - relations: { - project: { - type: 'many-to-one', - target: 'project', - cascade: true, - onUpdate: 'RESTRICT', - onDelete: 'CASCADE', - joinColumn: { - name: 'projectId', - foreignKeyConstraintName: 'fk_activity_project_id', - }, - }, - }, -}) diff --git a/packages/server/api/src/app/ee/activity/activity-module.ts b/packages/server/api/src/app/ee/activity/activity-module.ts deleted file mode 100644 index 4c4b065d95..0000000000 --- a/packages/server/api/src/app/ee/activity/activity-module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox' -import { activityController } from './activity-controller' -import { activityWorkerController } from './activity-worker-controller' - -export const activityModule: FastifyPluginAsyncTypebox = async (app) => { - await app.register(activityController, { prefix: '/v1/activities' }) - await app.register(activityWorkerController, { prefix: '/v1/worker/activities' }) -} diff --git a/packages/server/api/src/app/ee/activity/activity-service.ts b/packages/server/api/src/app/ee/activity/activity-service.ts deleted file mode 100644 index 4d6a20663a..0000000000 --- a/packages/server/api/src/app/ee/activity/activity-service.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { databaseConnection } from '../../database/database-connection' -import { buildPaginator } from '../../helper/pagination/build-paginator' -import { paginationHelper } from '../../helper/pagination/pagination-utils' -import { Order } from '../../helper/pagination/paginator' -import { ActivityEntity } from './activity-entity' -import { Activity, ActivityId, AddActivityRequestBody, ListActivityParams } from '@activepieces/ee-shared' -import { apId, ProjectId, SeekPage, spreadIfDefined } from '@activepieces/shared' - -const repo = databaseConnection.getRepository(ActivityEntity) - -export const activityService = { - async add(params: AddActivityRequestBody): Promise { - const newActivity: Activity = { - id: apId(), - created: new Date().toISOString(), - updated: new Date().toISOString(), - ...params, - } - - return repo.save(newActivity) - }, - - async list({ projectId, cursor, limit }: ListActivityParams): Promise> { - const decodedCursor = paginationHelper.decodeCursor(cursor ?? null) - const paginator = buildPaginator({ - entity: ActivityEntity, - query: { - limit, - order: Order.DESC, - afterCursor: decodedCursor.nextCursor, - beforeCursor: decodedCursor.previousCursor, - }, - }) - - const query = repo.createQueryBuilder(ActivityEntity.options.name).where({ - projectId, - }) - - const { data, cursor: newCursor } = await paginator.paginate(query) - - return paginationHelper.createPage(data, newCursor) - }, - - async update({ id, projectId, event, message, status }: UpdateParams): Promise { - const query = { - id, - projectId, - } - - const updatedProps = { - ...spreadIfDefined('event', event), - ...spreadIfDefined('message', message), - ...spreadIfDefined('status', status), - } - - await repo.update(query, updatedProps) - }, -} - - - -type UpdateParams = { - id: ActivityId - projectId: ProjectId - event?: string - message?: string - status?: string -} diff --git a/packages/server/api/src/app/ee/activity/activity-worker-controller.ts b/packages/server/api/src/app/ee/activity/activity-worker-controller.ts deleted file mode 100644 index 343e52ff6f..0000000000 --- a/packages/server/api/src/app/ee/activity/activity-worker-controller.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { FastifyPluginAsyncTypebox, Type } from '@fastify/type-provider-typebox' -import { StatusCodes } from 'http-status-codes' -import { activityService } from './activity-service' -import { AddActivityRequestBody, UpdateActivityRequestBody } from '@activepieces/ee-shared' -import { ApId, PrincipalType } from '@activepieces/shared' - -export const activityWorkerController: FastifyPluginAsyncTypebox = async (app) => { - app.post('/', AddActivityRequest, async (req, res) => { - const newActivity = await activityService.add(req.body) - - return res - .status(StatusCodes.CREATED) - .send(newActivity) - }) - - app.post('/:id', UpdateActivityRequest, async (req, res) => { - await activityService.update({ - id: req.params.id, - ...req.body, - }) - - return res.status(StatusCodes.NO_CONTENT).send() - }) -} - -const AddActivityRequest = { - config: { - allowedPrincipals: [ - PrincipalType.WORKER, - ], - }, - schema: { - body: AddActivityRequestBody, - }, -} - -const UpdateActivityRequest = { - config: { - allowedPrincipals: [ - PrincipalType.WORKER, - ], - }, - schema: { - params: Type.Object({ - id: ApId, - }), - body: UpdateActivityRequestBody, - }, -} diff --git a/packages/server/api/src/app/ee/authentication/rbac/access-control-list.ts b/packages/server/api/src/app/ee/authentication/rbac/access-control-list.ts index 7198f16f03..ee4ceffb6f 100644 --- a/packages/server/api/src/app/ee/authentication/rbac/access-control-list.ts +++ b/packages/server/api/src/app/ee/authentication/rbac/access-control-list.ts @@ -2,7 +2,6 @@ import { Permission, ProjectMemberRole } from '@activepieces/shared' export const rolePermissions: Record = { [ProjectMemberRole.ADMIN]: [ - Permission.READ_ACTIVITY, Permission.READ_APP_CONNECTION, Permission.WRITE_APP_CONNECTION, Permission.READ_FLOW, @@ -14,7 +13,6 @@ export const rolePermissions: Record = { Permission.READ_GIT_REPO, ], [ProjectMemberRole.EDITOR]: [ - Permission.READ_ACTIVITY, Permission.READ_APP_CONNECTION, Permission.WRITE_APP_CONNECTION, Permission.READ_FLOW, @@ -24,13 +22,11 @@ export const rolePermissions: Record = { Permission.READ_GIT_REPO, ], [ProjectMemberRole.VIEWER]: [ - Permission.READ_ACTIVITY, Permission.READ_APP_CONNECTION, Permission.READ_FLOW, Permission.READ_PROJECT_MEMBER, ], [ProjectMemberRole.EXTERNAL_CUSTOMER]: [ - Permission.READ_ACTIVITY, Permission.READ_APP_CONNECTION, Permission.WRITE_APP_CONNECTION, ], diff --git a/packages/server/api/src/app/ee/flags/enterprise-flags.hooks.ts b/packages/server/api/src/app/ee/flags/enterprise-flags.hooks.ts index 214aec1f06..e05d289442 100644 --- a/packages/server/api/src/app/ee/flags/enterprise-flags.hooks.ts +++ b/packages/server/api/src/app/ee/flags/enterprise-flags.hooks.ts @@ -47,7 +47,6 @@ export const enterpriseFlagsHooks: FlagsServiceHooks = { flagService.getThirdPartyRedirectUrl(platform.id, hostname) modifiedFlags[ApFlagId.PRIVACY_POLICY_URL] = platform.privacyPolicyUrl modifiedFlags[ApFlagId.OWN_AUTH2_ENABLED] = false - modifiedFlags[ApFlagId.SHOW_ACTIVITY_LOG] = platform.showActivityLog } return modifiedFlags }, diff --git a/packages/server/api/src/app/pieces/piece-metadata-service/hooks/piece-filtering.ts b/packages/server/api/src/app/pieces/piece-metadata-service/hooks/piece-filtering.ts index c8d08c6b30..e055675703 100644 --- a/packages/server/api/src/app/pieces/piece-metadata-service/hooks/piece-filtering.ts +++ b/packages/server/api/src/app/pieces/piece-metadata-service/hooks/piece-filtering.ts @@ -42,12 +42,7 @@ async function filterPiecesBasedOnFeatures( return pieces } const platform = await platformService.getOneOrThrow(platformId) - return pieces.filter((piece) => { - if (piece.name === '@activepieces/piece-activity' && !platform.showActivityLog) { - return false - } - return true - }) + return pieces } const filterBasedOnSearchQuery = ({ diff --git a/packages/server/api/src/app/platform/platform.entity.ts b/packages/server/api/src/app/platform/platform.entity.ts index 58c0348552..407fb7f586 100644 --- a/packages/server/api/src/app/platform/platform.entity.ts +++ b/packages/server/api/src/app/platform/platform.entity.ts @@ -159,11 +159,7 @@ export const PlatformEntity = new EntitySchema({ auditLogEnabled: { type: Boolean, nullable: false, - }, - showActivityLog: { - type: Boolean, - nullable: false, - }, + } }, indices: [], relations: { diff --git a/packages/server/api/src/app/platform/platform.service.ts b/packages/server/api/src/app/platform/platform.service.ts index d2880be934..e9c6d2202d 100644 --- a/packages/server/api/src/app/platform/platform.service.ts +++ b/packages/server/api/src/app/platform/platform.service.ts @@ -55,7 +55,6 @@ export const platformService = { manageTemplatesEnabled: false, manageProjectsEnabled: false, projectRolesEnabled: false, - showActivityLog: false, customDomainsEnabled: false, apiKeysEnabled: false, customAppearanceEnabled: false, diff --git a/packages/server/api/test/helpers/mocks/index.ts b/packages/server/api/test/helpers/mocks/index.ts index 53c6d95506..f3ea4b4099 100644 --- a/packages/server/api/test/helpers/mocks/index.ts +++ b/packages/server/api/test/helpers/mocks/index.ts @@ -9,7 +9,6 @@ import { PieceMetadataSchema } from '../../../src/app/pieces/piece-metadata-enti import { PieceTagSchema } from '../../../src/app/tags/pieces/piece-tag.entity' import { TagEntitySchema } from '../../../src/app/tags/tag-entity' import { - Activity, ApiKey, ApplicationEvent, ApplicationEventName, @@ -190,7 +189,6 @@ export const createMockPlatform = (platform?: Partial): Platform => { embeddingEnabled: platform?.embeddingEnabled ?? faker.datatype.boolean(), cloudAuthEnabled: platform?.cloudAuthEnabled ?? faker.datatype.boolean(), showPoweredBy: platform?.showPoweredBy ?? faker.datatype.boolean(), - showActivityLog: platform?.showActivityLog ?? faker.datatype.boolean(), managePiecesEnabled: platform?.managePiecesEnabled ?? faker.datatype.boolean(), manageProjectsEnabled: platform?.manageProjectsEnabled ?? faker.datatype.boolean(), manageTemplatesEnabled: platform?.manageTemplatesEnabled ?? faker.datatype.boolean(), @@ -479,18 +477,6 @@ export const createMockFlowVersion = ( } } -export const createMockActivity = (activity?: Partial): Activity => { - return { - id: activity?.id ?? apId(), - created: activity?.created ?? faker.date.recent().toISOString(), - updated: activity?.updated ?? faker.date.recent().toISOString(), - projectId: activity?.projectId ?? apId(), - event: activity?.status ?? faker.lorem.words(), - message: activity?.message ?? faker.lorem.paragraph(), - status: activity?.status ?? faker.lorem.word(), - } -} - export const mockBasicSetup = async (params?: MockBasicSetupParams): Promise => { const mockOwner = createMockUser({ ...params?.user, diff --git a/packages/server/api/test/integration/cloud/activity/activity-worker.test.ts b/packages/server/api/test/integration/cloud/activity/activity-worker.test.ts deleted file mode 100644 index c19660184a..0000000000 --- a/packages/server/api/test/integration/cloud/activity/activity-worker.test.ts +++ /dev/null @@ -1,324 +0,0 @@ -import { FastifyInstance } from 'fastify' -import { StatusCodes } from 'http-status-codes' -import { setupApp } from '../../../../src/app/app' -import { databaseConnection } from '../../../../src/app/database/database-connection' -import { generateMockToken } from '../../../helpers/auth' -import { createMockActivity, createMockPlatform, createMockProject, createMockUser } from '../../../helpers/mocks' -import { apId, PrincipalType } from '@activepieces/shared' - -let app: FastifyInstance | null = null - -beforeAll(async () => { - await databaseConnection.initialize() - app = await setupApp() -}) - -afterAll(async () => { - await databaseConnection.destroy() - await app?.close() -}) - -describe('[Worker] Activity API', () => { - describe('Add Activity endpoint', () => { - it('Creates new Activity', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: mockProject.id, - event: 'test-event', - message: 'test-message', - status: 'test-status', - } - - // act - const response = await app?.inject({ - method: 'POST', - url: '/v1/worker/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.CREATED) - - const responseBody = response?.json() - - expect(responseBody?.id).toHaveLength(21) - expect(responseBody?.event).toBe('test-event') - expect(responseBody?.message).toBe('test-message') - expect(responseBody?.status).toBe('test-status') - }) - - it('Enforces event max length', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: mockProject.id, - event: 'e'.repeat(201), - message: 'test-message', - status: 'test-status', - } - - // act - const response = await app?.inject({ - method: 'POST', - url: '/v1/worker/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.BAD_REQUEST) - - const responseBody = response?.json() - expect(responseBody?.message).toBe('body/event must NOT have more than 200 characters') - }) - - it('Enforces message max length', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: mockProject.id, - event: 'test-event', - message: 'm'.repeat(2001), - status: 'test-status', - } - - // act - const response = await app?.inject({ - method: 'POST', - url: '/v1/worker/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.BAD_REQUEST) - - const responseBody = response?.json() - expect(responseBody?.message).toBe('body/message must NOT have more than 2000 characters') - }) - - it('Enforces status max length', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: mockProject.id, - event: 'test-event', - message: 'test-message', - status: 's'.repeat(101), - } - - // act - const response = await app?.inject({ - method: 'POST', - url: '/v1/worker/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.BAD_REQUEST) - - const responseBody = response?.json() - expect(responseBody?.message).toBe('body/status must NOT have more than 100 characters') - }) - - it('Forbids access to projects other than principal\'s', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: apId(), - event: 'test-event', - message: 'test-message', - status: 'test-status', - } - - // act - const response = await app?.inject({ - method: 'POST', - url: '/v1/worker/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.FORBIDDEN) - - const responseBody = response?.json() - expect(responseBody?.params?.message).toBe('invalid project id') - }) - - it('Forbids access to principal types other than WORKER', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.USER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: mockProject.id, - event: 'test-event', - message: 'test-message', - status: 'test-status', - } - - // act - const response = await app?.inject({ - method: 'POST', - url: '/v1/worker/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.FORBIDDEN) - - const responseBody = response?.json() - expect(responseBody?.params?.message).toBe('invalid route for principal type') - }) - }) - - describe('Update Activity endpoint', () => { - it('Edits existing Activity', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockActivity = createMockActivity({ projectId: mockProject.id }) - await databaseConnection.getRepository('activity').save(mockActivity) - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProject.id, - }) - - const mockRequestBody = { - projectId: mockProject.id, - event: 'updated-event', - message: 'updated-message', - status: 'updated-status', - } - - // act - const response = await app?.inject({ - method: 'POST', - url: `/v1/worker/activities/${mockActivity.id}`, - headers: { - authorization: `Bearer ${mockToken}`, - }, - body: mockRequestBody, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.NO_CONTENT) - - const updatedMockActivity = await databaseConnection.getRepository('activity').findOneBy({ - id: mockActivity.id, - }) - - expect(updatedMockActivity?.event).toBe('updated-event') - expect(updatedMockActivity?.message).toBe('updated-message') - expect(updatedMockActivity?.status).toBe('updated-status') - }) - }) -}) diff --git a/packages/server/api/test/integration/cloud/activity/activity.test.ts b/packages/server/api/test/integration/cloud/activity/activity.test.ts deleted file mode 100644 index c160b63114..0000000000 --- a/packages/server/api/test/integration/cloud/activity/activity.test.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { FastifyInstance } from 'fastify' -import { StatusCodes } from 'http-status-codes' -import { setupApp } from '../../../../src/app/app' -import { databaseConnection } from '../../../../src/app/database/database-connection' -import { generateMockToken } from '../../../helpers/auth' -import { createMockActivity, createMockPlatform, createMockProject, createMockProjectMember, createMockUser } from '../../../helpers/mocks' -import { apId, PlatformRole, PrincipalType, ProjectMemberRole } from '@activepieces/shared' - -let app: FastifyInstance | null = null - -beforeAll(async () => { - await databaseConnection.initialize() - app = await setupApp() -}) - -afterAll(async () => { - await databaseConnection.destroy() - await app?.close() -}) - -describe('Activity API', () => { - describe('List Activities endpoint', () => { - it('Sorts by created desc', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save(mockProject) - - const mockActivity1 = createMockActivity({ projectId: mockProject.id, created: '1999-01-01T00:00:00.000Z' }) - const mockActivity2 = createMockActivity({ projectId: mockProject.id, created: '2111-01-01T00:00:00.000Z' }) - await databaseConnection.getRepository('activity').save([mockActivity1, mockActivity2]) - - const mockToken = await generateMockToken({ - id: mockUser.id, - type: PrincipalType.USER, - projectId: mockProject.id, - }) - - // act - const response = await app?.inject({ - method: 'GET', - url: '/v1/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - query: { - projectId: mockProject.id, - }, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.OK) - - const responseBody = response?.json() - - expect(responseBody?.data.length).toBe(2) - expect(responseBody?.data?.[0]?.id).toBe(mockActivity2.id) - expect(responseBody?.data?.[1]?.id).toBe(mockActivity1.id) - }) - - it('Filters by projectId', async () => { - // arrange - const mockUser = createMockUser() - await databaseConnection.getRepository('user').save(mockUser) - - const mockPlatform = createMockPlatform({ ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject1 = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - const mockProject2 = createMockProject({ ownerId: mockUser.id, platformId: mockPlatform.id }) - await databaseConnection.getRepository('project').save([mockProject1, mockProject2]) - - const mockActivity1 = createMockActivity({ projectId: mockProject1.id }) - const mockActivity2 = createMockActivity({ projectId: mockProject2.id }) - await databaseConnection.getRepository('activity').save([mockActivity1, mockActivity2]) - - const mockToken = await generateMockToken({ - id: mockUser.id, - type: PrincipalType.USER, - projectId: mockProject1.id, - }) - - // act - const response = await app?.inject({ - method: 'GET', - url: '/v1/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - query: { - projectId: mockProject1.id, - }, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.OK) - - const responseBody = response?.json() - - expect(responseBody?.data?.length).toBe(1) - expect(responseBody?.data?.[0]?.id).toBe(mockActivity1.id) - }) - - it('Forbids access to projects other than principal\'s', async () => { - // arrange - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.USER, - projectId: apId(), - }) - - // act - const response = await app?.inject({ - method: 'GET', - url: '/v1/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - query: { - projectId: apId(), - }, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.FORBIDDEN) - - const responseBody = response?.json() - expect(responseBody?.params?.message).toBe('invalid project id') - }) - - it('Forbids access to principal types other than USER', async () => { - // arrange - const mockProjectId = apId() - - const mockToken = await generateMockToken({ - id: apId(), - type: PrincipalType.WORKER, - projectId: mockProjectId, - }) - - // act - const response = await app?.inject({ - method: 'GET', - url: '/v1/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - query: { - projectId: mockProjectId, - }, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.FORBIDDEN) - - const responseBody = response?.json() - expect(responseBody?.params?.message).toBe('invalid route for principal type') - }) - - it.each([ - ProjectMemberRole.ADMIN, - ProjectMemberRole.EDITOR, - ProjectMemberRole.VIEWER, - ProjectMemberRole.EXTERNAL_CUSTOMER, - ])('Succeeds if user role is %s', async (testRole) => { - // arrange - const mockPlatformId = apId() - const mockOwner = createMockUser({ platformId: mockPlatformId }) - const mockUser = createMockUser({ platformId: mockPlatformId, platformRole: PlatformRole.MEMBER }) - await databaseConnection.getRepository('user').save([mockOwner, mockUser]) - - const mockPlatform = createMockPlatform({ id: mockPlatformId, ownerId: mockUser.id }) - await databaseConnection.getRepository('platform').save(mockPlatform) - - const mockProject = createMockProject({ - ownerId: mockOwner.id, - platformId: mockPlatform.id, - }) - await databaseConnection.getRepository('project').save([mockProject]) - - const mockProjectMember = createMockProjectMember({ - email: mockUser.email, - platformId: mockPlatform.id, - projectId: mockProject.id, - role: testRole, - }) - await databaseConnection.getRepository('project_member').save([mockProjectMember]) - - const mockToken = await generateMockToken({ - id: mockUser.id, - type: PrincipalType.USER, - projectId: mockProject.id, - platform: { - id: mockPlatform.id, - }, - }) - - // act - const response = await app?.inject({ - method: 'GET', - url: '/v1/activities', - headers: { - authorization: `Bearer ${mockToken}`, - }, - query: { - projectId: mockProject.id, - }, - }) - - // assert - expect(response?.statusCode).toBe(StatusCodes.OK) - }) - }) -}) diff --git a/packages/shared/src/lib/common/security/permission.ts b/packages/shared/src/lib/common/security/permission.ts index 277e386fa7..c87833dc54 100644 --- a/packages/shared/src/lib/common/security/permission.ts +++ b/packages/shared/src/lib/common/security/permission.ts @@ -1,5 +1,4 @@ export enum Permission { - READ_ACTIVITY = 'READ_ACTIVITY', READ_APP_CONNECTION = 'READ_APP_CONNECTION', WRITE_APP_CONNECTION = 'WRITE_APP_CONNECTION', READ_FLOW = 'READ_FLOW', diff --git a/packages/shared/src/lib/flag/flag.ts b/packages/shared/src/lib/flag/flag.ts index 9bbe9bdafb..f8e256d161 100755 --- a/packages/shared/src/lib/flag/flag.ts +++ b/packages/shared/src/lib/flag/flag.ts @@ -36,7 +36,6 @@ export enum ApFlagId { PIECES_SYNC_MODE = 'PIECES_SYNC_MODE', PRIVATE_PIECES_ENABLED = 'PRIVATE_PIECES_ENABLED', SANDBOX_RUN_TIME_SECONDS = 'SANDBOX_RUN_TIME_SECONDS', - SHOW_ACTIVITY_LOG = 'SHOW_ACTIVITY_LOG', SHOW_BILLING = 'SHOW_BILLING', INSTALL_PROJECT_PIECES_ENABLED = 'INSTALL_PROJECT_PIECES_ENABLED', MANAGE_PROJECT_PIECES_ENABLED = 'MANAGE_PROJECT_PIECES_ENABLED', diff --git a/packages/shared/src/lib/platform/platform.model.ts b/packages/shared/src/lib/platform/platform.model.ts index 4565d37eab..4eeb8bf464 100644 --- a/packages/shared/src/lib/platform/platform.model.ts +++ b/packages/shared/src/lib/platform/platform.model.ts @@ -54,7 +54,6 @@ export const Platform = Type.Object({ allowedAuthDomains: Type.Array(Type.String()), federatedAuthProviders: FederatedAuthnProviderConfig, emailAuthEnabled: Type.Boolean(), - showActivityLog: Type.Boolean(), }) export type Platform = Static diff --git a/packages/ui/common/src/lib/utils/consts.ts b/packages/ui/common/src/lib/utils/consts.ts index ba129039c4..acc0daa73a 100644 --- a/packages/ui/common/src/lib/utils/consts.ts +++ b/packages/ui/common/src/lib/utils/consts.ts @@ -92,14 +92,7 @@ export const EMPTY_SPACE_BETWEEN_INPUTS_IN_PIECE_PROPERTIES_FORM = 24 + 'px'; export const BOTTOM_MARGIN_FOR_DESCRIPTION_IN_PIECE_PROPERTIES_FORM = 18 + 'px'; export const findHomePageRouteForRole = (role: ProjectMemberRole) => { - switch (role) { - case ProjectMemberRole.ADMIN: - case ProjectMemberRole.EDITOR: - case ProjectMemberRole.VIEWER: - return '/flows'; - case ProjectMemberRole.EXTERNAL_CUSTOMER: - return '/activity'; - } + return '/flows'; }; export const showPlatformDashboard$ = ( diff --git a/packages/ui/core/src/assets/img/custom/dashboard/activity.svg b/packages/ui/core/src/assets/img/custom/dashboard/activity.svg deleted file mode 100644 index 4f612d3a8b..0000000000 --- a/packages/ui/core/src/assets/img/custom/dashboard/activity.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/ui/feature-builder-header/src/lib/flow-builder-header.component.ts b/packages/ui/feature-builder-header/src/lib/flow-builder-header.component.ts index c5e2725a30..7034d67903 100755 --- a/packages/ui/feature-builder-header/src/lib/flow-builder-header.component.ts +++ b/packages/ui/feature-builder-header/src/lib/flow-builder-header.component.ts @@ -104,7 +104,7 @@ export class FlowBuilderHeaderComponent implements OnInit { redirectHome(openInNewWindow: boolean) { if (this.router.url.includes('/runs')) { this.navigationService.navigate({ - route: ['/executions'], + route: ['/runs'], openInNewWindow, }); } else { diff --git a/packages/ui/feature-dashboard/src/lib/components/issues-table/issues-table.component.ts b/packages/ui/feature-dashboard/src/lib/components/issues-table/issues-table.component.ts index 5248348928..d6b95c1930 100644 --- a/packages/ui/feature-dashboard/src/lib/components/issues-table/issues-table.component.ts +++ b/packages/ui/feature-dashboard/src/lib/components/issues-table/issues-table.component.ts @@ -87,7 +87,7 @@ export class IssuesTableComponent implements OnInit { event.ctrlKey || event.which == 2 || event.button == 4; if (openInNewWindow && !this.embeddingService.getState().isEmbedded) { this.navigationService.navigate({ - route: ['/executions'], + route: ['/runs'], extras: { fragment: executionsPageFragments.Runs, queryParams: { diff --git a/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts b/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts index 1269cbd839..70eb2dd9cc 100755 --- a/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts +++ b/packages/ui/feature-dashboard/src/lib/components/sidenav-routes-list/sidenav-routes-list.component.ts @@ -138,16 +138,6 @@ export class SidenavRoutesListComponent implements OnInit { showNotification$: this.issuesService.shouldShowIssuesNotificationIconInSidebarObs$, }, - - { - icon: 'assets/img/custom/dashboard/activity.svg', - caption: $localize`Activity`, - route: 'activity', - showInSideNav$: this.flagServices.isFlagEnabled( - ApFlagId.SHOW_ACTIVITY_LOG - ), - showLock$: of(false), - }, { icon: 'assets/img/custom/dashboard/connections.svg', caption: $localize`Connections`, @@ -242,7 +232,7 @@ export class SidenavRoutesListComponent implements OnInit { case ProjectMemberRole.VIEWER: return of(true); case ProjectMemberRole.EXTERNAL_CUSTOMER: - return of(route === 'connections' || route === 'activity'); + return of(route === 'connections'); } } } diff --git a/packages/ui/feature-dashboard/src/lib/dashboard.routing.ts b/packages/ui/feature-dashboard/src/lib/dashboard.routing.ts index 58d1cb7879..70c85cc12b 100755 --- a/packages/ui/feature-dashboard/src/lib/dashboard.routing.ts +++ b/packages/ui/feature-dashboard/src/lib/dashboard.routing.ts @@ -19,7 +19,6 @@ import { import { PlansPageComponent } from 'ee-billing-ui'; import { ProjectMembersTableComponent } from 'ee-project-members'; import { ApFlagId, ProjectMemberRole } from '@activepieces/shared'; -import { ActivityTableComponent } from './pages/activity-table/activity-table.component'; import { IssuesTableComponent } from './components/issues-table/issues-table.component'; import { SettingsPageComponent } from './pages/settings-page/settings-page.component'; import { FLAGS_RESOLVE_DATA, FlagsResolver } from './resolvers/flags.resolver'; @@ -94,15 +93,6 @@ export const DashboardLayoutRouting: Routes = [ ]), ], }, - { - data: { - title: $localize`Activity`, - }, - path: 'activity', - pathMatch: 'full', - component: ActivityTableComponent, - canActivate: [showBasedOnFlagGuard(ApFlagId.SHOW_ACTIVITY_LOG)], - }, { data: { title: $localize`Connections`, diff --git a/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.component.html b/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.component.html deleted file mode 100644 index 5a4b376cd3..0000000000 --- a/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.component.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - Name - {{ activity.event }} - - - - Message - {{ activity.message }} - - - - Status - {{ activity.status }} - - - Occurred on - - {{ activity.created | apDate: 'mdhm' }} - - - - - - - - - - - - - - - - No activity to display yet - - - - - - - - \ No newline at end of file diff --git a/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.component.ts b/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.component.ts deleted file mode 100644 index cbe0308854..0000000000 --- a/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - OnInit, - ViewChild, -} from '@angular/core'; -import { ActivityableDataSource } from './activity-table.datasource'; -import { ActivityService } from '../../services/activity.service'; -import { - ApPaginatorComponent, - AuthenticationService, -} from '@activepieces/ui/common'; -import { ActivatedRoute } from '@angular/router'; - -@Component({ - selector: 'app-activity-table', - templateUrl: './activity-table.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class ActivityTableComponent implements OnInit { - @ViewChild(ApPaginatorComponent, { static: true }) - paginator: ApPaginatorComponent; - dataSource: ActivityableDataSource; - displayedColumns: string[] = ['event', 'message', 'status', 'created']; - constructor( - private activityService: ActivityService, - private authService: AuthenticationService, - private route: ActivatedRoute - ) {} - ngOnInit(): void { - this.dataSource = new ActivityableDataSource( - this.route.queryParams, - this.paginator, - this.activityService, - this.authService.getProjectId() - ); - } -} diff --git a/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.datasource.ts b/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.datasource.ts deleted file mode 100644 index 5b0fc38539..0000000000 --- a/packages/ui/feature-dashboard/src/lib/pages/activity-table/activity-table.datasource.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { DataSource } from '@angular/cdk/collections'; -import { - Observable, - combineLatest, - switchMap, - tap, - catchError, - of, - BehaviorSubject, - map, -} from 'rxjs'; -import { - ApPaginatorComponent, - DEFAULT_PAGE_SIZE, - LIMIT_QUERY_PARAM, - CURSOR_QUERY_PARAM, -} from '@activepieces/ui/common'; -import { Params } from '@angular/router'; -import { Activity } from '@activepieces/ee-shared'; -import { ActivityService } from '../../services/activity.service'; - -/** - * Data source for the LogsTable view. This class should - * encapsulate all logic for fetching and manipulating the displayed data - * (including sorting, pagination, and filtering). - */ -export class ActivityableDataSource extends DataSource { - data: Activity[] = []; - isLoading$: BehaviorSubject = new BehaviorSubject(true); - constructor( - private queryParams$: Observable, - private paginator: ApPaginatorComponent, - private activityService: ActivityService, - private projectId: string - ) { - super(); - } - - /** - * Connect this data source to the table. The table will only update when - * the returned stream emits new items. - * @returns A stream of the items to be rendered. - */ - connect(): Observable { - return combineLatest({ - queryParams: this.queryParams$, - }).pipe( - tap(() => { - this.isLoading$.next(true); - }), - switchMap((res) => { - const limit = res.queryParams[LIMIT_QUERY_PARAM] || DEFAULT_PAGE_SIZE; - const cursor = res.queryParams[CURSOR_QUERY_PARAM] || ''; - return this.activityService.list({ - projectId: this.projectId, - limit: limit, - cursor: cursor, - }); - }), - catchError((err) => { - console.error(err); - return of({ - next: '', - previous: '', - data: [], - }); - }), - tap((res) => { - this.isLoading$.next(false); - this.paginator.setNextAndPrevious(res.next, res.previous); - this.data = res.data; - }), - map((res) => res.data) - ); - } - - /** - * Called when the table is being destroyed. Use this function, to clean up - * any open connections or free any held resources that were set up during connect. - */ - disconnect(): void { - //ignore - } -} diff --git a/packages/ui/feature-dashboard/src/lib/services/activity.service.ts b/packages/ui/feature-dashboard/src/lib/services/activity.service.ts deleted file mode 100644 index 97c3035331..0000000000 --- a/packages/ui/feature-dashboard/src/lib/services/activity.service.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Activity, ListActivityParams } from '@activepieces/ee-shared'; -import { SeekPage } from '@activepieces/shared'; -import { environment } from '@activepieces/ui/common'; -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { Params } from '@angular/router'; -@Injectable({ - providedIn: 'root', -}) -export class ActivityService { - constructor(private http: HttpClient) {} - - list(req: ListActivityParams) { - const params: Params = { - projectId: req.projectId, - cursor: req.cursor, - limit: req.limit, - }; - return this.http.get>( - environment.apiUrl + `/activities`, - { - params, - } - ); - } -} diff --git a/packages/ui/feature-dashboard/src/lib/ui-feature-dashboard.module.ts b/packages/ui/feature-dashboard/src/lib/ui-feature-dashboard.module.ts index 2058a8a895..037120321b 100644 --- a/packages/ui/feature-dashboard/src/lib/ui-feature-dashboard.module.ts +++ b/packages/ui/feature-dashboard/src/lib/ui-feature-dashboard.module.ts @@ -31,7 +31,6 @@ import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatNativeDateModule } from '@angular/material/core'; import { NewConnectionDialogComponent } from './components/dialogs/new-connection-dialog/new-connection-dialog.component'; import { UiFeatureConnectionsModule } from '@activepieces/ui/feature-connections'; -import { ActivityTableComponent } from './pages/activity-table/activity-table.component'; import { ContactSalesComponent } from './components/contact-sales/contact-sales.component'; import { FormsModule } from '@angular/forms'; import { @@ -79,7 +78,6 @@ import { RewardsNoteComponent } from './components/rewards-note/rewards-note.com ProjectSwitcherComponent, RenameFlowDialogComponent, NewConnectionDialogComponent, - ActivityTableComponent, ContactSalesComponent, ], providers: [DatePipe], diff --git a/tsconfig.base.json b/tsconfig.base.json index fa047d7160..7079c27ed4 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -27,9 +27,6 @@ "@activepieces/piece-activepieces": [ "packages/pieces/community/activepieces/src/index.ts" ], - "@activepieces/piece-activity": [ - "packages/pieces/community/activity/src/index.ts" - ], "@activepieces/piece-acumbamail": [ "packages/pieces/community/acumbamail/src/index.ts" ],