Skip to content

Commit b008534

Browse files
authored
Merge pull request #2 from navtech-io/develop
Develop
2 parents f6c9a13 + 40bed03 commit b008534

File tree

8 files changed

+35
-53
lines changed

8 files changed

+35
-53
lines changed

README.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ $\color{skyblue}{Syntax}$
9292
[partial] set <variablename> = expression
9393
```
9494

95-
9695
#### Data Types
9796
**Simple Types:**
9897
###### Number
@@ -111,7 +110,7 @@ let hasValue = true
111110
let allow = false
112111
```
113112
###### Date
114-
Simpleflow does not recognize date type directly, but this can be declared by using built-in date function.
113+
Use date function to declare a variable as date type.
115114
```csharp
116115
let birthday = $date(y:1980, m: 1, d: 1 )
117116
```
@@ -157,6 +156,7 @@ rule when <predicate> then
157156
> <small> condition does not allow expression. If you need to write expression
158157
declare variable and write expression and use that variable in predicate. This does not support nested rules to avoid code complexity</small>
159158
159+
160160
#### Emitters
161161

162162
$\color{skyblue}{Syntax}$
@@ -178,34 +178,36 @@ $<function_name>(param_name1: value1, param_name2: value2, ...)
178178

179179
###### Date Functions
180180

181-
* $\color{green}{\$Date(y: int, m: int, d: int, [h:int, mn: int, s: int])}$
181+
* $\color{#4686f2}{\$Date(y: int, m: int, d: int, [h:int, mn: int, s: int])}$
182182
```csharp
183183
// Examples
184184
let d1 = $Date(y: 2022, m: 7, d:11)
185185
let d2 = $Date(m: 10, d:25, y: 2022 )
186186
let t1 = $Date(m: 10, d:25, y: 2022, h:13, mn:30 )
187187
```
188-
* $\color{green}{\$GetCurrentDate()}$
189-
* $\color{green}{\$GetCurrentTime()}$
190-
* $\color{green}{\$GetCurrentDateTime(timeZone: "")}$
191-
<br>
192-
Check supported time zones here:
193-
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11#time-zones
188+
* $\color{#4686f2}{\$GetCurrentDate()}$
189+
* $\color{#4686f2}{\$GetCurrentTime()}$
190+
* $\color{#4686f2}{\$GetCurrentDateTime(timeZone: "")}$
191+
192+
Check available list of time zones here: <br>
193+
Windows: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11#time-zones <br>
194+
Ubuntu: https://manpages.ubuntu.com/manpages/bionic/man3/DateTime::TimeZone::Catalog.3pm.html <br>
195+
194196
```csharp
195197
let today = $GetCurrentDateTime()
196198
let todayEst = $GetCurrentDateTime ( timezone: "Eastern Standard Time" )
197199
```
198200

199201
###### String Functions
200-
* $\color{green}{\$Substring(input: string, startIndex:int, length: int)}$
201-
* $\color{green}{\$IndexOf(input: string, value:string, startIndex: int) }$
202-
* $\color{green}{\$Length(input: string) }$
203-
* $\color{green}{\$Contains(input: string, value:string) }$
204-
* $\color{green}{\$StartsWith(input: string, value:string) }$
205-
* $\color{green}{\$EndsWith(input: string, value:string) }$
206-
* $\color{green}{\$Trim(input: string, value:string) }$
207-
* $\color{green}{\$Match(input: string, pattern:string) }$
208-
* $\color{green}{\$Concat(value1: string, value2:string, value3:string, value4:string, value5:string)}$
202+
* $\color{#4686f2}{\$Substring(input: string, startIndex:int, length: int)}$
203+
* $\color{#4686f2}{\$IndexOf(input: string, value:string, startIndex: int) }$
204+
* $\color{#4686f2}{\$Length(input: string) }$
205+
* $\color{#4686f2}{\$Contains(input: string, value:string) }$
206+
* $\color{#4686f2}{\$StartsWith(input: string, value:string) }$
207+
* $\color{#4686f2}{\$EndsWith(input: string, value:string) }$
208+
* $\color{#4686f2}{\$Trim(input: string, value:string) }$
209+
* $\color{#4686f2}{\$Match(input: string, pattern:string) }$
210+
* $\color{#4686f2}{\$Concat(value1: string, value2:string, value3:string, value4:string, value5:string)}$
209211
```csharp
210212
let value = $Concat ( value1: "I ", value2: "got it" )
211213
```
@@ -226,7 +228,7 @@ It supports only one style of comment can be used for single or multiline using
226228
#### Simpleflow Execution
227229
<a name="simpleflow-pipeline"></a>
228230

229-
<!-- ![Simpleflow Pipeline](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/navtech-io/Simpleflow/main/SimpleflowDiagram.puml) -->
231+
![Simpleflow Pipeline](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/navtech-io/Simpleflow/main/SimpleflowDiagram.puml)
230232
231233
Sample code to create, build and run pipeline
232234
```csharp
@@ -397,9 +399,3 @@ Below statement throws exception:
397399
let address = {City: "Ny"}
398400
let o = {Id: 2, Name: "John", Address: address }
399401
```
400-
401-
402-
403-
404-
405-

SimpleflowDiagram.puml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,27 @@ skinparam linetype ortho
44

55
skinparam component {
66
FontSize 15
7-
87
FontName Courier
98
BorderColor black
109
BackgroundColor white
1110
ArrowFontName Impact
12-
ArrowColor #db691d
11+
ArrowColor #1d3ddb
1312
}
1413

1514
skinparam package {
16-
FontSize 13
15+
FontSize 15
1716
FontName Courier
1817
BorderColor white
19-
BackgroundColor #fadd93
18+
BackgroundColor #dee9fa
2019
ArrowFontName Impact
2120

2221
}
2322

2423
package "Default Execution Pipeline" {
2524
Script -right- [Cache Component]
26-
[Cache Component] -right-> [Parser Component]
27-
[Cache Component] -right-> [Execution Component]
28-
[Parser Component] -right-> [Execution Component]
25+
[Cache Component] -right-> [Parser/Compiler Component]
26+
[Cache Component] .right.> [Execution Component]
27+
[Parser/Compiler Component] -right-> [Execution Component]
2928

3029
[Execution Component] - Output
3130
}

build/Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Build : NukeBuild
113113
.SetPackageProjectUrl("https://github.com/navtech-io/Simpleflow")
114114
.AddProperty("PackageLicenseExpression", "Apache-2.0")
115115
.SetIncludeSymbols(true)
116-
.SetVersion("0.1.0-beta03" /*NuGetVersionCustom*/)
116+
.SetVersion("0.1.0-beta04" /*NuGetVersionCustom*/)
117117
.SetDescription("Lightweight rule engine")
118118
.SetPackageTags("Simpleflow.NET Workflow RuleEngine DynamicExpressionEvaluator")
119119
.SetNoDependencies(true)

src/Simpleflow/FlowOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class FlowOptions : IOptions
1010
/// <summary>
1111
/// Gets or sets AllowArgumentToMutate
1212
/// </summary>
13-
public bool AllowArgumentToMutate { get; set; }
13+
// public bool AllowArgumentToMutate { get; set; } // Implement in next release
1414

1515
/// <summary>
1616
/// Gets or sets AllowFunctions

src/Simpleflow/IOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface IOptions
1111
/// <summary>
1212
/// Gets or sets AllowArgumentToMutate
1313
/// </summary>
14-
bool AllowArgumentToMutate { get; }
14+
//bool AllowArgumentToMutate { get; } // Implement in next release Check CacheService related impl
1515

1616
/// <summary>
1717
/// Gets or sets AllowFunctions

src/Simpleflow/Services/CacheService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@ protected virtual string GetScriptUniqueId(string script)
105105

106106
private string GetFlowContextOptionsId(IContextOptions options)
107107
{
108-
if (options.AllowArgumentToMutate == false
109-
&& (options.AllowFunctions == null || options.AllowFunctions.Length == 0)
108+
if (
109+
//options.AllowArgumentToMutate == false &&
110+
(options.AllowFunctions == null || options.AllowFunctions.Length == 0)
110111
&& (options.DenyFunctions == null || options.DenyFunctions.Length == 0)
111112
)
112113
{
113114
return string.Empty;
114115
}
115116

116117
StringBuilder sb = new StringBuilder();
117-
sb.Append(string.Join(' ', options.AllowArgumentToMutate));
118+
//sb.Append(string.Join(' ', options.AllowArgumentToMutate));
118119

119120
if (options.AllowFunctions != null && options.AllowFunctions.Length > 0)
120121
{

src/Simpleflow/Simpleflow.xml

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/Simpleflow.Tests/Infrastructure/FlowContextOptionsTest.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ message d
7575

7676
// Act & Assert
7777
Assert.Throws<AccessDeniedException>(
78-
() => new SimpleflowPipelineBuilder()
79-
.AddCorePipelineServices(FunctionRegister.Default)
80-
.AddPipelineServices(new LoggingService())
81-
.Build()
82-
.Run(script, new object(), options));
78+
() => SimpleflowEngine.Run(script, new object(), options));
8379
}
8480

8581
[Fact]

0 commit comments

Comments
 (0)