Skip to content

Commit bb2a228

Browse files
authored
0.9.2. (#21)
1 parent c30a42a commit bb2a228

File tree

7 files changed

+68
-7
lines changed

7 files changed

+68
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.9.2
2+
3+
This version fixes a bug in the `ValueEditorFactoryResolver` class. Now, when an editor is not found, the resolver throws an error.
4+
15
## 0.9.1
26

37
This version exports the `variableNameValidator` function in the `sequential-workflow-editor-model` package.

demos/webpack-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"sequential-workflow-model": "^0.2.0",
1919
"sequential-workflow-designer": "^0.16.0",
2020
"sequential-workflow-machine": "^0.4.0",
21-
"sequential-workflow-editor-model": "^0.9.1",
22-
"sequential-workflow-editor": "^0.9.1"
21+
"sequential-workflow-editor-model": "^0.9.2",
22+
"sequential-workflow-editor": "^0.9.2"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",

editor/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sequential-workflow-editor",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"type": "module",
55
"main": "./lib/esm/index.js",
66
"types": "./lib/index.d.ts",
@@ -46,11 +46,11 @@
4646
"prettier:fix": "prettier --write ./src ./css"
4747
},
4848
"dependencies": {
49-
"sequential-workflow-editor-model": "^0.9.1",
49+
"sequential-workflow-editor-model": "^0.9.2",
5050
"sequential-workflow-model": "^0.2.0"
5151
},
5252
"peerDependencies": {
53-
"sequential-workflow-editor-model": "^0.9.1",
53+
"sequential-workflow-editor-model": "^0.9.2",
5454
"sequential-workflow-model": "^0.2.0"
5555
},
5656
"devDependencies": {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { ValueEditorFactoryResolver } from './value-editor-factory-resolver';
2+
3+
describe('ValueEditorFactoryResolver', () => {
4+
describe('default', () => {
5+
const resolver = ValueEditorFactoryResolver.create();
6+
7+
describe('resolve()', () => {
8+
it('resolves string', () => {
9+
const factory = resolver.resolve('string', undefined);
10+
expect(factory).toBeDefined();
11+
});
12+
13+
it('throws error when editor is not found', () => {
14+
expect(() => resolver.resolve('some_unknown_mode_id', undefined)).toThrowError(
15+
'Editor id some_unknown_mode_id is not supported'
16+
);
17+
});
18+
});
19+
20+
describe('isHidden()', () => {
21+
it('string is not hidden', () => {
22+
const is = resolver.isHidden('string', undefined);
23+
expect(is).toBe(false);
24+
});
25+
26+
it('"branches" editor is hidden', () => {
27+
const is = resolver.isHidden('branches', undefined);
28+
expect(is).toBe(true);
29+
});
30+
31+
it('throws error when editor is not found', () => {
32+
expect(() => resolver.isHidden('some_unknown_mode_id', undefined)).toThrowError(
33+
'Editor id some_unknown_mode_id is not supported'
34+
);
35+
});
36+
});
37+
});
38+
});

editor/src/value-editors/value-editor-factory-resolver.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ export class ValueEditorFactoryResolver {
6464
}
6565

6666
public isHidden(valueModelId: string, editorId: string | undefined): boolean {
67-
return !this.map[editorId ?? valueModelId];
67+
const id = editorId ?? valueModelId;
68+
const editor = this.map[editorId ?? valueModelId];
69+
if (editor === null) {
70+
return true;
71+
}
72+
if (editor !== undefined) {
73+
return false;
74+
}
75+
throw new Error(`Editor id ${id} is not supported`);
6876
}
6977
}

model/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sequential-workflow-editor-model",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"homepage": "https://nocode-js.com/",
55
"author": {
66
"name": "NoCode JS",

scripts/publish.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
cd "$(dirname "${BASH_SOURCE[0]}")"
4+
5+
cd ../model
6+
yarn build
7+
npm publish
8+
9+
cd ../editor
10+
yarn build
11+
npm publish

0 commit comments

Comments
 (0)