Skip to content

Commit

Permalink
Merge pull request #145 from softflow24/development-main-merge
Browse files Browse the repository at this point in the history
Development main merge
  • Loading branch information
c0rtexR authored Oct 16, 2024
2 parents 4d8132f + d26bc1c commit 4ba493f
Show file tree
Hide file tree
Showing 124 changed files with 12,459 additions and 8,838 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml merge=union
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/1.bug.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug report 🐛
description: Create a bug report for data-river.
labels: ['status: needs triage']
labels: ["status: needs triage", "bug"]
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -76,6 +76,6 @@ body:
attributes:
label: Paste Error from Terminal/Console
description: |
Copy and paste the error output from the **terminal** (if the issue occurred server-side) or from the **browser console** (if it's a frontend issue). This will help us understand the issue better.
Copy and paste the error output from the **terminal** (if the issue occurred server-side) or from the **browser console** (if it's a frontend issue). This will help us understand the issue better.
validations:
required: false
required: false
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/2.feature.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature request 🚀
name: Feature request 🚀
description: Suggest a new idea for data-river
labels: ['status: needs triage']
labels: ["status: needs triage", "feature"]

body:
- type: markdown
Expand Down Expand Up @@ -29,4 +29,4 @@ body:
- type: textarea
attributes:
label: Motivation 🔦
description: What are you trying to accomplish? How has the absence of this feature affected you? Providing context helps us better understand the impact and prioritize accordingly.
description: What are you trying to accomplish? How has the absence of this feature affected you? Providing context helps us better understand the impact and prioritize accordingly.
25 changes: 22 additions & 3 deletions .github/workflows/pull-request-build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: "PR Build"
on:
# Runs on pull-requests against the develop / main branch
# Runs on pull-requests against the development branch
pull_request:
branches:
- development
- main

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
Expand All @@ -20,6 +19,26 @@ jobs:
cache: "pnpm"
- name: Install dependencies
run: pnpm install

# Check if pnpm-lock.yaml has changed and commit the change
- name: Check for pnpm-lock.yaml changes
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
if [[ $(git status --porcelain pnpm-lock.yaml) ]]; then
git add pnpm-lock.yaml
git commit -m "ci: fix pnpm-lock.yaml"
# Fetch the latest changes from the remote to check for conflicts
git fetch origin development
# Attempt to rebase the changes onto the latest development branch
git rebase origin/development || git rebase --abort
# Force push the changes if the rebase was successful
git push --force-with-lease
fi
- name: Run linter
run: npm run lint:all
- name: Build
Expand Down
2 changes: 2 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./scripts/setup-merge-driver.sh
./scripts/check-lockfile-change.sh "$1" "$2"
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
./scripts/check-pnpm-version.sh
npx lint-staged
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
shamefully-hoist=true
pnpm-version=9.12.1
shamefully-hoist=true
36 changes: 0 additions & 36 deletions examples/using-database-plugin.ts

This file was deleted.

67 changes: 0 additions & 67 deletions examples/workflow.json

This file was deleted.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@
"**/*.{js,ts,tsx}": "eslint --fix"
},
"devDependencies": {
"@eslint/js": "^9.10.0",
"@eslint/js": "^9.12.0",
"@types/lodash": "^4.17.10",
"@types/node": "^22.7.4",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"eslint": "^8.57.1",
"@types/node": "^22.7.5",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react": "^7.37.1",
"husky": "^9.1.6",
"lerna": "^8.1.8",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"packageManager": "[email protected]+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c",
"dependencies": {
"chalk": "4",
"chalk": "^5.3.0",
"tslib": "2.7.0"
}
}
6 changes: 4 additions & 2 deletions packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
"test": "jest"
},
"dependencies": {
"@data-river/shared": "workspace:*"
"@data-river/shared": "workspace:*",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/jest": "^29.5.13",
"@types/lodash": "^4.17.10",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
}
}
39 changes: 22 additions & 17 deletions packages/blocks/src/block/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,26 @@ export abstract class Block implements IBlock {
const missingFields: string[] = [];
const invalidFields: string[] = [];

for (const [key, value] of Object.entries(inputs)) {
for (const [key, config] of Object.entries(this.inputConfigs)) {
if (
key in this.inputConfigs &&
value !== undefined &&
value !== null &&
value !== ""
config.required &&
(!(key in inputs) ||
inputs[key] === undefined ||
inputs[key] === null ||
inputs[key] === "")
) {
cleanedInputs[key] = value;
}
}

for (const [key, config] of Object.entries(this.inputConfigs)) {
if (config.required && !(key in cleanedInputs)) {
missingFields.push(key);
} else if (
key in cleanedInputs &&
typeof cleanedInputs[key] !== config.type
key in inputs &&
inputs[key] !== undefined &&
inputs[key] !== null &&
inputs[key] !== ""
) {
invalidFields.push(key);
if (typeof inputs[key] !== config.type) {
invalidFields.push(key);
} else {
cleanedInputs[key] = inputs[key];
}
}
}

Expand Down Expand Up @@ -104,15 +105,19 @@ export abstract class Block implements IBlock {

async safeExecute(
inputs: Record<string, unknown>,
config: Record<string, unknown>,
): Promise<Record<string, unknown>> {
this.logger.group(`Block Id:${this.id} Type:${this.type}`);

// Merge inputs with config
const mergedInputs = { ...config, ...inputs };

this.logger.debug("safeExecute", {
inputs,
mergedInputs,
inputConfigs: this.inputConfigs,
});

const inputValidation = this.validateInputs(inputs);
const inputValidation = this.validateInputs(mergedInputs);
if (!inputValidation.valid) {
throw new BlockValidationError(
`Invalid inputs for block ${this.id}`,
Expand All @@ -122,7 +127,7 @@ export abstract class Block implements IBlock {
);
}

const outputs = await this.execute(inputs);
const outputs = await this.execute(mergedInputs);

const outputValidation = this.validateOutputs(outputs);
if (!outputValidation.valid) {
Expand Down
2 changes: 2 additions & 0 deletions packages/blocks/src/blockFactory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StartBlock } from "../startBlock";
import { EndBlock } from "../endBlock";
import { InputBlock } from "../inputBlock";
import { OutputBlock } from "../outputBlock";
import { LogicBlock } from "..";

type BlockConstructor = new (config: IBlockConfig, logger: ILogger) => IBlock;

Check warning on line 10 in packages/blocks/src/blockFactory/index.ts

View workflow job for this annotation

GitHub Actions / build

'config' is defined but never used

Check warning on line 10 in packages/blocks/src/blockFactory/index.ts

View workflow job for this annotation

GitHub Actions / build

'logger' is defined but never used

Expand All @@ -13,6 +14,7 @@ const blockRegistry: Record<string, BlockConstructor> = {
"blocks/[email protected]": EndBlock,
"blocks/[email protected]": InputBlock,
"blocks/[email protected]": OutputBlock,
"blocks/[email protected]": LogicBlock,
};

export function createBlock(config: IBlockConfig, logger: ILogger): IBlock {
Expand Down
Loading

0 comments on commit 4ba493f

Please sign in to comment.