Skip to content

Commit

Permalink
chore: bump versions and update dependencies (#2998)
Browse files Browse the repository at this point in the history
* chore: bump versions and update dependencies

- Bump version for kyb-app to 0.3.117
- Bump version for react-pdf-toolkit to 1.2.68
- Bump version for ui to 0.5.68 and workflows-service to 0.7.94

(Your version bumps are flying higher than my hopes for a bug-free release)

* fix(json-schema): validate input date format in custom validator

- Update date validation logic to check if the input date is valid
- Ensure that the custom format validation rejects invalid date inputs

(your date checks were less reliable than a broken clock)

* chore(releases): bump versions and update dependencies

- Update version numbers across multiple packages
- Upgrade @ballerine/ui to version 0.5.69 in projects

(your version bumps are more common than my failed attempts at humor)
  • Loading branch information
tomer-shvadron authored Jan 29, 2025
1 parent b2cd32a commit 53266d4
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
import dayjs from 'dayjs';
import uniqBy from 'lodash/uniqBy';
import ajvErrors from 'ajv-errors';
import { AnyObject } from '@ballerine/ui';
import Ajv, { ErrorObject } from 'ajv/dist/2019';
import addFormats, { FormatName } from 'ajv-formats';

import { Rule, UIElement } from '@/domains/collection-flow';
import {
ErrorField,
RuleEngine,
} from '@/components/organisms/DynamicUI/rule-engines/rule-engine.abstract';
import { Rule, UIElement } from '@/domains/collection-flow';
import { AnyObject } from '@ballerine/ui';
import ajvErrors from 'ajv-errors';
import addFormats, { FormatName } from 'ajv-formats';
import Ajv, { ErrorObject } from 'ajv/dist/2019';
import uniqBy from 'lodash/uniqBy';

const addCustomFormats = (validator: Ajv) => {
validator.addFormat('non-past-date', {
type: 'string',
validate: (dateString: string) => {
const inputDate = dayjs(dateString);

if (!inputDate.isValid()) {
return false;
}

return inputDate.startOf('day').valueOf() >= dayjs().startOf('day').valueOf();
},
});
};

export class JsonSchemaRuleEngine implements RuleEngine {
static ALLOWED_FORMATS: FormatName[] = ['email', 'uri', 'date', 'date-time'];
Expand All @@ -18,12 +35,16 @@ export class JsonSchemaRuleEngine implements RuleEngine {
// @ts-ignore
validate(context: unknown, rule: Rule, definition: UIElement<AnyObject>) {
const validator = new Ajv({ allErrors: true, useDefaults: true });

addFormats(validator, {
formats: JsonSchemaRuleEngine.ALLOWED_FORMATS,
keywords: true,
});

ajvErrors(validator, { singleError: true });

addCustomFormats(validator);

const validationResult = validator.validate(rule.value, context);

if (!validationResult) {
Expand All @@ -37,15 +58,17 @@ export class JsonSchemaRuleEngine implements RuleEngine {

test(context: unknown, rule: Rule) {
const validator = new Ajv({ allErrors: true, useDefaults: true, $data: true });

addFormats(validator, {
formats: ['email', 'uri', 'date', 'date-time'],
keywords: true,
});

ajvErrors(validator, { singleError: true });

const validationResult = validator.validate(rule.value, context);
addCustomFormats(validator);

return validationResult;
return validator.validate(rule.value, context);
}

private extractErrorsWithFields(validator: Ajv, definition: UIElement<AnyObject>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { MCC } from '@/components/organisms/UIRenderer/elements/JSONForm/compone
import { RJSFInputProps, TextInputAdapter } from '@ballerine/ui';

export const MCCPicker = (props: RJSFInputProps) => {
const options = useMemo(
() =>
MCC.map(item => ({
const: item.const,
title: `${item.const} - ${item.title}`,
})),
[],
);
const options = useMemo(() => {
const list =
(props.uiSchema?.['ui:options']?.mcc as Array<{ const: string; title: string }>) || MCC;

return list.map(item => ({
const: item.const,
title: `${item.const} - ${item.title}`,
}));
}, [props.uiSchema]);

const propsWithOptions = useMemo(
() => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Loader2 } from 'lucide-react';
export const LoadingScreen = () => {
return (
<div className="flex h-full w-full items-center justify-center">
<Loader2 className="text-black animate-spin" size={'48'} />
<Loader2 className="animate-spin text-black" size={'48'} />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useCallback } from 'react';

import { ctw } from '@/common/utils/ctw';
import { Checkbox } from '@/components/atoms';
import { RJSFInputAdapter } from '@/components/organisms/DynamicForm/components/RSJVInputAdaters/types';
import { useCallback } from 'react';

export const BooleanFieldAdapter: RJSFInputAdapter<boolean> = ({
id,
formData,
schema,
uiSchema,
disabled,
testId,
onChange,
Expand Down Expand Up @@ -34,7 +36,7 @@ export const BooleanFieldAdapter: RJSFInputAdapter<boolean> = ({
}}
onBlur={handleBlur}
/>
<span>{schema.title}</span>
<span className={ctw(uiSchema?.className)}>{schema.title}</span>
</label>
);
};
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions services/workflows-service/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @ballerine/workflows-service

## 0.7.95

### Patch Changes

- version bump

## 0.7.94

### Patch Changes

- version bump

## 0.7.93

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion services/workflows-service/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ballerine/workflows-service",
"private": false,
"version": "0.7.93",
"version": "0.7.95",
"description": "workflow-service",
"scripts": {
"spellcheck": "cspell \"*\"",
Expand Down
2 changes: 1 addition & 1 deletion services/workflows-service/prisma/data-migrations

0 comments on commit 53266d4

Please sign in to comment.