Skip to content

feat(api-service): extend query parser by json logic js#9572

Draft
djabarovgeorge wants to merge 10 commits intonextfrom
feat(api-service)-extend-query-parser-by-json-logic-js
Draft

feat(api-service): extend query parser by json logic js#9572
djabarovgeorge wants to merge 10 commits intonextfrom
feat(api-service)-extend-query-parser-by-json-logic-js

Conversation

@djabarovgeorge
Copy link
Contributor

@djabarovgeorge djabarovgeorge commented Nov 27, 2025

What changed? Why was the change needed?

example:

export const EXAMPLE_ANNOTATED_RULE: AnnotatedRule = {
  id: 'root-rule',
  rule: {
    and: [
      {
        id: 'user-status-check',
        rule: {
          or: [
            { id: 'active-user', rule: { '=': [{ var: 'user.status' }, 'active'] } },
            { id: 'premium-user', rule: { '=': [{ var: 'user.tier' }, 'premium'] } },
          ],
        },
      },
      {
        id: 'engagement-filters',
        rule: {
          and: [
            { id: 'name-starts-with', rule: { startsWith: [{ var: 'user.name' }, 'John'] } },
            { id: 'email-contains', rule: { contains: [{ var: 'user.email' }, '@company.com'] } },
            { id: 'age-range', rule: { between: [{ var: 'user.age' }, [18, 65]] } },
            { id: 'score-not-between', rule: { notBetween: [{ var: 'metrics.score' }, [0, 10]] } },
          ],
        },
      },
      {
        id: 'temporal-conditions',
        rule: {
          or: [
            { id: 'recent-signup', rule: { withinLast: [{ var: 'user.createdAt' }, { amount: 30, unit: 'days' }] } },
            { id: 'old-activity', rule: { moreThanXAgo: [{ var: 'user.lastLogin' }, { amount: 6, unit: 'months' }] } },
            {
              id: 'exact-anniversary',
              rule: { exactlyXAgo: [{ var: 'user.joinDate' }, { amount: 1, unit: 'years' }] },
            },
          ],
        },
      },
      {
        id: 'string-validations',
        rule: {
          and: [
            { id: 'not-ends-with', rule: { doesNotEndWith: [{ var: 'user.username' }, '_test'] } },
            { id: 'not-begins-with', rule: { doesNotBeginWith: [{ var: 'user.username' }, 'bot_'] } },
            { id: 'not-contains-spam', rule: { doesNotContain: [{ var: 'user.bio' }, 'spam'] } },
          ],
        },
      },
      {
        id: 'null-checks',
        rule: {
          and: [
            { id: 'has-phone', rule: { notNull: { var: 'user.phone' } } },
            { id: 'no-deleted-at', rule: { null: { var: 'user.deletedAt' } } },
          ],
        },
      },
      {
        id: 'collection-checks',
        rule: {
          and: [
            {
              id: 'role-in-list',
              rule: {
                or: [
                  { '==': [{ var: 'user.role' }, 'admin'] },
                  { '==': [{ var: 'user.role' }, 'moderator'] },
                  { '==': [{ var: 'user.role' }, 'editor'] },
                ],
              },
            },
            { id: 'status-not-in', rule: { notIn: [{ var: 'user.status' }, ['banned', 'suspended', 'deleted']] } },
          ],
        },
      },
      {
        id: 'comparison-operators',
        rule: {
          and: [
            { id: 'credits-gt', rule: { '>': [{ var: 'account.credits' }, 100] } },
            { id: 'balance-gte', rule: { '>=': [{ var: 'account.balance' }, 0] } },
            { id: 'failures-lt', rule: { '<': [{ var: 'metrics.failures' }, 5] } },
            { id: 'retries-lte', rule: { '<=': [{ var: 'metrics.retries' }, 3] } },
            { id: 'version-eq', rule: { '==': [{ var: 'app.version' }, '2.0.0'] } },
            { id: 'env-neq', rule: { '!=': [{ var: 'app.environment' }, 'production'] } },
          ],
        },
      },
    ],
  },
};

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

@netlify
Copy link

netlify bot commented Nov 27, 2025

👷 Deploy Preview for dashboard-v2-novu-staging processing.

Name Link
🔨 Latest commit 199c608
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/69a045e4f6ea020008e73c96

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

Hey there and thank you for opening this pull request! 👋

We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted.

Your PR title is: feat(api-service): extend query parser by json logic js

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

…al and enhance preference DTOs with ExtendedOperations type
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

Open in StackBlitz

@novu/js

npm i https://pkg.pr.new/novuhq/novu/@novu/js@9572

@novu/nextjs

npm i https://pkg.pr.new/novuhq/novu/@novu/nextjs@9572

novu

npm i https://pkg.pr.new/novuhq/novu@9572

@novu/react

npm i https://pkg.pr.new/novuhq/novu/@novu/react@9572

@novu/react-native

npm i https://pkg.pr.new/novuhq/novu/@novu/react-native@9572

commit: 199c608

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants