sequential-workflow-editor-model
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -320,3 +320,3 @@ (function (global, factory) { | ||
if (!configuration.choices.includes(configuration.defaultValue)) { | ||
throw new Error('Default value does not match any of the choices.'); | ||
throw new Error(`Default value "${configuration.defaultValue}" does not match any of the choices.`); | ||
} | ||
@@ -1048,2 +1048,6 @@ return configuration.defaultValue; | ||
}; | ||
this.tryGetVariableType = (variableName) => { | ||
const variable = this.getVariables().find(v => v.name === variableName); | ||
return variable ? variable.type : null; | ||
}; | ||
this.getVariables = () => { | ||
@@ -1070,2 +1074,3 @@ return this.parentsProvider.getVariables(); | ||
this.isVariableDuplicated = this.scopedPropertyContext.isVariableDuplicated; | ||
this.tryGetVariableType = this.scopedPropertyContext.tryGetVariableType; | ||
this.getVariables = this.scopedPropertyContext.getVariables; | ||
@@ -1179,2 +1184,3 @@ this.getValue = () => { | ||
this.isVariableDuplicated = this.valueContext.isVariableDuplicated; | ||
this.tryGetVariableType = this.valueContext.tryGetVariableType; | ||
this.getVariables = this.valueContext.getVariables; | ||
@@ -1181,0 +1187,0 @@ } |
@@ -314,3 +314,3 @@ class DefaultValueContext { | ||
if (!configuration.choices.includes(configuration.defaultValue)) { | ||
throw new Error('Default value does not match any of the choices.'); | ||
throw new Error(`Default value "${configuration.defaultValue}" does not match any of the choices.`); | ||
} | ||
@@ -1042,2 +1042,6 @@ return configuration.defaultValue; | ||
}; | ||
this.tryGetVariableType = (variableName) => { | ||
const variable = this.getVariables().find(v => v.name === variableName); | ||
return variable ? variable.type : null; | ||
}; | ||
this.getVariables = () => { | ||
@@ -1064,2 +1068,3 @@ return this.parentsProvider.getVariables(); | ||
this.isVariableDuplicated = this.scopedPropertyContext.isVariableDuplicated; | ||
this.tryGetVariableType = this.scopedPropertyContext.tryGetVariableType; | ||
this.getVariables = this.scopedPropertyContext.getVariables; | ||
@@ -1173,2 +1178,3 @@ this.getValue = () => { | ||
this.isVariableDuplicated = this.valueContext.isVariableDuplicated; | ||
this.tryGetVariableType = this.valueContext.tryGetVariableType; | ||
this.getVariables = this.valueContext.getVariables; | ||
@@ -1175,0 +1181,0 @@ } |
@@ -99,2 +99,3 @@ import * as sequential_workflow_model from 'sequential-workflow-model'; | ||
readonly isVariableDuplicated: (variableName: string) => boolean; | ||
readonly tryGetVariableType: (variableName: string) => ValueType | null; | ||
readonly getVariables: () => ContextVariable[]; | ||
@@ -133,2 +134,3 @@ } | ||
readonly isVariableDuplicated: (variableName: string) => boolean; | ||
readonly tryGetVariableType: (variableName: string) => string | null; | ||
readonly getVariables: () => ContextVariable[]; | ||
@@ -177,2 +179,3 @@ readonly getValue: () => ReturnType<TValueModel['getDefaultValue']>; | ||
readonly isVariableDuplicated: (variableName: string) => boolean; | ||
readonly tryGetVariableType: (variableName: string) => string | null; | ||
readonly getVariables: () => ContextVariable[]; | ||
@@ -439,9 +442,9 @@ getValue(): TValue; | ||
interface ChoiceValueModelConfiguration { | ||
choices: string[]; | ||
defaultValue?: string; | ||
interface ChoiceValueModelConfiguration<TValue extends string = string> { | ||
choices: TValue[]; | ||
defaultValue?: TValue; | ||
} | ||
type ChoiceValueModel = ValueModel<string, ChoiceValueModelConfiguration>; | ||
type ChoiceValueModel<TValue extends string = string> = ValueModel<TValue, ChoiceValueModelConfiguration<TValue>>; | ||
declare const choiceValueModelId = "choice"; | ||
declare function createChoiceValueModel(configuration: ChoiceValueModelConfiguration): ValueModelFactoryFromModel<ChoiceValueModel>; | ||
declare function createChoiceValueModel<TValue extends string>(configuration: ChoiceValueModelConfiguration<TValue>): ValueModelFactory<TValue, ChoiceValueModelConfiguration<TValue>>; | ||
@@ -448,0 +451,0 @@ interface DynamicValueModelConfiguration<TSubModels extends ValueModelFactoryFromModel[]> { |
{ | ||
"name": "sequential-workflow-editor-model", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"homepage": "https://nocode-js.com/", | ||
@@ -75,2 +75,2 @@ "author": { | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
184352
4364