Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@
"xoxb",
"fanout",
"adminconsent",
"Annotatable",
"Arik",
"Chakma",
"selectednode",
Expand Down
1 change: 1 addition & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
},
"devDependencies": {
"@faker-js/faker": "^6.0.0",
"@novu/js": "workspace:*",
"@nestjs/cli": "10.4.5",
"@nestjs/schematics": "10.1.4",
"@nestjs/testing": "10.4.18",
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/ai/services/llm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class LlmService {

this.config = {
provider,
apiKey,
apiKey: apiKey!,
model: modelId,
maxOutputTokens: parseInt(process.env.AI_LLM_MAX_OUTPUT_TOKENS || '4096', 10),
temperature: parseFloat(process.env.AI_LLM_TEMPERATURE || '0'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import {
emailControlSchema,
FeatureFlagsService,
InMemoryLRUCacheService,
InMemoryLRUCacheStore,
Instrument,
Expand All @@ -19,9 +18,9 @@ import {
import { workflow } from '@novu/framework/express';
import { ActionStep, ChannelStep, PostActionEnum, Schema, Step, StepOutput, Workflow } from '@novu/framework/internal';
import { EnvironmentTypeEnum, LAYOUT_PREVIEW_EMAIL_STEP, LAYOUT_PREVIEW_WORKFLOW_ID, StepTypeEnum } from '@novu/shared';
import { AdditionalOperation, RulesLogic } from 'json-logic-js';
import { RulesLogic } from 'json-logic-js';
import _ from 'lodash';
import { evaluateRules } from '../../../shared/services/query-parser/query-parser.service';
import { ExtendedOperations, evaluateRules } from '../../../shared/services/query-parser/query-parser.service';
import { isMatchingJsonSchema } from '../../../workflows-v2/util/jsonToSchema';
import {
ChatOutputRendererUsecase,
Expand Down Expand Up @@ -53,7 +52,6 @@ export class ConstructFrameworkWorkflow {
private delayOutputRendererUseCase: DelayOutputRendererUsecase,
private digestOutputRendererUseCase: DigestOutputRendererUsecase,
private throttleOutputRendererUseCase: ThrottleOutputRendererUsecase,
private featureFlagsService: FeatureFlagsService,
private inMemoryLRUCacheService: InMemoryLRUCacheService
) {}

Expand Down Expand Up @@ -426,7 +424,7 @@ export class ConstructFrameworkWorkflow {
controlValues: { [x: string]: unknown },
variables: FullPayloadForRender
): Promise<boolean> {
const skipRules = controlValues.skip as RulesLogic<AdditionalOperation>;
const skipRules = controlValues.skip as RulesLogic<ExtendedOperations>;

if (_.isEmpty(skipRules)) {
return false;
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/app/events/e2e/bridge-trigger.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1994,9 +1994,12 @@ describe('Novu-Hosted Bridge Trigger #novu-v2', () => {
await triggerEvent(session, responseData.workflowId, subscriber._id, {});
currentMetrics = await (jobsService as any).getQueueMetrics();
console.log(
`[Test] Queue breakdown - Workflow: ${currentMetrics.activeWorkflowJobsCount + currentMetrics.waitingWorkflowJobsCount}, Subscriber: ${currentMetrics.activeSubscriberJobsCount + currentMetrics.waitingSubscriberJobsCount}, Standard: ${currentMetrics.activeStandardJobsCount + currentMetrics.waitingStandardJobsCount}`
`[Test] Start Wait For Job Completion - Queue breakdown - Workflow: ${currentMetrics.activeWorkflowJobsCount + currentMetrics.waitingWorkflowJobsCount}, Subscriber: ${currentMetrics.activeSubscriberJobsCount + currentMetrics.waitingSubscriberJobsCount}, Standard: ${currentMetrics.activeStandardJobsCount + currentMetrics.waitingStandardJobsCount}`
);
await session.waitForJobCompletion();
console.log(
`[Test] End Wait For Job Completion - Queue breakdown - Workflow: ${currentMetrics.activeWorkflowJobsCount + currentMetrics.waitingWorkflowJobsCount}, Subscriber: ${currentMetrics.activeSubscriberJobsCount + currentMetrics.waitingSubscriberJobsCount}, Standard: ${currentMetrics.activeStandardJobsCount + currentMetrics.waitingStandardJobsCount}`
);

const sentMessages = await messageRepository.find({
_environmentId: session.environment._id,
Expand Down
3 changes: 2 additions & 1 deletion apps/api/src/app/inbox/dtos/get-preferences-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Type } from 'class-transformer';
import { IsDefined, IsEnum, IsOptional, ValidateNested } from 'class-validator';
import { RulesLogic } from 'json-logic-js';
import { SubscriberPreferenceChannels } from '../../shared/dtos/preference-channels';
import { ExtendedOperations } from '../../shared/services/query-parser/query-parser.service';
import { WorkflowDto } from './workflow.dto';

export class GetPreferencesResponseDto {
Expand Down Expand Up @@ -50,5 +51,5 @@ export class GetPreferencesResponseDto {
nullable: true,
})
@IsOptional()
condition?: RulesLogic;
condition?: RulesLogic<ExtendedOperations>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Type } from 'class-transformer';
import { IsBoolean, IsObject, IsOptional, ValidateNested } from 'class-validator';
import { RulesLogic } from 'json-logic-js';
import { ScheduleDto } from '../../shared/dtos/schedule';
import { ExtendedOperations } from '../../shared/services/query-parser/query-parser.service';

export class UpdatePreferencesRequestDto {
@IsOptional()
Expand Down Expand Up @@ -47,5 +48,5 @@ export class UpdatePreferencesRequestDto {
})
@IsObject()
@IsOptional()
readonly condition?: RulesLogic;
readonly condition?: RulesLogic<ExtendedOperations>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from 'class-validator';
import { RulesLogic } from 'json-logic-js';
import { EnvironmentWithSubscriber } from '../../../shared/commands/project.command';
import { ExtendedOperations } from '../../../shared/services/query-parser/query-parser.service';

class AllPreferences {
@IsOptional()
Expand All @@ -21,7 +22,7 @@ class AllPreferences {

@IsOptional()
@IsObject()
condition?: RulesLogic;
condition?: RulesLogic<ExtendedOperations>;
}

export class UpdatePreferencesCommand extends EnvironmentWithSubscriber {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Type } from 'class-transformer';
import { IsArray, IsDefined, IsOptional, IsString, ValidateIf, ValidateNested } from 'class-validator';
import { RulesLogic } from 'json-logic-js';
import { WorkflowDto } from '../../../inbox/dtos/workflow.dto';
import { ExtendedOperations } from '../../services/query-parser/query-parser.service';

export class TopicDto {
@ApiProperty({
Expand Down Expand Up @@ -127,7 +128,7 @@ export class SubscriptionPreferenceDto {
})
@ValidateIf((o) => o.condition !== undefined)
@IsOptional()
condition?: RulesLogic;
condition?: RulesLogic<ExtendedOperations>;
}

export class SubscriptionResponseDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ValidateNested,
} from 'class-validator';
import { RulesLogic } from 'json-logic-js';
import { ExtendedOperations } from '../../services/query-parser/query-parser.service';

export class TopicSubscriberIdentifierDto {
@ApiProperty({
Expand Down Expand Up @@ -57,7 +58,7 @@ export class BasePreferenceDto {
})
@ValidateIf((o) => o.condition !== undefined)
@IsOptional()
condition?: RulesLogic;
condition?: RulesLogic<ExtendedOperations>;
}

export class WorkflowPreferenceRequestDto extends BasePreferenceDto {
Expand Down
Loading
Loading