Skip to content

Commit

Permalink
chore(root): Release 2024-10-09 08:55 (#6661)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 9, 2024
2 parents 7fd0632 + 920bb75 commit 6ed674f
Show file tree
Hide file tree
Showing 32 changed files with 344 additions and 231 deletions.
2 changes: 1 addition & 1 deletion .source
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { BadRequestException, Logger, Injectable } from '@nestjs/common';
import axios from 'axios';
import { HealthCheck } from '@novu/framework';
import { GetBridgeStatusCommand } from './get-bridge-status.command';

const axiosInstance = axios.create();

export const LOG_CONTEXT = 'GetBridgeStatusUsecase';

@Injectable()
export class GetBridgeStatus {
async execute(command: GetBridgeStatusCommand): Promise<HealthCheck> {
Expand All @@ -18,6 +20,11 @@ export class GetBridgeStatus {

return response.data;
} catch (err: any) {
Logger.error(
`Failed to verify Bridge endpoint ${command.bridgeUrl} with error: ${(err as Error).message || err}`,
(err as Error).stack,
LOG_CONTEXT
);
throw new BadRequestException(`Bridge is not accessible. ${err.message}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IsDefined, IsEnum, IsOptional, IsString } from 'class-validator';

import { JobTitleEnum, ProductUseCases } from '@novu/shared';
import { JobTitleEnum } from '@novu/shared';

import { AuthenticatedCommand } from '../../../shared/commands/authenticated.command';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
WorkflowListResponseDto,
WorkflowOriginEnum,
WorkflowResponseDto,
WorkflowStatusEnum,
WorkflowTypeEnum,
} from '@novu/shared';
import { ControlValuesEntity, NotificationStepEntity, NotificationTemplateEntity } from '@novu/dal';
import { GetPreferencesResponseDto } from '@novu/application-generic';
Expand All @@ -31,8 +33,10 @@ export function toResponseWorkflowDto(
name: template.name,
description: template.description,
origin: template.origin || WorkflowOriginEnum.NOVU_CLOUD,
type: template.type || WorkflowTypeEnum.BRIDGE,
updatedAt: template.updatedAt || 'Missing Updated At',
createdAt: template.createdAt || 'Missing Create At',
status: WorkflowStatusEnum.ACTIVE,
};
}

Expand All @@ -52,12 +56,15 @@ function getSteps(template: NotificationTemplateEntity, controlValuesMap: { [p:

function toMinifiedWorkflowDto(template: NotificationTemplateEntity): WorkflowListResponseDto {
return {
origin: template.origin || WorkflowOriginEnum.NOVU_CLOUD,
type: template.type || WorkflowTypeEnum.BRIDGE,
_id: template._id,
name: template.name,
tags: template.tags,
updatedAt: template.updatedAt || 'Missing Updated At',
stepTypeOverviews: template.steps.map(buildStepTypeOverview).filter((stepTypeEnum) => !!stepTypeEnum),
createdAt: template.createdAt || 'Missing Create At',
status: WorkflowStatusEnum.ACTIVE,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BadRequestException, Injectable } from '@nestjs/common';

import {
ControlValuesEntity,
EnvironmentRepository,
NotificationGroupRepository,
NotificationStepEntity,
NotificationTemplateEntity,
Expand Down Expand Up @@ -58,7 +57,6 @@ export class UpsertWorkflowUseCase {
private notificationGroupRepository: NotificationGroupRepository,
private upsertPreferencesUsecase: UpsertPreferences,
private upsertControlValuesUseCase: UpsertControlValuesUseCase,
private environmentRepository: EnvironmentRepository,
private getPreferencesUseCase: GetPreferences
) {}
async execute(command: UpsertWorkflowCommand): Promise<WorkflowResponseDto> {
Expand Down
37 changes: 22 additions & 15 deletions apps/api/src/app/workflows-v2/workflow.controller.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,23 @@ function buildErrorMsg(createWorkflowDto: Omit<WorkflowCommonsFields, '_id'>, cr

async function createWorkflowAndValidate(nameSuffix: string = ''): Promise<WorkflowResponseDto> {
const createWorkflowDto: CreateWorkflowDto = buildCreateWorkflowDto(nameSuffix);
console.log('createWorkflowDto', JSON.stringify(createWorkflowDto, null, 2));
const res = await session.testAgent.post(`${v2Prefix}/workflows`).send(createWorkflowDto);
const workflowResponseDto: WorkflowResponseDto = res.body.data;
expect(workflowResponseDto, JSON.stringify(res, null, 2)).to.be.ok;
expect(workflowResponseDto._id, JSON.stringify(res, null, 2)).to.be.ok;
expect(workflowResponseDto.updatedAt, JSON.stringify(res, null, 2)).to.be.ok;
expect(workflowResponseDto.createdAt, JSON.stringify(res, null, 2)).to.be.ok;
expect(workflowResponseDto.preferences, JSON.stringify(res, null, 2)).to.be.ok;
expect(workflowResponseDto.status, JSON.stringify(res, null, 2)).to.be.ok;
const createdWorkflowWithoutUpdateDate = removeFields(
workflowResponseDto,
'_id',
'origin',
'preferences',
'updatedAt',
'createdAt'
'createdAt',
'status',
'type'
);
createdWorkflowWithoutUpdateDate.steps = createdWorkflowWithoutUpdateDate.steps.map((step) =>
removeFields(step, 'stepUuid')
Expand Down Expand Up @@ -249,9 +251,6 @@ function buildCreateWorkflowDto(nameSuffix: string): CreateWorkflowDto {
}

async function updateWorkflowRest(id: string, workflow: UpdateWorkflowDto): Promise<WorkflowResponseDto> {
console.log(`updateWorkflow- ${id}:
${JSON.stringify(workflow, null, 2)}`);

return await safePut(`${v2Prefix}/workflows/${id}`, workflow);
}

Expand Down Expand Up @@ -296,7 +295,14 @@ function validateUpdatedWorkflowAndRemoveResponseFields(
workflowResponse: WorkflowResponseDto,
workflowUpdateRequest: UpdateWorkflowDto
): UpdateWorkflowDto {
const updatedWorkflowWoUpdated: UpdateWorkflowDto = removeFields(workflowResponse, 'updatedAt', 'origin', '_id');
const updatedWorkflowWoUpdated: UpdateWorkflowDto = removeFields(
workflowResponse,
'updatedAt',
'origin',
'_id',
'status',
'type'
);
const augmentedStep: (StepUpdateDto | StepCreateDto)[] = [];
for (const stepInResponse of workflowResponse.steps) {
expect(stepInResponse.stepUuid).to.be.ok;
Expand All @@ -318,7 +324,6 @@ async function updateWorkflowAndValidate(
updatedAt: string,
updateRequest: UpdateWorkflowDto
): Promise<void> {
console.log('updateRequest:::'.toUpperCase(), JSON.stringify(updateRequest.steps, null, 2));
const updatedWorkflow: WorkflowResponseDto = await updateWorkflowRest(id, updateRequest);
const updatedWorkflowWithResponseFieldsRemoved = validateUpdatedWorkflowAndRemoveResponseFields(
updatedWorkflow,
Expand Down Expand Up @@ -542,24 +547,19 @@ function buildInAppStepWithValues() {
}

function convertResponseToUpdateDto(workflowCreated: WorkflowResponseDto): UpdateWorkflowDto {
return removeFields(workflowCreated, 'updatedAt', '_id', 'origin') as UpdateWorkflowDto;
return removeFields(workflowCreated, 'updatedAt', '_id', 'origin', 'type', 'status') as UpdateWorkflowDto;
}

function buildUpdateDtoWithValues(workflowCreated: WorkflowResponseDto): UpdateWorkflowDto {
const updateDto = convertResponseToUpdateDto(workflowCreated);
const updatedStep = addValueToExistingStep(updateDto.steps);
const newStep = buildInAppStepWithValues();
console.log('newStep:::', JSON.stringify(newStep, null, 2));

const stoWithValues: UpdateWorkflowDto = {
return {
...updateDto,
name: `${TEST_WORKFLOW_UPDATED_NAME}-${generateUUID()}`,
steps: [updatedStep, newStep],
};

console.log('updateDto:::', JSON.stringify(stoWithValues, null, 2));

return stoWithValues;
}
function createStep(): StepCreateDto {
return {
Expand All @@ -576,7 +576,14 @@ function createStep(): StepCreateDto {

function buildUpdateRequest(workflowCreated: WorkflowResponseDto): UpdateWorkflowDto {
const steps = [createStep()];
const updateRequest = removeFields(workflowCreated, 'updatedAt', '_id', 'origin') as UpdateWorkflowDto;
const updateRequest = removeFields(
workflowCreated,
'updatedAt',
'_id',
'origin',
'status',
'type'
) as UpdateWorkflowDto;

return { ...updateRequest, name: TEST_WORKFLOW_UPDATED_NAME, steps };
}
21 changes: 4 additions & 17 deletions apps/api/src/instrument.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import { nodeProfilingIntegration } from '@sentry/profiling-node';
import { init } from '@sentry/nestjs';
import { version } from '../package.json';

if (process.env.SENTRY_DSN) {
init({
dsn: process.env.SENTRY_DSN,
integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
],

/*
* Add Tracing by setting tracesSampleRate
* We recommend adjusting this value in production
*/
tracesSampleRate: 1.0,

/*
* Set sampling rate for profiling
* This is relative to tracesSampleRate
*/
profilesSampleRate: 1.0,
environment: process.env.NODE_ENV,
release: `v${version}`,
ignoreErrors: ['Non-Error exception captured'],
});
}
155 changes: 81 additions & 74 deletions apps/dashboard/src/components/side-navigation/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,79 +8,86 @@ import {
RiStore3Line,
RiUserAddLine,
} from 'react-icons/ri';
import type { IEnvironment } from '@novu/shared';
import { NavItemsGroup } from './types';
import { LEGACY_ROUTES, ROUTES } from '@/utils/routes';
import { buildRoute, LEGACY_ROUTES, ROUTES } from '@/utils/routes';

export const navigationItems: NavItemsGroup[] = [
{
items: [
{
label: 'Workflows',
icon: RiRouteFill,
to: ROUTES.WORKFLOWS,
},
{
label: 'Subscribers',
icon: RiGroup2Line,
isExternal: true,
to: 'https://docs.novu.co/api-reference/subscribers/get-subscribers',
disabled: true,
},
],
},
{
label: 'Monitor',
items: [
{
label: 'Activity Feed',
icon: RiBarChartBoxLine,
to: LEGACY_ROUTES.ACTIVITY_FEED,
isExternal: true,
},
],
},
{
label: 'Developer',
items: [
{
label: 'Integration Store',
icon: RiStore3Line,
to: LEGACY_ROUTES.INTEGRATIONS,
isExternal: true,
},
{
label: 'API Keys',
icon: RiKey2Line,
to: LEGACY_ROUTES.API_KEYS,
isExternal: true,
},
],
},
{
label: 'Application',
items: [
{
label: 'Branding',
icon: RiPaintBrushLine,
to: LEGACY_ROUTES.BRANDING,
isExternal: true,
},
{
label: 'Settings',
icon: RiSettings4Line,
to: LEGACY_ROUTES.SETTINGS,
isExternal: true,
},
],
},
{
items: [
{
label: 'Invite teammates',
icon: RiUserAddLine,
to: LEGACY_ROUTES.INVITE_TEAM_MEMBERS,
isExternal: true,
},
],
},
];
export const buildNavigationItems = ({
currentEnvironment,
}: {
currentEnvironment?: IEnvironment;
}): NavItemsGroup[] => {
return [
{
items: [
{
label: 'Workflows',
icon: RiRouteFill,
to: buildRoute(ROUTES.WORKFLOWS, { environmentId: currentEnvironment?._id ?? '' }),
},
{
label: 'Subscribers',
icon: RiGroup2Line,
isExternal: true,
to: 'https://docs.novu.co/api-reference/subscribers/get-subscribers',
disabled: true,
},
],
},
{
label: 'Monitor',
items: [
{
label: 'Activity Feed',
icon: RiBarChartBoxLine,
to: LEGACY_ROUTES.ACTIVITY_FEED,
isExternal: true,
},
],
},
{
label: 'Developer',
items: [
{
label: 'Integration Store',
icon: RiStore3Line,
to: LEGACY_ROUTES.INTEGRATIONS,
isExternal: true,
},
{
label: 'API Keys',
icon: RiKey2Line,
to: LEGACY_ROUTES.API_KEYS,
isExternal: true,
},
],
},
{
label: 'Application',
items: [
{
label: 'Branding',
icon: RiPaintBrushLine,
to: LEGACY_ROUTES.BRANDING,
isExternal: true,
},
{
label: 'Settings',
icon: RiSettings4Line,
to: LEGACY_ROUTES.SETTINGS,
isExternal: true,
},
],
},
{
items: [
{
label: 'Invite teammates',
icon: RiUserAddLine,
to: LEGACY_ROUTES.INVITE_TEAM_MEMBERS,
isExternal: true,
},
],
},
];
};
Loading

0 comments on commit 6ed674f

Please sign in to comment.