@cxtms/cx-schema 1.5.3 → 1.5.4

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.
@@ -152,9 +152,28 @@ All entity tasks follow the `Namespace/Operation@Version` pattern. Outputs are s
152
152
  | `OrderCharge/Create` | Create order charge |
153
153
  | `OrderDocument/Create` | Create order document |
154
154
  | `OrderDocument/Send` | Send order document |
155
- | `OrderTrackingEvent/Create` | Create tracking event |
155
+ | `OrderTrackingEvent/Create` | Create a single tracking event on an order |
156
156
  | `OrderEntity/ChangeCustomValue` | Change custom field value |
157
157
 
158
+ ```yaml
159
+ # Create a single tracking event
160
+ - task: "OrderTrackingEvent/Create@1"
161
+ name: AddPickupEvent
162
+ inputs:
163
+ orderId: "{{ inputs.orderId }}"
164
+ organizationId: "{{ inputs.organizationId }}"
165
+ eventDefinitionName: "Picked Up"
166
+ eventDate: "{{ utcNow() }}"
167
+ description: "Package picked up from shipper"
168
+ location: "{{ order.shipFromAddress?.city }}"
169
+ includeInTracking: true
170
+ sendEmail: false
171
+ skipIfExists: true
172
+ customValues?:
173
+ carrierId: "{{ carrier.contactId }}"
174
+ carrierEventCode: "PU"
175
+ ```
176
+
158
177
  ## Inventory
159
178
 
160
179
  | Task | Description |
@@ -171,7 +190,34 @@ All entity tasks follow the `Namespace/Operation@Version` pattern. Outputs are s
171
190
  | `Country/Create`, `Country/Update`, `Country/Delete` | Country CRUD |
172
191
  | `Cities/Import` | Import cities |
173
192
  | `Rate/Update` | Update rate |
174
- | `TrackingEvent/Import` | Import tracking events |
193
+ | `TrackingEvent/Import` | Batch import tracking events into an order |
194
+
195
+ ```yaml
196
+ # Batch import tracking events
197
+ - task: "TrackingEvent/Import@1"
198
+ name: ImportEvents
199
+ inputs:
200
+ orderId: "{{ order.orderId }}"
201
+ events: "{{ trackingEvents }}"
202
+ matchByFields:
203
+ - "eventDate"
204
+ - "customValues.eventType"
205
+ - "customValues.locationId"
206
+ skipIfExists: true
207
+ createEventDefinitions: true
208
+ matchByEventDefinition:
209
+ - "customValues.carrierId"
210
+ - "customValues.carrierEventCode"
211
+ eventDefinitionDefaults:
212
+ includeInTracking: true
213
+ outputs:
214
+ - name: result
215
+ mapping: "result?"
216
+ ```
217
+
218
+ Each event in the `events` array: `eventDefinitionName` (required), `eventDate`, `description`, `location`, `includeInTracking`, `sendEmail`, `isInactive`, `customValues` (object).
219
+
220
+ Output `result`: `{ added, updated, skipped, failed, total, errors[] }`.
175
221
 
176
222
  ## Note
177
223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cxtms/cx-schema",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Schema validation package for CargoXplorer YAML modules",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -97,6 +97,9 @@
97
97
  {
98
98
  "$ref": "number.json"
99
99
  },
100
+ {
101
+ "$ref": "order-tracking-event.json"
102
+ },
100
103
  {
101
104
  "$ref": "order.json"
102
105
  },
@@ -115,6 +118,9 @@
115
118
  {
116
119
  "$ref": "template.json"
117
120
  },
121
+ {
122
+ "$ref": "tracking-event.json"
123
+ },
118
124
  {
119
125
  "$ref": "user.json"
120
126
  },
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "OrderTrackingEvent Tasks",
4
+ "description": "Create a single tracking event on an order",
5
+ "type": "object",
6
+ "properties": {
7
+ "task": {
8
+ "type": "string",
9
+ "enum": [
10
+ "OrderTrackingEvent/Create@1"
11
+ ],
12
+ "description": "Task type identifier"
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "description": "Step name identifier"
17
+ },
18
+ "description": {
19
+ "type": "string",
20
+ "description": "Step description"
21
+ },
22
+ "conditions": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "object",
26
+ "properties": {
27
+ "expression": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "required": ["expression"]
32
+ }
33
+ },
34
+ "continueOnError": {
35
+ "type": "boolean"
36
+ },
37
+ "inputs": {
38
+ "type": "object",
39
+ "description": "OrderTrackingEvent/Create inputs",
40
+ "properties": {
41
+ "orderId": {
42
+ "type": "string",
43
+ "description": "Target order ID (required)"
44
+ },
45
+ "organizationId": {
46
+ "type": "string",
47
+ "description": "Organization ID (required)"
48
+ },
49
+ "eventDefinitionName": {
50
+ "type": "string",
51
+ "description": "Name of the event definition to look up or create (required)"
52
+ },
53
+ "eventDate": {
54
+ "type": "string",
55
+ "description": "Event date (converted to UTC)"
56
+ },
57
+ "description": {
58
+ "type": "string",
59
+ "description": "Event description (overrides EventDefinition default)"
60
+ },
61
+ "location": {
62
+ "type": "string",
63
+ "description": "Event location (overrides EventDefinition default)"
64
+ },
65
+ "includeInTracking": {
66
+ "type": ["boolean", "string"],
67
+ "description": "Include in tracking display (overrides EventDefinition default)"
68
+ },
69
+ "sendEmail": {
70
+ "type": ["boolean", "string"],
71
+ "description": "Send email notification (overrides EventDefinition default)"
72
+ },
73
+ "skipIfExists": {
74
+ "type": ["boolean", "string"],
75
+ "description": "Skip if same EventDefinitionId already on order"
76
+ },
77
+ "eventDefinitionValues?": {
78
+ "type": "object",
79
+ "description": "Values for creating a new EventDefinition if not found by name",
80
+ "additionalProperties": true
81
+ },
82
+ "customValues?": {
83
+ "type": "object",
84
+ "description": "Free-form custom values stored on the tracking event",
85
+ "additionalProperties": true
86
+ }
87
+ },
88
+ "additionalProperties": true
89
+ },
90
+ "outputs": {
91
+ "type": "array",
92
+ "description": "No outputs (returns null)",
93
+ "items": {
94
+ "type": "object",
95
+ "properties": {
96
+ "name": {
97
+ "type": "string"
98
+ },
99
+ "mapping": {
100
+ "type": "string"
101
+ }
102
+ },
103
+ "required": ["name", "mapping"]
104
+ }
105
+ }
106
+ },
107
+ "required": ["task"],
108
+ "additionalProperties": true
109
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "TrackingEvent Tasks",
4
+ "description": "Tracking event import operations",
5
+ "type": "object",
6
+ "properties": {
7
+ "task": {
8
+ "type": "string",
9
+ "enum": [
10
+ "TrackingEvent/Import@1"
11
+ ],
12
+ "description": "Task type identifier"
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "description": "Step name identifier"
17
+ },
18
+ "description": {
19
+ "type": "string",
20
+ "description": "Step description"
21
+ },
22
+ "conditions": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "object",
26
+ "properties": {
27
+ "expression": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "required": ["expression"]
32
+ }
33
+ },
34
+ "continueOnError": {
35
+ "type": "boolean"
36
+ },
37
+ "inputs": {
38
+ "type": "object",
39
+ "description": "TrackingEvent/Import inputs",
40
+ "properties": {
41
+ "orderId": {
42
+ "type": "string",
43
+ "description": "Target order ID (required)"
44
+ },
45
+ "events": {
46
+ "type": ["array", "string"],
47
+ "description": "Array of tracking event objects to import. Each event: eventDefinitionName, eventDate, description, location, includeInTracking, sendEmail, isInactive, customValues",
48
+ "items": {
49
+ "type": "object",
50
+ "properties": {
51
+ "eventDefinitionName": {
52
+ "type": "string",
53
+ "description": "Name of the event definition to match or create"
54
+ },
55
+ "eventDate": {
56
+ "type": "string",
57
+ "description": "Event date (converted to UTC)"
58
+ },
59
+ "description": {
60
+ "type": "string",
61
+ "description": "Event description (overrides EventDefinition default)"
62
+ },
63
+ "location": {
64
+ "type": "string",
65
+ "description": "Event location (overrides EventDefinition default)"
66
+ },
67
+ "includeInTracking": {
68
+ "type": ["boolean", "string"],
69
+ "description": "Include in tracking display"
70
+ },
71
+ "sendEmail": {
72
+ "type": ["boolean", "string"],
73
+ "description": "Send email notification"
74
+ },
75
+ "isInactive": {
76
+ "type": ["boolean", "string"],
77
+ "description": "Mark event as inactive"
78
+ },
79
+ "customValues": {
80
+ "type": "object",
81
+ "description": "Free-form custom values (carrierId, carrierEventCode, etc.)",
82
+ "additionalProperties": true
83
+ }
84
+ },
85
+ "additionalProperties": true
86
+ }
87
+ },
88
+ "matchByFields": {
89
+ "type": "array",
90
+ "description": "Fields used to detect duplicate events. Supports dot notation for customValues (e.g., customValues.eventType). Default: [eventDefinitionName, eventDate]",
91
+ "items": {
92
+ "type": "string"
93
+ }
94
+ },
95
+ "skipIfExists": {
96
+ "type": ["boolean", "string"],
97
+ "description": "Skip event if duplicate found via matchByFields. Default: true"
98
+ },
99
+ "createEventDefinitions": {
100
+ "type": ["boolean", "string"],
101
+ "description": "Auto-create EventDefinition if name not found. Default: true"
102
+ },
103
+ "eventDefinitionDefaults": {
104
+ "type": "object",
105
+ "description": "Default values when creating new EventDefinitions (includeInTracking, sendEmail, eventName, etc.)",
106
+ "additionalProperties": true
107
+ },
108
+ "matchByEventDefinition": {
109
+ "type": "array",
110
+ "description": "Match EventDefinition by customValues fields instead of name (e.g., [customValues.carrierId, customValues.carrierEventCode])",
111
+ "items": {
112
+ "type": "string"
113
+ }
114
+ }
115
+ },
116
+ "additionalProperties": true
117
+ },
118
+ "outputs": {
119
+ "type": "array",
120
+ "description": "Output mapping. Result contains: added, updated, skipped, failed, total, errors",
121
+ "items": {
122
+ "type": "object",
123
+ "properties": {
124
+ "name": {
125
+ "type": "string"
126
+ },
127
+ "mapping": {
128
+ "type": "string"
129
+ }
130
+ },
131
+ "required": ["name", "mapping"]
132
+ }
133
+ }
134
+ },
135
+ "required": ["task"],
136
+ "additionalProperties": true
137
+ }