Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanbond committed Apr 19, 2024
2 parents 6f42a86 + dc37723 commit b67e6c2
Show file tree
Hide file tree
Showing 94 changed files with 4,131 additions and 12,568 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build & Test

on: push

env:
NODE_VERSION: 18.x

jobs:
setup:
runs-on: ubuntu-latest
steps:
- run: echo "Triggered by ${{ github.event_name }} event."

- name: Check out repository code ${{ github.repository }} on ${{ github.ref }}
uses: actions/checkout@v3

- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Installing dependencies
if: steps.cache.outputs.cache-hit != 'true'
uses: borales/actions-yarn@v4
with:
cmd: install --frozen-lockfile

build:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Check out repository code ${{ github.repository }} on ${{ github.ref }}
uses: actions/checkout@v3

- name: Restore node modules from cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build
uses: borales/actions-yarn@v4
with:
cmd: build

test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Check out repository code ${{ github.repository }} on ${{ github.ref }}
uses: actions/checkout@v3

- name: Restore node modules from cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Test
uses: borales/actions-yarn@v4
with:
cmd: test
53 changes: 53 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
## [Unreleased: 2.1.0-rc.1]
### Changed
- FIO-8177: fix unsetting empty array values
- FIO-8185: Fixing issues with EditGrid and DataGrid clearOnHide with Conditionally visible elements
- FIO-8178: correctly add "validator" param to interpolated error object
- FIO-8121: Fix json and custom validation errors response
- FIO-8128: allow export of dist minified js
- FIO-8143: update eachComponent to be able to return proper pathing


## 2.0.0-rc.24
### Changed
- FIO-8106: add default storeas value to tags
- FIO-8106: add invalidDate error translation

## 2.0.0-rc.23
### Changed
- Fix: JSONLogic validations should get same context as calculations

## 2.0.0-rc.22
### Changed
- FIO-7146: gh actions for repository
- FIO-8100: add clearhidden processor to cover logic, conditions, and custom
- FIO-8101: always process json validation even if value is falsy
- FIO-8107: correct small error in normalize processor

## 2.0.0-rc.21
### Changed
- FIO-8092: update isEmpty to isComponentDataEmpty and account for differing component data types

## 2.0.0-rc.20
### Changed
- FIO-8086: don't multiple validate select components
- FIO-8079: add stricter time validation

## 2.0.0-rc.19
### Changed
- FIO-8047: add dereferencing processor for datatable comp

## 2.0.0-rc.18
### Changed
- FIO-8055: validate components that include custom validations, even when their data is empty
- FIO-8049: fix value prop in evaluations
- FIO-8040: add functions from formiojs
- restructure conditional processor to fix conditional components in emails

## 2.0.0-rc.17
### Changed
- FIO-8023: Fixing issues with the parent traversal on deeply nested components within nested forms

## 2.0.0-rc.16
- FIO-7884: Fixed issues with processing data within nested form data structures

## 2.0.0-rc.14
### Changed
- FIO-7884: Fixed an issue with nested form data where it would not set correctly
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formio/core",
"version": "2.0.0-rc.15",
"version": "2.0.0-rc.24",
"description": "The core Form.io renderering framework.",
"main": "lib/index.js",
"exports": {
Expand All @@ -9,7 +9,8 @@
"./sdk": "./lib/sdk/index.js",
"./process": "./lib/process/index.js",
"./types": "./lib/types/index.js",
"./experimental": "./lib/experimental/index.js"
"./experimental": "./lib/experimental/index.js",
"./dist/formio.core.min.js": "./dist/formio.core.min.js"
},
"scripts": {
"test": "TEST=1 mocha -r ts-node/register -r tsconfig-paths/register -r mock-local-storage -r jsdom-global/register -b -t 0 'src/**/__tests__/*.test.ts'",
Expand Down Expand Up @@ -90,6 +91,7 @@
"dayjs": "^1.11.10",
"dompurify": "^3.0.6",
"eventemitter3": "^5.0.0",
"fast-json-patch": "^3.1.1",
"fetch-ponyfill": "^7.1.0",
"inputmask": "^5.0.9-beta.45",
"json-logic-js": "^2.0.2",
Expand Down
6 changes: 4 additions & 2 deletions src/error/FieldError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ type FieldErrorContext = ValidationContext & {
export class FieldError {
context: FieldErrorContext
errorKeyOrMessage: string;
ruleName: string;
level?: string;
constructor(errorKeyOrMessage: string, context: FieldErrorContext) {
constructor(errorKeyOrMessage: string, context: FieldErrorContext, ruleName: string = errorKeyOrMessage) {
const { component, hasLabel = true, field = getComponentErrorField(component, context), level = 'error' } = context;
this.ruleName = ruleName;
if (context.component.validate?.customMessage) {
this.errorKeyOrMessage = context.component.validate.customMessage;
this.context = { ...context, hasLabel: false, field, level };
Expand All @@ -40,4 +42,4 @@ export class FieldError {
}
}

export type InterpolateErrorFn = (text: string, context: FieldErrorContext) => string;
export type InterpolateErrorFn = (text: string, context: FieldErrorContext) => string;
10 changes: 10 additions & 0 deletions src/error/ProcessorError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ProcessorContext } from "types";
export class ProcessorError extends Error {
context: Omit<ProcessorContext<any>, 'scope'>;
constructor(message: string, context: ProcessorContext<any>, processor: string = 'unknown') {
super(message);
this.message = `${message}\nin ${processor} at ${context.path}`;
const { component, path, data, row } = context;
this.context = {component, path, data, row};
}
};
1 change: 0 additions & 1 deletion src/error/ValidatorError.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/error/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './FieldError';
export * from './ValidatorError';
export * from './ProcessorError';
10 changes: 5 additions & 5 deletions src/modules/jsonlogic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export type EvaluatorContext = {
export type EvaluatorFn = (context: EvaluatorContext) => any;

export function evaluate(
context: EvaluatorContext,
evaluation: string,
ret: string = 'result',
context: EvaluatorContext,
evaluation: string,
ret: string = 'result',
evalContextFn?: EvaluatorFn,
fnName?: string,
options: any = {}
Expand All @@ -49,8 +49,8 @@ export function evaluate(
}

export function interpolate(
context: EvaluatorContext,
evaluation: string,
context: EvaluatorContext,
evaluation: string,
evalContextFn?: EvaluatorFn
) : string {
return evaluate(context, evaluation, undefined, evalContextFn, 'interpolate', {
Expand Down
12 changes: 12 additions & 0 deletions src/process/__tests__/fixtures/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import get from 'lodash/get';
import { ProcessorContext, ProcessorScope, Component } from 'types';
export const generateProcessorContext = (component: Component, data: any): ProcessorContext<ProcessorScope> => {
return {
component,
path: component.key,
data,
row: data,
scope: {} as ProcessorScope,
value: get(data, component.key),
}
}
Loading

0 comments on commit b67e6c2

Please sign in to comment.