Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
66caff1
installed neverthrow
FelipeTrost Nov 25, 2025
d7c1d8a
# This is a combination of 2 commits.
FelipeTrost Dec 8, 2025
6405821
feat(ms2): use neverthrow for error handling
FelipeTrost Dec 9, 2025
114b627
fix
FelipeTrost Dec 9, 2025
6563262
fixes
FelipeTrost Dec 9, 2025
f533906
fix: error type checks
FelipeTrost Dec 9, 2025
a39e94c
fix(ms2): error handling get process with bpmn
FelipeTrost Dec 9, 2025
64a707b
Merge branch 'main' into ms2/error-handling
FelipeTrost Dec 10, 2025
f899c4e
remove unused import
FelipeTrost Dec 10, 2025
5982dc1
fix error returns
FelipeTrost Dec 10, 2025
39e13f1
fix(shared-viewer): don't stop import on error
FelipeTrost Dec 10, 2025
ed698cb
Removed debug loggin
jjoderis Jan 27, 2026
2873e2a
Removed unused file
jjoderis Jan 27, 2026
3ec5a32
Fixed: If the signin page encounters an error when fetching the user …
jjoderis Jan 27, 2026
7512502
Fixed a typo
jjoderis Jan 27, 2026
751fe79
Removed unused code and added/updated some comments
jjoderis Jan 27, 2026
fc39cd0
Fixed a small typo
jjoderis Jan 27, 2026
71105f5
Fixed a typo
jjoderis Jan 27, 2026
9de1d03
Fixed: In some places the code was not correctly updated to reflect t…
jjoderis Jan 27, 2026
49819b7
Fixed: the check for getUserById returning a falsy value will always …
jjoderis Jan 27, 2026
8ac1bf8
Fixed: the retry button that is shown on some pages when something fa…
jjoderis Jan 27, 2026
bbc8e72
Some code improvements
jjoderis Jan 27, 2026
a98c0d0
Fixed: cannot login as dev user johndoe when the user does not exist …
jjoderis Jan 27, 2026
d9e2d7b
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/error…
jjoderis Jan 28, 2026
73c38eb
Readded some code that was unused but still required
jjoderis Jan 28, 2026
948c466
Fixed: Register as New User is not working, logging in after register…
jjoderis Jan 28, 2026
d988ec7
Fixed: Sign In With E-Mail is not working; The link that is generated…
jjoderis Jan 28, 2026
9133d42
Fixed: if isMember is called without a transaction client the functio…
jjoderis Jan 29, 2026
38ff8d0
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/error…
jjoderis Jan 30, 2026
a62187a
Fixed a typo
jjoderis Jan 30, 2026
93a49d8
Small comment improvement
jjoderis Jan 30, 2026
cd20872
Fixed: the MS cannot be built due to an unused typescript error direc…
jjoderis Jan 30, 2026
7d9bffe
Fixed: if the executions view encounters an error while loading the h…
jjoderis Jan 30, 2026
64fc1ed
Role Page returns neverthrow error when there is an error accesing th…
jjoderis Jan 30, 2026
50016f1
Small improvements
jjoderis Jan 30, 2026
db1affc
Fixed: Trying to invite users to an organization will silently fail
jjoderis Jan 30, 2026
a13a737
Fixed: trying to update a role will result in an error
jjoderis Jan 30, 2026
e403f05
Fixed typo
jjoderis Jan 30, 2026
78e4d66
Fixed: When there is an error loading the organization management pag…
jjoderis Jan 30, 2026
ead78d1
Fixed: Versioning processes with script tasks does not work
jjoderis Jan 30, 2026
3625b39
Fixed: leaving a space is not possible
jjoderis Jan 30, 2026
9dedacf
Catch an error with accesing the environment in the layout of the set…
jjoderis Jan 30, 2026
0297658
Fixed: When clicking on a row in the task editor table to navigate to…
jjoderis Jan 30, 2026
ab85c6e
Fixed: getting the html for a local task leads to an error
jjoderis Jan 30, 2026
a64bba0
Small improvements
jjoderis Feb 2, 2026
00eee2b
Extended error handling to more places
jjoderis Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/management-system-v2/app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import Layout from '@/app/(dashboard)/[environmentId]/layout-client';
import { getCurrentUser } from '@/components/auth';
import Content from '@/components/content';
import Processes from '@/components/processes';
import { SetAbility } from '@/lib/abilityStore';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';
import { FC, PropsWithChildren } from 'react';
import { AiOutlineFile, AiOutlineProfile } from 'react-icons/ai';

const SigninLayout: FC<PropsWithChildren> = ({ children }) => {
const SigninLayout: FC<PropsWithChildren> = async ({ children }) => {
const currentUser = await getCurrentUser();
if (currentUser.isErr()) {
return errorResponse(currentUser);
}

return (
<>
{children}
Expand Down
11 changes: 9 additions & 2 deletions src/management-system-v2/app/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { getProviders } from '@/lib/auth';
import { getCurrentUser } from '@/components/auth';
import { redirect } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import SignIn from './signin';
import { generateGuestReferenceToken } from '@/lib/reference-guest-user-token';
import { env } from '@/lib/ms-config/env-vars';
import db from '@/lib/data/db';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';

const dayInMS = 1000 * 60 * 60 * 24;

// take in search query
const SignInPage = async (props: { searchParams: Promise<{ callbackUrl: string }> }) => {
const searchParams = await props.searchParams;
const { session } = await getCurrentUser();
const currentUser = await getCurrentUser();
if (currentUser.isErr()) {
// this shouldn't really occur since it is handled in the layout file in the parent folder
// already
return notFound();
}
const { session } = currentUser.value;
const isGuest = session?.user.isGuest;

if (session?.user && !isGuest) {
Expand Down
7 changes: 4 additions & 3 deletions src/management-system-v2/app/(auth)/signin/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const SignIn: FC<{
</Button>

<Alert
message='Note: if you select "Continue as Guest", the this Platform is functionally restricted and your created processes will not be accessible on other devices. All your data will be deleted automatically after a few days."'
message='Note: if you select "Continue as Guest", the PROCEED Platform is functionally restricted and your created processes will not be accessible on other devices. All your data will be deleted automatically after a few days."'
type="info"
/>
</>
Expand All @@ -163,8 +163,9 @@ const SignIn: FC<{
color: '#434343',
}}
>
By using the this Platform, you agree to the <Link href="/terms">Terms of Service</Link>{' '}
and the storage of functionally essential cookies on your device.
By using the PROCEED Platform, you agree to the{' '}
<Link href="/terms">Terms of Service</Link> and the storage of functionally essential
cookies on your device.
</Typography.Paragraph>
</AuthModal>
</ConfigProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getDbEngineById } from '@/lib/data/db/engines';
import { getMSConfig } from '@/lib/ms-config/ms-config';
import EngineDashboard from '@/components/engine-dashboard/server-component';
import SpaceLink from '@/components/space-link';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';

export type TableEngine = Engine & { id: string };

Expand All @@ -24,8 +25,15 @@ export default async function EnginesPage(props: {
const dbEngineId = decodeURIComponent(params.dbEngineId);
const engineId = decodeURIComponent(searchParams.engineId || '');

const { ability, activeEnvironment } = await getCurrentEnvironment(params.environmentId);
const currentSpace = await getCurrentEnvironment(params.environmentId);
if (currentSpace.isErr()) {
return errorResponse(currentSpace);
}
const { ability, activeEnvironment } = currentSpace.value;
const dbEngine = await getDbEngineById(dbEngineId, activeEnvironment.spaceId, ability);
if (dbEngine.isErr()) {
return errorResponse(dbEngine);
}

return (
<Suspense
Expand All @@ -36,7 +44,7 @@ export default async function EnginesPage(props: {
}
>
<EngineDashboard
dbEngine={dbEngine}
dbEngine={dbEngine.value}
engineId={engineId}
backButton={
<SpaceLink href="/engines">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { getSpaceSettingsValues } from '@/lib/data/db/space-settings';
import { savedEnginesToEngines } from '@/lib/engines/saved-engines-helpers';
import { Engine as DBEngine } from '@prisma/client';
import { spaceURL } from '@/lib/utils';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';

const getEngineStatus = async (engine: DBEngine) => {
const engines = await savedEnginesToEngines([engine]);
Expand All @@ -26,20 +27,30 @@ const EnginesPage = async (props: { params: Promise<{ environmentId: string }> }
if (!msConfig.PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE) return notFound();

const params = await props.params;
const { activeEnvironment, ability } = await getCurrentEnvironment(params.environmentId);
const currentSpace = await getCurrentEnvironment(params.environmentId);
if (currentSpace.isErr()) {
return errorResponse(currentSpace);
}
const { activeEnvironment, ability } = currentSpace.value;

const machinesSettings = await getSpaceSettingsValues(
activeEnvironment.spaceId,
'process-automation.process-engines',
);
if (machinesSettings.isErr()) {
return errorResponse(machinesSettings);
}

if (machinesSettings.active === false) {
if (machinesSettings.value.active === false) {
return notFound();
}

const engines = await getDbEngines(activeEnvironment.spaceId, ability);
if (engines.isErr()) {
return errorResponse(engines);
}

const enginesWithStatus = engines.map((engine) => {
const enginesWithStatus = engines.value.map((engine) => {
return {
...engine,
status: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@ import { getCurrentEnvironment } from '@/components/auth';
import { getMSConfig } from '@/lib/ms-config/ms-config';
import { getSpaceSettingsValues } from '@/lib/data/db/space-settings';
import DashboardView from './dashboard-view';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';

const Page = async (props: any) => {
const params = await props.params;
const msConfig = await getMSConfig();
if (!msConfig.PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE) return notFound();

const { activeEnvironment, ability } = await getCurrentEnvironment(params.environmentId);
const currentSpace = await getCurrentEnvironment(params.environmentId);
if (currentSpace.isErr()) {
return errorResponse(currentSpace);
}
const { activeEnvironment, ability } = currentSpace.value;

const machinesSettings = await getSpaceSettingsValues(
activeEnvironment.spaceId,
'process-automation.dashboard',
ability,
);
if (machinesSettings.isErr()) {
return errorResponse(machinesSettings);
}

if (machinesSettings.active === false) {
if (machinesSettings.value.active === false) {
return notFound();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { getDeployment } from '@/lib/engines/server-actions';
import ProcessDeploymentView from './process-deployment-view';
import { Suspense } from 'react';
import { getCurrentEnvironment } from '@/components/auth';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';
import { isUserErrorResponse } from '@/lib/server-error-handling/user-error';
import { err } from 'neverthrow';

async function Deployment({ processId, spaceId }: { processId: string; spaceId: string }) {
const deployment = await getDeployment(spaceId, processId);
if (isUserErrorResponse(deployment)) return errorResponse(err());

if (!deployment) {
return (
Expand All @@ -24,7 +28,11 @@ export default async function Page(props: {
}) {
const params = await props.params;
//TODO: authentication + authorization
const { activeEnvironment } = await getCurrentEnvironment(params.environmentId);
const currentSpace = await getCurrentEnvironment(params.environmentId);
if (currentSpace.isErr()) {
return errorResponse(currentSpace);
}
const { activeEnvironment } = currentSpace.value;

return (
<Suspense
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Engine } from '@/lib/engines/machines';
import { getStartFormFromMachine } from '@/lib/engines/tasklist';
import useEngines from '@/lib/engines/use-engines';
import { asyncFilter, asyncForEach, deepEquals } from '@/lib/helpers/javascriptHelpers';
import { getErrorMessage, userError } from '@/lib/user-error';
import { getErrorMessage, userError } from '@/lib/server-error-handling/user-error';
import { useQuery } from '@tanstack/react-query';
import { useCallback } from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useEnvironment } from '@/components/auth-can';
import { getFolder, getFolderContents } from '@/lib/data/folders';
import { ProcessDeploymentList } from '@/components/process-list';
import { useQuery } from '@tanstack/react-query';
import { isUserErrorResponse } from '@/lib/user-error';
import { isUserErrorResponse } from '@/lib/server-error-handling/user-error';
import { getAvailableSpaceEngines } from '@/lib/engines/server-actions';
import { SpaceEngine } from '@/lib/engines/machines';
import { MdOutlineComputer } from 'react-icons/md';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useRouter } from 'next/navigation';
import { deployProcess as serverDeployProcess } from '@/lib/engines/server-actions';
import { wrapServerCall } from '@/lib/wrap-server-call';
import { SpaceEngine } from '@/lib/engines/machines';
import { userError } from '@/lib/user-error';
import { userError } from '@/lib/server-error-handling/user-error';
import { removeDeployment as serverRemoveDeployment } from '@/lib/engines/server-actions';
import { useQueryClient } from '@tanstack/react-query';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getSpaceSettingsValues } from '@/lib/data/db/space-settings';
import { notFound } from 'next/navigation';
import { getCurrentEnvironment } from '@/components/auth';
import { getMSConfig } from '@/lib/ms-config/ms-config';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';

type ExecutionLayoutProps = {
params: Promise<{ environmentId: string }>;
Expand All @@ -17,14 +18,21 @@ const ExecutionsLayout: React.FC<ExecutionLayoutProps> = async (props) => {

if (!msConfig.PROCEED_PUBLIC_PROCESS_AUTOMATION_ACTIVE) return notFound();

const { activeEnvironment } = await getCurrentEnvironment(params.environmentId);
const currentSpace = await getCurrentEnvironment(params.environmentId);
if (currentSpace.isErr()) {
return errorResponse(currentSpace);
}
const { activeEnvironment } = currentSpace.value;

const exeuctionsSettings = await getSpaceSettingsValues(
const executionsSettings = await getSpaceSettingsValues(
activeEnvironment.spaceId,
'process-automation.executions',
);
if (executionsSettings.isErr()) {
return errorResponse(executionsSettings);
}

if (exeuctionsSettings.active === false) {
if (executionsSettings.value.active === false) {
return notFound();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { getRootFolder, getFolderById, getFolderContents } from '@/lib/data/db/f
import { getUsersFavourites } from '@/lib/data/users';
import { getDeployedProcessesFromSavedEngines } from '@/lib/engines/saved-engines-helpers';
import { DeployedProcessInfo } from '@/lib/engines/deployment';
import { isUserErrorResponse } from '@/lib/user-error';
import { Skeleton } from 'antd';
import { Suspense } from 'react';
import { isUserErrorResponse } from '@/lib/server-error-handling/user-error';
import { getDbEngines } from '@/lib/data/db/engines';
import { errorResponse } from '@/lib/server-error-handling/page-error-response';
import { Result, err, ok } from 'neverthrow';

function getDeploymentNames<T extends { versions: DeployedProcessInfo['versions'] }>(
deployments: T[],
Expand All @@ -29,30 +29,56 @@ function getDeploymentNames<T extends { versions: DeployedProcessInfo['versions'
}

async function Executions({ environmentId }: { environmentId: string }) {
const { ability, activeEnvironment } = await getCurrentEnvironment(environmentId);
const currentSpace = await getCurrentEnvironment(environmentId);
if (currentSpace.isErr()) {
return errorResponse(currentSpace);
}
const { ability, activeEnvironment } = currentSpace.value;

// TODO: check ability

// TODO: once the legacy storage is dropped, it would be better to do one db transaction
let [favs, [folder, folderContents], deployedInProceed, deployedInSpaceEngines] =
await Promise.all([
getUsersFavourites(),
(async () => {
const rootFolder = await getRootFolder(activeEnvironment.spaceId, ability);
const folder = await getFolderById(rootFolder.id);
const folderContents = await getFolderContents(folder.id, ability);
return [folder, folderContents];
})(),
(async () => {
const engines = await getDbEngines(null, ability, 'dont-check');
return await getDeployedProcessesFromSavedEngines(engines);
})(),
(async () => {
const spaceEngines = await getDbEngines(activeEnvironment.spaceId, ability);
if (isUserErrorResponse(spaceEngines)) return [];
return await getDeployedProcessesFromSavedEngines(spaceEngines);
})(),
]);
let promises = await Promise.all([
(async () => {
const favorites = await getUsersFavourites();
if (isUserErrorResponse(favorites)) return err(favorites);

return ok(favorites);
})(),
(async () => {
const rootFolder = await getRootFolder(activeEnvironment.spaceId, ability);
if (rootFolder.isErr()) return rootFolder;

const folder = await getFolderById(rootFolder.value.id);
if (folder.isErr()) return folder;

const folderContents = await getFolderContents(folder.value.id, ability);
if (folderContents.isErr()) {
return folderContents;
}

return ok([folder.value, folderContents.value] as const);
})(),
(async () => {
const engines = await getDbEngines(null, ability, 'dont-check');
if (engines.isErr()) return engines;

return ok(await getDeployedProcessesFromSavedEngines(engines.value));
})(),
(async () => {
const spaceEngines = await getDbEngines(activeEnvironment.spaceId, ability);
if (spaceEngines.isErr()) return spaceEngines;

return ok(await getDeployedProcessesFromSavedEngines(spaceEngines.value));
})(),
]);

const results = Result.combine(promises);
if (results.isErr()) {
return errorResponse(results);
}

let [favs, [folder, folderContents], deployedInProceed, deployedInSpaceEngines] = results.value;

folderContents = folderContents.filter((p) => p.type === 'folder' || p.versions.length);

Expand All @@ -66,22 +92,20 @@ async function Executions({ environmentId }: { environmentId: string }) {
const deployedProcesses = getDeploymentNames(deployedWithRemappedIds);

return (
<DeploymentsView
processes={folderContents}
folder={folder}
favourites={favs as string[]}
deployedProcesses={deployedProcesses}
/>
<Content title="Executions">
<DeploymentsView
processes={folderContents}
folder={folder}
favourites={favs as string[]}
deployedProcesses={deployedProcesses}
/>
</Content>
);
}

export default async function ExecutionsPage(props: {
params: Promise<{ environmentId: string }>;
}) {
const params = await props.params;
return (
<Content title="Executions">
<Executions environmentId={params.environmentId} />
</Content>
);
return <Executions environmentId={params.environmentId} />;
}
Loading
Loading