Skip to content

Commit 70dec25

Browse files
authored
0.7.1. (#16)
1 parent 8e0dce5 commit 70dec25

File tree

64 files changed

+427
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+427
-244
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 0.7.1
2+
3+
This version renames all `*ValueModel` functions to `create*ValueModel`, adding the `create` prefix.
4+
5+
```ts
6+
// Old
7+
stringValueModel({ ... });
8+
9+
// New
10+
createStringValueModel({ ... });
11+
```
12+
13+
This version doesn't introduce breaking changes. The old functions are still available, but they are deprecated.
14+
115
## 0.7.0
216

317
This version changes the license to the MIT license. 🎉

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ export interface LogStep extends Step {
5252
Now we can create a model for the step:
5353

5454
```ts
55-
import { createStepModel, stringValueModel } from 'sequential-workflow-editor-model';
55+
import { createStepModel, createStringValueModel } from 'sequential-workflow-editor-model';
5656

5757
export const logStepModel = createStepModel<LogStep>('log', 'task', step => {
5858
step.property('message')
5959
.value(
60-
stringValueModel({
60+
createStringValueModel({
6161
minLength: 1
6262
})
6363
)
@@ -68,12 +68,12 @@ export const logStepModel = createStepModel<LogStep>('log', 'task', step => {
6868
If your workflow contains global properties you can create a root model:
6969

7070
```ts
71-
import { createRootModel, variableDefinitionsValueModel } from 'sequential-workflow-editor-model';
71+
import { createRootModel, createVariableDefinitionsValueModel } from 'sequential-workflow-editor-model';
7272

7373
export const rootModel = createRootModel<MyDefinition>(root => {
7474
root.property('inputs')
7575
.value(
76-
variableDefinitionsValueModel({})
76+
createVariableDefinitionsValueModel({})
7777
);
7878
);
7979
```

demos/webpack-app/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"xstate": "^4.37.2",
1818
"sequential-workflow-model": "^0.1.4",
1919
"sequential-workflow-designer": "^0.13.5",
20-
"sequential-workflow-machine": "^0.2.0",
21-
"sequential-workflow-editor-model": "^0.7.0",
22-
"sequential-workflow-editor": "^0.7.0"
20+
"sequential-workflow-machine": "^0.3.0",
21+
"sequential-workflow-editor-model": "^0.7.1",
22+
"sequential-workflow-editor": "^0.7.1"
2323
},
2424
"devDependencies": {
2525
"ts-loader": "^9.4.2",

demos/webpack-app/src/editors/model/any-variables-step-model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AnyVariables, anyVariablesValueModel, createStepModel } from 'sequential-workflow-editor-model';
1+
import { AnyVariables, createAnyVariablesValueModel, createStepModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface AnyVariablesStepModel extends Step {
@@ -11,9 +11,9 @@ export interface AnyVariablesStepModel extends Step {
1111
}
1212

1313
export const anyVariablesStepModel = createStepModel<AnyVariablesStepModel>('anyVariables', 'task', step => {
14-
step.property('zeroConfig').value(anyVariablesValueModel({}));
14+
step.property('zeroConfig').value(createAnyVariablesValueModel({}));
1515
step.property('onlyBoolean').value(
16-
anyVariablesValueModel({
16+
createAnyVariablesValueModel({
1717
valueTypes: ['boolean']
1818
})
1919
);

demos/webpack-app/src/editors/model/boolean-step-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { booleanValueModel, createStepModel } from 'sequential-workflow-editor-model';
1+
import { createBooleanValueModel, createStepModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface BooleanStepModel extends Step {
@@ -12,14 +12,14 @@ export interface BooleanStepModel extends Step {
1212
}
1313

1414
export const booleanStepModel = createStepModel<BooleanStepModel>('boolean', 'task', step => {
15-
step.property('zeroConfig').value(booleanValueModel({}));
15+
step.property('zeroConfig').value(createBooleanValueModel({}));
1616
step.property('defaultValueTrue').value(
17-
booleanValueModel({
17+
createBooleanValueModel({
1818
defaultValue: true
1919
})
2020
);
2121
step.property('defaultValueFalse').value(
22-
booleanValueModel({
22+
createBooleanValueModel({
2323
defaultValue: false
2424
})
2525
);

demos/webpack-app/src/editors/model/choice-step-model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { choiceValueModel, createStepModel } from 'sequential-workflow-editor-model';
1+
import { createChoiceValueModel, createStepModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface ChoiceStepModel extends Step {
@@ -13,6 +13,6 @@ export interface ChoiceStepModel extends Step {
1313
export const choiceStepModel = createStepModel<ChoiceStepModel>('choice', 'task', step => {
1414
const choices = ['red', 'blue', 'green'];
1515

16-
step.property('minimalConfig').value(choiceValueModel({ choices }));
17-
step.property('defaultValueGreen').value(choiceValueModel({ choices, defaultValue: 'green' }));
16+
step.property('minimalConfig').value(createChoiceValueModel({ choices }));
17+
step.property('defaultValueGreen').value(createChoiceValueModel({ choices, defaultValue: 'green' }));
1818
});

demos/webpack-app/src/editors/model/dynamic-step-model.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { Dynamic, booleanValueModel, createStepModel, dynamicValueModel, stringValueModel } from 'sequential-workflow-editor-model';
1+
import {
2+
Dynamic,
3+
createBooleanValueModel,
4+
createStepModel,
5+
createDynamicValueModel,
6+
createStringValueModel
7+
} from 'sequential-workflow-editor-model';
28
import { Step } from 'sequential-workflow-model';
39

410
export interface DynamicStepModel extends Step {
@@ -11,8 +17,8 @@ export interface DynamicStepModel extends Step {
1117

1218
export const dynamicStepModel = createStepModel<DynamicStepModel>('dynamic', 'task', step => {
1319
step.property('example').value(
14-
dynamicValueModel({
15-
models: [stringValueModel({}), booleanValueModel({})]
20+
createDynamicValueModel({
21+
models: [createStringValueModel({}), createBooleanValueModel({})]
1622
})
1723
);
1824
});

demos/webpack-app/src/editors/model/generated-string-step-model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createStepModel, generatedStringValueModel, numberValueModel } from 'sequential-workflow-editor-model';
1+
import { createStepModel, createGeneratedStringValueModel, createNumberValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface GeneratedStringStepModel extends Step {
@@ -11,12 +11,12 @@ export interface GeneratedStringStepModel extends Step {
1111
}
1212

1313
export const generatedStringStepModel = createStepModel<GeneratedStringStepModel>('generatedString', 'task', step => {
14-
step.property('x').value(numberValueModel({}));
14+
step.property('x').value(createNumberValueModel({}));
1515

1616
step.property('example')
1717
.dependentProperty('x')
1818
.value(
19-
generatedStringValueModel({
19+
createGeneratedStringValueModel({
2020
generator(context) {
2121
const x = context.getPropertyValue('x');
2222
switch (x) {

demos/webpack-app/src/editors/model/nullable-any-variable-step-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NullableAnyVariable, createStepModel, nullableAnyVariableValueModel } from 'sequential-workflow-editor-model';
1+
import { NullableAnyVariable, createStepModel, createNullableAnyVariableValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface NullableAnyVariableStepModel extends Step {
@@ -12,14 +12,14 @@ export interface NullableAnyVariableStepModel extends Step {
1212
}
1313

1414
export const nullableAnyVariableStepModel = createStepModel<NullableAnyVariableStepModel>('nullableAnyVariable', 'task', step => {
15-
step.property('zeroConfig').value(nullableAnyVariableValueModel({}));
15+
step.property('zeroConfig').value(createNullableAnyVariableValueModel({}));
1616
step.property('required').value(
17-
nullableAnyVariableValueModel({
17+
createNullableAnyVariableValueModel({
1818
isRequired: true
1919
})
2020
);
2121
step.property('onlyNumber').value(
22-
nullableAnyVariableValueModel({
22+
createNullableAnyVariableValueModel({
2323
valueTypes: ['number']
2424
})
2525
);

demos/webpack-app/src/editors/model/nullable-variable-definition-step-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NullableVariableDefinition, createStepModel, nullableVariableDefinitionValueModel } from 'sequential-workflow-editor-model';
1+
import { NullableVariableDefinition, createStepModel, createNullableVariableDefinitionValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface NullableVariableDefinitionStepModel extends Step {
@@ -16,19 +16,19 @@ export const nullableVariableDefinitionStepModel = createStepModel<NullableVaria
1616
'task',
1717
step => {
1818
step.property('minimalConfig').value(
19-
nullableVariableDefinitionValueModel({
19+
createNullableVariableDefinitionValueModel({
2020
valueType: 'number'
2121
})
2222
);
2323
step.property('required').value(
24-
nullableVariableDefinitionValueModel({
24+
createNullableVariableDefinitionValueModel({
2525
valueType: 'number',
2626
isRequired: true
2727
})
2828
);
2929

3030
step.property('defaultValue').value(
31-
nullableVariableDefinitionValueModel({
31+
createNullableVariableDefinitionValueModel({
3232
valueType: 'number',
3333
defaultValue: {
3434
name: 'index',

demos/webpack-app/src/editors/model/nullable-variable-step-model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NullableVariable, createStepModel, nullableVariableValueModel } from 'sequential-workflow-editor-model';
1+
import { NullableVariable, createStepModel, createNullableVariableValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface NullableVariableStepModel extends Step {
@@ -12,12 +12,12 @@ export interface NullableVariableStepModel extends Step {
1212

1313
export const nullableVariableStepModel = createStepModel<NullableVariableStepModel>('nullableVariable', 'task', step => {
1414
step.property('minimalConfig').value(
15-
nullableVariableValueModel({
15+
createNullableVariableValueModel({
1616
valueType: 'number'
1717
})
1818
);
1919
step.property('required').value(
20-
nullableVariableValueModel({
20+
createNullableVariableValueModel({
2121
valueType: 'number',
2222
isRequired: true
2323
})

demos/webpack-app/src/editors/model/number-step-model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createStepModel, numberValueModel } from 'sequential-workflow-editor-model';
1+
import { createStepModel, createNumberValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface NumberStepModel extends Step {
@@ -13,19 +13,19 @@ export interface NumberStepModel extends Step {
1313
}
1414

1515
export const numberStepModel = createStepModel<NumberStepModel>('number', 'task', step => {
16-
step.property('zeroConfig').value(numberValueModel({}));
16+
step.property('zeroConfig').value(createNumberValueModel({}));
1717
step.property('defaultValue10').value(
18-
numberValueModel({
18+
createNumberValueModel({
1919
defaultValue: 10
2020
})
2121
);
2222
step.property('min10').value(
23-
numberValueModel({
23+
createNumberValueModel({
2424
min: 10
2525
})
2626
);
2727
step.property('max20').value(
28-
numberValueModel({
28+
createNumberValueModel({
2929
max: 20
3030
})
3131
);

demos/webpack-app/src/editors/model/root-model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { createRootModel, sequenceValueModel, variableDefinitionsValueModel } from 'sequential-workflow-editor-model';
1+
import { createRootModel, createSequenceValueModel, createVariableDefinitionsValueModel } from 'sequential-workflow-editor-model';
22
import { stepModels } from './step-models';
33

44
export const rootModel = createRootModel(root => {
55
root.sequence().value(
6-
sequenceValueModel({
6+
createSequenceValueModel({
77
sequence: stepModels.map(s => s.type)
88
})
99
);
1010
root.property('x').value(
11-
variableDefinitionsValueModel({
11+
createVariableDefinitionsValueModel({
1212
defaultValue: {
1313
variables: [
1414
{

demos/webpack-app/src/editors/model/string-dictionary-step-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StringDictionary, createStepModel, stringDictionaryValueModel } from 'sequential-workflow-editor-model';
1+
import { StringDictionary, createStepModel, createStringDictionaryValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface StringDictionaryStepModel extends Step {
@@ -12,14 +12,14 @@ export interface StringDictionaryStepModel extends Step {
1212
}
1313

1414
export const stringDictionaryStepModel = createStepModel<StringDictionaryStepModel>('stringDictionary', 'task', step => {
15-
step.property('zeroConfig').value(stringDictionaryValueModel({}));
15+
step.property('zeroConfig').value(createStringDictionaryValueModel({}));
1616
step.property('uniqueKeys').value(
17-
stringDictionaryValueModel({
17+
createStringDictionaryValueModel({
1818
uniqueKeys: true
1919
})
2020
);
2121
step.property('valueMinLength3').value(
22-
stringDictionaryValueModel({
22+
createStringDictionaryValueModel({
2323
valueMinLength: 3
2424
})
2525
);

demos/webpack-app/src/editors/model/string-step-model.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createStepModel, stringValueModel } from 'sequential-workflow-editor-model';
1+
import { createStepModel, createStringValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface StringStepModel extends Step {
@@ -14,24 +14,24 @@ export interface StringStepModel extends Step {
1414
}
1515

1616
export const stringStepModel = createStepModel<StringStepModel>('string', 'task', step => {
17-
step.property('zeroConfig').value(stringValueModel({}));
17+
step.property('zeroConfig').value(createStringValueModel({}));
1818
step.property('defaultValue').value(
19-
stringValueModel({
19+
createStringValueModel({
2020
defaultValue: 'Some default value'
2121
})
2222
);
2323
step.property('minLength3').value(
24-
stringValueModel({
24+
createStringValueModel({
2525
minLength: 3
2626
})
2727
);
2828
step.property('patternYear').value(
29-
stringValueModel({
29+
createStringValueModel({
3030
pattern: /^\d{4}$/
3131
})
3232
);
3333
step.property('multiLine').value(
34-
stringValueModel({
34+
createStringValueModel({
3535
multiline: true
3636
})
3737
);

demos/webpack-app/src/editors/model/variable-definitions-step-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { VariableDefinitions, createStepModel, variableDefinitionsValueModel } from 'sequential-workflow-editor-model';
1+
import { VariableDefinitions, createStepModel, createVariableDefinitionsValueModel } from 'sequential-workflow-editor-model';
22
import { Step } from 'sequential-workflow-model';
33

44
export interface VariableDefinitionsStepModel extends Step {
@@ -12,14 +12,14 @@ export interface VariableDefinitionsStepModel extends Step {
1212
}
1313

1414
export const variableDefinitionsStepModel = createStepModel<VariableDefinitionsStepModel>('variableDefinitions', 'task', step => {
15-
step.property('zeroConfig').value(variableDefinitionsValueModel({}));
15+
step.property('zeroConfig').value(createVariableDefinitionsValueModel({}));
1616
step.property('numberAndBooleanOnly').value(
17-
variableDefinitionsValueModel({
17+
createVariableDefinitionsValueModel({
1818
valueTypes: ['number', 'boolean']
1919
})
2020
);
2121
step.property('defaultValue').value(
22-
variableDefinitionsValueModel({
22+
createVariableDefinitionsValueModel({
2323
defaultValue: {
2424
variables: [
2525
{ name: 'x', type: 'number' },

demos/webpack-app/src/playground/machine/activities/calculate-activity.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { createAtomActivity } from 'sequential-workflow-machine';
22
import { GlobalState } from '../global-state';
33
import { CalculateStep } from '../../model/calculate-step-model';
44

5-
export const calculateActivity = createAtomActivity<CalculateStep, GlobalState>({
5+
export const calculateActivity = createAtomActivity<CalculateStep, GlobalState>('calculate', {
66
init: () => ({}),
7-
stepType: 'calculate',
87
handler: async (step: CalculateStep, { $variables, $dynamics }: GlobalState) => {
98
if (!step.properties.result) {
109
throw new Error('Result variable is not defined');

demos/webpack-app/src/playground/machine/activities/convert-value-activity.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { createAtomActivity } from 'sequential-workflow-machine';
22
import { GlobalState } from '../global-state';
33
import { ConvertValueStep } from '../../model/convert-value-step-model';
44

5-
export const convertValueActivity = createAtomActivity<ConvertValueStep, GlobalState>({
5+
export const convertValueActivity = createAtomActivity<ConvertValueStep, GlobalState>('convertValue', {
66
init: () => ({}),
7-
stepType: 'convertValue',
87
handler: async (step: ConvertValueStep, { $variables }: GlobalState) => {
98
if (!step.properties.source) {
109
throw new Error('Source variable is required');

demos/webpack-app/src/playground/machine/activities/if-activity.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { branchName, createForkActivity } from 'sequential-workflow-machine';
33
import { IfStep } from '../../model/if-step-model';
44
import { GlobalState } from '../global-state';
55

6-
export const ifActivity = createForkActivity<IfStep, GlobalState>({
7-
stepType: 'if',
6+
export const ifActivity = createForkActivity<IfStep, GlobalState>('if', {
87
init: () => ({}),
98
handler: async (step: IfStep, { $dynamics }: GlobalState) => {
109
const a = $dynamics.readAny<any>(step.properties.a);

0 commit comments

Comments
 (0)