@burdenoff/cli-sdk 2026.1107.2 → 2026.1107.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.
- package/dist/{chunk-YIY5IDXQ.js → chunk-AQ5I53SK.js} +7 -7
- package/dist/{chunk-O6UCQ5IT.js → chunk-AQE5ZDEN.js} +1 -1
- package/dist/core/index.cjs +7 -7
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +1 -1
- package/dist/modules/adaptercloud/index.cjs +3 -3
- package/dist/modules/adaptercloud/index.js +1 -1
- package/dist/modules/artistrybase/index.cjs +3 -3
- package/dist/modules/artistrybase/index.js +1 -1
- package/dist/modules/assethandler/index.js +1 -1
- package/dist/modules/atheletebridge/index.cjs +3 -3
- package/dist/modules/atheletebridge/index.js +1 -1
- package/dist/modules/auth/index.js +1 -1
- package/dist/modules/billing/index.js +1 -1
- package/dist/modules/brainyrich/index.cjs +2 -2
- package/dist/modules/brainyrich/index.js +1 -1
- package/dist/modules/buildmyiq/index.js +1 -1
- package/dist/modules/channels/index.js +1 -1
- package/dist/modules/collabkin/index.js +1 -1
- package/dist/modules/comradecircle/index.js +1 -1
- package/dist/modules/conversations/index.js +1 -1
- package/dist/modules/coolandlovely/index.js +1 -1
- package/dist/modules/cosmicintersection/index.cjs +1 -1
- package/dist/modules/cosmicintersection/index.js +1 -1
- package/dist/modules/crewfoundry/index.cjs +9 -9
- package/dist/modules/crewfoundry/index.js +1 -1
- package/dist/modules/devportal/index.js +1 -1
- package/dist/modules/ecoimpacthub/index.js +1 -1
- package/dist/modules/eventfullymanaged/index.cjs +8 -8
- package/dist/modules/eventfullymanaged/index.js +1 -1
- package/dist/modules/export/index.cjs +2 -2
- package/dist/modules/export/index.js +1 -1
- package/dist/modules/files/index.cjs +2 -2
- package/dist/modules/files/index.js +1 -1
- package/dist/modules/fluidgrids/index.js +1 -1
- package/dist/modules/ggnomad/index.js +1 -1
- package/dist/modules/govcitizenhub/index.js +1 -1
- package/dist/modules/groups/index.js +1 -1
- package/dist/modules/headshotmarketing/index.cjs +232 -144
- package/dist/modules/headshotmarketing/index.js +229 -141
- package/dist/modules/hookmovies/index.js +1 -1
- package/dist/modules/housingvista/index.js +1 -1
- package/dist/modules/integrations/index.cjs +3 -3
- package/dist/modules/integrations/index.js +1 -1
- package/dist/modules/intelwatchtower/index.cjs +3 -3
- package/dist/modules/intelwatchtower/index.js +1 -1
- package/dist/modules/kadaikodi/index.js +1 -1
- package/dist/modules/labsofscience/index.js +1 -1
- package/dist/modules/manufacturedops/index.cjs +2 -2
- package/dist/modules/manufacturedops/index.js +1 -1
- package/dist/modules/movethewheels/index.cjs +122 -66
- package/dist/modules/movethewheels/index.js +123 -67
- package/dist/modules/mybodyshield/index.js +1 -1
- package/dist/modules/notifications/index.js +1 -1
- package/dist/modules/organizations/index.cjs +3 -3
- package/dist/modules/organizations/index.js +1 -1
- package/dist/modules/planmagnet/index.cjs +17 -17
- package/dist/modules/planmagnet/index.js +1 -1
- package/dist/modules/products/index.js +1 -1
- package/dist/modules/proserviceworld/index.js +1 -1
- package/dist/modules/rbac/index.js +1 -1
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +4 -4
- package/dist/modules/scheduler/index.js +1 -1
- package/dist/modules/security/index.js +1 -1
- package/dist/modules/semanticfed/index.js +1 -1
- package/dist/modules/store/index.js +1 -1
- package/dist/modules/subscriberbot/index.js +1 -1
- package/dist/modules/support/index.js +1 -1
- package/dist/modules/tags/index.js +1 -1
- package/dist/modules/technospam/index.cjs +2 -2
- package/dist/modules/technospam/index.js +1 -1
- package/dist/modules/theculturepost/index.js +1 -1
- package/dist/modules/theglobalfuel/index.js +1 -1
- package/dist/modules/timecampus/index.js +1 -1
- package/dist/modules/tours/index.js +1 -1
- package/dist/modules/vibecontrols/index.js +1 -1
- package/dist/modules/workspaces/index.cjs +2 -2
- package/dist/modules/workspaces/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var m=class extends Error{exitCode;hint;constructor(r,t){super(r),this.name="CliUserError",this.exitCode=t?.exitCode??1,this.hint=t?.hint;}},E=class extends m{constructor(r,t){super(r,{exitCode:2,hint:t?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},w=class extends Error{cause;constructor(r,t){super(r),this.name="CliInternalError",this.cause=t;}};var D=null;function R(o){D=o;}function C(){if(!D)throw new w("vibecontrols module helpers used before setHelpersContext was called");return D}function St(){let o=C();if(!o.auth.isAuthenticated())throw new E("Authentication required.",{hint:`Run \`${o.productName} auth login\` to authenticate.`})}async function a(o,r){return St(),C().gql.workspace.request(o,r)}function c(o){let r=o instanceof Error?o.message:String(o);throw new m(r)}function s(o,r,t){C().output.formatAndOutput(o,r,t);}function p(o){C().output.printSuccess(o);}function f(o,r){return C().output.truncate(o,r)}var A=`
|
|
2
2
|
query MovethewheelsGetCustomer($id: ID!) {
|
|
3
3
|
customer(id: $id) {
|
|
4
4
|
id name email phone company type taxId businessLicense address rating
|
|
5
5
|
createdAt updatedAt createdBy updatedBy workspaceId
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,N=`
|
|
9
9
|
query MovethewheelsCustomers($filter: CustomerFilterInput, $pagination: PaginationInput) {
|
|
10
10
|
customers(filter: $filter, pagination: $pagination) {
|
|
11
11
|
id name email phone company type rating createdAt
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`,
|
|
14
|
+
`,x=`
|
|
15
15
|
mutation MovethewheelsCreateCustomer($input: CreateCustomerInput!) {
|
|
16
16
|
createCustomer(input: $input) {
|
|
17
17
|
id name email phone company type taxId businessLicense address rating createdAt
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
`,$=`
|
|
21
21
|
mutation MovethewheelsUpdateCustomer($id: ID!, $input: UpdateCustomerInput!) {
|
|
22
22
|
updateCustomer(id: $id, input: $input) {
|
|
23
23
|
id name email phone company type taxId businessLicense address rating updatedAt
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,L=`
|
|
27
27
|
mutation MovethewheelsDeleteCustomer($id: ID!) {
|
|
28
28
|
deleteCustomer(id: $id)
|
|
29
29
|
}
|
|
30
|
-
`,
|
|
30
|
+
`,_=`
|
|
31
31
|
query MovethewheelsGetDriver($id: ID!) {
|
|
32
32
|
driver(id: $id) {
|
|
33
33
|
id employeeId firstName lastName email phone status licenseNumber
|
|
@@ -35,63 +35,63 @@
|
|
|
35
35
|
currentLocation performanceMetrics createdAt updatedAt workspaceId
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
`,P=`
|
|
39
39
|
query MovethewheelsDrivers($filter: DriverFilterInput, $pagination: PaginationInput) {
|
|
40
40
|
drivers(filter: $filter, pagination: $pagination) {
|
|
41
41
|
id employeeId firstName lastName email phone status vehicleId rating createdAt
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
`,
|
|
44
|
+
`,U=`
|
|
45
45
|
mutation MovethewheelsCreateDriver($input: CreateDriverInput!) {
|
|
46
46
|
createDriver(input: $input) {
|
|
47
47
|
id employeeId firstName lastName email phone status licenseNumber
|
|
48
48
|
licenseClass vehicleId rating createdAt
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,V=`
|
|
52
52
|
mutation MovethewheelsUpdateDriver($id: ID!, $input: UpdateDriverInput!) {
|
|
53
53
|
updateDriver(id: $id, input: $input) {
|
|
54
54
|
id employeeId firstName lastName email phone status licenseNumber
|
|
55
55
|
licenseClass vehicleId rating updatedAt
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
`,
|
|
58
|
+
`,M=`
|
|
59
59
|
mutation MovethewheelsDeleteDriver($id: ID!) {
|
|
60
60
|
deleteDriver(id: $id)
|
|
61
61
|
}
|
|
62
|
-
`,
|
|
62
|
+
`,q=`
|
|
63
63
|
mutation MovethewheelsUpdateDriverStatus($id: ID!, $status: DriverStatus!) {
|
|
64
64
|
updateDriverStatus(id: $id, status: $status) {
|
|
65
65
|
id firstName lastName status updatedAt
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
`,
|
|
68
|
+
`,J=`
|
|
69
69
|
mutation MovethewheelsAssignDriverVehicle($id: ID!, $vehicleId: ID) {
|
|
70
70
|
assignDriverVehicle(id: $id, vehicleId: $vehicleId) {
|
|
71
71
|
id firstName lastName vehicleId status updatedAt
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
`,
|
|
74
|
+
`,F=`
|
|
75
75
|
query MovethewheelsGetVehicle($id: ID!) {
|
|
76
76
|
vehicle(id: $id) {
|
|
77
77
|
id vehicleNumber type status make model year licensePlate fuelLevel
|
|
78
78
|
mileage ownershipType capacity currentLocation createdAt updatedAt workspaceId
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
`,
|
|
81
|
+
`,j=`
|
|
82
82
|
query MovethewheelsVehicles($filter: VehicleFilterInput, $pagination: PaginationInput) {
|
|
83
83
|
vehicles(filter: $filter, pagination: $pagination) {
|
|
84
84
|
id vehicleNumber type status make model year licensePlate fuelLevel createdAt
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
`,
|
|
87
|
+
`,W=`
|
|
88
88
|
mutation MovethewheelsCreateVehicle($input: CreateVehicleInput!) {
|
|
89
89
|
createVehicle(input: $input) {
|
|
90
90
|
id vehicleNumber type status make model year licensePlate fuelLevel
|
|
91
91
|
mileage ownershipType createdAt
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
`,
|
|
94
|
+
`,G=`
|
|
95
95
|
mutation MovethewheelsUpdateVehicle($id: ID!, $input: UpdateVehicleInput!) {
|
|
96
96
|
updateVehicle(id: $id, input: $input) {
|
|
97
97
|
id vehicleNumber type status make model year licensePlate fuelLevel
|
|
@@ -102,19 +102,19 @@
|
|
|
102
102
|
mutation MovethewheelsDeleteVehicle($id: ID!) {
|
|
103
103
|
deleteVehicle(id: $id)
|
|
104
104
|
}
|
|
105
|
-
`,
|
|
105
|
+
`,z=`
|
|
106
106
|
mutation MovethewheelsUpdateVehicleStatus($id: ID!, $status: VehicleStatus!) {
|
|
107
107
|
updateVehicleStatus(id: $id, status: $status) {
|
|
108
108
|
id vehicleNumber status updatedAt
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
`,
|
|
111
|
+
`,Y=`
|
|
112
112
|
mutation MovethewheelsUpdateVehicleLocation($id: ID!, $location: JSON!) {
|
|
113
113
|
updateVehicleLocation(id: $id, location: $location) {
|
|
114
114
|
id vehicleNumber currentLocation updatedAt
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
`,
|
|
117
|
+
`,B=`
|
|
118
118
|
query MovethewheelsGetWarehouse($id: ID!) {
|
|
119
119
|
warehouse(id: $id) {
|
|
120
120
|
id code name type status address contactInfo operatingHours capabilities
|
|
@@ -122,48 +122,48 @@
|
|
|
122
122
|
locations { id locationCode locationType status zone aisle rack shelf bin capacity }
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
`,
|
|
125
|
+
`,K=`
|
|
126
126
|
query MovethewheelsWarehouses($filter: WarehouseFilterInput, $pagination: PaginationInput) {
|
|
127
127
|
warehouses(filter: $filter, pagination: $pagination) {
|
|
128
128
|
id code name type status totalCapacity usedCapacity createdAt
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
`,
|
|
131
|
+
`,Q=`
|
|
132
132
|
mutation MovethewheelsCreateWarehouse($input: CreateWarehouseInput!) {
|
|
133
133
|
createWarehouse(input: $input) {
|
|
134
134
|
id code name type status address totalCapacity usedCapacity createdAt
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
`,
|
|
137
|
+
`,Z=`
|
|
138
138
|
mutation MovethewheelsUpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {
|
|
139
139
|
updateWarehouse(id: $id, input: $input) {
|
|
140
140
|
id code name type status address totalCapacity usedCapacity updatedAt
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
`,
|
|
143
|
+
`,X=`
|
|
144
144
|
mutation MovethewheelsDeleteWarehouse($id: ID!) {
|
|
145
145
|
deleteWarehouse(id: $id)
|
|
146
146
|
}
|
|
147
|
-
`,
|
|
147
|
+
`,ee=`
|
|
148
148
|
mutation MovethewheelsCreateWarehouseLocation($input: CreateWarehouseLocationInput!) {
|
|
149
149
|
createWarehouseLocation(input: $input) {
|
|
150
150
|
id warehouseId locationCode locationType status zone aisle rack shelf bin capacity createdAt
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
`,
|
|
153
|
+
`,te=`
|
|
154
154
|
mutation MovethewheelsUpdateWarehouseLocation($id: ID!, $input: UpdateWarehouseLocationInput!) {
|
|
155
155
|
updateWarehouseLocation(id: $id, input: $input) {
|
|
156
156
|
id warehouseId locationCode locationType status zone aisle rack shelf bin capacity updatedAt
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
`,
|
|
159
|
+
`,ie=`
|
|
160
160
|
query MovethewheelsGetInventoryItem($id: ID!) {
|
|
161
161
|
inventoryItem(id: $id) {
|
|
162
162
|
id cargoItemId warehouseId locationId onHand available allocated damaged reorderPoint safetyStock
|
|
163
163
|
unitCost createdAt updatedAt workspaceId
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
`,
|
|
166
|
+
`,ne=`
|
|
167
167
|
query MovethewheelsInventoryItems(
|
|
168
168
|
$filter: InventoryFilterInput
|
|
169
169
|
$pagination: PaginationInput
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
id cargoItemId warehouseId onHand available allocated damaged reorderPoint unitCost createdAt
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
`,
|
|
175
|
+
`,re=`
|
|
176
176
|
query MovethewheelsInventoryTransactions(
|
|
177
177
|
$filter: InventoryFilterInput
|
|
178
178
|
$pagination: PaginationInput
|
|
@@ -182,44 +182,100 @@
|
|
|
182
182
|
createdAt
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
`,
|
|
185
|
+
`,oe=`
|
|
186
186
|
query MovethewheelsInventoryStats {
|
|
187
187
|
inventoryStats {
|
|
188
188
|
totalOnHand totalAvailable totalAllocated totalDamaged lowStockCount
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
`,
|
|
191
|
+
`,ae=`
|
|
192
192
|
mutation MovethewheelsCreateInventoryItem($input: CreateInventoryItemInput!) {
|
|
193
193
|
createInventoryItem(input: $input) {
|
|
194
194
|
id cargoItemId warehouseId locationId onHand available allocated damaged reorderPoint safetyStock
|
|
195
195
|
unitCost createdAt
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
`,
|
|
198
|
+
`,se=`
|
|
199
199
|
mutation MovethewheelsUpdateInventoryItem($id: ID!, $input: UpdateInventoryItemInput!) {
|
|
200
200
|
updateInventoryItem(id: $id, input: $input) {
|
|
201
201
|
id cargoItemId warehouseId locationId onHand available allocated damaged reorderPoint safetyStock
|
|
202
202
|
unitCost updatedAt
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
`,
|
|
205
|
+
`,ce=`
|
|
206
206
|
mutation MovethewheelsDeleteInventoryItem($id: ID!) {
|
|
207
207
|
deleteInventoryItem(id: $id)
|
|
208
208
|
}
|
|
209
|
-
`,
|
|
209
|
+
`,de=`
|
|
210
210
|
mutation MovethewheelsAdjustInventoryStock($input: AdjustInventoryStockInput!) {
|
|
211
211
|
adjustInventoryStock(input: $input) {
|
|
212
212
|
id cargoItemId warehouseId onHand available allocated damaged updatedAt
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
`,
|
|
215
|
+
`,ue=`
|
|
216
216
|
mutation MovethewheelsCreateInventoryTransaction($input: CreateInventoryTransactionInput!) {
|
|
217
217
|
createInventoryTransaction(input: $input) {
|
|
218
218
|
id transactionNumber type cargoItemId warehouseId quantity unitCost referenceType referenceId notes
|
|
219
219
|
createdAt
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
`,
|
|
222
|
+
`,b=`
|
|
223
|
+
id deliveryJobNumber status priority customerId driverId vehicleId routeId storeOrderId
|
|
224
|
+
scheduledDelivery trackingNumber createdAt
|
|
225
|
+
`,pe=`
|
|
226
|
+
query MovethewheelsGetDeliveryJob($id: ID!) {
|
|
227
|
+
deliveryJob(id: $id) {
|
|
228
|
+
${b}
|
|
229
|
+
cargoItems pickupAddress deliveryAddress pricing specialInstructions updatedAt workspaceId
|
|
230
|
+
customer { id name }
|
|
231
|
+
driver { id firstName lastName }
|
|
232
|
+
vehicle { id vehicleNumber }
|
|
233
|
+
shipment { id shipmentNumber status trackingNumber }
|
|
234
|
+
statusHistory { id previousStatus status notes location createdAt }
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
`,le=`
|
|
238
|
+
query MovethewheelsDeliveryJobs($filter: DeliveryJobFilterInput, $pagination: PaginationInput) {
|
|
239
|
+
deliveryJobs(filter: $filter, pagination: $pagination) { ${b} }
|
|
240
|
+
}
|
|
241
|
+
`,me=`
|
|
242
|
+
query MovethewheelsDeliveryJobsCount($filter: DeliveryJobFilterInput) {
|
|
243
|
+
deliveryJobsCount(filter: $filter)
|
|
244
|
+
}
|
|
245
|
+
`,fe=`
|
|
246
|
+
query MovethewheelsDeliveryJobStats {
|
|
247
|
+
deliveryJobStats {
|
|
248
|
+
total pending confirmed assigned pickedUp inTransit outForDelivery delivered failed
|
|
249
|
+
returned cancelled
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
`,ge=`
|
|
253
|
+
query MovethewheelsDeliveryJobTracking($deliveryJobId: ID!, $pagination: PaginationInput) {
|
|
254
|
+
deliveryJobTracking(deliveryJobId: $deliveryJobId, pagination: $pagination) {
|
|
255
|
+
id shipmentId eventType details location timestamp
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
`,ye=`
|
|
259
|
+
query MovethewheelsMyPendingEpodDeliveryJobs($pagination: PaginationInput) {
|
|
260
|
+
myPendingEpodDeliveryJobs(pagination: $pagination) { ${b} }
|
|
261
|
+
}
|
|
262
|
+
`,he=`
|
|
263
|
+
query MovethewheelsMyPendingEpodDeliveryJobsCount { myPendingEpodDeliveryJobsCount }
|
|
264
|
+
`,ve=`
|
|
265
|
+
mutation MovethewheelsCreateDeliveryJob($input: CreateDeliveryJobInput!) {
|
|
266
|
+
createDeliveryJob(input: $input) { ${b} }
|
|
267
|
+
}
|
|
268
|
+
`,Ie=`
|
|
269
|
+
mutation MovethewheelsUpdateDeliveryJob($id: ID!, $input: UpdateDeliveryJobInput!) {
|
|
270
|
+
updateDeliveryJob(id: $id, input: $input) { ${b} }
|
|
271
|
+
}
|
|
272
|
+
`,we=`
|
|
273
|
+
mutation MovethewheelsUpdateDeliveryJobStatus($id: ID!, $input: UpdateDeliveryJobStatusInput!) {
|
|
274
|
+
updateDeliveryJobStatus(id: $id, input: $input) { ${b} }
|
|
275
|
+
}
|
|
276
|
+
`,Ee=`
|
|
277
|
+
mutation MovethewheelsDeleteDeliveryJob($id: ID!) { deleteDeliveryJob(id: $id) }
|
|
278
|
+
`,be=`
|
|
223
279
|
query MovethewheelsGetShipment($id: ID!) {
|
|
224
280
|
shipment(id: $id) {
|
|
225
281
|
id shipmentNumber customerId carrierId deliveryJobId storeOrderId status trackingNumber origin destination
|
|
@@ -227,56 +283,56 @@
|
|
|
227
283
|
trackingEvents { id eventType details location timestamp }
|
|
228
284
|
}
|
|
229
285
|
}
|
|
230
|
-
`,
|
|
286
|
+
`,Ce=`
|
|
231
287
|
query MovethewheelsShipments($filter: ShipmentFilterInput, $pagination: PaginationInput) {
|
|
232
288
|
shipments(filter: $filter, pagination: $pagination) {
|
|
233
289
|
id shipmentNumber customerId carrierId deliveryJobId storeOrderId status trackingNumber
|
|
234
290
|
estimatedDelivery createdAt
|
|
235
291
|
}
|
|
236
292
|
}
|
|
237
|
-
`,
|
|
293
|
+
`,De=`
|
|
238
294
|
query MovethewheelsActiveDeliveries($pagination: PaginationInput) {
|
|
239
295
|
activeDeliveries(pagination: $pagination) {
|
|
240
296
|
id shipmentNumber deliveryJobId storeOrderId status trackingNumber estimatedDelivery createdAt
|
|
241
297
|
}
|
|
242
298
|
}
|
|
243
|
-
`,
|
|
299
|
+
`,Oe=`
|
|
244
300
|
query MovethewheelsShipmentTracking($shipmentId: ID!, $pagination: PaginationInput) {
|
|
245
301
|
shipmentTracking(shipmentId: $shipmentId, pagination: $pagination) {
|
|
246
302
|
id shipmentId eventType details location timestamp createdAt
|
|
247
303
|
}
|
|
248
304
|
}
|
|
249
|
-
`,
|
|
305
|
+
`,Te=`
|
|
250
306
|
query MovethewheelsTrackingAlerts($pagination: PaginationInput) {
|
|
251
307
|
trackingAlerts(pagination: $pagination) {
|
|
252
308
|
alertType message shipmentId shipmentNumber
|
|
253
309
|
}
|
|
254
310
|
}
|
|
255
|
-
`,
|
|
311
|
+
`,Se=`
|
|
256
312
|
mutation MovethewheelsCreateShipment($input: CreateShipmentInput!) {
|
|
257
313
|
createShipment(input: $input) {
|
|
258
314
|
id shipmentNumber customerId carrierId deliveryJobId storeOrderId status trackingNumber origin destination
|
|
259
315
|
estimatedDelivery createdAt
|
|
260
316
|
}
|
|
261
317
|
}
|
|
262
|
-
`,
|
|
318
|
+
`,ke=`
|
|
263
319
|
mutation MovethewheelsUpdateShipment($id: ID!, $input: UpdateShipmentInput!) {
|
|
264
320
|
updateShipment(id: $id, input: $input) {
|
|
265
321
|
id shipmentNumber customerId carrierId deliveryJobId storeOrderId status trackingNumber origin destination
|
|
266
322
|
estimatedDelivery actualDelivery updatedAt
|
|
267
323
|
}
|
|
268
324
|
}
|
|
269
|
-
`,
|
|
325
|
+
`,Re=`
|
|
270
326
|
mutation MovethewheelsDeleteShipment($id: ID!) {
|
|
271
327
|
deleteShipment(id: $id)
|
|
272
328
|
}
|
|
273
|
-
`,
|
|
329
|
+
`,Ae=`
|
|
274
330
|
mutation MovethewheelsAddTrackingEvent($input: AddTrackingEventInput!) {
|
|
275
331
|
addTrackingEvent(input: $input) {
|
|
276
332
|
id shipmentId eventType details location timestamp createdAt
|
|
277
333
|
}
|
|
278
334
|
}
|
|
279
|
-
`,
|
|
335
|
+
`,Ne=`
|
|
280
336
|
query MovethewheelsGetRoute($id: ID!) {
|
|
281
337
|
route(id: $id) {
|
|
282
338
|
id name status driverId vehicleId shipmentId waypoints
|
|
@@ -284,38 +340,38 @@
|
|
|
284
340
|
fuelCost createdAt updatedAt workspaceId
|
|
285
341
|
}
|
|
286
342
|
}
|
|
287
|
-
`,
|
|
343
|
+
`,xe=`
|
|
288
344
|
query MovethewheelsRoutes($filter: RouteFilterInput, $pagination: PaginationInput) {
|
|
289
345
|
routes(filter: $filter, pagination: $pagination) {
|
|
290
346
|
id name status driverId vehicleId shipmentId estimatedDistance
|
|
291
347
|
estimatedDuration fuelCost createdAt
|
|
292
348
|
}
|
|
293
349
|
}
|
|
294
|
-
|
|
350
|
+
`,$e=`
|
|
295
351
|
mutation MovethewheelsCreateRoute($input: CreateRouteInput!) {
|
|
296
352
|
createRoute(input: $input) {
|
|
297
353
|
id name status driverId vehicleId shipmentId waypoints
|
|
298
354
|
estimatedDistance estimatedDuration fuelCost createdAt
|
|
299
355
|
}
|
|
300
356
|
}
|
|
301
|
-
`,
|
|
357
|
+
`,Le=`
|
|
302
358
|
mutation MovethewheelsUpdateRoute($id: ID!, $input: UpdateRouteInput!) {
|
|
303
359
|
updateRoute(id: $id, input: $input) {
|
|
304
360
|
id name status driverId vehicleId shipmentId waypoints
|
|
305
361
|
estimatedDistance actualDistance estimatedDuration actualDuration fuelCost updatedAt
|
|
306
362
|
}
|
|
307
363
|
}
|
|
308
|
-
`,
|
|
364
|
+
`,_e=`
|
|
309
365
|
mutation MovethewheelsDeleteRoute($id: ID!) {
|
|
310
366
|
deleteRoute(id: $id)
|
|
311
367
|
}
|
|
312
|
-
`,
|
|
368
|
+
`,Pe=`
|
|
313
369
|
mutation MovethewheelsOptimizeRoute($id: ID!) {
|
|
314
370
|
optimizeRoute(id: $id) {
|
|
315
371
|
id name status estimatedDistance estimatedDuration fuelCost waypoints updatedAt
|
|
316
372
|
}
|
|
317
373
|
}
|
|
318
|
-
`,
|
|
374
|
+
`,Ue=`
|
|
319
375
|
query MovethewheelsGetServiceProvider($id: ID!) {
|
|
320
376
|
serviceProvider(id: $id) {
|
|
321
377
|
id name type description isActive isVerified rating contactInfo services
|
|
@@ -323,7 +379,7 @@
|
|
|
323
379
|
offerings { id name category price currency }
|
|
324
380
|
}
|
|
325
381
|
}
|
|
326
|
-
`,
|
|
382
|
+
`,Ve=`
|
|
327
383
|
query MovethewheelsServiceProviders(
|
|
328
384
|
$filter: MtwServiceProviderFilterInput
|
|
329
385
|
$pagination: PaginationInput
|
|
@@ -332,13 +388,13 @@
|
|
|
332
388
|
id name type description isActive isVerified rating createdAt
|
|
333
389
|
}
|
|
334
390
|
}
|
|
335
|
-
`,
|
|
391
|
+
`,Me=`
|
|
336
392
|
mutation MovethewheelsCreateServiceProvider($input: MtwCreateServiceProviderInput!) {
|
|
337
393
|
createServiceProvider(input: $input) {
|
|
338
394
|
id name type description isActive isVerified rating createdAt
|
|
339
395
|
}
|
|
340
396
|
}
|
|
341
|
-
`,
|
|
397
|
+
`,qe=`
|
|
342
398
|
mutation MovethewheelsUpdateServiceProvider(
|
|
343
399
|
$id: ID!
|
|
344
400
|
$input: MtwUpdateServiceProviderInput!
|
|
@@ -347,18 +403,18 @@
|
|
|
347
403
|
id name type description isActive isVerified rating updatedAt
|
|
348
404
|
}
|
|
349
405
|
}
|
|
350
|
-
`,
|
|
406
|
+
`,Je=`
|
|
351
407
|
mutation MovethewheelsDeleteServiceProvider($id: ID!) {
|
|
352
408
|
deleteServiceProvider(id: $id)
|
|
353
409
|
}
|
|
354
|
-
`,
|
|
410
|
+
`,Fe=`
|
|
355
411
|
query MovethewheelsGetServiceOffering($id: ID!) {
|
|
356
412
|
serviceOffering(id: $id) {
|
|
357
413
|
id providerId name description category price currency availability
|
|
358
414
|
createdAt updatedAt workspaceId
|
|
359
415
|
}
|
|
360
416
|
}
|
|
361
|
-
`,
|
|
417
|
+
`,je=`
|
|
362
418
|
query MovethewheelsServiceOfferings(
|
|
363
419
|
$filter: MtwServiceOfferingFilterInput
|
|
364
420
|
$pagination: PaginationInput
|
|
@@ -367,13 +423,13 @@
|
|
|
367
423
|
id providerId name category price currency createdAt
|
|
368
424
|
}
|
|
369
425
|
}
|
|
370
|
-
`,
|
|
426
|
+
`,We=`
|
|
371
427
|
mutation MovethewheelsCreateServiceOffering($input: MtwCreateServiceOfferingInput!) {
|
|
372
428
|
createServiceOffering(input: $input) {
|
|
373
429
|
id providerId name description category price currency availability createdAt
|
|
374
430
|
}
|
|
375
431
|
}
|
|
376
|
-
`,
|
|
432
|
+
`,Ge=`
|
|
377
433
|
mutation MovethewheelsUpdateServiceOffering(
|
|
378
434
|
$id: ID!
|
|
379
435
|
$input: MtwUpdateServiceOfferingInput!
|
|
@@ -382,25 +438,25 @@
|
|
|
382
438
|
id providerId name description category price currency availability updatedAt
|
|
383
439
|
}
|
|
384
440
|
}
|
|
385
|
-
`,
|
|
441
|
+
`,He=`
|
|
386
442
|
mutation MovethewheelsDeleteServiceOffering($id: ID!) {
|
|
387
443
|
deleteServiceOffering(id: $id)
|
|
388
444
|
}
|
|
389
|
-
|
|
445
|
+
`,ze=`
|
|
390
446
|
query MovethewheelsModuleSettings {
|
|
391
447
|
mtwModuleSettings {
|
|
392
448
|
workspaceId defaultCurrency defaultDeliveryWindowHours defaultOrderPriority
|
|
393
449
|
distanceUnit weightUnit timezone isCustomized updatedAt updatedBy
|
|
394
450
|
}
|
|
395
451
|
}
|
|
396
|
-
`,
|
|
452
|
+
`,Ye=`
|
|
397
453
|
mutation MovethewheelsUpdateModuleSettings($input: UpdateMtwModuleSettingsInput!) {
|
|
398
454
|
updateMtwModuleSettings(input: $input) {
|
|
399
455
|
workspaceId defaultCurrency defaultDeliveryWindowHours defaultOrderPriority
|
|
400
456
|
distanceUnit weightUnit timezone isCustomized updatedAt updatedBy
|
|
401
457
|
}
|
|
402
458
|
}
|
|
403
|
-
`,
|
|
459
|
+
`,Be=`
|
|
404
460
|
query MovethewheelsAnalytics {
|
|
405
461
|
analytics {
|
|
406
462
|
orderTrend { label value }
|
|
@@ -408,24 +464,24 @@
|
|
|
408
464
|
deliveryTrend { label value }
|
|
409
465
|
}
|
|
410
466
|
}
|
|
411
|
-
`,
|
|
467
|
+
`,Ke=`
|
|
412
468
|
query MovethewheelsDashboardMetrics {
|
|
413
469
|
dashboardMetrics {
|
|
414
470
|
activeDeliveries totalRevenue activeVehicles availableDrivers lowStockItems
|
|
415
471
|
}
|
|
416
472
|
}
|
|
417
|
-
`,
|
|
473
|
+
`,Qe=`
|
|
418
474
|
query MovethewheelsFinanceMetrics {
|
|
419
475
|
financeMetrics {
|
|
420
476
|
fuelCost openInvoices
|
|
421
477
|
revenue { totalRevenue deliveredRevenue averageOrderValue }
|
|
422
478
|
}
|
|
423
479
|
}
|
|
424
|
-
`,
|
|
480
|
+
`,Ze=`
|
|
425
481
|
query MovethewheelsFleetStats {
|
|
426
482
|
fleetStats {
|
|
427
483
|
totalVehicles activeVehicles inTransitVehicles maintenanceVehicles
|
|
428
484
|
totalDrivers availableDrivers onDeliveryDrivers
|
|
429
485
|
}
|
|
430
486
|
}
|
|
431
|
-
`;function f(c,r){try{return JSON.parse(r)}catch{throw new l(`--${c} must be valid JSON`)}}function d(c){let r=Number.parseInt(c,10);if(Number.isNaN(r))throw new l(`Expected an integer but got "${c}"`);return r}function m(c){let r=Number.parseFloat(c);if(Number.isNaN(r))throw new l(`Expected a number but got "${c}"`);return r}function y(c){let r={};return c.limit!==void 0&&(r.limit=c.limit),c.offset!==void 0&&(r.offset=c.offset),Object.keys(r).length?r:void 0}function Me(c){let r=c.command("customers").description("Movethewheels customers");r.command("list").description("List customers").option("--type <t>","Filter by customer type (b2c/b2b)").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.type&&(e.type=t.type),t.query&&(e.search=t.query);let n=await o(k,{filter:Object.keys(e).length?e:void 0,pagination:y(t)});s(t,n.customers,{headers:["ID","Name","Type","Email","Phone","Rating"],rows:n.customers.map(i=>[g(i.id,12),i.name,i.type,i.email??"-",i.phone??"-",i.rating!=null?String(i.rating):"-"])});}catch(e){a(e);}}),r.command("get").description("Get a customer by id").argument("<id>","Customer ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(S,{id:t});if(!n.customer)throw new l(`Customer ${t} not found`);s(e,n.customer);}catch(n){a(n);}}),r.command("create").description("Create a customer").requiredOption("--name <name>","Customer name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--company <company>","Company").option("--type <t>","Customer type","b2c").option("--tax-id <s>","Tax ID").option("--business-license <s>","Business license").option("--rating <n>","Rating",m).option("--address <json>","Address JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={name:t.name,type:t.type??"b2c"};t.email&&(e.email=t.email),t.phone&&(e.phone=t.phone),t.company&&(e.company=t.company),t.taxId&&(e.taxId=t.taxId),t.businessLicense&&(e.businessLicense=t.businessLicense),t.rating!==void 0&&(e.rating=t.rating),t.address&&(e.address=f("address",t.address));let n=await o(R,{input:e});p(`Customer created: ${n.createCustomer.name}`),s(t,n.createCustomer);}catch(e){a(e);}}),r.command("update").description("Update a customer").argument("<id>","Customer ID").option("--name <name>","Customer name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--company <company>","Company").option("--type <t>","Customer type").option("--tax-id <s>","Tax ID").option("--business-license <s>","Business license").option("--rating <n>","Rating",m).option("--address <json>","Address JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.name&&(n.name=e.name),e.email!==void 0&&(n.email=e.email),e.phone!==void 0&&(n.phone=e.phone),e.company!==void 0&&(n.company=e.company),e.type&&(n.type=e.type),e.taxId!==void 0&&(n.taxId=e.taxId),e.businessLicense!==void 0&&(n.businessLicense=e.businessLicense),e.rating!==void 0&&(n.rating=e.rating),e.address&&(n.address=f("address",e.address)),!Object.keys(n).length)throw new l("No updates specified");let i=await o(A,{id:t,input:n});p("Customer updated"),s(e,i.updateCustomer);}catch(n){a(n);}}),r.command("remove").description("Delete a customer").argument("<id>","Customer ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(x,{id:t});p(`Customer ${t} deleted`),s(e,{deleted:n.deleteCustomer});}catch(n){a(n);}});}function qe(c){let r=c.command("drivers").description("Movethewheels drivers");r.command("list").description("List drivers").option("--status <s>","Filter by driver status").option("--vehicle <id>","Filter by vehicle ID").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.status&&(e.status=t.status.toUpperCase()),t.vehicle&&(e.vehicleId=t.vehicle),t.query&&(e.search=t.query);let n=await o($,{filter:Object.keys(e).length?e:void 0,pagination:y(t)});s(t,n.drivers,{headers:["ID","Name","Employee","Status","Vehicle","Rating"],rows:n.drivers.map(i=>[g(i.id,12),`${i.firstName} ${i.lastName}`,i.employeeId,i.status,i.vehicleId?g(i.vehicleId,12):"-",i.rating!=null?String(i.rating):"-"])});}catch(e){a(e);}}),r.command("get").description("Get a driver by id").argument("<id>","Driver ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(N,{id:t});if(!n.driver)throw new l(`Driver ${t} not found`);s(e,n.driver);}catch(n){a(n);}}),r.command("create").description("Create a driver").requiredOption("--employee-id <s>","Employee ID").requiredOption("--first-name <s>","First name").requiredOption("--last-name <s>","Last name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--status <s>","Driver status","AVAILABLE").option("--license-number <s>","License number").option("--license-class <s>","License class").option("--license-expiry <s>","License expiry (ISO date)").option("--vehicle-id <id>","Vehicle ID").option("--user-id <id>","User ID").option("--rating <n>","Rating",m).option("--certifications <json>","Certifications JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={employeeId:t.employeeId,firstName:t.firstName,lastName:t.lastName,status:(t.status??"AVAILABLE").toUpperCase()};t.email&&(e.email=t.email),t.phone&&(e.phone=t.phone),t.licenseNumber&&(e.licenseNumber=t.licenseNumber),t.licenseClass&&(e.licenseClass=t.licenseClass),t.licenseExpiry&&(e.licenseExpiry=t.licenseExpiry),t.vehicleId&&(e.vehicleId=t.vehicleId),t.userId&&(e.userId=t.userId),t.rating!==void 0&&(e.rating=t.rating),t.certifications&&(e.certifications=f("certifications",t.certifications)),t.currentLocation&&(e.currentLocation=f("current-location",t.currentLocation));let n=await o(L,{input:e});p(`Driver created: ${n.createDriver.firstName} ${n.createDriver.lastName}`),s(t,n.createDriver);}catch(e){a(e);}}),r.command("update").description("Update a driver").argument("<id>","Driver ID").option("--first-name <s>","First name").option("--last-name <s>","Last name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--status <s>","Driver status").option("--license-number <s>","License number").option("--license-class <s>","License class").option("--license-expiry <s>","License expiry (ISO date)").option("--vehicle-id <id>","Vehicle ID").option("--rating <n>","Rating",m).option("--certifications <json>","Certifications JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.firstName&&(n.firstName=e.firstName),e.lastName&&(n.lastName=e.lastName),e.email!==void 0&&(n.email=e.email),e.phone!==void 0&&(n.phone=e.phone),e.status&&(n.status=e.status.toUpperCase()),e.licenseNumber!==void 0&&(n.licenseNumber=e.licenseNumber),e.licenseClass!==void 0&&(n.licenseClass=e.licenseClass),e.licenseExpiry&&(n.licenseExpiry=e.licenseExpiry),e.vehicleId!==void 0&&(n.vehicleId=e.vehicleId),e.rating!==void 0&&(n.rating=e.rating),e.certifications&&(n.certifications=f("certifications",e.certifications)),e.currentLocation&&(n.currentLocation=f("current-location",e.currentLocation)),!Object.keys(n).length)throw new l("No updates specified");let i=await o(P,{id:t,input:n});p("Driver updated"),s(e,i.updateDriver);}catch(n){a(n);}}),r.command("remove").description("Delete a driver").argument("<id>","Driver ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(_,{id:t});p(`Driver ${t} deleted`),s(e,{deleted:n.deleteDriver});}catch(n){a(n);}}),r.command("set-status").description("Update a driver status").argument("<id>","Driver ID").requiredOption("--status <s>","AVAILABLE|ON_DELIVERY|ON_BREAK|OFF_DUTY|INACTIVE").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(U,{id:t,status:e.status.toUpperCase()});p(`Driver status set to ${n.updateDriverStatus.status}`),s(e,n.updateDriverStatus);}catch(n){a(n);}}),r.command("assign-vehicle").description("Assign (or clear) a vehicle for a driver").argument("<id>","Driver ID").option("--vehicle <id>","Vehicle ID (omit to clear assignment)").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(V,{id:t,vehicleId:e.vehicle});p(e.vehicle?`Vehicle ${e.vehicle} assigned`:"Vehicle assignment cleared"),s(e,n.assignDriverVehicle);}catch(n){a(n);}});}function Fe(c){let r=c.command("vehicles").description("Movethewheels fleet vehicles");r.command("list").description("List vehicles").option("--type <t>","Filter by vehicle type").option("--status <s>","Filter by vehicle status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.type&&(e.type=t.type.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.query&&(e.search=t.query);let n=await o(q,{filter:Object.keys(e).length?e:void 0,pagination:y(t)});s(t,n.vehicles,{headers:["ID","Number","Type","Status","Make/Model","Plate"],rows:n.vehicles.map(i=>[g(i.id,12),i.vehicleNumber,i.type,i.status,`${i.make??"-"} ${i.model??""}`.trim(),i.licensePlate??"-"])});}catch(e){a(e);}}),r.command("get").description("Get a vehicle by id").argument("<id>","Vehicle ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(M,{id:t});if(!n.vehicle)throw new l(`Vehicle ${t} not found`);s(e,n.vehicle);}catch(n){a(n);}}),r.command("create").description("Create a vehicle").requiredOption("--number <s>","Vehicle number").requiredOption("--type <t>","Vehicle type (TRUCK|VAN|MOTORCYCLE|\u2026)").option("--status <s>","Vehicle status","ACTIVE").option("--make <s>","Make").option("--model <s>","Model").option("--year <n>","Year",d).option("--license-plate <s>","License plate").option("--fuel-level <n>","Fuel level",m).option("--mileage <n>","Mileage",m).option("--ownership-type <s>","Ownership type").option("--capacity <json>","Capacity JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={vehicleNumber:t.number,type:t.type.toUpperCase(),status:(t.status??"ACTIVE").toUpperCase()};t.make&&(e.make=t.make),t.model&&(e.model=t.model),t.year!==void 0&&(e.year=t.year),t.licensePlate&&(e.licensePlate=t.licensePlate),t.fuelLevel!==void 0&&(e.fuelLevel=t.fuelLevel),t.mileage!==void 0&&(e.mileage=t.mileage),t.ownershipType&&(e.ownershipType=t.ownershipType),t.capacity&&(e.capacity=f("capacity",t.capacity)),t.currentLocation&&(e.currentLocation=f("current-location",t.currentLocation));let n=await o(F,{input:e});p(`Vehicle created: ${n.createVehicle.vehicleNumber}`),s(t,n.createVehicle);}catch(e){a(e);}}),r.command("update").description("Update a vehicle").argument("<id>","Vehicle ID").option("--number <s>","Vehicle number").option("--type <t>","Vehicle type").option("--status <s>","Vehicle status").option("--make <s>","Make").option("--model <s>","Model").option("--year <n>","Year",d).option("--license-plate <s>","License plate").option("--fuel-level <n>","Fuel level",m).option("--mileage <n>","Mileage",m).option("--ownership-type <s>","Ownership type").option("--capacity <json>","Capacity JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.number&&(n.vehicleNumber=e.number),e.type&&(n.type=e.type.toUpperCase()),e.status&&(n.status=e.status.toUpperCase()),e.make!==void 0&&(n.make=e.make),e.model!==void 0&&(n.model=e.model),e.year!==void 0&&(n.year=e.year),e.licensePlate!==void 0&&(n.licensePlate=e.licensePlate),e.fuelLevel!==void 0&&(n.fuelLevel=e.fuelLevel),e.mileage!==void 0&&(n.mileage=e.mileage),e.ownershipType!==void 0&&(n.ownershipType=e.ownershipType),e.capacity&&(n.capacity=f("capacity",e.capacity)),e.currentLocation&&(n.currentLocation=f("current-location",e.currentLocation)),!Object.keys(n).length)throw new l("No updates specified");let i=await o(W,{id:t,input:n});p("Vehicle updated"),s(e,i.updateVehicle);}catch(n){a(n);}}),r.command("remove").description("Delete a vehicle").argument("<id>","Vehicle ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(H,{id:t});p(`Vehicle ${t} deleted`),s(e,{deleted:n.deleteVehicle});}catch(n){a(n);}}),r.command("set-status").description("Update a vehicle status").argument("<id>","Vehicle ID").requiredOption("--status <s>","ACTIVE|INACTIVE|IN_TRANSIT|MAINTENANCE|DECOMMISSIONED").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(j,{id:t,status:e.status.toUpperCase()});p(`Vehicle status set to ${n.updateVehicleStatus.status}`),s(e,n.updateVehicleStatus);}catch(n){a(n);}}),r.command("set-location").description("Update a vehicle current location").argument("<id>","Vehicle ID").requiredOption("--location <json>","Location JSON (latitude/longitude/\u2026)").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=f("location",e.location),i=await o(G,{id:t,location:n});p("Vehicle location updated"),s(e,i.updateVehicleLocation);}catch(n){a(n);}});}function We(c){let r=c.command("warehouses").description("Movethewheels warehouses & locations");r.command("list").description("List warehouses").option("--type <t>","Filter by warehouse type").option("--status <s>","Filter by status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.type&&(e.type=t.type.toUpperCase()),t.status&&(e.status=t.status),t.query&&(e.search=t.query);let n=await o(z,{filter:Object.keys(e).length?e:void 0,pagination:y(t)});s(t,n.warehouses,{headers:["ID","Code","Name","Type","Status","Capacity"],rows:n.warehouses.map(i=>[g(i.id,12),i.code,i.name,i.type,i.status,`${i.usedCapacity??0}/${i.totalCapacity??0}`])});}catch(e){a(e);}}),r.command("get").description("Get a warehouse by id (includes locations)").argument("<id>","Warehouse ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(J,{id:t});if(!n.warehouse)throw new l(`Warehouse ${t} not found`);s(e,n.warehouse);}catch(n){a(n);}}),r.command("create").description("Create a warehouse").requiredOption("--code <code>","Warehouse code").requiredOption("--name <name>","Warehouse name").requiredOption("--type <t>","Warehouse type (DISTRIBUTION|FULFILLMENT|\u2026)").requiredOption("--address <json>","Address JSON").option("--status <s>","Status","ACTIVE").option("--contact-info <json>","Contact info JSON").option("--operating-hours <json>","Operating hours JSON").option("--capabilities <json>","Capabilities JSON").option("--total-capacity <n>","Total capacity",m).option("--used-capacity <n>","Used capacity",m).option("-f, --format <format>","Output format").action(async t=>{try{let e={code:t.code,name:t.name,type:t.type.toUpperCase(),address:f("address",t.address),status:t.status??"ACTIVE"};t.contactInfo&&(e.contactInfo=f("contact-info",t.contactInfo)),t.operatingHours&&(e.operatingHours=f("operating-hours",t.operatingHours)),t.capabilities&&(e.capabilities=f("capabilities",t.capabilities)),t.totalCapacity!==void 0&&(e.totalCapacity=t.totalCapacity),t.usedCapacity!==void 0&&(e.usedCapacity=t.usedCapacity);let n=await o(B,{input:e});p(`Warehouse created: ${n.createWarehouse.name}`),s(t,n.createWarehouse);}catch(e){a(e);}}),r.command("update").description("Update a warehouse").argument("<id>","Warehouse ID").option("--code <code>","Warehouse code").option("--name <name>","Warehouse name").option("--type <t>","Warehouse type").option("--status <s>","Status").option("--address <json>","Address JSON").option("--contact-info <json>","Contact info JSON").option("--operating-hours <json>","Operating hours JSON").option("--capabilities <json>","Capabilities JSON").option("--total-capacity <n>","Total capacity",m).option("--used-capacity <n>","Used capacity",m).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.code&&(n.code=e.code),e.name&&(n.name=e.name),e.type&&(n.type=e.type.toUpperCase()),e.status&&(n.status=e.status),e.address&&(n.address=f("address",e.address)),e.contactInfo&&(n.contactInfo=f("contact-info",e.contactInfo)),e.operatingHours&&(n.operatingHours=f("operating-hours",e.operatingHours)),e.capabilities&&(n.capabilities=f("capabilities",e.capabilities)),e.totalCapacity!==void 0&&(n.totalCapacity=e.totalCapacity),e.usedCapacity!==void 0&&(n.usedCapacity=e.usedCapacity),!Object.keys(n).length)throw new l("No updates specified");let i=await o(Y,{id:t,input:n});p("Warehouse updated"),s(e,i.updateWarehouse);}catch(n){a(n);}}),r.command("remove").description("Delete a warehouse").argument("<id>","Warehouse ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(K,{id:t});p(`Warehouse ${t} deleted`),s(e,{deleted:n.deleteWarehouse});}catch(n){a(n);}}),r.command("create-location").description("Create a warehouse location").requiredOption("--warehouse <id>","Warehouse ID").requiredOption("--code <s>","Location code").option("--location-type <s>","Location type").option("--status <s>","Status","ACTIVE").option("--zone <s>","Zone").option("--aisle <s>","Aisle").option("--rack <s>","Rack").option("--shelf <s>","Shelf").option("--bin <s>","Bin").option("--capacity <n>","Capacity",m).option("-f, --format <format>","Output format").action(async t=>{try{let e={warehouseId:t.warehouse,locationCode:t.code,status:t.status??"ACTIVE"};t.locationType&&(e.locationType=t.locationType),t.zone&&(e.zone=t.zone),t.aisle&&(e.aisle=t.aisle),t.rack&&(e.rack=t.rack),t.shelf&&(e.shelf=t.shelf),t.bin&&(e.bin=t.bin),t.capacity!==void 0&&(e.capacity=t.capacity);let n=await o(Q,{input:e});p(`Location created: ${n.createWarehouseLocation.locationCode}`),s(t,n.createWarehouseLocation);}catch(e){a(e);}}),r.command("update-location").description("Update a warehouse location").argument("<id>","Location ID").option("--code <s>","Location code").option("--location-type <s>","Location type").option("--status <s>","Status").option("--zone <s>","Zone").option("--aisle <s>","Aisle").option("--rack <s>","Rack").option("--shelf <s>","Shelf").option("--bin <s>","Bin").option("--capacity <n>","Capacity",m).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.code&&(n.locationCode=e.code),e.locationType!==void 0&&(n.locationType=e.locationType),e.status&&(n.status=e.status),e.zone!==void 0&&(n.zone=e.zone),e.aisle!==void 0&&(n.aisle=e.aisle),e.rack!==void 0&&(n.rack=e.rack),e.shelf!==void 0&&(n.shelf=e.shelf),e.bin!==void 0&&(n.bin=e.bin),e.capacity!==void 0&&(n.capacity=e.capacity),!Object.keys(n).length)throw new l("No updates specified");let i=await o(Z,{id:t,input:n});p("Location updated"),s(e,i.updateWarehouseLocation);}catch(n){a(n);}});}function He(c){let r={};return c.cargoItem&&(r.cargoItemId=c.cargoItem),c.warehouse&&(r.warehouseId=c.warehouse),c.location&&(r.locationId=c.location),c.query&&(r.search=c.query),Object.keys(r).length?r:void 0}function je(c){let r=c.command("inventory").description("Movethewheels inventory");r.command("list").description("List inventory items").option("--cargo-item <id>","Filter by cargo item ID").option("--warehouse <id>","Filter by warehouse ID").option("--location <id>","Filter by location ID").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(ee,{filter:He(t),pagination:y(t)});s(t,e.inventoryItems,{headers:["ID","Cargo item","Warehouse","OnHand","Available","Allocated"],rows:e.inventoryItems.map(n=>[g(n.id,12),g(n.cargoItemId,12),g(n.warehouseId,12),String(n.onHand),String(n.available),String(n.allocated)])});}catch(e){a(e);}}),r.command("get").description("Get an inventory item by id").argument("<id>","Inventory item ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(X,{id:t});if(!n.inventoryItem)throw new l(`Inventory item ${t} not found`);s(e,n.inventoryItem);}catch(n){a(n);}}),r.command("stats").description("Inventory stats (on-hand, available, allocated, damaged, low-stock)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(ne);s(t,e.inventoryStats);}catch(e){a(e);}}),r.command("create").description("Create an inventory item").requiredOption("--cargo-item <id>","Cargo item ID").requiredOption("--warehouse <id>","Warehouse ID").option("--location <id>","Location ID").option("--on-hand <n>","On-hand quantity",d).option("--available <n>","Available quantity",d).option("--allocated <n>","Allocated quantity",d).option("--damaged <n>","Damaged quantity",d).option("--reorder-point <n>","Reorder point",d).option("--safety-stock <n>","Safety stock",d).option("--unit-cost <n>","Unit cost",m).option("-f, --format <format>","Output format").action(async t=>{try{let e={cargoItemId:t.cargoItem,warehouseId:t.warehouse};t.location&&(e.locationId=t.location),t.onHand!==void 0&&(e.onHand=t.onHand),t.available!==void 0&&(e.available=t.available),t.allocated!==void 0&&(e.allocated=t.allocated),t.damaged!==void 0&&(e.damaged=t.damaged),t.reorderPoint!==void 0&&(e.reorderPoint=t.reorderPoint),t.safetyStock!==void 0&&(e.safetyStock=t.safetyStock),t.unitCost!==void 0&&(e.unitCost=t.unitCost);let n=await o(ie,{input:e});p("Inventory item created"),s(t,n.createInventoryItem);}catch(e){a(e);}}),r.command("update").description("Update an inventory item").argument("<id>","Inventory item ID").option("--location <id>","Location ID").option("--on-hand <n>","On-hand quantity",d).option("--available <n>","Available quantity",d).option("--allocated <n>","Allocated quantity",d).option("--damaged <n>","Damaged quantity",d).option("--reorder-point <n>","Reorder point",d).option("--safety-stock <n>","Safety stock",d).option("--unit-cost <n>","Unit cost",m).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.location!==void 0&&(n.locationId=e.location),e.onHand!==void 0&&(n.onHand=e.onHand),e.available!==void 0&&(n.available=e.available),e.allocated!==void 0&&(n.allocated=e.allocated),e.damaged!==void 0&&(n.damaged=e.damaged),e.reorderPoint!==void 0&&(n.reorderPoint=e.reorderPoint),e.safetyStock!==void 0&&(n.safetyStock=e.safetyStock),e.unitCost!==void 0&&(n.unitCost=e.unitCost),!Object.keys(n).length)throw new l("No updates specified");let i=await o(re,{id:t,input:n});p("Inventory item updated"),s(e,i.updateInventoryItem);}catch(n){a(n);}}),r.command("remove").description("Delete an inventory item").argument("<id>","Inventory item ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(oe,{id:t});p(`Inventory item ${t} deleted`),s(e,{deleted:n.deleteInventoryItem});}catch(n){a(n);}}),r.command("adjust").description("Adjust inventory stock levels").argument("<id>","Inventory item ID").option("--on-hand <n>","On-hand quantity",d).option("--available <n>","Available quantity",d).option("--allocated <n>","Allocated quantity",d).option("--damaged <n>","Damaged quantity",d).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={id:t};if(e.onHand!==void 0&&(n.onHand=e.onHand),e.available!==void 0&&(n.available=e.available),e.allocated!==void 0&&(n.allocated=e.allocated),e.damaged!==void 0&&(n.damaged=e.damaged),Object.keys(n).length===1)throw new l("No stock adjustments specified");let i=await o(ae,{input:n});p("Inventory stock adjusted"),s(e,i.adjustInventoryStock);}catch(n){a(n);}}),r.command("transactions").description("List inventory transactions").option("--cargo-item <id>","Filter by cargo item ID").option("--warehouse <id>","Filter by warehouse ID").option("--location <id>","Filter by location ID").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(te,{filter:He(t),pagination:y(t)});s(t,e.inventoryTransactions,{headers:["ID","Number","Type","Cargo item","Warehouse","Qty"],rows:e.inventoryTransactions.map(n=>[g(n.id,12),n.transactionNumber,n.type,g(n.cargoItemId,12),g(n.warehouseId,12),String(n.quantity)])});}catch(e){a(e);}}),r.command("record-transaction").description("Record an inventory transaction").requiredOption("--number <s>","Transaction number").requiredOption("--type <t>","Transaction type (RECEIPT|ISSUE|TRANSFER|ADJUSTMENT|RETURN)").requiredOption("--cargo-item <id>","Cargo item ID").requiredOption("--warehouse <id>","Warehouse ID").requiredOption("--quantity <n>","Quantity",d).option("--inventory-item <id>","Inventory item ID").option("--unit-cost <n>","Unit cost",m).option("--reference-type <s>","Reference type").option("--reference-id <s>","Reference ID").option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async t=>{try{let e={transactionNumber:t.number,type:t.type.toUpperCase(),cargoItemId:t.cargoItem,warehouseId:t.warehouse,quantity:t.quantity};t.inventoryItem&&(e.inventoryItemId=t.inventoryItem),t.unitCost!==void 0&&(e.unitCost=t.unitCost),t.referenceType&&(e.referenceType=t.referenceType),t.referenceId&&(e.referenceId=t.referenceId),t.notes&&(e.notes=t.notes);let n=await o(se,{input:e});p(`Transaction recorded: ${n.createInventoryTransaction.transactionNumber}`),s(t,n.createInventoryTransaction);}catch(e){a(e);}});}function Ge(c){let r=c.command("shipments").description("Movethewheels shipments & tracking");r.command("list").description("List shipments").option("--delivery-job <id>","Filter by delivery job ID").option("--store-order <id>","Filter by store order ID").option("--customer <id>","Filter by customer ID").option("--carrier <id>","Filter by carrier ID").option("--status <s>","Filter by status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.deliveryJob&&(e.deliveryJobId=t.deliveryJob),t.storeOrder&&(e.storeOrderId=t.storeOrder),t.customer&&(e.customerId=t.customer),t.carrier&&(e.carrierId=t.carrier),t.status&&(e.status=t.status.toUpperCase()),t.query&&(e.search=t.query);let n=await o(de,{filter:Object.keys(e).length?e:void 0,pagination:y(t)});s(t,n.shipments,{headers:["ID","Shipment #","Delivery job","Store order","Status","Tracking"],rows:n.shipments.map(i=>[g(i.id,12),i.shipmentNumber,g(i.deliveryJobId??"-",12),g(i.storeOrderId??"-",12),i.status,i.trackingNumber??"-"])});}catch(e){a(e);}}),r.command("get").description("Get a shipment by id (includes tracking events)").argument("<id>","Shipment ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(ce,{id:t});if(!n.shipment)throw new l(`Shipment ${t} not found`);s(e,n.shipment);}catch(n){a(n);}}),r.command("active").description("List active deliveries (in-transit shipments)").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(ue,{pagination:y(t)});s(t,e.activeDeliveries,{headers:["ID","Shipment #","Delivery job","Store order","Status","Tracking"],rows:e.activeDeliveries.map(n=>[g(n.id,12),n.shipmentNumber,g(n.deliveryJobId??"-",12),g(n.storeOrderId??"-",12),n.status,n.trackingNumber??"-"])});}catch(e){a(e);}}),r.command("create").description("Create a shipment").requiredOption("--shipment-number <s>","Shipment number").option("--delivery-job <id>","Delivery job the shipment fulfils").option("--store-order <id>","Store order the shipment fulfils").requiredOption("--origin <json>","Origin JSON").requiredOption("--destination <json>","Destination JSON").option("--status <s>","Status","PLANNED").option("--customer <id>","Customer ID").option("--carrier <id>","Carrier ID").option("--tracking-number <s>","Tracking number").option("--cargo-details <json>","Cargo details JSON").option("--estimated-delivery <s>","Estimated delivery (ISO date)").option("--actual-delivery <s>","Actual delivery (ISO date)").option("-f, --format <format>","Output format").action(async t=>{try{let e={shipmentNumber:t.shipmentNumber,origin:f("origin",t.origin),destination:f("destination",t.destination),status:(t.status??"PLANNED").toUpperCase()};t.deliveryJob&&(e.deliveryJobId=t.deliveryJob),t.storeOrder&&(e.storeOrderId=t.storeOrder),t.customer&&(e.customerId=t.customer),t.carrier&&(e.carrierId=t.carrier),t.trackingNumber&&(e.trackingNumber=t.trackingNumber),t.cargoDetails&&(e.cargoDetails=f("cargo-details",t.cargoDetails)),t.estimatedDelivery&&(e.estimatedDelivery=t.estimatedDelivery),t.actualDelivery&&(e.actualDelivery=t.actualDelivery);let n=await o(me,{input:e});p(`Shipment created: ${n.createShipment.shipmentNumber}`),s(t,n.createShipment);}catch(e){a(e);}}),r.command("update").description("Update a shipment").argument("<id>","Shipment ID").option("--status <s>","Status").option("--customer <id>","Customer ID").option("--carrier <id>","Carrier ID").option("--tracking-number <s>","Tracking number").option("--origin <json>","Origin JSON").option("--destination <json>","Destination JSON").option("--cargo-details <json>","Cargo details JSON").option("--estimated-delivery <s>","Estimated delivery (ISO date)").option("--actual-delivery <s>","Actual delivery (ISO date)").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.status&&(n.status=e.status.toUpperCase()),e.customer!==void 0&&(n.customerId=e.customer),e.carrier!==void 0&&(n.carrierId=e.carrier),e.trackingNumber!==void 0&&(n.trackingNumber=e.trackingNumber),e.origin&&(n.origin=f("origin",e.origin)),e.destination&&(n.destination=f("destination",e.destination)),e.cargoDetails&&(n.cargoDetails=f("cargo-details",e.cargoDetails)),e.estimatedDelivery&&(n.estimatedDelivery=e.estimatedDelivery),e.actualDelivery&&(n.actualDelivery=e.actualDelivery),!Object.keys(n).length)throw new l("No updates specified");let i=await o(fe,{id:t,input:n});p("Shipment updated"),s(e,i.updateShipment);}catch(n){a(n);}}),r.command("remove").description("Delete a shipment").argument("<id>","Shipment ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(ge,{id:t});p(`Shipment ${t} deleted`),s(e,{deleted:n.deleteShipment});}catch(n){a(n);}}),r.command("add-event").description("Add a tracking event to a shipment").requiredOption("--shipment <id>","Shipment ID").requiredOption("--event-type <t>","CREATED|PICKED_UP|IN_TRANSIT|ARRIVED|DEPARTED|OUT_FOR_DELIVERY|DELIVERED|FAILED|RETURNED").option("--details <s>","Event details").option("--location <json>","Location JSON").option("--timestamp <s>","Timestamp (ISO date)").option("-f, --format <format>","Output format").action(async t=>{try{let e={shipmentId:t.shipment,eventType:t.eventType.toUpperCase()};t.details&&(e.details=t.details),t.location&&(e.location=f("location",t.location)),t.timestamp&&(e.timestamp=t.timestamp);let n=await o(he,{input:e});p(`Tracking event added: ${n.addTrackingEvent.eventType}`),s(t,n.addTrackingEvent);}catch(e){a(e);}}),r.command("tracking").description("List tracking events for a shipment").argument("<shipmentId>","Shipment ID").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(pe,{shipmentId:t,pagination:y(e)});s(e,n.shipmentTracking,{headers:["ID","Event","Details","Timestamp"],rows:n.shipmentTracking.map(i=>[g(i.id,12),i.eventType,g(i.details??"-",30),i.timestamp])});}catch(n){a(n);}}),r.command("alerts").description("List tracking alerts (delayed / at-risk shipments)").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(le,{pagination:y(t)});s(t,e.trackingAlerts,{headers:["Type","Shipment #","Message"],rows:e.trackingAlerts.map(n=>[n.alertType,n.shipmentNumber,g(n.message,40)])});}catch(e){a(e);}});}function Je(c){let r=c.command("routes").description("Movethewheels delivery routes");r.command("list").description("List routes").option("--driver <id>","Filter by driver ID").option("--vehicle <id>","Filter by vehicle ID").option("--shipment <id>","Filter by shipment ID").option("--status <s>","Filter by status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.driver&&(e.driverId=t.driver),t.vehicle&&(e.vehicleId=t.vehicle),t.shipment&&(e.shipmentId=t.shipment),t.status&&(e.status=t.status.toUpperCase()),t.query&&(e.search=t.query);let n=await o(ve,{filter:Object.keys(e).length?e:void 0,pagination:y(t)});s(t,n.routes,{headers:["ID","Name","Status","Driver","Vehicle","Distance"],rows:n.routes.map(i=>[g(i.id,12),i.name,i.status,i.driverId?g(i.driverId,12):"-",i.vehicleId?g(i.vehicleId,12):"-",i.estimatedDistance!=null?String(i.estimatedDistance):"-"])});}catch(e){a(e);}}),r.command("get").description("Get a route by id").argument("<id>","Route ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(ye,{id:t});if(!n.route)throw new l(`Route ${t} not found`);s(e,n.route);}catch(n){a(n);}}),r.command("create").description("Create a route").requiredOption("--name <name>","Route name").requiredOption("--waypoints <json>","Waypoints JSON").option("--status <s>","Status","PLANNED").option("--driver <id>","Driver ID").option("--vehicle <id>","Vehicle ID").option("--shipment <id>","Shipment ID").option("--estimated-distance <n>","Estimated distance",m).option("--estimated-duration <n>","Estimated duration",m).option("--actual-distance <n>","Actual distance",m).option("--actual-duration <n>","Actual duration",m).option("--fuel-cost <n>","Fuel cost",m).option("-f, --format <format>","Output format").action(async t=>{try{let e={name:t.name,waypoints:f("waypoints",t.waypoints),status:(t.status??"PLANNED").toUpperCase()};t.driver&&(e.driverId=t.driver),t.vehicle&&(e.vehicleId=t.vehicle),t.shipment&&(e.shipmentId=t.shipment),t.estimatedDistance!==void 0&&(e.estimatedDistance=t.estimatedDistance),t.estimatedDuration!==void 0&&(e.estimatedDuration=t.estimatedDuration),t.actualDistance!==void 0&&(e.actualDistance=t.actualDistance),t.actualDuration!==void 0&&(e.actualDuration=t.actualDuration),t.fuelCost!==void 0&&(e.fuelCost=t.fuelCost);let n=await o(Ie,{input:e});p(`Route created: ${n.createRoute.name}`),s(t,n.createRoute);}catch(e){a(e);}}),r.command("update").description("Update a route").argument("<id>","Route ID").option("--name <name>","Route name").option("--status <s>","Status").option("--driver <id>","Driver ID").option("--vehicle <id>","Vehicle ID").option("--shipment <id>","Shipment ID").option("--waypoints <json>","Waypoints JSON").option("--estimated-distance <n>","Estimated distance",m).option("--estimated-duration <n>","Estimated duration",m).option("--actual-distance <n>","Actual distance",m).option("--actual-duration <n>","Actual duration",m).option("--fuel-cost <n>","Fuel cost",m).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n={};if(e.name&&(n.name=e.name),e.status&&(n.status=e.status.toUpperCase()),e.driver!==void 0&&(n.driverId=e.driver),e.vehicle!==void 0&&(n.vehicleId=e.vehicle),e.shipment!==void 0&&(n.shipmentId=e.shipment),e.waypoints&&(n.waypoints=f("waypoints",e.waypoints)),e.estimatedDistance!==void 0&&(n.estimatedDistance=e.estimatedDistance),e.estimatedDuration!==void 0&&(n.estimatedDuration=e.estimatedDuration),e.actualDistance!==void 0&&(n.actualDistance=e.actualDistance),e.actualDuration!==void 0&&(n.actualDuration=e.actualDuration),e.fuelCost!==void 0&&(n.fuelCost=e.fuelCost),!Object.keys(n).length)throw new l("No updates specified");let i=await o(we,{id:t,input:n});p("Route updated"),s(e,i.updateRoute);}catch(n){a(n);}}),r.command("remove").description("Delete a route").argument("<id>","Route ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(Ce,{id:t});p(`Route ${t} deleted`),s(e,{deleted:n.deleteRoute});}catch(n){a(n);}}),r.command("optimize").description("Optimize a route").argument("<id>","Route ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let n=await o(Ee,{id:t});p("Route optimized"),s(e,n.optimizeRoute);}catch(n){a(n);}});}function Be(c){let r=c.command("marketplace").description("Movethewheels logistics marketplace (providers & offerings)"),t=r.command("providers").description("Service providers");t.command("list").description("List service providers").option("--type <t>","Filter by provider type").option("--active <bool>","Filter by active state (true|false)",n=>n==="true").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async n=>{try{let i={};n.type&&(i.type=n.type),n.active!==void 0&&(i.isActive=n.active),n.query&&(i.search=n.query);let u=await o(Te,{filter:Object.keys(i).length?i:void 0,pagination:y(n)});s(n,u.serviceProviders,{headers:["ID","Name","Type","Active","Verified","Rating"],rows:u.serviceProviders.map(v=>[g(v.id,12),v.name,v.type,v.isActive?"yes":"no",v.isVerified?"yes":"no",v.rating!=null?String(v.rating):"-"])});}catch(i){a(i);}}),t.command("get").description("Get a service provider by id (includes offerings)").argument("<id>","Provider ID").option("-f, --format <format>","Output format").action(async(n,i)=>{try{let u=await o(be,{id:n});if(!u.serviceProvider)throw new l(`Provider ${n} not found`);s(i,u.serviceProvider);}catch(u){a(u);}}),t.command("create").description("Create a service provider").requiredOption("--name <name>","Provider name").requiredOption("--type <t>","Provider type").option("--description <s>","Description").option("--rating <n>","Rating",m).option("--active <bool>","Active (true|false)",n=>n==="true",true).option("--verified <bool>","Verified (true|false)",n=>n==="true",false).option("--contact-info <json>","Contact info JSON").option("--services <list>","Comma-separated services offered").option("-f, --format <format>","Output format").action(async n=>{try{let i={name:n.name,type:n.type,isActive:n.active??!0,isVerified:n.verified??!1};n.description&&(i.description=n.description),n.rating!==void 0&&(i.rating=n.rating),n.contactInfo&&(i.contactInfo=f("contact-info",n.contactInfo)),n.services&&(i.services=ze(n.services));let u=await o(De,{input:i});p(`Provider created: ${u.createServiceProvider.name}`),s(n,u.createServiceProvider);}catch(i){a(i);}}),t.command("update").description("Update a service provider").argument("<id>","Provider ID").option("--name <name>","Provider name").option("--type <t>","Provider type").option("--description <s>","Description").option("--rating <n>","Rating",m).option("--active <bool>","Active (true|false)",n=>n==="true").option("--verified <bool>","Verified (true|false)",n=>n==="true").option("--contact-info <json>","Contact info JSON").option("--services <list>","Comma-separated services offered").option("-f, --format <format>","Output format").action(async(n,i)=>{try{let u={};if(i.name&&(u.name=i.name),i.type&&(u.type=i.type),i.description!==void 0&&(u.description=i.description),i.rating!==void 0&&(u.rating=i.rating),i.active!==void 0&&(u.isActive=i.active),i.verified!==void 0&&(u.isVerified=i.verified),i.contactInfo&&(u.contactInfo=f("contact-info",i.contactInfo)),i.services&&(u.services=ze(i.services)),!Object.keys(u).length)throw new l("No updates specified");let v=await o(Oe,{id:n,input:u});p("Provider updated"),s(i,v.updateServiceProvider);}catch(u){a(u);}}),t.command("remove").description("Delete a service provider").argument("<id>","Provider ID").option("-f, --format <format>","Output format").action(async(n,i)=>{try{let u=await o(Se,{id:n});p(`Provider ${n} deleted`),s(i,{deleted:u.deleteServiceProvider});}catch(u){a(u);}});let e=r.command("offerings").description("Service offerings");e.command("list").description("List service offerings").option("--provider <id>","Filter by provider ID").option("--category <c>","Filter by category").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async n=>{try{let i={};n.provider&&(i.providerId=n.provider),n.category&&(i.category=n.category.toUpperCase()),n.query&&(i.search=n.query);let u=await o(Re,{filter:Object.keys(i).length?i:void 0,pagination:y(n)});s(n,u.serviceOfferings,{headers:["ID","Name","Provider","Category","Price","Currency"],rows:u.serviceOfferings.map(v=>[g(v.id,12),v.name,g(v.providerId,12),v.category??"-",String(v.price),v.currency])});}catch(i){a(i);}}),e.command("get").description("Get a service offering by id").argument("<id>","Offering ID").option("-f, --format <format>","Output format").action(async(n,i)=>{try{let u=await o(ke,{id:n});if(!u.serviceOffering)throw new l(`Offering ${n} not found`);s(i,u.serviceOffering);}catch(u){a(u);}}),e.command("create").description("Create a service offering").requiredOption("--provider <id>","Provider ID").requiredOption("--name <name>","Offering name").requiredOption("--price <n>","Price",m).requiredOption("--category <c>","Category (FULL_TRUCKLOAD, LESS_THAN_TRUCKLOAD, LAST_MILE, EXPRESS, AIR_FREIGHT, OCEAN_FREIGHT, RAIL_FREIGHT, COLD_CHAIN, CUSTOMS_CLEARANCE, WAREHOUSING, OTHER)").option("--description <s>","Description").option("--currency <c>","Currency","USD").option("--availability <a>","Availability (AVAILABLE, LIMITED, UNAVAILABLE)").option("-f, --format <format>","Output format").action(async n=>{try{let i={providerId:n.provider,name:n.name,price:n.price,currency:n.currency??"USD"};n.description&&(i.description=n.description),i.category=n.category.toUpperCase(),n.availability&&(i.availability=n.availability.toUpperCase());let u=await o(Ae,{input:i});p(`Offering created: ${u.createServiceOffering.name}`),s(n,u.createServiceOffering);}catch(i){a(i);}}),e.command("update").description("Update a service offering").argument("<id>","Offering ID").option("--name <name>","Offering name").option("--description <s>","Description").option("--category <c>","Category").option("--price <n>","Price",m).option("--currency <c>","Currency").option("--availability <a>","Availability (AVAILABLE, LIMITED, UNAVAILABLE)").option("-f, --format <format>","Output format").action(async(n,i)=>{try{let u={};if(i.name&&(u.name=i.name),i.description!==void 0&&(u.description=i.description),i.category!==void 0&&(u.category=i.category.toUpperCase()),i.price!==void 0&&(u.price=i.price),i.currency&&(u.currency=i.currency),i.availability&&(u.availability=i.availability.toUpperCase()),!Object.keys(u).length)throw new l("No updates specified");let v=await o(xe,{id:n,input:u});p("Offering updated"),s(i,v.updateServiceOffering);}catch(u){a(u);}}),e.command("remove").description("Delete a service offering").argument("<id>","Offering ID").option("-f, --format <format>","Output format").action(async(n,i)=>{try{let u=await o(Ne,{id:n});p(`Offering ${n} deleted`),s(i,{deleted:u.deleteServiceOffering});}catch(u){a(u);}});}function ze(c){return c.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function Ye(c){let r=c.command("settings").description("Movethewheels module settings");r.command("get").description("Get module settings").option("-f, --format <format>","Output format").action(async t=>{try{let e=await o($e);s(t,e.mtwModuleSettings);}catch(e){a(e);}}),r.command("update").description("Update module settings (only the options passed are changed)").option("--currency <code>","Default ISO 4217 currency code").option("--delivery-window-hours <n>","Default delivery window in hours (1 to 720)",d).option("--order-priority <p>","Default order priority (LOW, MEDIUM, HIGH, URGENT, CRITICAL)").option("--distance-unit <u>","Distance unit (KM or MI)").option("--weight-unit <u>","Weight unit (KG or LB)").option("--timezone <tz>","IANA timezone").option("-f, --format <format>","Output format").action(async t=>{try{let e={};if(t.currency!==void 0&&(e.defaultCurrency=t.currency.toUpperCase()),t.deliveryWindowHours!==void 0&&(e.defaultDeliveryWindowHours=t.deliveryWindowHours),t.orderPriority!==void 0&&(e.defaultOrderPriority=t.orderPriority.toUpperCase()),t.distanceUnit!==void 0&&(e.distanceUnit=t.distanceUnit.toUpperCase()),t.weightUnit!==void 0&&(e.weightUnit=t.weightUnit.toUpperCase()),t.timezone!==void 0&&(e.timezone=t.timezone),Object.keys(e).length===0)throw new l("Pass at least one setting to update");let n=await o(Le,{input:e});p("Module settings updated"),s(t,n.updateMtwModuleSettings);}catch(e){a(e);}});}function Ke(c){let r=c.command("analytics").description("Movethewheels analytics & dashboards");r.command("dashboard").description("Dashboard metrics (orders, deliveries, revenue, fleet, low stock)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(_e);s(t,e.dashboardMetrics);}catch(e){a(e);}}),r.command("trends").description("Analytics time series (order, revenue, delivery trends)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(Pe);s(t,e.analytics);}catch(e){a(e);}}),r.command("finance").description("Finance metrics (revenue, fuel cost, open invoices)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(Ue);s(t,e.financeMetrics);}catch(e){a(e);}}),r.command("fleet").description("Fleet stats (vehicles & drivers by status)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await o(Ve);s(t,e.fleetStats);}catch(e){a(e);}});}var dt={id:"movethewheels",version:"1.0.0",displayName:"Movethewheels",dependsOn:["auth","workspaces"],register(c,r){O(r);let t=c.command("movethewheels").description("Movethewheels logistics & fleet operations");Me(t),qe(t),Fe(t),We(t),je(t),Ge(t),Je(t),Be(t),Ye(t),Ke(t);}},ci=dt;module.exports=ci;
|
|
487
|
+
`;function l(o,r){try{return JSON.parse(r)}catch{throw new m(`--${o} must be valid JSON`)}}function d(o){let r=Number.parseInt(o,10);if(Number.isNaN(r))throw new m(`Expected an integer but got "${o}"`);return r}function g(o){let r=Number.parseFloat(o);if(Number.isNaN(r))throw new m(`Expected a number but got "${o}"`);return r}function h(o){let r={};return o.limit!==void 0&&(r.limit=o.limit),o.offset!==void 0&&(r.offset=o.offset),Object.keys(r).length?r:void 0}function Xe(o){let r=o.command("customers").description("Movethewheels customers");r.command("list").description("List customers").option("--type <t>","Filter by customer type (b2c/b2b)").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.type&&(e.type=t.type),t.query&&(e.search=t.query);let i=await a(N,{filter:Object.keys(e).length?e:void 0,pagination:h(t)});s(t,i.customers,{headers:["ID","Name","Type","Email","Phone","Rating"],rows:i.customers.map(n=>[f(n.id,12),n.name,n.type,n.email??"-",n.phone??"-",n.rating!=null?String(n.rating):"-"])});}catch(e){c(e);}}),r.command("get").description("Get a customer by id").argument("<id>","Customer ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(A,{id:t});if(!i.customer)throw new m(`Customer ${t} not found`);s(e,i.customer);}catch(i){c(i);}}),r.command("create").description("Create a customer").requiredOption("--name <name>","Customer name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--company <company>","Company").option("--type <t>","Customer type","b2c").option("--tax-id <s>","Tax ID").option("--business-license <s>","Business license").option("--rating <n>","Rating",g).option("--address <json>","Address JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={name:t.name,type:t.type??"b2c"};t.email&&(e.email=t.email),t.phone&&(e.phone=t.phone),t.company&&(e.company=t.company),t.taxId&&(e.taxId=t.taxId),t.businessLicense&&(e.businessLicense=t.businessLicense),t.rating!==void 0&&(e.rating=t.rating),t.address&&(e.address=l("address",t.address));let i=await a(x,{input:e});p(`Customer created: ${i.createCustomer.name}`),s(t,i.createCustomer);}catch(e){c(e);}}),r.command("update").description("Update a customer").argument("<id>","Customer ID").option("--name <name>","Customer name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--company <company>","Company").option("--type <t>","Customer type").option("--tax-id <s>","Tax ID").option("--business-license <s>","Business license").option("--rating <n>","Rating",g).option("--address <json>","Address JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.name&&(i.name=e.name),e.email!==void 0&&(i.email=e.email),e.phone!==void 0&&(i.phone=e.phone),e.company!==void 0&&(i.company=e.company),e.type&&(i.type=e.type),e.taxId!==void 0&&(i.taxId=e.taxId),e.businessLicense!==void 0&&(i.businessLicense=e.businessLicense),e.rating!==void 0&&(i.rating=e.rating),e.address&&(i.address=l("address",e.address)),!Object.keys(i).length)throw new m("No updates specified");let n=await a($,{id:t,input:i});p("Customer updated"),s(e,n.updateCustomer);}catch(i){c(i);}}),r.command("remove").description("Delete a customer").argument("<id>","Customer ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(L,{id:t});p(`Customer ${t} deleted`),s(e,{deleted:i.deleteCustomer});}catch(i){c(i);}});}function et(o){let r=o.command("drivers").description("Movethewheels drivers");r.command("list").description("List drivers").option("--status <s>","Filter by driver status").option("--vehicle <id>","Filter by vehicle ID").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.status&&(e.status=t.status.toUpperCase()),t.vehicle&&(e.vehicleId=t.vehicle),t.query&&(e.search=t.query);let i=await a(P,{filter:Object.keys(e).length?e:void 0,pagination:h(t)});s(t,i.drivers,{headers:["ID","Name","Employee","Status","Vehicle","Rating"],rows:i.drivers.map(n=>[f(n.id,12),`${n.firstName} ${n.lastName}`,n.employeeId,n.status,n.vehicleId?f(n.vehicleId,12):"-",n.rating!=null?String(n.rating):"-"])});}catch(e){c(e);}}),r.command("get").description("Get a driver by id").argument("<id>","Driver ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(_,{id:t});if(!i.driver)throw new m(`Driver ${t} not found`);s(e,i.driver);}catch(i){c(i);}}),r.command("create").description("Create a driver").requiredOption("--employee-id <s>","Employee ID").requiredOption("--first-name <s>","First name").requiredOption("--last-name <s>","Last name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--status <s>","Driver status","AVAILABLE").option("--license-number <s>","License number").option("--license-class <s>","License class").option("--license-expiry <s>","License expiry (ISO date)").option("--vehicle-id <id>","Vehicle ID").option("--user-id <id>","User ID").option("--rating <n>","Rating",g).option("--certifications <json>","Certifications JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={employeeId:t.employeeId,firstName:t.firstName,lastName:t.lastName,status:(t.status??"AVAILABLE").toUpperCase()};t.email&&(e.email=t.email),t.phone&&(e.phone=t.phone),t.licenseNumber&&(e.licenseNumber=t.licenseNumber),t.licenseClass&&(e.licenseClass=t.licenseClass),t.licenseExpiry&&(e.licenseExpiry=t.licenseExpiry),t.vehicleId&&(e.vehicleId=t.vehicleId),t.userId&&(e.userId=t.userId),t.rating!==void 0&&(e.rating=t.rating),t.certifications&&(e.certifications=l("certifications",t.certifications)),t.currentLocation&&(e.currentLocation=l("current-location",t.currentLocation));let i=await a(U,{input:e});p(`Driver created: ${i.createDriver.firstName} ${i.createDriver.lastName}`),s(t,i.createDriver);}catch(e){c(e);}}),r.command("update").description("Update a driver").argument("<id>","Driver ID").option("--first-name <s>","First name").option("--last-name <s>","Last name").option("--email <email>","Email").option("--phone <phone>","Phone").option("--status <s>","Driver status").option("--license-number <s>","License number").option("--license-class <s>","License class").option("--license-expiry <s>","License expiry (ISO date)").option("--vehicle-id <id>","Vehicle ID").option("--rating <n>","Rating",g).option("--certifications <json>","Certifications JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.firstName&&(i.firstName=e.firstName),e.lastName&&(i.lastName=e.lastName),e.email!==void 0&&(i.email=e.email),e.phone!==void 0&&(i.phone=e.phone),e.status&&(i.status=e.status.toUpperCase()),e.licenseNumber!==void 0&&(i.licenseNumber=e.licenseNumber),e.licenseClass!==void 0&&(i.licenseClass=e.licenseClass),e.licenseExpiry&&(i.licenseExpiry=e.licenseExpiry),e.vehicleId!==void 0&&(i.vehicleId=e.vehicleId),e.rating!==void 0&&(i.rating=e.rating),e.certifications&&(i.certifications=l("certifications",e.certifications)),e.currentLocation&&(i.currentLocation=l("current-location",e.currentLocation)),!Object.keys(i).length)throw new m("No updates specified");let n=await a(V,{id:t,input:i});p("Driver updated"),s(e,n.updateDriver);}catch(i){c(i);}}),r.command("remove").description("Delete a driver").argument("<id>","Driver ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(M,{id:t});p(`Driver ${t} deleted`),s(e,{deleted:i.deleteDriver});}catch(i){c(i);}}),r.command("set-status").description("Update a driver status").argument("<id>","Driver ID").requiredOption("--status <s>","AVAILABLE|ON_DELIVERY|ON_BREAK|OFF_DUTY|INACTIVE").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(q,{id:t,status:e.status.toUpperCase()});p(`Driver status set to ${i.updateDriverStatus.status}`),s(e,i.updateDriverStatus);}catch(i){c(i);}}),r.command("assign-vehicle").description("Assign (or clear) a vehicle for a driver").argument("<id>","Driver ID").option("--vehicle <id>","Vehicle ID (omit to clear assignment)").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(J,{id:t,vehicleId:e.vehicle});p(e.vehicle?`Vehicle ${e.vehicle} assigned`:"Vehicle assignment cleared"),s(e,i.assignDriverVehicle);}catch(i){c(i);}});}function tt(o){let r=o.command("vehicles").description("Movethewheels fleet vehicles");r.command("list").description("List vehicles").option("--type <t>","Filter by vehicle type").option("--status <s>","Filter by vehicle status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.type&&(e.type=t.type.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.query&&(e.search=t.query);let i=await a(j,{filter:Object.keys(e).length?e:void 0,pagination:h(t)});s(t,i.vehicles,{headers:["ID","Number","Type","Status","Make/Model","Plate"],rows:i.vehicles.map(n=>[f(n.id,12),n.vehicleNumber,n.type,n.status,`${n.make??"-"} ${n.model??""}`.trim(),n.licensePlate??"-"])});}catch(e){c(e);}}),r.command("get").description("Get a vehicle by id").argument("<id>","Vehicle ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(F,{id:t});if(!i.vehicle)throw new m(`Vehicle ${t} not found`);s(e,i.vehicle);}catch(i){c(i);}}),r.command("create").description("Create a vehicle").requiredOption("--number <s>","Vehicle number").requiredOption("--type <t>","Vehicle type (TRUCK|VAN|MOTORCYCLE|\u2026)").option("--status <s>","Vehicle status","ACTIVE").option("--make <s>","Make").option("--model <s>","Model").option("--year <n>","Year",d).option("--license-plate <s>","License plate").option("--fuel-level <n>","Fuel level",g).option("--mileage <n>","Mileage",g).option("--ownership-type <s>","Ownership type").option("--capacity <json>","Capacity JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={vehicleNumber:t.number,type:t.type.toUpperCase(),status:(t.status??"ACTIVE").toUpperCase()};t.make&&(e.make=t.make),t.model&&(e.model=t.model),t.year!==void 0&&(e.year=t.year),t.licensePlate&&(e.licensePlate=t.licensePlate),t.fuelLevel!==void 0&&(e.fuelLevel=t.fuelLevel),t.mileage!==void 0&&(e.mileage=t.mileage),t.ownershipType&&(e.ownershipType=t.ownershipType),t.capacity&&(e.capacity=l("capacity",t.capacity)),t.currentLocation&&(e.currentLocation=l("current-location",t.currentLocation));let i=await a(W,{input:e});p(`Vehicle created: ${i.createVehicle.vehicleNumber}`),s(t,i.createVehicle);}catch(e){c(e);}}),r.command("update").description("Update a vehicle").argument("<id>","Vehicle ID").option("--number <s>","Vehicle number").option("--type <t>","Vehicle type").option("--status <s>","Vehicle status").option("--make <s>","Make").option("--model <s>","Model").option("--year <n>","Year",d).option("--license-plate <s>","License plate").option("--fuel-level <n>","Fuel level",g).option("--mileage <n>","Mileage",g).option("--ownership-type <s>","Ownership type").option("--capacity <json>","Capacity JSON").option("--current-location <json>","Current location JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.number&&(i.vehicleNumber=e.number),e.type&&(i.type=e.type.toUpperCase()),e.status&&(i.status=e.status.toUpperCase()),e.make!==void 0&&(i.make=e.make),e.model!==void 0&&(i.model=e.model),e.year!==void 0&&(i.year=e.year),e.licensePlate!==void 0&&(i.licensePlate=e.licensePlate),e.fuelLevel!==void 0&&(i.fuelLevel=e.fuelLevel),e.mileage!==void 0&&(i.mileage=e.mileage),e.ownershipType!==void 0&&(i.ownershipType=e.ownershipType),e.capacity&&(i.capacity=l("capacity",e.capacity)),e.currentLocation&&(i.currentLocation=l("current-location",e.currentLocation)),!Object.keys(i).length)throw new m("No updates specified");let n=await a(G,{id:t,input:i});p("Vehicle updated"),s(e,n.updateVehicle);}catch(i){c(i);}}),r.command("remove").description("Delete a vehicle").argument("<id>","Vehicle ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(H,{id:t});p(`Vehicle ${t} deleted`),s(e,{deleted:i.deleteVehicle});}catch(i){c(i);}}),r.command("set-status").description("Update a vehicle status").argument("<id>","Vehicle ID").requiredOption("--status <s>","ACTIVE|INACTIVE|IN_TRANSIT|MAINTENANCE|DECOMMISSIONED").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(z,{id:t,status:e.status.toUpperCase()});p(`Vehicle status set to ${i.updateVehicleStatus.status}`),s(e,i.updateVehicleStatus);}catch(i){c(i);}}),r.command("set-location").description("Update a vehicle current location").argument("<id>","Vehicle ID").requiredOption("--location <json>","Location JSON (latitude/longitude/\u2026)").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=l("location",e.location),n=await a(Y,{id:t,location:i});p("Vehicle location updated"),s(e,n.updateVehicleLocation);}catch(i){c(i);}});}function it(o){let r=o.command("warehouses").description("Movethewheels warehouses & locations");r.command("list").description("List warehouses").option("--type <t>","Filter by warehouse type").option("--status <s>","Filter by status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.type&&(e.type=t.type.toUpperCase()),t.status&&(e.status=t.status),t.query&&(e.search=t.query);let i=await a(K,{filter:Object.keys(e).length?e:void 0,pagination:h(t)});s(t,i.warehouses,{headers:["ID","Code","Name","Type","Status","Capacity"],rows:i.warehouses.map(n=>[f(n.id,12),n.code,n.name,n.type,n.status,`${n.usedCapacity??0}/${n.totalCapacity??0}`])});}catch(e){c(e);}}),r.command("get").description("Get a warehouse by id (includes locations)").argument("<id>","Warehouse ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(B,{id:t});if(!i.warehouse)throw new m(`Warehouse ${t} not found`);s(e,i.warehouse);}catch(i){c(i);}}),r.command("create").description("Create a warehouse").requiredOption("--code <code>","Warehouse code").requiredOption("--name <name>","Warehouse name").requiredOption("--type <t>","Warehouse type (DISTRIBUTION|FULFILLMENT|\u2026)").requiredOption("--address <json>","Address JSON").option("--status <s>","Status","ACTIVE").option("--contact-info <json>","Contact info JSON").option("--operating-hours <json>","Operating hours JSON").option("--capabilities <json>","Capabilities JSON").option("--total-capacity <n>","Total capacity",g).option("--used-capacity <n>","Used capacity",g).option("-f, --format <format>","Output format").action(async t=>{try{let e={code:t.code,name:t.name,type:t.type.toUpperCase(),address:l("address",t.address),status:t.status??"ACTIVE"};t.contactInfo&&(e.contactInfo=l("contact-info",t.contactInfo)),t.operatingHours&&(e.operatingHours=l("operating-hours",t.operatingHours)),t.capabilities&&(e.capabilities=l("capabilities",t.capabilities)),t.totalCapacity!==void 0&&(e.totalCapacity=t.totalCapacity),t.usedCapacity!==void 0&&(e.usedCapacity=t.usedCapacity);let i=await a(Q,{input:e});p(`Warehouse created: ${i.createWarehouse.name}`),s(t,i.createWarehouse);}catch(e){c(e);}}),r.command("update").description("Update a warehouse").argument("<id>","Warehouse ID").option("--code <code>","Warehouse code").option("--name <name>","Warehouse name").option("--type <t>","Warehouse type").option("--status <s>","Status").option("--address <json>","Address JSON").option("--contact-info <json>","Contact info JSON").option("--operating-hours <json>","Operating hours JSON").option("--capabilities <json>","Capabilities JSON").option("--total-capacity <n>","Total capacity",g).option("--used-capacity <n>","Used capacity",g).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.code&&(i.code=e.code),e.name&&(i.name=e.name),e.type&&(i.type=e.type.toUpperCase()),e.status&&(i.status=e.status),e.address&&(i.address=l("address",e.address)),e.contactInfo&&(i.contactInfo=l("contact-info",e.contactInfo)),e.operatingHours&&(i.operatingHours=l("operating-hours",e.operatingHours)),e.capabilities&&(i.capabilities=l("capabilities",e.capabilities)),e.totalCapacity!==void 0&&(i.totalCapacity=e.totalCapacity),e.usedCapacity!==void 0&&(i.usedCapacity=e.usedCapacity),!Object.keys(i).length)throw new m("No updates specified");let n=await a(Z,{id:t,input:i});p("Warehouse updated"),s(e,n.updateWarehouse);}catch(i){c(i);}}),r.command("remove").description("Delete a warehouse").argument("<id>","Warehouse ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(X,{id:t});p(`Warehouse ${t} deleted`),s(e,{deleted:i.deleteWarehouse});}catch(i){c(i);}}),r.command("create-location").description("Create a warehouse location").requiredOption("--warehouse <id>","Warehouse ID").requiredOption("--code <s>","Location code").option("--location-type <s>","Location type").option("--status <s>","Status","ACTIVE").option("--zone <s>","Zone").option("--aisle <s>","Aisle").option("--rack <s>","Rack").option("--shelf <s>","Shelf").option("--bin <s>","Bin").option("--capacity <n>","Capacity",g).option("-f, --format <format>","Output format").action(async t=>{try{let e={warehouseId:t.warehouse,locationCode:t.code,status:t.status??"ACTIVE"};t.locationType&&(e.locationType=t.locationType),t.zone&&(e.zone=t.zone),t.aisle&&(e.aisle=t.aisle),t.rack&&(e.rack=t.rack),t.shelf&&(e.shelf=t.shelf),t.bin&&(e.bin=t.bin),t.capacity!==void 0&&(e.capacity=t.capacity);let i=await a(ee,{input:e});p(`Location created: ${i.createWarehouseLocation.locationCode}`),s(t,i.createWarehouseLocation);}catch(e){c(e);}}),r.command("update-location").description("Update a warehouse location").argument("<id>","Location ID").option("--code <s>","Location code").option("--location-type <s>","Location type").option("--status <s>","Status").option("--zone <s>","Zone").option("--aisle <s>","Aisle").option("--rack <s>","Rack").option("--shelf <s>","Shelf").option("--bin <s>","Bin").option("--capacity <n>","Capacity",g).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.code&&(i.locationCode=e.code),e.locationType!==void 0&&(i.locationType=e.locationType),e.status&&(i.status=e.status),e.zone!==void 0&&(i.zone=e.zone),e.aisle!==void 0&&(i.aisle=e.aisle),e.rack!==void 0&&(i.rack=e.rack),e.shelf!==void 0&&(i.shelf=e.shelf),e.bin!==void 0&&(i.bin=e.bin),e.capacity!==void 0&&(i.capacity=e.capacity),!Object.keys(i).length)throw new m("No updates specified");let n=await a(te,{id:t,input:i});p("Location updated"),s(e,n.updateWarehouseLocation);}catch(i){c(i);}});}function nt(o){let r={};return o.cargoItem&&(r.cargoItemId=o.cargoItem),o.warehouse&&(r.warehouseId=o.warehouse),o.location&&(r.locationId=o.location),o.query&&(r.search=o.query),Object.keys(r).length?r:void 0}function rt(o){let r=o.command("inventory").description("Movethewheels inventory");r.command("list").description("List inventory items").option("--cargo-item <id>","Filter by cargo item ID").option("--warehouse <id>","Filter by warehouse ID").option("--location <id>","Filter by location ID").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(ne,{filter:nt(t),pagination:h(t)});s(t,e.inventoryItems,{headers:["ID","Cargo item","Warehouse","OnHand","Available","Allocated"],rows:e.inventoryItems.map(i=>[f(i.id,12),f(i.cargoItemId,12),f(i.warehouseId,12),String(i.onHand),String(i.available),String(i.allocated)])});}catch(e){c(e);}}),r.command("get").description("Get an inventory item by id").argument("<id>","Inventory item ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(ie,{id:t});if(!i.inventoryItem)throw new m(`Inventory item ${t} not found`);s(e,i.inventoryItem);}catch(i){c(i);}}),r.command("stats").description("Inventory stats (on-hand, available, allocated, damaged, low-stock)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(oe);s(t,e.inventoryStats);}catch(e){c(e);}}),r.command("create").description("Create an inventory item").requiredOption("--cargo-item <id>","Cargo item ID").requiredOption("--warehouse <id>","Warehouse ID").option("--location <id>","Location ID").option("--on-hand <n>","On-hand quantity",d).option("--available <n>","Available quantity",d).option("--allocated <n>","Allocated quantity",d).option("--damaged <n>","Damaged quantity",d).option("--reorder-point <n>","Reorder point",d).option("--safety-stock <n>","Safety stock",d).option("--unit-cost <n>","Unit cost",g).option("-f, --format <format>","Output format").action(async t=>{try{let e={cargoItemId:t.cargoItem,warehouseId:t.warehouse};t.location&&(e.locationId=t.location),t.onHand!==void 0&&(e.onHand=t.onHand),t.available!==void 0&&(e.available=t.available),t.allocated!==void 0&&(e.allocated=t.allocated),t.damaged!==void 0&&(e.damaged=t.damaged),t.reorderPoint!==void 0&&(e.reorderPoint=t.reorderPoint),t.safetyStock!==void 0&&(e.safetyStock=t.safetyStock),t.unitCost!==void 0&&(e.unitCost=t.unitCost);let i=await a(ae,{input:e});p("Inventory item created"),s(t,i.createInventoryItem);}catch(e){c(e);}}),r.command("update").description("Update an inventory item").argument("<id>","Inventory item ID").option("--location <id>","Location ID").option("--on-hand <n>","On-hand quantity",d).option("--available <n>","Available quantity",d).option("--allocated <n>","Allocated quantity",d).option("--damaged <n>","Damaged quantity",d).option("--reorder-point <n>","Reorder point",d).option("--safety-stock <n>","Safety stock",d).option("--unit-cost <n>","Unit cost",g).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.location!==void 0&&(i.locationId=e.location),e.onHand!==void 0&&(i.onHand=e.onHand),e.available!==void 0&&(i.available=e.available),e.allocated!==void 0&&(i.allocated=e.allocated),e.damaged!==void 0&&(i.damaged=e.damaged),e.reorderPoint!==void 0&&(i.reorderPoint=e.reorderPoint),e.safetyStock!==void 0&&(i.safetyStock=e.safetyStock),e.unitCost!==void 0&&(i.unitCost=e.unitCost),!Object.keys(i).length)throw new m("No updates specified");let n=await a(se,{id:t,input:i});p("Inventory item updated"),s(e,n.updateInventoryItem);}catch(i){c(i);}}),r.command("remove").description("Delete an inventory item").argument("<id>","Inventory item ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(ce,{id:t});p(`Inventory item ${t} deleted`),s(e,{deleted:i.deleteInventoryItem});}catch(i){c(i);}}),r.command("adjust").description("Adjust inventory stock levels").argument("<id>","Inventory item ID").option("--on-hand <n>","On-hand quantity",d).option("--available <n>","Available quantity",d).option("--allocated <n>","Allocated quantity",d).option("--damaged <n>","Damaged quantity",d).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={id:t};if(e.onHand!==void 0&&(i.onHand=e.onHand),e.available!==void 0&&(i.available=e.available),e.allocated!==void 0&&(i.allocated=e.allocated),e.damaged!==void 0&&(i.damaged=e.damaged),Object.keys(i).length===1)throw new m("No stock adjustments specified");let n=await a(de,{input:i});p("Inventory stock adjusted"),s(e,n.adjustInventoryStock);}catch(i){c(i);}}),r.command("transactions").description("List inventory transactions").option("--cargo-item <id>","Filter by cargo item ID").option("--warehouse <id>","Filter by warehouse ID").option("--location <id>","Filter by location ID").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(re,{filter:nt(t),pagination:h(t)});s(t,e.inventoryTransactions,{headers:["ID","Number","Type","Cargo item","Warehouse","Qty"],rows:e.inventoryTransactions.map(i=>[f(i.id,12),i.transactionNumber,i.type,f(i.cargoItemId,12),f(i.warehouseId,12),String(i.quantity)])});}catch(e){c(e);}}),r.command("record-transaction").description("Record an inventory transaction").requiredOption("--number <s>","Transaction number").requiredOption("--type <t>","Transaction type (RECEIPT|ISSUE|TRANSFER|ADJUSTMENT|RETURN)").requiredOption("--cargo-item <id>","Cargo item ID").requiredOption("--warehouse <id>","Warehouse ID").requiredOption("--quantity <n>","Quantity",d).option("--inventory-item <id>","Inventory item ID").option("--unit-cost <n>","Unit cost",g).option("--reference-type <s>","Reference type").option("--reference-id <s>","Reference ID").option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async t=>{try{let e={transactionNumber:t.number,type:t.type.toUpperCase(),cargoItemId:t.cargoItem,warehouseId:t.warehouse,quantity:t.quantity};t.inventoryItem&&(e.inventoryItemId=t.inventoryItem),t.unitCost!==void 0&&(e.unitCost=t.unitCost),t.referenceType&&(e.referenceType=t.referenceType),t.referenceId&&(e.referenceId=t.referenceId),t.notes&&(e.notes=t.notes);let i=await a(ue,{input:e});p(`Transaction recorded: ${i.createInventoryTransaction.transactionNumber}`),s(t,i.createInventoryTransaction);}catch(e){c(e);}});}var O="PENDING|CONFIRMED|ASSIGNED|PICKED_UP|IN_TRANSIT|OUT_FOR_DELIVERY|DELIVERED|FAILED|RETURNED|CANCELLED",T="LOW|MEDIUM|HIGH|URGENT|CRITICAL",ot=["ID","Job #","Status","Priority","Driver","Store order","Scheduled"];function at(o){return o.map(r=>[f(r.id,12),r.deliveryJobNumber,r.status,r.priority,f(r.driverId??"-",12),f(r.storeOrderId??"-",12),r.scheduledDelivery??"-"])}function st(o){let r={};return o.status&&(r.status=o.status.toUpperCase()),o.priority&&(r.priority=o.priority.toUpperCase()),o.customer&&(r.customerId=o.customer),o.driver&&(r.driverId=o.driver),o.vehicle&&(r.vehicleId=o.vehicle),o.route&&(r.routeId=o.route),o.storeOrder&&(r.storeOrderId=o.storeOrder),o.unassigned&&(r.unassigned=true),o.query&&(r.search=o.query),Object.keys(r).length?r:void 0}function ct(o){return o.option("--status <s>",`Filter by status (${O})`).option("--priority <p>",`Filter by priority (${T})`).option("--customer <id>","Filter by customer ID").option("--driver <id>","Filter by driver ID").option("--vehicle <id>","Filter by vehicle ID").option("--route <id>","Filter by route ID").option("--store-order <id>","Filter by the store order the job delivers").option("--unassigned","Only jobs with no driver assigned").option("--query <q>","Free-text search")}function dt(o){let r=o.command("delivery-jobs").description("Movethewheels delivery jobs (dispatch units linked to store orders)");ct(r.command("list").description("List delivery jobs")).option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(le,{filter:st(t),pagination:h(t)});s(t,e.deliveryJobs,{headers:ot,rows:at(e.deliveryJobs)});}catch(e){c(e);}}),ct(r.command("count").description("Count delivery jobs matching a filter")).option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(me,{filter:st(t)});s(t,{count:e.deliveryJobsCount});}catch(e){c(e);}}),r.command("get").description("Get a delivery job (customer, driver, vehicle, shipment, status history)").argument("<id>","Delivery job ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(pe,{id:t});if(!i.deliveryJob)throw new m(`Delivery job ${t} not found`);s(e,i.deliveryJob);}catch(i){c(i);}}),r.command("stats").description("Delivery job counts by status").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(fe);s(t,e.deliveryJobStats);}catch(e){c(e);}}),r.command("tracking").description("Tracking events of the shipment that fulfils a delivery job").argument("<id>","Delivery job ID").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(ge,{deliveryJobId:t,pagination:h(e)});s(e,i.deliveryJobTracking,{headers:["ID","Event","Details","Timestamp"],rows:i.deliveryJobTracking.map(n=>[f(n.id,12),n.eventType,f(n.details??"-",30),n.timestamp])});}catch(i){c(i);}}),r.command("create").description("Create a delivery job").requiredOption("--number <s>","Delivery job number").requiredOption("--customer <id>","Customer ID").requiredOption("--cargo-items <json>","Cargo items JSON array").requiredOption("--pickup-address <json>","Pickup address JSON").requiredOption("--delivery-address <json>","Delivery address JSON").option("--store-order <id>","Store order the job delivers").option("--priority <p>",`Priority (${T}); server default MEDIUM`).option("--status <s>",`Initial status (${O}); server default PENDING`).option("--driver <id>","Driver ID").option("--vehicle <id>","Vehicle ID").option("--route <id>","Route ID").option("--scheduled-delivery <s>","Scheduled delivery (ISO date)").option("--special-instructions <s>","Special instructions").option("--tracking-number <s>","Tracking number").option("--pricing <json>","Pricing JSON").option("-f, --format <format>","Output format").action(async t=>{try{let e={deliveryJobNumber:t.number,customerId:t.customer,cargoItems:l("cargo-items",t.cargoItems),pickupAddress:l("pickup-address",t.pickupAddress),deliveryAddress:l("delivery-address",t.deliveryAddress)};t.storeOrder&&(e.storeOrderId=t.storeOrder),t.priority&&(e.priority=t.priority.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.driver&&(e.driverId=t.driver),t.vehicle&&(e.vehicleId=t.vehicle),t.route&&(e.routeId=t.route),t.scheduledDelivery&&(e.scheduledDelivery=t.scheduledDelivery),t.specialInstructions&&(e.specialInstructions=t.specialInstructions),t.trackingNumber&&(e.trackingNumber=t.trackingNumber),t.pricing&&(e.pricing=l("pricing",t.pricing));let i=await a(ve,{input:e});p(`Delivery job created: ${i.createDeliveryJob.deliveryJobNumber}`),s(t,i.createDeliveryJob);}catch(e){c(e);}}),r.command("update").description("Update a delivery job (use set-status to move it through its lifecycle)").argument("<id>","Delivery job ID").option("--customer <id>","Customer ID").option("--store-order <id>","Store order the job delivers").option("--priority <p>",`Priority (${T})`).option("--driver <id>","Driver ID").option("--vehicle <id>","Vehicle ID").option("--route <id>","Route ID").option("--cargo-items <json>","Cargo items JSON array").option("--pickup-address <json>","Pickup address JSON").option("--delivery-address <json>","Delivery address JSON").option("--scheduled-delivery <s>","Scheduled delivery (ISO date)").option("--special-instructions <s>","Special instructions").option("--tracking-number <s>","Tracking number").option("--pricing <json>","Pricing JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.customer&&(i.customerId=e.customer),e.storeOrder&&(i.storeOrderId=e.storeOrder),e.priority&&(i.priority=e.priority.toUpperCase()),e.driver&&(i.driverId=e.driver),e.vehicle&&(i.vehicleId=e.vehicle),e.route&&(i.routeId=e.route),e.cargoItems&&(i.cargoItems=l("cargo-items",e.cargoItems)),e.pickupAddress&&(i.pickupAddress=l("pickup-address",e.pickupAddress)),e.deliveryAddress&&(i.deliveryAddress=l("delivery-address",e.deliveryAddress)),e.scheduledDelivery&&(i.scheduledDelivery=e.scheduledDelivery),e.specialInstructions&&(i.specialInstructions=e.specialInstructions),e.trackingNumber&&(i.trackingNumber=e.trackingNumber),e.pricing&&(i.pricing=l("pricing",e.pricing)),!Object.keys(i).length)throw new m("No updates specified");let n=await a(Ie,{id:t,input:i});p("Delivery job updated"),s(e,n.updateDeliveryJob);}catch(i){c(i);}}),r.command("set-status").description("Move a delivery job to a new status (recorded in its status history)").argument("<id>","Delivery job ID").requiredOption("--status <s>",O).option("--notes <s>","Notes for the status history entry").option("--location <json>","Location JSON").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={status:e.status.toUpperCase()};e.notes&&(i.notes=e.notes),e.location&&(i.location=l("location",e.location));let n=await a(we,{id:t,input:i});p(`Delivery job ${t} is now ${n.updateDeliveryJobStatus.status}`),s(e,n.updateDeliveryJobStatus);}catch(i){c(i);}}),r.command("remove").description("Delete a delivery job").argument("<id>","Delivery job ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(Ee,{id:t});p(`Delivery job ${t} deleted`),s(e,{deleted:i.deleteDeliveryJob});}catch(i){c(i);}}),r.command("pending-epod").description("Your delivery jobs still awaiting proof-of-delivery capture").option("--count","Only print how many there are").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{if(t.count){let i=await a(he);s(t,{count:i.myPendingEpodDeliveryJobsCount});return}let e=await a(ye,{pagination:h(t)});s(t,e.myPendingEpodDeliveryJobs,{headers:ot,rows:at(e.myPendingEpodDeliveryJobs)});}catch(e){c(e);}});}function ut(o){let r=o.command("shipments").description("Movethewheels shipments & tracking");r.command("list").description("List shipments").option("--delivery-job <id>","Filter by delivery job ID").option("--store-order <id>","Filter by store order ID").option("--customer <id>","Filter by customer ID").option("--carrier <id>","Filter by carrier ID").option("--status <s>","Filter by status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.deliveryJob&&(e.deliveryJobId=t.deliveryJob),t.storeOrder&&(e.storeOrderId=t.storeOrder),t.customer&&(e.customerId=t.customer),t.carrier&&(e.carrierId=t.carrier),t.status&&(e.status=t.status.toUpperCase()),t.query&&(e.search=t.query);let i=await a(Ce,{filter:Object.keys(e).length?e:void 0,pagination:h(t)});s(t,i.shipments,{headers:["ID","Shipment #","Delivery job","Store order","Status","Tracking"],rows:i.shipments.map(n=>[f(n.id,12),n.shipmentNumber,f(n.deliveryJobId??"-",12),f(n.storeOrderId??"-",12),n.status,n.trackingNumber??"-"])});}catch(e){c(e);}}),r.command("get").description("Get a shipment by id (includes tracking events)").argument("<id>","Shipment ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(be,{id:t});if(!i.shipment)throw new m(`Shipment ${t} not found`);s(e,i.shipment);}catch(i){c(i);}}),r.command("active").description("List active deliveries (in-transit shipments)").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(De,{pagination:h(t)});s(t,e.activeDeliveries,{headers:["ID","Shipment #","Delivery job","Store order","Status","Tracking"],rows:e.activeDeliveries.map(i=>[f(i.id,12),i.shipmentNumber,f(i.deliveryJobId??"-",12),f(i.storeOrderId??"-",12),i.status,i.trackingNumber??"-"])});}catch(e){c(e);}}),r.command("create").description("Create a shipment").requiredOption("--shipment-number <s>","Shipment number").option("--delivery-job <id>","Delivery job the shipment fulfils").option("--store-order <id>","Store order the shipment fulfils").requiredOption("--origin <json>","Origin JSON").requiredOption("--destination <json>","Destination JSON").option("--status <s>","Status","PLANNED").option("--customer <id>","Customer ID").option("--carrier <id>","Carrier ID").option("--tracking-number <s>","Tracking number").option("--cargo-details <json>","Cargo details JSON").option("--estimated-delivery <s>","Estimated delivery (ISO date)").option("--actual-delivery <s>","Actual delivery (ISO date)").option("-f, --format <format>","Output format").action(async t=>{try{let e={shipmentNumber:t.shipmentNumber,origin:l("origin",t.origin),destination:l("destination",t.destination),status:(t.status??"PLANNED").toUpperCase()};t.deliveryJob&&(e.deliveryJobId=t.deliveryJob),t.storeOrder&&(e.storeOrderId=t.storeOrder),t.customer&&(e.customerId=t.customer),t.carrier&&(e.carrierId=t.carrier),t.trackingNumber&&(e.trackingNumber=t.trackingNumber),t.cargoDetails&&(e.cargoDetails=l("cargo-details",t.cargoDetails)),t.estimatedDelivery&&(e.estimatedDelivery=t.estimatedDelivery),t.actualDelivery&&(e.actualDelivery=t.actualDelivery);let i=await a(Se,{input:e});p(`Shipment created: ${i.createShipment.shipmentNumber}`),s(t,i.createShipment);}catch(e){c(e);}}),r.command("update").description("Update a shipment").argument("<id>","Shipment ID").option("--status <s>","Status").option("--delivery-job <id>","Re-link to another delivery job").option("--store-order <id>","Re-link to another store order").option("--customer <id>","Customer ID").option("--carrier <id>","Carrier ID").option("--tracking-number <s>","Tracking number").option("--origin <json>","Origin JSON").option("--destination <json>","Destination JSON").option("--cargo-details <json>","Cargo details JSON").option("--estimated-delivery <s>","Estimated delivery (ISO date)").option("--actual-delivery <s>","Actual delivery (ISO date)").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.status&&(i.status=e.status.toUpperCase()),e.deliveryJob&&(i.deliveryJobId=e.deliveryJob),e.storeOrder&&(i.storeOrderId=e.storeOrder),e.customer!==void 0&&(i.customerId=e.customer),e.carrier!==void 0&&(i.carrierId=e.carrier),e.trackingNumber!==void 0&&(i.trackingNumber=e.trackingNumber),e.origin&&(i.origin=l("origin",e.origin)),e.destination&&(i.destination=l("destination",e.destination)),e.cargoDetails&&(i.cargoDetails=l("cargo-details",e.cargoDetails)),e.estimatedDelivery&&(i.estimatedDelivery=e.estimatedDelivery),e.actualDelivery&&(i.actualDelivery=e.actualDelivery),!Object.keys(i).length)throw new m("No updates specified");let n=await a(ke,{id:t,input:i});p("Shipment updated"),s(e,n.updateShipment);}catch(i){c(i);}}),r.command("remove").description("Delete a shipment").argument("<id>","Shipment ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(Re,{id:t});p(`Shipment ${t} deleted`),s(e,{deleted:i.deleteShipment});}catch(i){c(i);}}),r.command("add-event").description("Add a tracking event to a shipment").requiredOption("--shipment <id>","Shipment ID").requiredOption("--event-type <t>","CREATED|PICKED_UP|IN_TRANSIT|ARRIVED|DEPARTED|OUT_FOR_DELIVERY|DELIVERED|FAILED|RETURNED").option("--details <s>","Event details").option("--location <json>","Location JSON").option("--timestamp <s>","Timestamp (ISO date)").option("-f, --format <format>","Output format").action(async t=>{try{let e={shipmentId:t.shipment,eventType:t.eventType.toUpperCase()};t.details&&(e.details=t.details),t.location&&(e.location=l("location",t.location)),t.timestamp&&(e.timestamp=t.timestamp);let i=await a(Ae,{input:e});p(`Tracking event added: ${i.addTrackingEvent.eventType}`),s(t,i.addTrackingEvent);}catch(e){c(e);}}),r.command("tracking").description("List tracking events for a shipment").argument("<shipmentId>","Shipment ID").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(Oe,{shipmentId:t,pagination:h(e)});s(e,i.shipmentTracking,{headers:["ID","Event","Details","Timestamp"],rows:i.shipmentTracking.map(n=>[f(n.id,12),n.eventType,f(n.details??"-",30),n.timestamp])});}catch(i){c(i);}}),r.command("alerts").description("List tracking alerts (delayed / at-risk shipments)").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(Te,{pagination:h(t)});s(t,e.trackingAlerts,{headers:["Type","Shipment #","Message"],rows:e.trackingAlerts.map(i=>[i.alertType,i.shipmentNumber,f(i.message,40)])});}catch(e){c(e);}});}function pt(o){let r=o.command("routes").description("Movethewheels delivery routes");r.command("list").description("List routes").option("--driver <id>","Filter by driver ID").option("--vehicle <id>","Filter by vehicle ID").option("--shipment <id>","Filter by shipment ID").option("--status <s>","Filter by status").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async t=>{try{let e={};t.driver&&(e.driverId=t.driver),t.vehicle&&(e.vehicleId=t.vehicle),t.shipment&&(e.shipmentId=t.shipment),t.status&&(e.status=t.status.toUpperCase()),t.query&&(e.search=t.query);let i=await a(xe,{filter:Object.keys(e).length?e:void 0,pagination:h(t)});s(t,i.routes,{headers:["ID","Name","Status","Driver","Vehicle","Distance"],rows:i.routes.map(n=>[f(n.id,12),n.name,n.status,n.driverId?f(n.driverId,12):"-",n.vehicleId?f(n.vehicleId,12):"-",n.estimatedDistance!=null?String(n.estimatedDistance):"-"])});}catch(e){c(e);}}),r.command("get").description("Get a route by id").argument("<id>","Route ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(Ne,{id:t});if(!i.route)throw new m(`Route ${t} not found`);s(e,i.route);}catch(i){c(i);}}),r.command("create").description("Create a route").requiredOption("--name <name>","Route name").requiredOption("--waypoints <json>","Waypoints JSON").option("--status <s>","Status","PLANNED").option("--driver <id>","Driver ID").option("--vehicle <id>","Vehicle ID").option("--shipment <id>","Shipment ID").option("--estimated-distance <n>","Estimated distance",g).option("--estimated-duration <n>","Estimated duration",g).option("--actual-distance <n>","Actual distance",g).option("--actual-duration <n>","Actual duration",g).option("--fuel-cost <n>","Fuel cost",g).option("-f, --format <format>","Output format").action(async t=>{try{let e={name:t.name,waypoints:l("waypoints",t.waypoints),status:(t.status??"PLANNED").toUpperCase()};t.driver&&(e.driverId=t.driver),t.vehicle&&(e.vehicleId=t.vehicle),t.shipment&&(e.shipmentId=t.shipment),t.estimatedDistance!==void 0&&(e.estimatedDistance=t.estimatedDistance),t.estimatedDuration!==void 0&&(e.estimatedDuration=t.estimatedDuration),t.actualDistance!==void 0&&(e.actualDistance=t.actualDistance),t.actualDuration!==void 0&&(e.actualDuration=t.actualDuration),t.fuelCost!==void 0&&(e.fuelCost=t.fuelCost);let i=await a($e,{input:e});p(`Route created: ${i.createRoute.name}`),s(t,i.createRoute);}catch(e){c(e);}}),r.command("update").description("Update a route").argument("<id>","Route ID").option("--name <name>","Route name").option("--status <s>","Status").option("--driver <id>","Driver ID").option("--vehicle <id>","Vehicle ID").option("--shipment <id>","Shipment ID").option("--waypoints <json>","Waypoints JSON").option("--estimated-distance <n>","Estimated distance",g).option("--estimated-duration <n>","Estimated duration",g).option("--actual-distance <n>","Actual distance",g).option("--actual-duration <n>","Actual duration",g).option("--fuel-cost <n>","Fuel cost",g).option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i={};if(e.name&&(i.name=e.name),e.status&&(i.status=e.status.toUpperCase()),e.driver!==void 0&&(i.driverId=e.driver),e.vehicle!==void 0&&(i.vehicleId=e.vehicle),e.shipment!==void 0&&(i.shipmentId=e.shipment),e.waypoints&&(i.waypoints=l("waypoints",e.waypoints)),e.estimatedDistance!==void 0&&(i.estimatedDistance=e.estimatedDistance),e.estimatedDuration!==void 0&&(i.estimatedDuration=e.estimatedDuration),e.actualDistance!==void 0&&(i.actualDistance=e.actualDistance),e.actualDuration!==void 0&&(i.actualDuration=e.actualDuration),e.fuelCost!==void 0&&(i.fuelCost=e.fuelCost),!Object.keys(i).length)throw new m("No updates specified");let n=await a(Le,{id:t,input:i});p("Route updated"),s(e,n.updateRoute);}catch(i){c(i);}}),r.command("remove").description("Delete a route").argument("<id>","Route ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(_e,{id:t});p(`Route ${t} deleted`),s(e,{deleted:i.deleteRoute});}catch(i){c(i);}}),r.command("optimize").description("Optimize a route").argument("<id>","Route ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let i=await a(Pe,{id:t});p("Route optimized"),s(e,i.optimizeRoute);}catch(i){c(i);}});}function mt(o){let r=o.command("marketplace").description("Movethewheels logistics marketplace (providers & offerings)"),t=r.command("providers").description("Service providers");t.command("list").description("List service providers").option("--type <t>","Filter by provider type").option("--active <bool>","Filter by active state (true|false)",i=>i==="true").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async i=>{try{let n={};i.type&&(n.type=i.type),i.active!==void 0&&(n.isActive=i.active),i.query&&(n.search=i.query);let u=await a(Ve,{filter:Object.keys(n).length?n:void 0,pagination:h(i)});s(i,u.serviceProviders,{headers:["ID","Name","Type","Active","Verified","Rating"],rows:u.serviceProviders.map(v=>[f(v.id,12),v.name,v.type,v.isActive?"yes":"no",v.isVerified?"yes":"no",v.rating!=null?String(v.rating):"-"])});}catch(n){c(n);}}),t.command("get").description("Get a service provider by id (includes offerings)").argument("<id>","Provider ID").option("-f, --format <format>","Output format").action(async(i,n)=>{try{let u=await a(Ue,{id:i});if(!u.serviceProvider)throw new m(`Provider ${i} not found`);s(n,u.serviceProvider);}catch(u){c(u);}}),t.command("create").description("Create a service provider").requiredOption("--name <name>","Provider name").requiredOption("--type <t>","Provider type").option("--description <s>","Description").option("--rating <n>","Rating",g).option("--active <bool>","Active (true|false)",i=>i==="true",true).option("--verified <bool>","Verified (true|false)",i=>i==="true",false).option("--contact-info <json>","Contact info JSON").option("--services <list>","Comma-separated services offered").option("-f, --format <format>","Output format").action(async i=>{try{let n={name:i.name,type:i.type,isActive:i.active??!0,isVerified:i.verified??!1};i.description&&(n.description=i.description),i.rating!==void 0&&(n.rating=i.rating),i.contactInfo&&(n.contactInfo=l("contact-info",i.contactInfo)),i.services&&(n.services=lt(i.services));let u=await a(Me,{input:n});p(`Provider created: ${u.createServiceProvider.name}`),s(i,u.createServiceProvider);}catch(n){c(n);}}),t.command("update").description("Update a service provider").argument("<id>","Provider ID").option("--name <name>","Provider name").option("--type <t>","Provider type").option("--description <s>","Description").option("--rating <n>","Rating",g).option("--active <bool>","Active (true|false)",i=>i==="true").option("--verified <bool>","Verified (true|false)",i=>i==="true").option("--contact-info <json>","Contact info JSON").option("--services <list>","Comma-separated services offered").option("-f, --format <format>","Output format").action(async(i,n)=>{try{let u={};if(n.name&&(u.name=n.name),n.type&&(u.type=n.type),n.description!==void 0&&(u.description=n.description),n.rating!==void 0&&(u.rating=n.rating),n.active!==void 0&&(u.isActive=n.active),n.verified!==void 0&&(u.isVerified=n.verified),n.contactInfo&&(u.contactInfo=l("contact-info",n.contactInfo)),n.services&&(u.services=lt(n.services)),!Object.keys(u).length)throw new m("No updates specified");let v=await a(qe,{id:i,input:u});p("Provider updated"),s(n,v.updateServiceProvider);}catch(u){c(u);}}),t.command("remove").description("Delete a service provider").argument("<id>","Provider ID").option("-f, --format <format>","Output format").action(async(i,n)=>{try{let u=await a(Je,{id:i});p(`Provider ${i} deleted`),s(n,{deleted:u.deleteServiceProvider});}catch(u){c(u);}});let e=r.command("offerings").description("Service offerings");e.command("list").description("List service offerings").option("--provider <id>","Filter by provider ID").option("--category <c>","Filter by category").option("--query <q>","Free-text search").option("--limit <n>","Page size",d,50).option("--offset <n>","Offset",d,0).option("-f, --format <format>","Output format").action(async i=>{try{let n={};i.provider&&(n.providerId=i.provider),i.category&&(n.category=i.category.toUpperCase()),i.query&&(n.search=i.query);let u=await a(je,{filter:Object.keys(n).length?n:void 0,pagination:h(i)});s(i,u.serviceOfferings,{headers:["ID","Name","Provider","Category","Price","Currency"],rows:u.serviceOfferings.map(v=>[f(v.id,12),v.name,f(v.providerId,12),v.category??"-",String(v.price),v.currency])});}catch(n){c(n);}}),e.command("get").description("Get a service offering by id").argument("<id>","Offering ID").option("-f, --format <format>","Output format").action(async(i,n)=>{try{let u=await a(Fe,{id:i});if(!u.serviceOffering)throw new m(`Offering ${i} not found`);s(n,u.serviceOffering);}catch(u){c(u);}}),e.command("create").description("Create a service offering").requiredOption("--provider <id>","Provider ID").requiredOption("--name <name>","Offering name").requiredOption("--price <n>","Price",g).requiredOption("--category <c>","Category (FULL_TRUCKLOAD, LESS_THAN_TRUCKLOAD, LAST_MILE, EXPRESS, AIR_FREIGHT, OCEAN_FREIGHT, RAIL_FREIGHT, COLD_CHAIN, CUSTOMS_CLEARANCE, WAREHOUSING, OTHER)").option("--description <s>","Description").option("--currency <c>","Currency","USD").option("--availability <a>","Availability (AVAILABLE, LIMITED, UNAVAILABLE)").option("-f, --format <format>","Output format").action(async i=>{try{let n={providerId:i.provider,name:i.name,price:i.price,currency:i.currency??"USD"};i.description&&(n.description=i.description),n.category=i.category.toUpperCase(),i.availability&&(n.availability=i.availability.toUpperCase());let u=await a(We,{input:n});p(`Offering created: ${u.createServiceOffering.name}`),s(i,u.createServiceOffering);}catch(n){c(n);}}),e.command("update").description("Update a service offering").argument("<id>","Offering ID").option("--name <name>","Offering name").option("--description <s>","Description").option("--category <c>","Category").option("--price <n>","Price",g).option("--currency <c>","Currency").option("--availability <a>","Availability (AVAILABLE, LIMITED, UNAVAILABLE)").option("-f, --format <format>","Output format").action(async(i,n)=>{try{let u={};if(n.name&&(u.name=n.name),n.description!==void 0&&(u.description=n.description),n.category!==void 0&&(u.category=n.category.toUpperCase()),n.price!==void 0&&(u.price=n.price),n.currency&&(u.currency=n.currency),n.availability&&(u.availability=n.availability.toUpperCase()),!Object.keys(u).length)throw new m("No updates specified");let v=await a(Ge,{id:i,input:u});p("Offering updated"),s(n,v.updateServiceOffering);}catch(u){c(u);}}),e.command("remove").description("Delete a service offering").argument("<id>","Offering ID").option("-f, --format <format>","Output format").action(async(i,n)=>{try{let u=await a(He,{id:i});p(`Offering ${i} deleted`),s(n,{deleted:u.deleteServiceOffering});}catch(u){c(u);}});}function lt(o){return o.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function ft(o){let r=o.command("settings").description("Movethewheels module settings");r.command("get").description("Get module settings").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(ze);s(t,e.mtwModuleSettings);}catch(e){c(e);}}),r.command("update").description("Update module settings (only the options passed are changed)").option("--currency <code>","Default ISO 4217 currency code").option("--delivery-window-hours <n>","Default delivery window in hours (1 to 720)",d).option("--order-priority <p>","Default order priority (LOW, MEDIUM, HIGH, URGENT, CRITICAL)").option("--distance-unit <u>","Distance unit (KM or MI)").option("--weight-unit <u>","Weight unit (KG or LB)").option("--timezone <tz>","IANA timezone").option("-f, --format <format>","Output format").action(async t=>{try{let e={};if(t.currency!==void 0&&(e.defaultCurrency=t.currency.toUpperCase()),t.deliveryWindowHours!==void 0&&(e.defaultDeliveryWindowHours=t.deliveryWindowHours),t.orderPriority!==void 0&&(e.defaultOrderPriority=t.orderPriority.toUpperCase()),t.distanceUnit!==void 0&&(e.distanceUnit=t.distanceUnit.toUpperCase()),t.weightUnit!==void 0&&(e.weightUnit=t.weightUnit.toUpperCase()),t.timezone!==void 0&&(e.timezone=t.timezone),Object.keys(e).length===0)throw new m("Pass at least one setting to update");let i=await a(Ye,{input:e});p("Module settings updated"),s(t,i.updateMtwModuleSettings);}catch(e){c(e);}});}function gt(o){let r=o.command("analytics").description("Movethewheels analytics & dashboards");r.command("dashboard").description("Dashboard metrics (orders, deliveries, revenue, fleet, low stock)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(Ke);s(t,e.dashboardMetrics);}catch(e){c(e);}}),r.command("trends").description("Analytics time series (order, revenue, delivery trends)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(Be);s(t,e.analytics);}catch(e){c(e);}}),r.command("finance").description("Finance metrics (revenue, fuel cost, open invoices)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(Qe);s(t,e.financeMetrics);}catch(e){c(e);}}),r.command("fleet").description("Fleet stats (vehicles & drivers by status)").option("-f, --format <format>","Output format").action(async t=>{try{let e=await a(Ze);s(t,e.fleetStats);}catch(e){c(e);}});}var kt={id:"movethewheels",version:"1.0.0",displayName:"Movethewheels",dependsOn:["auth","workspaces"],register(o,r){R(r);let t=o.command("movethewheels").description("Movethewheels logistics & fleet operations");Xe(t),et(t),tt(t),it(t),rt(t),dt(t),ut(t),pt(t),mt(t),ft(t),gt(t);}},Nn=kt;module.exports=Nn;
|