@cxtms/cx-schema 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/cx-core/ref-cli-auth.md +120 -0
- package/.claude/skills/cx-core/ref-entity-accounting.md +7 -0
- package/.claude/skills/cx-core/ref-entity-commodity.md +12 -0
- package/.claude/skills/cx-core/ref-entity-contact.md +10 -0
- package/.claude/skills/cx-core/ref-entity-geography.md +34 -1
- package/.claude/skills/cx-core/ref-entity-order-sub.md +13 -0
- package/.claude/skills/cx-core/ref-entity-order.md +14 -0
- package/.claude/skills/cx-core/ref-entity-rate.md +8 -0
- package/.claude/skills/cx-core/ref-entity-shared.md +9 -0
- package/.claude/skills/cx-core/ref-entity-warehouse.md +5 -0
- package/.claude/skills/cx-core/ref-graphql-query.md +320 -0
- package/.claude/skills/cx-module/SKILL.md +103 -28
- package/.claude/skills/cx-module/ref-components-data.md +7 -0
- package/.claude/skills/cx-module/ref-components-display.md +17 -0
- package/.claude/skills/cx-module/ref-components-forms.md +7 -1
- package/.claude/skills/cx-module/ref-components-interactive.md +11 -0
- package/.claude/skills/cx-module/ref-components-layout.md +11 -0
- package/.claude/skills/cx-module/ref-components-specialized.md +50 -0
- package/.claude/skills/cx-workflow/SKILL.md +127 -18
- package/.claude/skills/cx-workflow/ref-communication.md +8 -0
- package/.claude/skills/cx-workflow/ref-entity.md +43 -0
- package/.claude/skills/cx-workflow/ref-expressions-ncalc.md +128 -0
- package/.claude/skills/cx-workflow/ref-expressions-template.md +159 -0
- package/.claude/skills/cx-workflow/ref-flow.md +8 -1
- package/.claude/skills/cx-workflow/ref-other.md +9 -0
- package/README.md +34 -34
- package/dist/cli.js +2395 -167
- package/dist/cli.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validator.d.ts +8 -0
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +54 -2
- package/dist/validator.js.map +1 -1
- package/dist/workflowValidator.d.ts +4 -0
- package/dist/workflowValidator.d.ts.map +1 -1
- package/dist/workflowValidator.js +28 -2
- package/dist/workflowValidator.js.map +1 -1
- package/package.json +1 -1
- package/schemas/components/appComponent.json +8 -0
- package/schemas/components/module.json +31 -2
- package/schemas/components/timelineGrid.json +4 -0
- package/schemas/schemas.json +12 -0
- package/schemas/workflows/tasks/authentication.json +26 -12
- package/schemas/workflows/workflow.json +0 -4
- package/scripts/postinstall.js +1 -1
- package/templates/module-configuration.yaml +23 -89
- package/templates/module-form.yaml +3 -3
- package/templates/module-grid.yaml +3 -3
- package/templates/module-select.yaml +3 -3
- package/templates/module.yaml +3 -2
- package/templates/workflow-api-tracking.yaml +1 -1
- package/templates/workflow-basic.yaml +1 -1
- package/templates/workflow-document.yaml +1 -1
- package/templates/workflow-entity-trigger.yaml +1 -1
- package/templates/workflow-ftp-edi.yaml +1 -1
- package/templates/workflow-ftp-tracking.yaml +1 -1
- package/templates/workflow-mcp-tool.yaml +1 -1
- package/templates/workflow-public-api.yaml +1 -1
- package/templates/workflow-scheduled.yaml +1 -1
- package/templates/workflow-utility.yaml +1 -1
- package/templates/workflow-webhook.yaml +1 -1
- package/templates/workflow.yaml +1 -1
- package/.claude/skills/cx-workflow/ref-expressions.md +0 -272
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
# Entity CRUD Tasks Reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
- Entity/Change task (generic entity modification in Before triggers)
|
|
5
|
+
- Order tasks (Create, Update, Delete, Get, Copy, Split, Import, etc.)
|
|
6
|
+
- Contact tasks (Create, Update, Delete)
|
|
7
|
+
- ContactAddress tasks (Create, Update, Delete, Import)
|
|
8
|
+
- ContactPaymentMethod tasks (Create, Update, SendChargedAmount, VerifyChargedAmount)
|
|
9
|
+
- Commodity tasks (Create, Update, Split, Repack, Unpack)
|
|
10
|
+
- CommodityTrackingNumber tasks (Create, Update, Delete)
|
|
11
|
+
- Job tasks (Create, Update, Delete, Assign, Unassign)
|
|
12
|
+
- Charge tasks (Create, Update, Delete, DynamicUpdate, Calculate)
|
|
13
|
+
- Discount task (Update)
|
|
14
|
+
- Order sub-entity tasks (OrderCommodity, OrderCharge, OrderDocument, OrderTrackingEvent, OrderEntity)
|
|
15
|
+
- Inventory tasks (InventoryItem Create, Update, Delete)
|
|
16
|
+
- Other entity tasks (Movement, Country, Cities, Rate, TrackingEvent/Import)
|
|
17
|
+
- Note tasks (Create, Update, Delete, Import, Export, RenameThread)
|
|
18
|
+
- AccountingTransaction/ApplyCredit task
|
|
19
|
+
|
|
3
20
|
All entity tasks follow the `Namespace/Operation@Version` pattern. Outputs are stored as `ActivityName.StepName.outputKey`.
|
|
4
21
|
|
|
22
|
+
## PostalCodes
|
|
23
|
+
|
|
24
|
+
| Task | Description |
|
|
25
|
+
|------|-------------|
|
|
26
|
+
| `PostalCodes/Import@1` | Import postal codes from file URL, stream, or inline data |
|
|
27
|
+
|
|
28
|
+
### PostalCodes/Import@1
|
|
29
|
+
|
|
30
|
+
Imports postal codes (CSV, JSON, Excel). Supports upsert via `matchByFields`.
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
- task: "PostalCodes/Import@1"
|
|
34
|
+
name: ImportPostalCodes
|
|
35
|
+
inputs:
|
|
36
|
+
organizationId: "{{ int inputs.organizationId }}"
|
|
37
|
+
fileUrl: "{{ inputs.fileUrl }}"
|
|
38
|
+
matchByFields: ["code", "countryCode"]
|
|
39
|
+
outputs:
|
|
40
|
+
- name: importResult
|
|
41
|
+
mapping: "result?"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Inputs:** `organizationId` (int, required), `fileUrl` (string?), `fileType` (FileType?), `stream` (Stream?), `postalCodes` (List?), `matchByFields` (string[]?)
|
|
45
|
+
**Outputs:** `result.success`, `result.added`, `result.updated`, `result.errors`, `result.totalProcessed`, `result.hasErrors`
|
|
46
|
+
Input priority: `stream` > `fileUrl` > `postalCodes`. Task catches exceptions and returns them in `result.errors`.
|
|
47
|
+
|
|
5
48
|
## Generic Entity Change
|
|
6
49
|
|
|
7
50
|
| Task | Description |
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# NCalc Expressions & Functions
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
- NCalc expression syntax `[variable]` (in conditions and expression directives)
|
|
5
|
+
- Operators (comparison, logical, arithmetic, ternary, membership)
|
|
6
|
+
- Iterator variables (`[each.*]` and `[item.*]`)
|
|
7
|
+
- Collection functions (any, all, count, sum, first, last, distinct, groupBy, join, etc.)
|
|
8
|
+
- String functions (isNullOrEmpty, length, lower, upper, replace, format, base64, etc.)
|
|
9
|
+
- Date functions (now, parseDate, addDays, formatDate, dateFromUnix, etc.)
|
|
10
|
+
- Math functions (Abs, Ceiling, Floor, Round, Min, Max, etc.)
|
|
11
|
+
- Domain functions (convertWeight, convertDimension)
|
|
12
|
+
|
|
13
|
+
For template expressions `{{ path }}` used in step inputs, see [ref-expressions-template.md](ref-expressions-template.md).
|
|
14
|
+
|
|
15
|
+
## NCalc Expressions: `[variable]` (in conditions and expression directives)
|
|
16
|
+
|
|
17
|
+
Used in `conditions[].expression`, `switch` case `when`, and `expression:` value directives. Variables use **square bracket** `[name]` syntax.
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
conditions:
|
|
21
|
+
- expression: "[status] = 'Active' AND [amount] > 100"
|
|
22
|
+
- expression: "isNullOrEmpty([Data.GetOrder.order?]) = false"
|
|
23
|
+
- expression: "any([changes], [each.key] = 'Status') = true"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Parameter resolution rules**:
|
|
27
|
+
- Empty strings are converted to `null` (so `""` is treated as no value)
|
|
28
|
+
- Numeric strings are auto-converted to `decimal` when needed (e.g., `[price] > 100` works even if price is the string `"150"`)
|
|
29
|
+
- Dot paths resolve deep: `[Activity.Step.output.nested.field]`
|
|
30
|
+
- Optional suffix `?` prevents errors: `[order.customer?.name?]`
|
|
31
|
+
|
|
32
|
+
### Operators
|
|
33
|
+
|
|
34
|
+
| Type | Operators |
|
|
35
|
+
|------|-----------|
|
|
36
|
+
| Comparison | `=`, `!=`, `<>`, `<`, `>`, `<=`, `>=` |
|
|
37
|
+
| Logical | `AND`, `OR`, `NOT` (also `&&`, `\|\|`, `!`) |
|
|
38
|
+
| Arithmetic | `+`, `-`, `*`, `/`, `%` |
|
|
39
|
+
| Ternary | `if(condition, trueVal, falseVal)` |
|
|
40
|
+
| Membership | `in(value, val1, val2, ...)` |
|
|
41
|
+
|
|
42
|
+
### Iterator Variables
|
|
43
|
+
|
|
44
|
+
Functions use two iterator variable names:
|
|
45
|
+
- **`[each.*]`** -- used by: `any`, `all`, `sum`, `join` (3-arg)
|
|
46
|
+
- **`[item.*]`** -- used by: `first`, `last`, `groupBy`
|
|
47
|
+
|
|
48
|
+
### Collection Functions
|
|
49
|
+
|
|
50
|
+
| Function | Description |
|
|
51
|
+
|----------|-------------|
|
|
52
|
+
| `any([items], [each.prop] = 'val')` | True if any item matches expression. Without expression: checks if collection contains the value |
|
|
53
|
+
| `all([items], [each.prop] > 0)` | True if all items match. Returns `false` for null/empty collections |
|
|
54
|
+
| `count([items])` | Count items in list or JToken. Returns `0` for non-collections |
|
|
55
|
+
| `sum([items], [each.amount])` | Sum values as `decimal`. Optional `[each.*]` accessor. Skips nulls |
|
|
56
|
+
| `first([items])` or `first([items], [item.name])` | First item or evaluate expression on first item. Returns `""` if empty |
|
|
57
|
+
| `last([items])` or `last([items], [item.name])` | Last item or evaluate expression on last item. Returns `""` if empty |
|
|
58
|
+
| `distinct([items])` | Remove duplicates. Uses deep comparison for dictionaries |
|
|
59
|
+
| `reverse([items])` | Reverse collection or string |
|
|
60
|
+
| `contains([source], 'needle')` | String contains, JArray contains, list contains, or dict key/value contains |
|
|
61
|
+
| `removeEmpty([items])` | Remove null and whitespace-only items |
|
|
62
|
+
| `concat([list1], [list2], ...)` | Concatenate multiple collections into flat list. Variadic args. Skips nulls |
|
|
63
|
+
| `groupBy([items], [item.cat])` | Group by one or more key expressions. Returns `[{key, items}]`. Multi-key: keys joined with `\|` |
|
|
64
|
+
| `join([items], [each.name], ',')` | Join collection with `[each.*]` accessor and separator (3-arg) |
|
|
65
|
+
| `join([items], ',')` | Join collection directly with separator (2-arg) |
|
|
66
|
+
| `split([str], ' ')` | Split string by first character of separator. Returns `List<string>` |
|
|
67
|
+
| `elementAt([items], 0)` | Get element at index (zero-based) from list |
|
|
68
|
+
|
|
69
|
+
### String Functions
|
|
70
|
+
|
|
71
|
+
| Function | Description |
|
|
72
|
+
|----------|-------------|
|
|
73
|
+
| `isNullOrEmpty([var])` | True if null, empty string, or empty list |
|
|
74
|
+
| `length([var])` | String length or collection count. `0` for null strings and non-collections |
|
|
75
|
+
| `lower([name])` / `upper([code])` | Case conversion. Handles string, JToken, any `.ToString()` |
|
|
76
|
+
| `left([code], 3)` / `right([code], 3)` | Left/right N characters. Returns full string if shorter than N |
|
|
77
|
+
| `substring([str], 0, 5)` | Extract substring starting at position for given length |
|
|
78
|
+
| `replace([str], 'old', 'new')` | String replacement. Returns null if any arg is null |
|
|
79
|
+
| `trim([value])` | Trim whitespace. Returns `""` for null |
|
|
80
|
+
| `format('{0}-{1}', [prefix], [id])` | String.Format style. Variadic args. Returns null if format is null |
|
|
81
|
+
| `base64([value])` / `fromBase64([encoded])` | Base64 encode/decode. Handles string, byte[], JToken |
|
|
82
|
+
| `bool([value])` | Convert to boolean: null->`false`, empty string->`false`, "true"/"false"->parsed, non-zero number->`true`, any object->`true` |
|
|
83
|
+
| `transliterate([value])` | Unicode to ASCII (Unidecode). Returns `""` for null |
|
|
84
|
+
| `transliterateUa([value])` | Ukrainian-specific transliteration. Returns `""` for null |
|
|
85
|
+
| `parseAddress([address])` | Parse address -> `{StreetNumber, StreetName}`. Handles US and EU formats |
|
|
86
|
+
|
|
87
|
+
### Date Functions
|
|
88
|
+
|
|
89
|
+
| Function | Description |
|
|
90
|
+
|----------|-------------|
|
|
91
|
+
| `parseDate([str])` | Parse date string to DateTime. Supports common formats (ISO, US, etc.) |
|
|
92
|
+
| `now()` | Current UTC `DateTime` |
|
|
93
|
+
| `now('yyyy-MM-dd', 'en-US')` | Formatted current time as string |
|
|
94
|
+
| `addDays([date], 30)` | Add days (decimal, can be negative). Accepts DateTime, DateTimeOffset, string |
|
|
95
|
+
| `addHours([date], 2)` | Add hours (decimal, can be negative). Same type handling |
|
|
96
|
+
| `formatDate([date], 'dd/MM/yyyy', 'en-US')` | Format date with culture. Accepts DateTime or string |
|
|
97
|
+
| `dateFromUnix([unixTime])` | Unix timestamp (seconds) -> `DateTimeOffset`. Accepts int, long, decimal, string |
|
|
98
|
+
| `dateToUtc([date])` or `dateToUtc([date], 'en-US')` | Convert to UTC. Optional culture for string parsing |
|
|
99
|
+
| `toLocalTime([date], 'America/Chicago')` | Convert UTC datetime to local time in IANA timezone. Returns `null` if date or timezone is invalid |
|
|
100
|
+
|
|
101
|
+
### Business Date Math (in Lucene filter expressions)
|
|
102
|
+
|
|
103
|
+
The filter engine (`FilterBy`) supports business-aware date math units in Lucene date expressions:
|
|
104
|
+
|
|
105
|
+
| Unit | Aliases | Description |
|
|
106
|
+
|------|---------|-------------|
|
|
107
|
+
| `BHOUR` | `BHOURS` | Add/subtract business hours (respects weekly schedule + holidays) |
|
|
108
|
+
| `BDAY` | `BDAYS` | Add/subtract business days (skips non-working days) |
|
|
109
|
+
|
|
110
|
+
**Usage**: These units are used in **Lucene filter strings** (not NCalc expressions). They require an `IBusinessDateMathResolver` and are resolved via the organization's business calendar.
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
dueDate: [NOW TO NOW+3BDAYS]
|
|
114
|
+
pickupDate: [* TO NOW-8BHOURS]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Math Functions (NCalc built-in)
|
|
118
|
+
|
|
119
|
+
`Abs(x)`, `Ceiling(x)`, `Floor(x)`, `Round(x, decimals)`, `Min(x, y)`, `Max(x, y)`, `Pow(x, y)`, `Sqrt(x)`, `Truncate(x)`
|
|
120
|
+
|
|
121
|
+
Custom: `ceiling([value])` -- same as `Ceiling` but handles type conversion to double.
|
|
122
|
+
|
|
123
|
+
### Domain Functions
|
|
124
|
+
|
|
125
|
+
| Function | Description |
|
|
126
|
+
|----------|-------------|
|
|
127
|
+
| `convertWeight([weight], 'Kg', 'Lb')` | Weight unit conversion. Returns `decimal` rounded to 5 places |
|
|
128
|
+
| `convertDimension([length], 'Cm', 'In')` | Dimension unit conversion. Returns `decimal` rounded to 3 places |
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Template Expressions & Value Directives
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
- Template expression syntax `{{ path }}` (in step inputs)
|
|
5
|
+
- Type converters (int, decimal, bool, fromJson, toJson, etc.)
|
|
6
|
+
- Value directives (expression, coalesce, foreach, switch, extends, $raw, $eval, encrypt/decrypt)
|
|
7
|
+
- Property path syntax (dot paths, array indexing, wildcards, filters, projections)
|
|
8
|
+
|
|
9
|
+
There are **two distinct syntaxes** for referencing variables, used in different contexts. This file covers **template expressions** used in step inputs. For NCalc conditions and functions, see [ref-expressions-ncalc.md](ref-expressions-ncalc.md).
|
|
10
|
+
|
|
11
|
+
## Template Expressions: `{{ path }}` (in step inputs)
|
|
12
|
+
|
|
13
|
+
Used in step `inputs` values. Resolves variable paths from scoped variables.
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
inputs:
|
|
17
|
+
orderId: "{{ inputs.orderId }}" # Simple reference
|
|
18
|
+
url: "{{ chopinConfig.baseUrl }}/api/v1" # String interpolation
|
|
19
|
+
order: "{{ Data.GetOrder.order }}" # Raw object (single {{ }})
|
|
20
|
+
name: "Order {{ Data.GetOrder.order.orderNumber }}" # String interpolation (multiple)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Key behavior**: A single `{{ path }}` returns the **raw object** (preserving type). Multiple `{{ }}` in a string returns string interpolation (each resolved value is `.ToString()`).
|
|
24
|
+
|
|
25
|
+
### Type Converters (prefix in {{ }})
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
organizationId: "{{ int organizationId }}"
|
|
29
|
+
amount: "{{ decimal totalAmount }}"
|
|
30
|
+
isActive: "{{ bool isActive }}"
|
|
31
|
+
flag: "{{ boolOrFalse someFlag }}" # null -> false
|
|
32
|
+
flagOn: "{{ boolOrTrue someFlag }}" # null -> true
|
|
33
|
+
notes: "{{ emptyIfNull notes }}" # null -> ""
|
|
34
|
+
notes: "{{ nullIfEmpty notes }}" # "" or whitespace -> null
|
|
35
|
+
config: "{{ fromJson configJsonString }}" # JSON string -> dict/array
|
|
36
|
+
payload: "{{ toJson someObject }}" # object -> JSON string
|
|
37
|
+
name: "{{ trim value }}"
|
|
38
|
+
search: "{{ luceneString query }}" # escape & quote for Lucene
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
| Converter | Returns | Null handling |
|
|
42
|
+
|-----------|---------|---------------|
|
|
43
|
+
| `string` | `string` | null. Reads `Stream` to string if value is Stream |
|
|
44
|
+
| `int` | `int` | Throws on null |
|
|
45
|
+
| `decimal` | `decimal` | Throws on null |
|
|
46
|
+
| `bool` | `bool` | Throws on null |
|
|
47
|
+
| `boolOrFalse` | `bool` | `false` if null |
|
|
48
|
+
| `boolOrTrue` | `bool` | `true` if null |
|
|
49
|
+
| `datetime` | `DateTime` | Throws on null |
|
|
50
|
+
| `emptyIfNull` | same type | `""` if null, `0` for int?, `0m` for decimal? |
|
|
51
|
+
| `nullIfEmpty` | same type | `null` if empty/whitespace string or empty collection |
|
|
52
|
+
| `luceneString` | `string` | null |
|
|
53
|
+
| `transliterate` | `string` | null (Unicode -> ASCII via Unidecode) |
|
|
54
|
+
| `transliterateUa` | `string` | null (Ukrainian-specific rules) |
|
|
55
|
+
| `fromJson` | `dict` or `array` | null. Empty string -> empty dict |
|
|
56
|
+
| `toJson` | `string` | `""` if null |
|
|
57
|
+
| `trim` | `string` | null |
|
|
58
|
+
| `toLocalTime` | `DateTime` or `string` | null. Syntax: `{{ toLocalTime path 'TimezoneId' 'format?' }}` |
|
|
59
|
+
|
|
60
|
+
### Value Directives (in YAML input mappings)
|
|
61
|
+
|
|
62
|
+
**`expression`** -- Evaluate NCalc expression as a value:
|
|
63
|
+
```yaml
|
|
64
|
+
amount:
|
|
65
|
+
expression: "[price] * [quantity]"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**`coalesce`** -- First non-null value from a list:
|
|
69
|
+
```yaml
|
|
70
|
+
displayName:
|
|
71
|
+
coalesce:
|
|
72
|
+
- "{{ customer.name? }}"
|
|
73
|
+
- "{{ customer.email? }}"
|
|
74
|
+
- "Unknown"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**`foreach`** (value context) -- Transform collections inline:
|
|
78
|
+
```yaml
|
|
79
|
+
commodities:
|
|
80
|
+
foreach: "sourceCommodities"
|
|
81
|
+
item: "item" # default: "item"
|
|
82
|
+
conditions: "[item.isActive] = true" # optional NCalc filter per item
|
|
83
|
+
continueOnError: false # optional, skip errors
|
|
84
|
+
mapping: # dict -> List<dict>, string -> List<object>
|
|
85
|
+
name: "{{ item.name }}"
|
|
86
|
+
quantity: "{{ item.qty }}"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**`switch`** (value context) -- Value-based switch (case-insensitive match):
|
|
90
|
+
```yaml
|
|
91
|
+
perLb:
|
|
92
|
+
switch: "{{ contact.commissionTier }}"
|
|
93
|
+
cases:
|
|
94
|
+
"tier1": "{{ rate.customValues.commission_per_lb_tier1 }}"
|
|
95
|
+
"tier2": "{{ rate.customValues.commission_per_lb_tier2 }}"
|
|
96
|
+
default: "0"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**`extends`** -- Extend/merge an existing object or array:
|
|
100
|
+
```yaml
|
|
101
|
+
orderData:
|
|
102
|
+
extends: "{{ existingOrder }}" # base object or array
|
|
103
|
+
defaultIfNull: {} # fallback if extends is null
|
|
104
|
+
mapping: # dict: merge overrides. array: append items
|
|
105
|
+
status: "Updated"
|
|
106
|
+
notes: "{{ newNotes }}"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**`resolve`** -- Entity ID lookup by querying a GraphQL collection:
|
|
110
|
+
```yaml
|
|
111
|
+
customerId:
|
|
112
|
+
resolve:
|
|
113
|
+
entity: "Contact" # Entity type (auto-pluralized for query)
|
|
114
|
+
filter: "name:{{ customerName }}" # Lucene filter (template-parsed)
|
|
115
|
+
field: "contactId" # Field to return (default: <entity>Id)
|
|
116
|
+
```
|
|
117
|
+
Results are batched and cached per unique `entity|filter|field` combination by `ResolvePreProcessor` before step execution. Cache misses return `null`. Useful inside `foreach` mappings where many items reference the same entity — only one query per unique filter value.
|
|
118
|
+
|
|
119
|
+
**`$raw`** -- Prevent template parsing (pass as-is):
|
|
120
|
+
```yaml
|
|
121
|
+
template:
|
|
122
|
+
$raw: "This {{ won't }} be parsed"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**`$eval`** -- Parse JSON string then evaluate as template:
|
|
126
|
+
```yaml
|
|
127
|
+
dynamicConfig:
|
|
128
|
+
$eval: "{{ configJsonString }}"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**`decrypt`** / **`encrypt`** -- AES-CBC encryption (optional key/IV, has defaults):
|
|
132
|
+
```yaml
|
|
133
|
+
apiKey:
|
|
134
|
+
decrypt:
|
|
135
|
+
encryptedValue: "{{ encryptedApiKey }}"
|
|
136
|
+
key: "{{ encryptionKey }}" # optional Base64 AES key
|
|
137
|
+
initializationVector: "{{ iv }}" # optional Base64 IV
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Property Path Syntax (in collection, mapping, variable paths)
|
|
143
|
+
|
|
144
|
+
Used in `collection:` (foreach), `mapping:` (outputs), and variable resolution.
|
|
145
|
+
|
|
146
|
+
| Pattern | Description | Example |
|
|
147
|
+
|---------|-------------|---------|
|
|
148
|
+
| `a.b.c` | Dot-separated nested path | `order.customer.name` |
|
|
149
|
+
| `prop?` | Optional access (null if missing) | `order.customer?.name?` |
|
|
150
|
+
| `list[0]` | Array index | `items[0]` |
|
|
151
|
+
| `list[^1]` | Index from end (last item) | `items[^1]` |
|
|
152
|
+
| `list[*]` | Flatten/wildcard (all items) | `containers[*].commodities` |
|
|
153
|
+
| `list[**]` | Recursive flatten (all depths) | `containerCommodities[**]` |
|
|
154
|
+
| `list[-1]` | Depth filter (leaves only) | `tree[**][-1]` |
|
|
155
|
+
| `list[condition]` | Filter by condition | `items[status=Active]` |
|
|
156
|
+
| `dict['key']` | Dictionary key access | `customValues['myField']` |
|
|
157
|
+
| `list[*].{f1 f2}` | Field selector (projection) | `items[*].{name description}` |
|
|
158
|
+
| `list[*].{alias:source}` | Field selector with alias | `items[*].{id:commodityId}` |
|
|
159
|
+
| `list[*].{alias:_.parent}` | Field selector referencing parent | `items[*].{parentId:_.orderId}` |
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Flow Workflow YAML Reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
- Flow top-level structure (workflowType, entity, states, transitions, aggregations)
|
|
5
|
+
- Flow entity section (entity name, type, includes, query)
|
|
6
|
+
- Flow states section (initial, final, parent hierarchy, onEnter/onExit steps)
|
|
7
|
+
- Flow transitions section (manual, auto, event triggers; from/to states; conditions)
|
|
8
|
+
- Flow aggregations section (reusable collection expressions: all, any, sum, count)
|
|
9
|
+
|
|
3
10
|
Flow workflows are declarative state machines for entity lifecycle management. Use `workflowType: Flow` in the workflow section.
|
|
4
11
|
|
|
5
12
|
## Top-Level Structure
|
|
@@ -86,7 +93,7 @@ states:
|
|
|
86
93
|
|
|
87
94
|
### State Rules
|
|
88
95
|
- **name**: Required, must be unique across all states
|
|
89
|
-
- **isInitial**: At most one state can be initial
|
|
96
|
+
- **isInitial**: At most one state can be initial. When an entity has null status, the engine resolves it to the initial state automatically.
|
|
90
97
|
- **isFinal**: Final states cannot be transition sources
|
|
91
98
|
- **parent**: References another state; parent cannot be initial or final; children inherit parent transitions
|
|
92
99
|
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Other Tasks Reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
- User & Auth tasks (User CRUD, verification codes, OAuth2 authentication)
|
|
5
|
+
- Caching tasks (SetCache and GetCache for in-memory key-value storage)
|
|
6
|
+
- EDI & Structured File Parsing tasks (EDI/Parse for X12/EDIFACT, StructuredFile/Parse)
|
|
7
|
+
- Flow/Transition task (trigger state machine transitions programmatically)
|
|
8
|
+
- Note tasks (Create, Update, Delete, NoteThread/Rename, bulk Import/Export)
|
|
9
|
+
- AppModule tasks (Create, Update, Delete app modules)
|
|
10
|
+
- ActionEvent/Create task (trigger UI notifications or webhooks)
|
|
11
|
+
|
|
3
12
|
## User & Auth
|
|
4
13
|
|
|
5
14
|
| Task | Description |
|
package/README.md
CHANGED
|
@@ -29,19 +29,19 @@ npm install @cxtms/cx-schema
|
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
# Initialize a new project
|
|
32
|
-
npx
|
|
32
|
+
npx cxtms init
|
|
33
33
|
|
|
34
34
|
# Create a new module
|
|
35
|
-
npx
|
|
35
|
+
npx cxtms create module orders
|
|
36
36
|
|
|
37
37
|
# Create a new workflow
|
|
38
|
-
npx
|
|
38
|
+
npx cxtms create workflow invoice-processor
|
|
39
39
|
|
|
40
40
|
# Validate files
|
|
41
|
-
npx
|
|
41
|
+
npx cxtms modules/*.yaml workflows/*.yaml
|
|
42
42
|
|
|
43
43
|
# Generate validation report
|
|
44
|
-
npx
|
|
44
|
+
npx cxtms report modules/*.yaml --report report.html
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
## CLI Commands
|
|
@@ -51,14 +51,14 @@ npx cx-cli report modules/*.yaml --report report.html
|
|
|
51
51
|
Validate YAML file(s) against JSON Schema definitions.
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
cxtms [files...]
|
|
55
|
+
cxtms validate [files...]
|
|
56
56
|
|
|
57
57
|
# Examples
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
cxtms modules/orders-module.yaml
|
|
59
|
+
cxtms modules/*.yaml workflows/*.yaml
|
|
60
|
+
cxtms --verbose modules/orders-module.yaml
|
|
61
|
+
cxtms --format json modules/orders-module.yaml
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### init
|
|
@@ -66,7 +66,7 @@ cx-cli --format json modules/orders-module.yaml
|
|
|
66
66
|
Initialize a new CX project with configuration files.
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
|
|
69
|
+
cxtms init
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Creates:
|
|
@@ -81,11 +81,11 @@ Creates:
|
|
|
81
81
|
Create a new module or workflow from template.
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
|
|
84
|
+
cxtms create <type> <name>
|
|
85
85
|
|
|
86
86
|
# Examples
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
cxtms create module orders
|
|
88
|
+
cxtms create workflow invoice-generator
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
Generated files include:
|
|
@@ -98,12 +98,12 @@ Generated files include:
|
|
|
98
98
|
Generate validation report for multiple files.
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
|
-
|
|
101
|
+
cxtms report [files...] --report <output-file>
|
|
102
102
|
|
|
103
103
|
# Examples
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
cxtms report modules/*.yaml --report report.html
|
|
105
|
+
cxtms report workflows/*.yaml --report report.md
|
|
106
|
+
cxtms report modules/*.yaml workflows/*.yaml --report results.json
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Report formats (auto-detected from extension):
|
|
@@ -116,13 +116,13 @@ Report formats (auto-detected from extension):
|
|
|
116
116
|
Display the JSON Schema definition for a component or task.
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
|
|
119
|
+
cxtms schema <name>
|
|
120
120
|
|
|
121
121
|
# Examples
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
cxtms schema form
|
|
123
|
+
cxtms schema dataGrid
|
|
124
|
+
cxtms schema workflow
|
|
125
|
+
cxtms schema foreach
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
### example
|
|
@@ -130,11 +130,11 @@ cx-cli schema foreach
|
|
|
130
130
|
Show example YAML for a component or task.
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
|
-
|
|
133
|
+
cxtms example <name>
|
|
134
134
|
|
|
135
135
|
# Examples
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
cxtms example form
|
|
137
|
+
cxtms example workflow
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
### list
|
|
@@ -142,9 +142,9 @@ cx-cli example workflow
|
|
|
142
142
|
List all available schemas for validation.
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
cxtms list
|
|
146
|
+
cxtms list --type module
|
|
147
|
+
cxtms list --type workflow
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
## CLI Options
|
|
@@ -298,11 +298,11 @@ Generated workflows include:
|
|
|
298
298
|
```yaml
|
|
299
299
|
- name: Validate YAML files
|
|
300
300
|
run: |
|
|
301
|
-
npx
|
|
301
|
+
npx cxtms --format compact modules/*.yaml workflows/*.yaml
|
|
302
302
|
|
|
303
303
|
- name: Generate validation report
|
|
304
304
|
run: |
|
|
305
|
-
npx
|
|
305
|
+
npx cxtms report modules/*.yaml workflows/*.yaml --report validation-report.html
|
|
306
306
|
|
|
307
307
|
- name: Upload report
|
|
308
308
|
uses: actions/upload-artifact@v3
|
|
@@ -316,7 +316,7 @@ Generated workflows include:
|
|
|
316
316
|
```yaml
|
|
317
317
|
validate:
|
|
318
318
|
script:
|
|
319
|
-
- npx
|
|
319
|
+
- npx cxtms --format json modules/*.yaml > validation-results.json
|
|
320
320
|
artifacts:
|
|
321
321
|
paths:
|
|
322
322
|
- validation-results.json
|
|
@@ -331,7 +331,7 @@ validate:
|
|
|
331
331
|
staged_files=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(yaml|yml)$')
|
|
332
332
|
|
|
333
333
|
if [ -n "$staged_files" ]; then
|
|
334
|
-
npx
|
|
334
|
+
npx cxtms --format compact $staged_files
|
|
335
335
|
if [ $? -ne 0 ]; then
|
|
336
336
|
echo "Validation failed. Please fix errors before committing."
|
|
337
337
|
exit 1
|