Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.2

This version fixes a bug in the `ValueEditorFactoryResolver` class. Now, when an editor is not found, the resolver throws an error.

## 0.9.1

This version exports the `variableNameValidator` function in the `sequential-workflow-editor-model` package.
Expand Down
4 changes: 2 additions & 2 deletions demos/webpack-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"sequential-workflow-model": "^0.2.0",
"sequential-workflow-designer": "^0.16.0",
"sequential-workflow-machine": "^0.4.0",
"sequential-workflow-editor-model": "^0.9.1",
"sequential-workflow-editor": "^0.9.1"
"sequential-workflow-editor-model": "^0.9.2",
"sequential-workflow-editor": "^0.9.2"
},
"devDependencies": {
"ts-loader": "^9.4.2",
Expand Down
6 changes: 3 additions & 3 deletions editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sequential-workflow-editor",
"version": "0.9.1",
"version": "0.9.2",
"type": "module",
"main": "./lib/esm/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -46,11 +46,11 @@
"prettier:fix": "prettier --write ./src ./css"
},
"dependencies": {
"sequential-workflow-editor-model": "^0.9.1",
"sequential-workflow-editor-model": "^0.9.2",
"sequential-workflow-model": "^0.2.0"
},
"peerDependencies": {
"sequential-workflow-editor-model": "^0.9.1",
"sequential-workflow-editor-model": "^0.9.2",
"sequential-workflow-model": "^0.2.0"
},
"devDependencies": {
Expand Down
38 changes: 38 additions & 0 deletions editor/src/value-editors/value-editor-factory-resolver.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { ValueEditorFactoryResolver } from './value-editor-factory-resolver';

describe('ValueEditorFactoryResolver', () => {
describe('default', () => {
const resolver = ValueEditorFactoryResolver.create();

describe('resolve()', () => {
it('resolves string', () => {
const factory = resolver.resolve('string', undefined);
expect(factory).toBeDefined();
});

it('throws error when editor is not found', () => {
expect(() => resolver.resolve('some_unknown_mode_id', undefined)).toThrowError(
'Editor id some_unknown_mode_id is not supported'
);
});
});

describe('isHidden()', () => {
it('string is not hidden', () => {
const is = resolver.isHidden('string', undefined);
expect(is).toBe(false);
});

it('"branches" editor is hidden', () => {
const is = resolver.isHidden('branches', undefined);
expect(is).toBe(true);
});

it('throws error when editor is not found', () => {
expect(() => resolver.isHidden('some_unknown_mode_id', undefined)).toThrowError(
'Editor id some_unknown_mode_id is not supported'
);
});
});
});
});
10 changes: 9 additions & 1 deletion editor/src/value-editors/value-editor-factory-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export class ValueEditorFactoryResolver {
}

public isHidden(valueModelId: string, editorId: string | undefined): boolean {
return !this.map[editorId ?? valueModelId];
const id = editorId ?? valueModelId;
const editor = this.map[editorId ?? valueModelId];
if (editor === null) {
return true;
}
if (editor !== undefined) {
return false;
}
throw new Error(`Editor id ${id} is not supported`);
}
}
2 changes: 1 addition & 1 deletion model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sequential-workflow-editor-model",
"version": "0.9.1",
"version": "0.9.2",
"homepage": "https://nocode-js.com/",
"author": {
"name": "NoCode JS",
Expand Down
11 changes: 11 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

cd "$(dirname "${BASH_SOURCE[0]}")"

cd ../model
yarn build
npm publish

cd ../editor
yarn build
npm publish