@cxtms/cx-schema 1.1.1 → 1.3.0
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-entity-commodity.md +22 -0
- package/.claude/skills/cx-workflow/SKILL.md +2 -2
- package/.claude/skills/cx-workflow/ref-entity.md +30 -1
- package/.claude/skills/cx-workflow/ref-expressions.md +3 -0
- package/.claude/skills/cx-workflow/ref-utilities.md +21 -0
- package/dist/cli.js +399 -88
- package/dist/cli.js.map +1 -1
- package/dist/extractUtils.d.ts +11 -0
- package/dist/extractUtils.d.ts.map +1 -0
- package/dist/extractUtils.js +19 -0
- package/dist/extractUtils.js.map +1 -0
- package/dist/validator.js +2 -2
- package/dist/validator.js.map +1 -1
- package/dist/workflowValidator.js +2 -2
- package/dist/workflowValidator.js.map +1 -1
- package/package.json +5 -5
- package/schemas/workflows/tasks/action-event.json +65 -0
- package/schemas/workflows/tasks/all.json +126 -26
- package/schemas/workflows/tasks/appmodule.json +56 -0
- package/schemas/workflows/tasks/attachment.json +4 -1
- package/schemas/workflows/tasks/authentication.json +72 -0
- package/schemas/workflows/tasks/caching.json +68 -0
- package/schemas/workflows/tasks/charge.json +3 -1
- package/schemas/workflows/tasks/commodity.json +3 -0
- package/schemas/workflows/tasks/contact-address.json +72 -0
- package/schemas/workflows/tasks/contact-payment-method.json +72 -0
- package/schemas/workflows/tasks/edi.json +65 -0
- package/schemas/workflows/tasks/filetransfer.json +102 -0
- package/schemas/workflows/tasks/flow-transition.json +68 -0
- package/schemas/workflows/tasks/httpRequest.json +23 -0
- package/schemas/workflows/tasks/import.json +64 -0
- package/schemas/workflows/tasks/inventory.json +67 -0
- package/schemas/workflows/tasks/movement.json +54 -0
- package/schemas/workflows/tasks/note.json +59 -0
- package/schemas/workflows/tasks/number.json +65 -0
- package/schemas/workflows/tasks/order.json +8 -1
- package/schemas/workflows/tasks/pdf-document.json +60 -0
- package/schemas/workflows/tasks/user.json +70 -0
- package/scripts/postinstall.js +3 -3
|
@@ -203,3 +203,25 @@ inputs:
|
|
|
203
203
|
- `OrderCommodity.customValues` — per-order-per-commodity fields
|
|
204
204
|
- `CommodityType.customValues` — type-level fields
|
|
205
205
|
- `CommodityTag.customValues` — tag-level fields
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## CommodityEvent (Bridge Entity)
|
|
210
|
+
|
|
211
|
+
Links tracking events to individual commodities for granular item-level tracking.
|
|
212
|
+
|
|
213
|
+
| Field | Type | Notes |
|
|
214
|
+
|-------|------|-------|
|
|
215
|
+
| `commodityEventId` | `int` | PK |
|
|
216
|
+
| `commodityId` | `int` | FK to Commodity |
|
|
217
|
+
| `trackingEventId` | `int` | FK to TrackingEvent |
|
|
218
|
+
|
|
219
|
+
**Navigation:** `commodity`, `trackingEvent` (with `eventDefinition`)
|
|
220
|
+
|
|
221
|
+
Used in Flow workflow aggregations:
|
|
222
|
+
```yaml
|
|
223
|
+
aggregations:
|
|
224
|
+
- name: "hasCommodityEvent"
|
|
225
|
+
parameter: "eventCode"
|
|
226
|
+
expression: "any([Commodity.CommodityEvents], [each.TrackingEvent.EventDefinition.EventCode] = [eventCode])"
|
|
227
|
+
```
|
|
@@ -9,9 +9,9 @@ You are a CargoXplorer workflow YAML builder. You generate schema-valid YAML for
|
|
|
9
9
|
**IMPORTANT — use `cx-cli` for all workflow operations:**
|
|
10
10
|
- **Scaffold**: `npx cx-cli create workflow <name> --template <template>` — generates a schema-valid YAML file. ALWAYS run this first, then read the generated file, then customize. Do NOT write YAML from scratch or copy templates manually.
|
|
11
11
|
- **Validate**: `npx cx-cli <file.yaml>` — run after every change
|
|
12
|
-
- **Schema lookup**: `npx cx-cli schema <task>` — e.g., `cx-cli schema graphql`, `cx-cli schema foreach`
|
|
12
|
+
- **Schema lookup**: `npx cx-cli schema <task>` — e.g., `cx-cli schema graphql`, `cx-cli schema foreach`, `cx-cli schema action-event`. Schema names use kebab-case file names. Case-insensitive: `ActionEvent` resolves to `action-event`.
|
|
13
13
|
- **Examples**: `npx cx-cli example <task>` — show example YAML for a task
|
|
14
|
-
- **List schemas**: `npx cx-cli list --type workflow`
|
|
14
|
+
- **List schemas**: `npx cx-cli list --type workflow` — shows all available task schemas in the Tasks section
|
|
15
15
|
- **Feature folder**: `npx cx-cli create workflow <name> --template <template> --feature <feature-name>`
|
|
16
16
|
|
|
17
17
|
## Generation Workflow
|
|
@@ -6,7 +6,19 @@ All entity tasks follow the `Namespace/Operation@Version` pattern. Outputs are s
|
|
|
6
6
|
|
|
7
7
|
| Task | Description |
|
|
8
8
|
|------|-------------|
|
|
9
|
-
| `Entity/Change` | Generic entity change
|
|
9
|
+
| `Entity/Change` | Generic entity change — modify custom values on the tracked entity. Designed for **Before** triggers where the entity hasn't been persisted yet. |
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
- task: "Entity/Change@1"
|
|
13
|
+
name: SetDefaults
|
|
14
|
+
inputs:
|
|
15
|
+
changes:
|
|
16
|
+
customValues:
|
|
17
|
+
region: "{{ parseAddress(Order.ShipToAddress).state }}"
|
|
18
|
+
lastModifiedBy: "{{ currentUser.name }}"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
> **Note**: Async "Before" triggers are forbidden. Before triggers must use `executionMode: Sync`.
|
|
10
22
|
|
|
11
23
|
## Order
|
|
12
24
|
|
|
@@ -160,3 +172,20 @@ All entity tasks follow the `Namespace/Operation@Version` pattern. Outputs are s
|
|
|
160
172
|
| `Cities/Import` | Import cities |
|
|
161
173
|
| `Rate/Update` | Update rate |
|
|
162
174
|
| `TrackingEvent/Import` | Import tracking events |
|
|
175
|
+
|
|
176
|
+
## Note
|
|
177
|
+
|
|
178
|
+
| Task | Description |
|
|
179
|
+
|------|-------------|
|
|
180
|
+
| `Note/Create` | Create note in a thread |
|
|
181
|
+
| `Note/Update` | Update note content |
|
|
182
|
+
| `Note/Delete` | Delete a note |
|
|
183
|
+
| `Note/Import` | Bulk import notes |
|
|
184
|
+
| `Note/Export` | Export notes for an entity |
|
|
185
|
+
| `Note/RenameThread` | Rename a note thread |
|
|
186
|
+
|
|
187
|
+
## Accounting Transaction (Additional)
|
|
188
|
+
|
|
189
|
+
| Task | Description |
|
|
190
|
+
|------|-------------|
|
|
191
|
+
| `AccountingTransaction/ApplyCredit` | Apply credit memo to invoices |
|
|
@@ -174,6 +174,7 @@ Functions use two iterator variable names:
|
|
|
174
174
|
| `join([items], [each.name], ',')` | Join collection with `[each.*]` accessor and separator (3-arg) |
|
|
175
175
|
| `join([items], ',')` | Join collection directly with separator (2-arg) |
|
|
176
176
|
| `split([str], ' ')` | Split string by first character of separator. Returns `List<string>` |
|
|
177
|
+
| `elementAt([items], 0)` | Get element at index (zero-based) from list |
|
|
177
178
|
|
|
178
179
|
### String Functions
|
|
179
180
|
|
|
@@ -183,6 +184,7 @@ Functions use two iterator variable names:
|
|
|
183
184
|
| `length([var])` | String length or collection count. `0` for null strings and non-collections |
|
|
184
185
|
| `lower([name])` / `upper([code])` | Case conversion. Handles string, JToken, any `.ToString()` |
|
|
185
186
|
| `left([code], 3)` / `right([code], 3)` | Left/right N characters. Returns full string if shorter than N |
|
|
187
|
+
| `substring([str], 0, 5)` | Extract substring starting at position for given length |
|
|
186
188
|
| `replace([str], 'old', 'new')` | String replacement. Returns null if any arg is null |
|
|
187
189
|
| `trim([value])` | Trim whitespace. Returns `""` for null |
|
|
188
190
|
| `format('{0}-{1}', [prefix], [id])` | String.Format style. Variadic args. Returns null if format is null |
|
|
@@ -196,6 +198,7 @@ Functions use two iterator variable names:
|
|
|
196
198
|
|
|
197
199
|
| Function | Description |
|
|
198
200
|
|----------|-------------|
|
|
201
|
+
| `parseDate([str])` | Parse date string to DateTime. Supports common formats (ISO, US, etc.) |
|
|
199
202
|
| `now()` | Current UTC `DateTime` |
|
|
200
203
|
| `now('yyyy-MM-dd', 'en-US')` | Formatted current time as string |
|
|
201
204
|
| `addDays([date], 30)` | Add days (decimal, can be negative). Accepts DateTime, DateTimeOffset, string |
|
|
@@ -91,6 +91,27 @@ Performs HTTP requests to external APIs.
|
|
|
91
91
|
|
|
92
92
|
Response available at `ActivityName?.CallApi?.result?`.
|
|
93
93
|
|
|
94
|
+
**Action events**: When an HTTP request operates on a specific entity (e.g., sending parcel info for an order), enable `actionEvents` in the inputs so the system can track and notify about the request. Include `eventDataExt` with the entity ID to link the event to the entity.
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
- task: "Utilities/HttpRequest@1"
|
|
98
|
+
name: CallCarrierApi
|
|
99
|
+
inputs:
|
|
100
|
+
actionEvents:
|
|
101
|
+
enabled: true
|
|
102
|
+
eventName: "carrier.sendParcelInfo"
|
|
103
|
+
eventDataExt:
|
|
104
|
+
orderId: "{{ inputs.orderId }}"
|
|
105
|
+
url: "{{ carrierConfig?.baseUrl? }}/api/shipments"
|
|
106
|
+
method: POST
|
|
107
|
+
contentType: "application/json"
|
|
108
|
+
body:
|
|
109
|
+
trackingNumber: "{{ Data?.GetOrder?.order?.trackingNumber? }}"
|
|
110
|
+
outputs:
|
|
111
|
+
- name: result
|
|
112
|
+
mapping: "response?.body?"
|
|
113
|
+
```
|
|
114
|
+
|
|
94
115
|
## Map@1
|
|
95
116
|
|
|
96
117
|
Extracts/reshapes data from variables into new variables.
|