Skip to content

Commit 6397a30

Browse files
authored
0.12.1. (#35)
1 parent 44dc0f9 commit 6397a30

15 files changed

+50
-46
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.12.1
2+
3+
This version normalizes translations.
4+
15
## 0.12.0
26

37
This version introduces the localization feature. Now you can localize the editor to any language you want.

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.21.1",
2020
"sequential-workflow-machine": "^0.4.0",
21-
"sequential-workflow-editor-model": "^0.12.0",
22-
"sequential-workflow-editor": "^0.12.0"
21+
"sequential-workflow-editor-model": "^0.12.1",
22+
"sequential-workflow-editor": "^0.12.1"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",

docs/I18N-KEYS.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ This document lists all the I18N keys used in the Sequential Workflow Editor.
1111
"anyVariables.noVariablesSelected": "No variables selected",
1212
"anyVariables.variableIsLost": "Variable :name is lost",
1313
"boolean.false": "False",
14-
"boolean.invalidType": "The value must be a boolean.",
14+
"boolean.invalidType": "The value must be a boolean",
1515
"boolean.true": "True",
16-
"branches.empty": "No branches defined.",
17-
"branches.invalidLength": "Invalid number of branches.",
18-
"branches.missingBranch": "Missing branch: :name.",
19-
"branches.mustBeObject": "The value must be object.",
20-
"choice.notSupportedValue": "Value is not supported.",
16+
"branches.empty": "No branches defined",
17+
"branches.invalidLength": "Invalid number of branches",
18+
"branches.missingBranch": "Missing branch: :name",
19+
"branches.mustBeObject": "The value must be object",
20+
"choice.notSupportedValue": "Value is not supported",
2121
"generatedString.differentValue": "Generator returns different value than the current value",
2222
"nullableAnyVariable.invalidVariableType": "The variable :name has invalid type",
2323
"nullableAnyVariable.select": "- Select -",
@@ -29,12 +29,12 @@ This document lists all the I18N keys used in the Sequential Workflow Editor.
2929
"nullableVariableDefinition.expectedType": "Variable type must be :type",
3030
"nullableVariableDefinition.variableIsDuplicated": "Variable name is already used",
3131
"nullableVariableDefinition.variableIsRequired": "The variable is required",
32-
"number.valueMustBeNumber": "The value must be a number.",
33-
"number.valueTooHigh": "The value must be at most :max.",
34-
"number.valueTooLow": "The value must be at least :min.",
35-
"string.valueDoesNotMatchPattern": "The value does not match the required pattern.",
36-
"string.valueMustBeString": "The value must be a string.",
37-
"string.valueTooShort": "The value must be at least :min characters long.",
32+
"number.valueMustBeNumber": "The value must be a number",
33+
"number.valueTooHigh": "The value must be at most :max",
34+
"number.valueTooLow": "The value must be at least :min",
35+
"string.valueDoesNotMatchPattern": "The value does not match the required pattern",
36+
"string.valueMustBeString": "The value must be a string",
37+
"string.valueTooShort": "The value must be at least :min characters long",
3838
"stringDictionary.addItem": "Add item",
3939
"stringDictionary.delete": "Delete",
4040
"stringDictionary.duplicatedKey": "Key name is duplicated",

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.12.0",
3+
"version": "0.12.1",
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.12.0",
49+
"sequential-workflow-editor-model": "^0.12.1",
5050
"sequential-workflow-model": "^0.2.0"
5151
},
5252
"peerDependencies": {
53-
"sequential-workflow-editor-model": "^0.12.0",
53+
"sequential-workflow-editor-model": "^0.12.1",
5454
"sequential-workflow-model": "^0.2.0"
5555
},
5656
"devDependencies": {

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.12.0",
3+
"version": "0.12.1",
44
"homepage": "https://nocode-js.com/",
55
"author": {
66
"name": "NoCode JS",

model/src/validator/definition-validator.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('DefinitionValidator', () => {
5353

5454
expect(error?.stepId).toEqual(null);
5555
expect(error?.propertyPath.toString()).toEqual('properties/velocity');
56-
expect(error?.error.$).toEqual('The value must be at least 0.');
56+
expect(error?.error.$).toEqual('The value must be at least 0');
5757
});
5858

5959
it('returns error when step has invalid delta value', () => {
@@ -87,7 +87,7 @@ describe('DefinitionValidator', () => {
8787

8888
expect(error?.stepId).toEqual('0xFFFFFF');
8989
expect(error?.propertyPath.toString()).toEqual('properties/delta');
90-
expect(error?.error.$).toEqual('The value must be at most 0.');
90+
expect(error?.error.$).toEqual('The value must be at most 0');
9191
});
9292

9393
it('returns error when step has invalid name', () => {
@@ -112,7 +112,7 @@ describe('DefinitionValidator', () => {
112112

113113
expect(error?.stepId).toEqual('0xAAAAAA');
114114
expect(error?.propertyPath.toString()).toEqual('name');
115-
expect(error?.error.$).toEqual('The value must be at least 1 characters long.');
115+
expect(error?.error.$).toEqual('The value must be at least 1 characters long');
116116
});
117117

118118
it('returns null when definition is valid', () => {

model/src/value-models/boolean/boolean-value-model-validator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ describe('booleanValueModelValidator', () => {
1212
it('returns "The value must be a boolean" if value is not a boolean', () => {
1313
const context = createValueContextStub<BooleanValueModel>('this is not a boolean', {});
1414
const error = booleanValueModelValidator(context);
15-
expect(error?.$).toBe('The value must be a boolean.');
15+
expect(error?.$).toBe('The value must be a boolean');
1616
});
1717
});

model/src/value-models/boolean/boolean-value-model-validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BooleanValueModel } from './boolean-value-model';
55
export function booleanValueModelValidator(context: ValueContext<BooleanValueModel>): ValidationResult {
66
const value = context.getValue();
77
if (typeof value !== 'boolean') {
8-
return createValidationSingleError(context.i18n('boolean.invalidType', 'The value must be a boolean.'));
8+
return createValidationSingleError(context.i18n('boolean.invalidType', 'The value must be a boolean'));
99
}
1010
return null;
1111
}

model/src/value-models/branches/branches-value-model-validator.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('branchesValueModelValidator', () => {
1212
}
1313
);
1414
const error = branchesValueModelValidator(context);
15-
expect(error?.$).toBe('No branches defined.');
15+
expect(error?.$).toBe('No branches defined');
1616
});
1717

1818
it('returns "Missing branch" if branch is missing', () => {
@@ -29,7 +29,7 @@ describe('branchesValueModelValidator', () => {
2929
}
3030
);
3131
const error = branchesValueModelValidator(context);
32-
expect(error?.$).toBe('Missing branch: false.');
32+
expect(error?.$).toBe('Missing branch: false');
3333
});
3434

3535
it('returns "Invalid number of branches" if there is more branches', () => {
@@ -47,7 +47,7 @@ describe('branchesValueModelValidator', () => {
4747
}
4848
);
4949
const error = branchesValueModelValidator(context);
50-
expect(error?.$).toBe('Invalid number of branches.');
50+
expect(error?.$).toBe('Invalid number of branches');
5151
});
5252

5353
it('returns "The value must be object" if there is not any branch', () => {
@@ -58,7 +58,7 @@ describe('branchesValueModelValidator', () => {
5858
}
5959
});
6060
const error = branchesValueModelValidator(context);
61-
expect(error?.$).toBe('The value must be object.');
61+
expect(error?.$).toBe('The value must be object');
6262
});
6363

6464
it('returns null if there is valid branches', () => {

model/src/value-models/branches/branches-value-model-validator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ export function branchesValueModelValidator<TBranches extends Branches>(
1010
const branches = context.getValue();
1111

1212
if (typeof branches !== 'object') {
13-
return createValidationSingleError(context.i18n('branches.mustBeObject', 'The value must be object.'));
13+
return createValidationSingleError(context.i18n('branches.mustBeObject', 'The value must be object'));
1414
}
1515
const branchNames = Object.keys(branches);
1616
if (branchNames.length === 0) {
17-
return createValidationSingleError(context.i18n('branches.empty', 'No branches defined.'));
17+
return createValidationSingleError(context.i18n('branches.empty', 'No branches defined'));
1818
}
1919
if (!configuration.dynamic) {
2020
const configurationBranchNames = Object.keys(configuration.branches);
2121
if (branchNames.length !== configurationBranchNames.length) {
22-
return createValidationSingleError(context.i18n('branches.invalidLength', 'Invalid number of branches.'));
22+
return createValidationSingleError(context.i18n('branches.invalidLength', 'Invalid number of branches'));
2323
}
2424
const missingBranchName = configurationBranchNames.find(branchName => !branchNames.includes(branchName));
2525
if (missingBranchName) {
2626
return createValidationSingleError(
27-
context.i18n('branches.missingBranch', 'Missing branch: :name.', { name: missingBranchName })
27+
context.i18n('branches.missingBranch', 'Missing branch: :name', { name: missingBranchName })
2828
);
2929
}
3030
}

model/src/value-models/choice/choice-value-model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function createChoiceValueModel<TValue extends string>(
2727
getDefaultValue() {
2828
if (configuration.defaultValue) {
2929
if (!configuration.choices.includes(configuration.defaultValue)) {
30-
throw new Error(`Default value "${configuration.defaultValue}" does not match any of the choices.`);
30+
throw new Error(`Default value "${configuration.defaultValue}" does not match any of the choices`);
3131
}
3232
return configuration.defaultValue;
3333
}
@@ -37,7 +37,7 @@ export function createChoiceValueModel<TValue extends string>(
3737
validate(context: ValueContext<ChoiceValueModel<TValue>>): ValidationResult {
3838
const value = context.getValue();
3939
if (!configuration.choices.includes(value)) {
40-
return createValidationSingleError(context.i18n('choice.notSupportedValue', 'Value is not supported.'));
40+
return createValidationSingleError(context.i18n('choice.notSupportedValue', 'Value is not supported'));
4141
}
4242
return null;
4343
}

model/src/value-models/number/number-value-model-validator.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ describe('numberValueModelValidator', () => {
77
it('returns error when value is not a number', () => {
88
const context1 = createValueContextStub<NumberValueModel>(NaN, {});
99
const error1 = numberValueModelValidator(context1);
10-
expect(error1?.$).toBe('The value must be a number.');
10+
expect(error1?.$).toBe('The value must be a number');
1111

1212
const context2 = createValueContextStub<NumberValueModel>('10', {});
1313
const error2 = numberValueModelValidator(context2);
14-
expect(error2?.$).toBe('The value must be a number.');
14+
expect(error2?.$).toBe('The value must be a number');
1515
});
1616

1717
it('returns error when value is too small', () => {
@@ -21,7 +21,7 @@ describe('numberValueModelValidator', () => {
2121

2222
const context = createValueContextStub<NumberValueModel>(5, configuration);
2323
const error = numberValueModelValidator(context);
24-
expect(error?.$).toBe('The value must be at least 10.');
24+
expect(error?.$).toBe('The value must be at least 10');
2525
});
2626

2727
it('returns error when value is too big', () => {
@@ -31,7 +31,7 @@ describe('numberValueModelValidator', () => {
3131

3232
const context = createValueContextStub<NumberValueModel>(15, configuration);
3333
const error = numberValueModelValidator(context);
34-
expect(error?.$).toBe('The value must be at most 10.');
34+
expect(error?.$).toBe('The value must be at most 10');
3535
});
3636

3737
it('returns null when value is correct', () => {

model/src/value-models/number/number-value-model-validator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ export function numberValueModelValidator(context: ValueContext<NumberValueModel
77
const configuration = context.model.configuration;
88

99
if (isNaN(value) || typeof value !== 'number') {
10-
return createValidationSingleError(context.i18n('number.valueMustBeNumber', 'The value must be a number.'));
10+
return createValidationSingleError(context.i18n('number.valueMustBeNumber', 'The value must be a number'));
1111
}
1212
if (configuration.min !== undefined && value < configuration.min) {
1313
return createValidationSingleError(
14-
context.i18n('number.valueTooLow', 'The value must be at least :min.', {
14+
context.i18n('number.valueTooLow', 'The value must be at least :min', {
1515
min: String(configuration.min)
1616
})
1717
);
1818
}
1919
if (configuration.max !== undefined && value > configuration.max) {
2020
return createValidationSingleError(
21-
context.i18n('number.valueTooHigh', 'The value must be at most :max.', {
21+
context.i18n('number.valueTooHigh', 'The value must be at most :max', {
2222
max: String(configuration.max)
2323
})
2424
);

model/src/value-models/string/string-value-model-validator.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('stringValueModelValidator', () => {
1111

1212
const context1 = createValueContextStub<StringValueModel>('', configuration);
1313
const error1 = stringValueModelValidator(context1);
14-
expect(error1?.$).toBe('The value must be at least 2 characters long.');
14+
expect(error1?.$).toBe('The value must be at least 2 characters long');
1515

1616
const context2 = createValueContextStub<StringValueModel>('fo', configuration);
1717
const error2 = stringValueModelValidator(context2);
@@ -21,7 +21,7 @@ describe('stringValueModelValidator', () => {
2121
it('returns error when value is not string', () => {
2222
const context1 = createValueContextStub<StringValueModel>(0x123, {});
2323
const error1 = stringValueModelValidator(context1);
24-
expect(error1?.$).toBe('The value must be a string.');
24+
expect(error1?.$).toBe('The value must be a string');
2525
});
2626

2727
it('returns correct response when pattern is set', () => {
@@ -31,7 +31,7 @@ describe('stringValueModelValidator', () => {
3131

3232
const context1 = createValueContextStub<StringValueModel>('1', configuration);
3333
const error1 = stringValueModelValidator(context1);
34-
expect(error1?.$).toBe('The value does not match the required pattern.');
34+
expect(error1?.$).toBe('The value does not match the required pattern');
3535

3636
const context2 = createValueContextStub<StringValueModel>('a', configuration);
3737
const error2 = stringValueModelValidator(context2);

model/src/value-models/string/string-value-model-validator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ export function stringValueModelValidator(context: ValueContext<StringValueModel
77
const configuration = context.model.configuration;
88

99
if (typeof value !== 'string') {
10-
return createValidationSingleError(context.i18n('string.valueMustBeString', 'The value must be a string.'));
10+
return createValidationSingleError(context.i18n('string.valueMustBeString', 'The value must be a string'));
1111
}
1212
if (configuration.minLength !== undefined && value.length < configuration.minLength) {
1313
return createValidationSingleError(
14-
context.i18n('string.valueTooShort', 'The value must be at least :min characters long.', {
14+
context.i18n('string.valueTooShort', 'The value must be at least :min characters long', {
1515
min: String(configuration.minLength)
1616
})
1717
);
1818
}
1919
if (configuration.pattern && !configuration.pattern.test(value)) {
2020
return createValidationSingleError(
21-
context.i18n('string.valueDoesNotMatchPattern', 'The value does not match the required pattern.')
21+
context.i18n('string.valueDoesNotMatchPattern', 'The value does not match the required pattern')
2222
);
2323
}
2424
return null;

0 commit comments

Comments
 (0)