@hardfin/cli 0.0.2-dev.12 → 0.0.2-dev.13

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.
Files changed (3) hide show
  1. package/README.md +13 -2
  2. package/dist/cli.js +140 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -67,8 +67,19 @@ hardfin asset move execute create \
67
67
  --move assetId=ast_b2,locationId=loc_y
68
68
  ```
69
69
 
70
- An enum carries its values, so a wrong one fails locally with exit code 2 rather than at the
71
- API. A required field missing is caught the same way, before any request is made.
70
+ A value is sent as the type the document names. `--useful-life 36` sends the number 36. A
71
+ decimal such as `--salvage-value 1500.00` stays a string, which is how the API takes money
72
+ without losing precision.
73
+
74
+ Clear a field with `--unset`, naming the flag:
75
+
76
+ ```sh
77
+ hardfin asset accounting update ast_4f9xk2mq7plr8stz --unset useful-life
78
+ ```
79
+
80
+ Three things fail locally with exit code 2, before any request is made: a value outside an
81
+ enum, a required field that is missing, and `--unset` on a field the API will not take null
82
+ for.
72
83
 
73
84
  ### Overrides
74
85
 
package/dist/cli.js CHANGED
@@ -1632,6 +1632,13 @@ async function runMcp(input) {
1632
1632
  }
1633
1633
  //#endregion
1634
1634
  //#region src/command/operation.ts
1635
+ const UNSET_FLAG = {
1636
+ name: "unset",
1637
+ description: "A field to clear, named as its flag is, repeatable",
1638
+ valueName: "field",
1639
+ repeatable: true,
1640
+ schema: z.array(z.string())
1641
+ };
1635
1642
  const FILE_FLAG = {
1636
1643
  name: "file",
1637
1644
  description: "The file to upload",
@@ -1648,6 +1655,7 @@ function defineOperation(operation) {
1648
1655
  const flags = [
1649
1656
  ...operation.queryFlags,
1650
1657
  ...operation.bodyFlags,
1658
+ ...operation.bodyFlags.some((flag) => flag.nullable) ? [UNSET_FLAG] : [],
1651
1659
  ...operation.upload ? [...operation.upload.fields, FILE_FLAG] : [],
1652
1660
  JSON_FLAG
1653
1661
  ];
@@ -1661,6 +1669,10 @@ function defineOperation(operation) {
1661
1669
  description: operation.summary,
1662
1670
  command: operation.example
1663
1671
  }] : [],
1672
+ endpoint: {
1673
+ method: operation.method,
1674
+ path: operation.path
1675
+ },
1664
1676
  run: (input) => runOperation(operation, input)
1665
1677
  };
1666
1678
  }
@@ -1764,10 +1776,25 @@ function toBody(operation, flags) {
1764
1776
  hasField = true;
1765
1777
  continue;
1766
1778
  }
1767
- set(body, flag.jsonPath, value);
1779
+ const parsed = flag.schema.safeParse(value);
1780
+ set(body, flag.jsonPath, parsed.success ? parsed.data : value);
1768
1781
  hasField = true;
1769
1782
  }
1770
- return hasField ? body : void 0;
1783
+ const cleared = toCleared(operation, flags, body);
1784
+ if (cleared instanceof Error) return cleared;
1785
+ return hasField || cleared ? body : void 0;
1786
+ }
1787
+ /** toCleared sends null for each field named by --unset, which is how a field is cleared. */
1788
+ function toCleared(operation, flags, body) {
1789
+ const named = flags["unset"];
1790
+ const names = Array.isArray(named) ? named.map(String) : named === void 0 ? [] : [String(named)];
1791
+ for (const name of names) {
1792
+ const flag = operation.bodyFlags.find((entry) => entry.name === name.replace(/^--/, ""));
1793
+ if (!flag) return /* @__PURE__ */ new Error(`--unset names no field called ${name}`);
1794
+ if (!flag.nullable) return /* @__PURE__ */ new Error(`--${flag.name} cannot be cleared, because the API does not accept null for it`);
1795
+ set(body, flag.jsonPath, null);
1796
+ }
1797
+ return names.length > 0;
1771
1798
  }
1772
1799
  /** toElements reads the key=value pairs a repeated flag carries for one array element. */
1773
1800
  function toElements(flag, values) {
@@ -2007,6 +2034,7 @@ const surfaceCommands = [
2007
2034
  jsonPath: ["allocatedIndirect"],
2008
2035
  description: "One unit's share of overhead, a cost component",
2009
2036
  valueName: "value",
2037
+ nullable: true,
2010
2038
  schema: z.string()
2011
2039
  },
2012
2040
  {
@@ -2014,6 +2042,7 @@ const surfaceCommands = [
2014
2042
  jsonPath: ["billOfMaterials"],
2015
2043
  description: "The parts cost of one unit, a cost component",
2016
2044
  valueName: "value",
2045
+ nullable: true,
2017
2046
  schema: z.string()
2018
2047
  },
2019
2048
  {
@@ -2033,6 +2062,7 @@ const surfaceCommands = [
2033
2062
  jsonPath: ["description"],
2034
2063
  description: "A free-form description of the asset",
2035
2064
  valueName: "value",
2065
+ nullable: true,
2036
2066
  schema: z.string()
2037
2067
  },
2038
2068
  {
@@ -2040,6 +2070,7 @@ const surfaceCommands = [
2040
2070
  jsonPath: ["directLabor"],
2041
2071
  description: "The labor cost to build one unit, a cost component",
2042
2072
  valueName: "value",
2073
+ nullable: true,
2043
2074
  schema: z.string()
2044
2075
  },
2045
2076
  {
@@ -2047,6 +2078,7 @@ const surfaceCommands = [
2047
2078
  jsonPath: ["freightInbound"],
2048
2079
  description: "The shipping cost to receive one unit, a cost component",
2049
2080
  valueName: "value",
2081
+ nullable: true,
2050
2082
  schema: z.string()
2051
2083
  },
2052
2084
  {
@@ -2054,6 +2086,7 @@ const surfaceCommands = [
2054
2086
  jsonPath: ["freightOutbound"],
2055
2087
  description: "The shipping cost to deploy one unit, a deployment cost component",
2056
2088
  valueName: "value",
2089
+ nullable: true,
2057
2090
  schema: z.string()
2058
2091
  },
2059
2092
  {
@@ -2061,6 +2094,7 @@ const surfaceCommands = [
2061
2094
  jsonPath: ["functionalStatus"],
2062
2095
  description: "The asset's starting functional status, FUNCTIONAL when absent, which cannot be SCRAPPED",
2063
2096
  valueName: "value",
2097
+ nullable: true,
2064
2098
  schema: z.enum([
2065
2099
  "FUNCTIONAL",
2066
2100
  "NEEDS_REVIEW",
@@ -2080,6 +2114,7 @@ const surfaceCommands = [
2080
2114
  jsonPath: ["inServiceDate"],
2081
2115
  description: "The day the asset was put into service, which Hardfin sets itself when absent",
2082
2116
  valueName: "value",
2117
+ nullable: true,
2083
2118
  schema: z.string()
2084
2119
  },
2085
2120
  {
@@ -2087,6 +2122,7 @@ const surfaceCommands = [
2087
2122
  jsonPath: ["installation"],
2088
2123
  description: "The cost to install one unit, a deployment cost component",
2089
2124
  valueName: "value",
2125
+ nullable: true,
2090
2126
  schema: z.string()
2091
2127
  },
2092
2128
  {
@@ -2094,6 +2130,7 @@ const surfaceCommands = [
2094
2130
  jsonPath: ["interest"],
2095
2131
  description: "The financing cost of one unit, a cost component",
2096
2132
  valueName: "value",
2133
+ nullable: true,
2097
2134
  schema: z.string()
2098
2135
  },
2099
2136
  {
@@ -2116,6 +2153,7 @@ const surfaceCommands = [
2116
2153
  jsonPath: ["salvageValue"],
2117
2154
  description: "The value one unit keeps at the end of its useful life, or null to clear it",
2118
2155
  valueName: "value",
2156
+ nullable: true,
2119
2157
  schema: z.string()
2120
2158
  },
2121
2159
  {
@@ -2131,6 +2169,7 @@ const surfaceCommands = [
2131
2169
  jsonPath: ["simpleCostBasis"],
2132
2170
  description: "A single cost for one unit, which cannot be sent together with the cost components",
2133
2171
  valueName: "value",
2172
+ nullable: true,
2134
2173
  schema: z.string()
2135
2174
  },
2136
2175
  {
@@ -2138,6 +2177,7 @@ const surfaceCommands = [
2138
2177
  jsonPath: ["tariffs"],
2139
2178
  description: "The import duty paid on one unit, a cost component",
2140
2179
  valueName: "value",
2180
+ nullable: true,
2141
2181
  schema: z.string()
2142
2182
  },
2143
2183
  {
@@ -2145,6 +2185,7 @@ const surfaceCommands = [
2145
2185
  jsonPath: ["tax"],
2146
2186
  description: "The tax paid on one unit, a cost component",
2147
2187
  valueName: "value",
2188
+ nullable: true,
2148
2189
  schema: z.string()
2149
2190
  },
2150
2191
  {
@@ -2152,6 +2193,7 @@ const surfaceCommands = [
2152
2193
  jsonPath: ["usefulLife"],
2153
2194
  description: "The number of months one unit is depreciated over, or null to clear it",
2154
2195
  valueName: "number",
2196
+ nullable: true,
2155
2197
  schema: z.coerce.number()
2156
2198
  }
2157
2199
  ]
@@ -2257,6 +2299,7 @@ const surfaceCommands = [
2257
2299
  jsonPath: ["description"],
2258
2300
  description: "The asset's new description, or null to clear it",
2259
2301
  valueName: "value",
2302
+ nullable: true,
2260
2303
  schema: z.string()
2261
2304
  },
2262
2305
  {
@@ -2264,6 +2307,7 @@ const surfaceCommands = [
2264
2307
  jsonPath: ["functionalStatus"],
2265
2308
  description: "The asset's new functional status, which cannot be SCRAPPED because scrapping has its own endpoint",
2266
2309
  valueName: "value",
2310
+ nullable: true,
2267
2311
  schema: z.enum([
2268
2312
  "FUNCTIONAL",
2269
2313
  "NEEDS_REVIEW",
@@ -2276,6 +2320,7 @@ const surfaceCommands = [
2276
2320
  jsonPath: ["inInventoryDate"],
2277
2321
  description: "The day the asset entered inventory, which cannot be in the future",
2278
2322
  valueName: "value",
2323
+ nullable: true,
2279
2324
  schema: z.string()
2280
2325
  },
2281
2326
  {
@@ -2283,6 +2328,7 @@ const surfaceCommands = [
2283
2328
  jsonPath: ["initialLocationId"],
2284
2329
  description: "The ID of the location the asset entered inventory at",
2285
2330
  valueName: "value",
2331
+ nullable: true,
2286
2332
  schema: z.string()
2287
2333
  },
2288
2334
  {
@@ -2299,6 +2345,7 @@ const surfaceCommands = [
2299
2345
  jsonPath: ["serial"],
2300
2346
  description: "The asset's new serial number, which cannot be empty",
2301
2347
  valueName: "value",
2348
+ nullable: true,
2302
2349
  schema: z.string()
2303
2350
  }
2304
2351
  ]
@@ -2327,6 +2374,7 @@ const surfaceCommands = [
2327
2374
  jsonPath: ["allocatedIndirect"],
2328
2375
  description: "One unit's share of overhead, a cost component",
2329
2376
  valueName: "value",
2377
+ nullable: true,
2330
2378
  schema: z.string()
2331
2379
  },
2332
2380
  {
@@ -2334,6 +2382,7 @@ const surfaceCommands = [
2334
2382
  jsonPath: ["billOfMaterials"],
2335
2383
  description: "The parts cost of one unit, a cost component",
2336
2384
  valueName: "value",
2385
+ nullable: true,
2337
2386
  schema: z.string()
2338
2387
  },
2339
2388
  {
@@ -2353,6 +2402,7 @@ const surfaceCommands = [
2353
2402
  jsonPath: ["directLabor"],
2354
2403
  description: "The labor cost to build one unit, a cost component",
2355
2404
  valueName: "value",
2405
+ nullable: true,
2356
2406
  schema: z.string()
2357
2407
  },
2358
2408
  {
@@ -2360,6 +2410,7 @@ const surfaceCommands = [
2360
2410
  jsonPath: ["freightInbound"],
2361
2411
  description: "The shipping cost to receive one unit, a cost component",
2362
2412
  valueName: "value",
2413
+ nullable: true,
2363
2414
  schema: z.string()
2364
2415
  },
2365
2416
  {
@@ -2367,6 +2418,7 @@ const surfaceCommands = [
2367
2418
  jsonPath: ["freightOutbound"],
2368
2419
  description: "The shipping cost to deploy one unit, a deployment cost component",
2369
2420
  valueName: "value",
2421
+ nullable: true,
2370
2422
  schema: z.string()
2371
2423
  },
2372
2424
  {
@@ -2374,6 +2426,7 @@ const surfaceCommands = [
2374
2426
  jsonPath: ["inServiceDate"],
2375
2427
  description: "The day the asset was put into service and began depreciating, or null to clear it",
2376
2428
  valueName: "value",
2429
+ nullable: true,
2377
2430
  schema: z.string()
2378
2431
  },
2379
2432
  {
@@ -2381,6 +2434,7 @@ const surfaceCommands = [
2381
2434
  jsonPath: ["installation"],
2382
2435
  description: "The cost to install one unit, a deployment cost component",
2383
2436
  valueName: "value",
2437
+ nullable: true,
2384
2438
  schema: z.string()
2385
2439
  },
2386
2440
  {
@@ -2388,12 +2442,14 @@ const surfaceCommands = [
2388
2442
  jsonPath: ["interest"],
2389
2443
  description: "The financing cost of one unit, a cost component",
2390
2444
  valueName: "value",
2445
+ nullable: true,
2391
2446
  schema: z.string()
2392
2447
  },
2393
2448
  {
2394
2449
  name: "is-in-service-date-managed-automatically",
2395
2450
  jsonPath: ["isInServiceDateManagedAutomatically"],
2396
2451
  description: "Whether Hardfin sets the in-service date itself, which sending an in-service date turns off",
2452
+ nullable: true,
2397
2453
  schema: z.boolean()
2398
2454
  },
2399
2455
  {
@@ -2401,6 +2457,7 @@ const surfaceCommands = [
2401
2457
  jsonPath: ["salvageValue"],
2402
2458
  description: "The value one unit keeps at the end of its useful life, or null to clear it",
2403
2459
  valueName: "value",
2460
+ nullable: true,
2404
2461
  schema: z.string()
2405
2462
  },
2406
2463
  {
@@ -2408,6 +2465,7 @@ const surfaceCommands = [
2408
2465
  jsonPath: ["simpleCostBasis"],
2409
2466
  description: "A single cost for one unit, which cannot be sent together with the cost components",
2410
2467
  valueName: "value",
2468
+ nullable: true,
2411
2469
  schema: z.string()
2412
2470
  },
2413
2471
  {
@@ -2415,6 +2473,7 @@ const surfaceCommands = [
2415
2473
  jsonPath: ["tariffs"],
2416
2474
  description: "The import duty paid on one unit, a cost component",
2417
2475
  valueName: "value",
2476
+ nullable: true,
2418
2477
  schema: z.string()
2419
2478
  },
2420
2479
  {
@@ -2422,6 +2481,7 @@ const surfaceCommands = [
2422
2481
  jsonPath: ["tax"],
2423
2482
  description: "The tax paid on one unit, a cost component",
2424
2483
  valueName: "value",
2484
+ nullable: true,
2425
2485
  schema: z.string()
2426
2486
  },
2427
2487
  {
@@ -2429,6 +2489,7 @@ const surfaceCommands = [
2429
2489
  jsonPath: ["usefulLife"],
2430
2490
  description: "The number of months one unit is depreciated over, or null to clear it",
2431
2491
  valueName: "number",
2492
+ nullable: true,
2432
2493
  schema: z.coerce.number()
2433
2494
  }
2434
2495
  ]
@@ -2508,6 +2569,7 @@ const surfaceCommands = [
2508
2569
  jsonPath: ["notes"],
2509
2570
  description: "Free-form detail about the adjustment, which a reason of OTHER requires",
2510
2571
  valueName: "value",
2572
+ nullable: true,
2511
2573
  schema: z.string()
2512
2574
  },
2513
2575
  {
@@ -2716,6 +2778,7 @@ const surfaceCommands = [
2716
2778
  jsonPath: ["salePrice"],
2717
2779
  description: "What the customer paid for the asset, which cannot be negative",
2718
2780
  valueName: "value",
2781
+ nullable: true,
2719
2782
  schema: z.string()
2720
2783
  }
2721
2784
  ]
@@ -2781,6 +2844,7 @@ const surfaceCommands = [
2781
2844
  jsonPath: ["customerId"],
2782
2845
  description: "The ID of the customer that owned the asset during the segment",
2783
2846
  valueName: "value",
2847
+ nullable: true,
2784
2848
  schema: z.string()
2785
2849
  },
2786
2850
  {
@@ -2788,6 +2852,7 @@ const surfaceCommands = [
2788
2852
  jsonPath: ["date"],
2789
2853
  description: "The day the segment's owner took ownership, which cannot be in the future",
2790
2854
  valueName: "value",
2855
+ nullable: true,
2791
2856
  schema: z.string()
2792
2857
  },
2793
2858
  {
@@ -2795,6 +2860,7 @@ const surfaceCommands = [
2795
2860
  jsonPath: ["salePrice"],
2796
2861
  description: "What the owner paid for the asset, which cannot be negative",
2797
2862
  valueName: "value",
2863
+ nullable: true,
2798
2864
  schema: z.string()
2799
2865
  }
2800
2866
  ]
@@ -2851,6 +2917,7 @@ const surfaceCommands = [
2851
2917
  jsonPath: ["disposalPrice"],
2852
2918
  description: "What the scrapped asset was sold for, or null when it was not sold",
2853
2919
  valueName: "value",
2920
+ nullable: true,
2854
2921
  schema: z.string()
2855
2922
  },
2856
2923
  {
@@ -2858,6 +2925,7 @@ const surfaceCommands = [
2858
2925
  jsonPath: ["disposalReason"],
2859
2926
  description: "Why the asset was scrapped",
2860
2927
  valueName: "value",
2928
+ nullable: true,
2861
2929
  schema: z.string()
2862
2930
  }
2863
2931
  ]
@@ -2920,6 +2988,7 @@ const surfaceCommands = [
2920
2988
  jsonPath: ["name"],
2921
2989
  description: "The link's display name, or null to show the address instead",
2922
2990
  valueName: "value",
2991
+ nullable: true,
2923
2992
  schema: z.string()
2924
2993
  }, {
2925
2994
  name: "url",
@@ -2963,6 +3032,7 @@ const surfaceCommands = [
2963
3032
  jsonPath: ["notes"],
2964
3033
  description: "Free-form detail about the revision, which a reason of OTHER requires",
2965
3034
  valueName: "value",
3035
+ nullable: true,
2966
3036
  schema: z.string()
2967
3037
  },
2968
3038
  {
@@ -3092,6 +3162,7 @@ const surfaceCommands = [
3092
3162
  jsonPath: ["billingAddress"],
3093
3163
  description: "The address invoices are sent to",
3094
3164
  valueName: "value",
3165
+ nullable: true,
3095
3166
  schema: z.string()
3096
3167
  },
3097
3168
  {
@@ -3099,6 +3170,7 @@ const surfaceCommands = [
3099
3170
  jsonPath: ["billingContact", "email"],
3100
3171
  description: "The billing contact's email address",
3101
3172
  valueName: "value",
3173
+ nullable: true,
3102
3174
  schema: z.string()
3103
3175
  },
3104
3176
  {
@@ -3106,6 +3178,7 @@ const surfaceCommands = [
3106
3178
  jsonPath: ["billingContact", "name"],
3107
3179
  description: "The billing contact's name",
3108
3180
  valueName: "value",
3181
+ nullable: true,
3109
3182
  schema: z.string()
3110
3183
  },
3111
3184
  {
@@ -3113,6 +3186,7 @@ const surfaceCommands = [
3113
3186
  jsonPath: ["billingContact", "phone"],
3114
3187
  description: "The billing contact's phone number",
3115
3188
  valueName: "value",
3189
+ nullable: true,
3116
3190
  schema: z.string()
3117
3191
  },
3118
3192
  {
@@ -3120,6 +3194,7 @@ const surfaceCommands = [
3120
3194
  jsonPath: ["comment"],
3121
3195
  description: "A free-form note about the customer",
3122
3196
  valueName: "value",
3197
+ nullable: true,
3123
3198
  schema: z.string()
3124
3199
  },
3125
3200
  {
@@ -3127,6 +3202,7 @@ const surfaceCommands = [
3127
3202
  jsonPath: ["domain"],
3128
3203
  description: "The customer's web domain, used to look up its logo",
3129
3204
  valueName: "value",
3205
+ nullable: true,
3130
3206
  schema: z.string()
3131
3207
  },
3132
3208
  {
@@ -3134,6 +3210,7 @@ const surfaceCommands = [
3134
3210
  jsonPath: ["externalId"],
3135
3211
  description: "The customer's identifier in another system",
3136
3212
  valueName: "value",
3213
+ nullable: true,
3137
3214
  schema: z.string()
3138
3215
  },
3139
3216
  {
@@ -3190,6 +3267,7 @@ const surfaceCommands = [
3190
3267
  jsonPath: ["billingAddress"],
3191
3268
  description: "The address invoices are sent to",
3192
3269
  valueName: "value",
3270
+ nullable: true,
3193
3271
  schema: z.string()
3194
3272
  },
3195
3273
  {
@@ -3197,6 +3275,7 @@ const surfaceCommands = [
3197
3275
  jsonPath: ["billingContact", "email"],
3198
3276
  description: "The billing contact's email address",
3199
3277
  valueName: "value",
3278
+ nullable: true,
3200
3279
  schema: z.string()
3201
3280
  },
3202
3281
  {
@@ -3204,6 +3283,7 @@ const surfaceCommands = [
3204
3283
  jsonPath: ["billingContact", "name"],
3205
3284
  description: "The billing contact's name",
3206
3285
  valueName: "value",
3286
+ nullable: true,
3207
3287
  schema: z.string()
3208
3288
  },
3209
3289
  {
@@ -3211,6 +3291,7 @@ const surfaceCommands = [
3211
3291
  jsonPath: ["billingContact", "phone"],
3212
3292
  description: "The billing contact's phone number",
3213
3293
  valueName: "value",
3294
+ nullable: true,
3214
3295
  schema: z.string()
3215
3296
  },
3216
3297
  {
@@ -3218,6 +3299,7 @@ const surfaceCommands = [
3218
3299
  jsonPath: ["comment"],
3219
3300
  description: "A free-form note about the customer",
3220
3301
  valueName: "value",
3302
+ nullable: true,
3221
3303
  schema: z.string()
3222
3304
  },
3223
3305
  {
@@ -3225,6 +3307,7 @@ const surfaceCommands = [
3225
3307
  jsonPath: ["domain"],
3226
3308
  description: "The customer's web domain, used to look up its logo",
3227
3309
  valueName: "value",
3310
+ nullable: true,
3228
3311
  schema: z.string()
3229
3312
  },
3230
3313
  {
@@ -3232,24 +3315,28 @@ const surfaceCommands = [
3232
3315
  jsonPath: ["externalId"],
3233
3316
  description: "The customer's identifier in another system",
3234
3317
  valueName: "value",
3318
+ nullable: true,
3235
3319
  schema: z.string()
3236
3320
  },
3237
3321
  {
3238
3322
  name: "is-archived",
3239
3323
  jsonPath: ["isArchived"],
3240
3324
  description: "Whether the customer is archived",
3325
+ nullable: true,
3241
3326
  schema: z.boolean()
3242
3327
  },
3243
3328
  {
3244
3329
  name: "is-customer",
3245
3330
  jsonPath: ["isCustomer"],
3246
3331
  description: "Whether the company is a customer",
3332
+ nullable: true,
3247
3333
  schema: z.boolean()
3248
3334
  },
3249
3335
  {
3250
3336
  name: "is-supplier",
3251
3337
  jsonPath: ["isSupplier"],
3252
3338
  description: "Whether the company is a supplier",
3339
+ nullable: true,
3253
3340
  schema: z.boolean()
3254
3341
  },
3255
3342
  {
@@ -3257,6 +3344,7 @@ const surfaceCommands = [
3257
3344
  jsonPath: ["name"],
3258
3345
  description: "The customer's display name",
3259
3346
  valueName: "value",
3347
+ nullable: true,
3260
3348
  schema: z.string()
3261
3349
  }
3262
3350
  ]
@@ -3433,6 +3521,7 @@ const surfaceCommands = [
3433
3521
  jsonPath: ["description"],
3434
3522
  description: "A free-form description of the item",
3435
3523
  valueName: "value",
3524
+ nullable: true,
3436
3525
  schema: z.string()
3437
3526
  },
3438
3527
  {
@@ -3561,6 +3650,7 @@ const surfaceCommands = [
3561
3650
  name: "accepts-bulk-serials",
3562
3651
  jsonPath: ["acceptsBulkSerials"],
3563
3652
  description: "Whether a BULK item records serial numbers on its units, read only beside type",
3653
+ nullable: true,
3564
3654
  schema: z.boolean()
3565
3655
  },
3566
3656
  {
@@ -3568,6 +3658,7 @@ const surfaceCommands = [
3568
3658
  jsonPath: ["description"],
3569
3659
  description: "The item's new description, or null to clear it",
3570
3660
  valueName: "value",
3661
+ nullable: true,
3571
3662
  schema: z.string()
3572
3663
  },
3573
3664
  {
@@ -3587,6 +3678,7 @@ const surfaceCommands = [
3587
3678
  name: "is-archived",
3588
3679
  jsonPath: ["isArchived"],
3589
3680
  description: "Whether the item is archived, which cannot be null",
3681
+ nullable: true,
3590
3682
  schema: z.boolean()
3591
3683
  },
3592
3684
  {
@@ -3594,6 +3686,7 @@ const surfaceCommands = [
3594
3686
  jsonPath: ["name"],
3595
3687
  description: "The item's new display name, which cannot be empty",
3596
3688
  valueName: "value",
3689
+ nullable: true,
3597
3690
  schema: z.string()
3598
3691
  },
3599
3692
  {
@@ -3601,6 +3694,7 @@ const surfaceCommands = [
3601
3694
  jsonPath: ["sku"],
3602
3695
  description: "The item's new stock keeping unit, which cannot be empty and must be unique within your organization",
3603
3696
  valueName: "value",
3697
+ nullable: true,
3604
3698
  schema: z.string()
3605
3699
  },
3606
3700
  {
@@ -3608,6 +3702,7 @@ const surfaceCommands = [
3608
3702
  jsonPath: ["type"],
3609
3703
  description: "The type to convert the item to, when the item's assets and inventory history allow the conversion",
3610
3704
  valueName: "value",
3705
+ nullable: true,
3611
3706
  schema: z.enum([
3612
3707
  "BULK",
3613
3708
  "DEVICE",
@@ -3640,6 +3735,7 @@ const surfaceCommands = [
3640
3735
  jsonPath: ["allocatedIndirect"],
3641
3736
  description: "One unit's share of overhead, a cost component",
3642
3737
  valueName: "value",
3738
+ nullable: true,
3643
3739
  schema: z.string()
3644
3740
  },
3645
3741
  {
@@ -3647,6 +3743,7 @@ const surfaceCommands = [
3647
3743
  jsonPath: ["billOfMaterials"],
3648
3744
  description: "The parts cost of one unit, a cost component",
3649
3745
  valueName: "value",
3746
+ nullable: true,
3650
3747
  schema: z.string()
3651
3748
  },
3652
3749
  {
@@ -3666,6 +3763,7 @@ const surfaceCommands = [
3666
3763
  jsonPath: ["directLabor"],
3667
3764
  description: "The labor cost to build one unit, a cost component",
3668
3765
  valueName: "value",
3766
+ nullable: true,
3669
3767
  schema: z.string()
3670
3768
  },
3671
3769
  {
@@ -3673,6 +3771,7 @@ const surfaceCommands = [
3673
3771
  jsonPath: ["freightInbound"],
3674
3772
  description: "The shipping cost to receive one unit, a cost component",
3675
3773
  valueName: "value",
3774
+ nullable: true,
3676
3775
  schema: z.string()
3677
3776
  },
3678
3777
  {
@@ -3680,6 +3779,7 @@ const surfaceCommands = [
3680
3779
  jsonPath: ["freightOutbound"],
3681
3780
  description: "The shipping cost to deploy one unit, a deployment cost component",
3682
3781
  valueName: "value",
3782
+ nullable: true,
3683
3783
  schema: z.string()
3684
3784
  },
3685
3785
  {
@@ -3687,6 +3787,7 @@ const surfaceCommands = [
3687
3787
  jsonPath: ["installation"],
3688
3788
  description: "The cost to install one unit, a deployment cost component",
3689
3789
  valueName: "value",
3790
+ nullable: true,
3690
3791
  schema: z.string()
3691
3792
  },
3692
3793
  {
@@ -3694,6 +3795,7 @@ const surfaceCommands = [
3694
3795
  jsonPath: ["interest"],
3695
3796
  description: "The financing cost of one unit, a cost component",
3696
3797
  valueName: "value",
3798
+ nullable: true,
3697
3799
  schema: z.string()
3698
3800
  },
3699
3801
  {
@@ -3701,6 +3803,7 @@ const surfaceCommands = [
3701
3803
  jsonPath: ["salvageValue"],
3702
3804
  description: "The value one unit keeps at the end of its useful life, or null to clear it",
3703
3805
  valueName: "value",
3806
+ nullable: true,
3704
3807
  schema: z.string()
3705
3808
  },
3706
3809
  {
@@ -3708,6 +3811,7 @@ const surfaceCommands = [
3708
3811
  jsonPath: ["simpleCostBasis"],
3709
3812
  description: "A single cost for one unit, which cannot be sent together with the cost components",
3710
3813
  valueName: "value",
3814
+ nullable: true,
3711
3815
  schema: z.string()
3712
3816
  },
3713
3817
  {
@@ -3715,6 +3819,7 @@ const surfaceCommands = [
3715
3819
  jsonPath: ["tariffs"],
3716
3820
  description: "The import duty paid on one unit, a cost component",
3717
3821
  valueName: "value",
3822
+ nullable: true,
3718
3823
  schema: z.string()
3719
3824
  },
3720
3825
  {
@@ -3722,6 +3827,7 @@ const surfaceCommands = [
3722
3827
  jsonPath: ["tax"],
3723
3828
  description: "The tax paid on one unit, a cost component",
3724
3829
  valueName: "value",
3830
+ nullable: true,
3725
3831
  schema: z.string()
3726
3832
  },
3727
3833
  {
@@ -3729,6 +3835,7 @@ const surfaceCommands = [
3729
3835
  jsonPath: ["usefulLife"],
3730
3836
  description: "The number of months one unit is depreciated over, or null to clear it",
3731
3837
  valueName: "number",
3838
+ nullable: true,
3732
3839
  schema: z.coerce.number()
3733
3840
  }
3734
3841
  ]
@@ -3785,6 +3892,7 @@ const surfaceCommands = [
3785
3892
  description: "The field's position within its section, starting at 0",
3786
3893
  valueName: "number",
3787
3894
  required: true,
3895
+ nullable: true,
3788
3896
  schema: z.coerce.number()
3789
3897
  },
3790
3898
  {
@@ -3793,6 +3901,7 @@ const surfaceCommands = [
3793
3901
  description: "The group the field is shown in, starting at 0",
3794
3902
  valueName: "number",
3795
3903
  required: true,
3904
+ nullable: true,
3796
3905
  schema: z.coerce.number()
3797
3906
  }
3798
3907
  ]
@@ -3818,6 +3927,7 @@ const surfaceCommands = [
3818
3927
  jsonPath: ["label"],
3819
3928
  description: "The field's new display name, which cannot be empty",
3820
3929
  valueName: "value",
3930
+ nullable: true,
3821
3931
  schema: z.string()
3822
3932
  }]
3823
3933
  }),
@@ -3958,6 +4068,7 @@ const surfaceCommands = [
3958
4068
  jsonPath: ["address", "addressLine1"],
3959
4069
  description: "The first line of the street address",
3960
4070
  valueName: "value",
4071
+ nullable: true,
3961
4072
  schema: z.string()
3962
4073
  },
3963
4074
  {
@@ -3965,6 +4076,7 @@ const surfaceCommands = [
3965
4076
  jsonPath: ["address", "addressLine2"],
3966
4077
  description: "The second line of the street address, such as a suite",
3967
4078
  valueName: "value",
4079
+ nullable: true,
3968
4080
  schema: z.string()
3969
4081
  },
3970
4082
  {
@@ -3972,6 +4084,7 @@ const surfaceCommands = [
3972
4084
  jsonPath: ["address", "city"],
3973
4085
  description: "The city",
3974
4086
  valueName: "value",
4087
+ nullable: true,
3975
4088
  schema: z.string()
3976
4089
  },
3977
4090
  {
@@ -3979,6 +4092,7 @@ const surfaceCommands = [
3979
4092
  jsonPath: ["address", "country"],
3980
4093
  description: "The country",
3981
4094
  valueName: "value",
4095
+ nullable: true,
3982
4096
  schema: z.string()
3983
4097
  },
3984
4098
  {
@@ -3986,6 +4100,7 @@ const surfaceCommands = [
3986
4100
  jsonPath: ["address", "formattedAddress"],
3987
4101
  description: "The whole address on one line",
3988
4102
  valueName: "value",
4103
+ nullable: true,
3989
4104
  schema: z.string()
3990
4105
  },
3991
4106
  {
@@ -3993,6 +4108,7 @@ const surfaceCommands = [
3993
4108
  jsonPath: ["address", "postalCode"],
3994
4109
  description: "The postal or ZIP code",
3995
4110
  valueName: "value",
4111
+ nullable: true,
3996
4112
  schema: z.string()
3997
4113
  },
3998
4114
  {
@@ -4000,6 +4116,7 @@ const surfaceCommands = [
4000
4116
  jsonPath: ["address", "state"],
4001
4117
  description: "The state or region",
4002
4118
  valueName: "value",
4119
+ nullable: true,
4003
4120
  schema: z.string()
4004
4121
  },
4005
4122
  {
@@ -4007,6 +4124,7 @@ const surfaceCommands = [
4007
4124
  jsonPath: ["consignee"],
4008
4125
  description: "The ID of the customer a zone is designated for, such as for reservations, provisioning or a 3PL",
4009
4126
  valueName: "value",
4127
+ nullable: true,
4010
4128
  schema: z.string()
4011
4129
  },
4012
4130
  {
@@ -4014,6 +4132,7 @@ const surfaceCommands = [
4014
4132
  jsonPath: ["customerId"],
4015
4133
  description: "The ID of the customer to assign a site to, or null for your organization's own site",
4016
4134
  valueName: "value",
4135
+ nullable: true,
4017
4136
  schema: z.string()
4018
4137
  },
4019
4138
  {
@@ -4021,6 +4140,7 @@ const surfaceCommands = [
4021
4140
  jsonPath: ["description"],
4022
4141
  description: "A free-form description of a zone",
4023
4142
  valueName: "value",
4143
+ nullable: true,
4024
4144
  schema: z.string()
4025
4145
  },
4026
4146
  {
@@ -4053,6 +4173,7 @@ const surfaceCommands = [
4053
4173
  jsonPath: ["parentLocationId"],
4054
4174
  description: "The ID of the site a zone belongs to, required for a zone and refused for a site",
4055
4175
  valueName: "value",
4176
+ nullable: true,
4056
4177
  schema: z.string()
4057
4178
  },
4058
4179
  {
@@ -4100,6 +4221,7 @@ const surfaceCommands = [
4100
4221
  jsonPath: ["address", "addressLine1"],
4101
4222
  description: "The first line of the street address",
4102
4223
  valueName: "value",
4224
+ nullable: true,
4103
4225
  schema: z.string()
4104
4226
  },
4105
4227
  {
@@ -4107,6 +4229,7 @@ const surfaceCommands = [
4107
4229
  jsonPath: ["address", "addressLine2"],
4108
4230
  description: "The second line of the street address, such as a suite",
4109
4231
  valueName: "value",
4232
+ nullable: true,
4110
4233
  schema: z.string()
4111
4234
  },
4112
4235
  {
@@ -4114,6 +4237,7 @@ const surfaceCommands = [
4114
4237
  jsonPath: ["address", "city"],
4115
4238
  description: "The city",
4116
4239
  valueName: "value",
4240
+ nullable: true,
4117
4241
  schema: z.string()
4118
4242
  },
4119
4243
  {
@@ -4121,6 +4245,7 @@ const surfaceCommands = [
4121
4245
  jsonPath: ["address", "country"],
4122
4246
  description: "The country",
4123
4247
  valueName: "value",
4248
+ nullable: true,
4124
4249
  schema: z.string()
4125
4250
  },
4126
4251
  {
@@ -4128,6 +4253,7 @@ const surfaceCommands = [
4128
4253
  jsonPath: ["address", "formattedAddress"],
4129
4254
  description: "The whole address on one line",
4130
4255
  valueName: "value",
4256
+ nullable: true,
4131
4257
  schema: z.string()
4132
4258
  },
4133
4259
  {
@@ -4135,6 +4261,7 @@ const surfaceCommands = [
4135
4261
  jsonPath: ["address", "postalCode"],
4136
4262
  description: "The postal or ZIP code",
4137
4263
  valueName: "value",
4264
+ nullable: true,
4138
4265
  schema: z.string()
4139
4266
  },
4140
4267
  {
@@ -4142,6 +4269,7 @@ const surfaceCommands = [
4142
4269
  jsonPath: ["address", "state"],
4143
4270
  description: "The state or region",
4144
4271
  valueName: "value",
4272
+ nullable: true,
4145
4273
  schema: z.string()
4146
4274
  },
4147
4275
  {
@@ -4149,6 +4277,7 @@ const surfaceCommands = [
4149
4277
  jsonPath: ["consignee"],
4150
4278
  description: "The ID of the customer a zone is designated for, such as for reservations, provisioning or a 3PL",
4151
4279
  valueName: "value",
4280
+ nullable: true,
4152
4281
  schema: z.string()
4153
4282
  },
4154
4283
  {
@@ -4156,6 +4285,7 @@ const surfaceCommands = [
4156
4285
  jsonPath: ["customerId"],
4157
4286
  description: "The ID of the customer to assign a site to, or null for your organization's own site",
4158
4287
  valueName: "value",
4288
+ nullable: true,
4159
4289
  schema: z.string()
4160
4290
  },
4161
4291
  {
@@ -4163,30 +4293,35 @@ const surfaceCommands = [
4163
4293
  jsonPath: ["description"],
4164
4294
  description: "A free-form description of a zone",
4165
4295
  valueName: "value",
4296
+ nullable: true,
4166
4297
  schema: z.string()
4167
4298
  },
4168
4299
  {
4169
4300
  name: "is-archived",
4170
4301
  jsonPath: ["isArchived"],
4171
4302
  description: "Whether the location is archived, and archiving a site archives its zones",
4303
+ nullable: true,
4172
4304
  schema: z.boolean()
4173
4305
  },
4174
4306
  {
4175
4307
  name: "is-inventory",
4176
4308
  jsonPath: ["isInventory"],
4177
4309
  description: "Whether assets at the location count as inventory for reporting",
4310
+ nullable: true,
4178
4311
  schema: z.boolean()
4179
4312
  },
4180
4313
  {
4181
4314
  name: "is-inventory-override",
4182
4315
  jsonPath: ["isInventoryOverride"],
4183
4316
  description: "Whether a zone sets its own isInventory rather than inheriting its parent site's, which a site refuses",
4317
+ nullable: true,
4184
4318
  schema: z.boolean()
4185
4319
  },
4186
4320
  {
4187
4321
  name: "is-transient",
4188
4322
  jsonPath: ["isTransient"],
4189
4323
  description: "Whether assets make only occasional or temporary stops at the location, which hides it from location lists by default",
4324
+ nullable: true,
4190
4325
  schema: z.boolean()
4191
4326
  },
4192
4327
  {
@@ -4194,6 +4329,7 @@ const surfaceCommands = [
4194
4329
  jsonPath: ["name"],
4195
4330
  description: "The location's display name",
4196
4331
  valueName: "value",
4332
+ nullable: true,
4197
4333
  schema: z.string()
4198
4334
  },
4199
4335
  {
@@ -4280,12 +4416,14 @@ const surfaceCommands = [
4280
4416
  jsonPath: ["name"],
4281
4417
  description: "The link's display name, or null to show the address instead",
4282
4418
  valueName: "value",
4419
+ nullable: true,
4283
4420
  schema: z.string()
4284
4421
  }, {
4285
4422
  name: "url",
4286
4423
  jsonPath: ["url"],
4287
4424
  description: "The address the link points to, which cannot be empty or null",
4288
4425
  valueName: "value",
4426
+ nullable: true,
4289
4427
  schema: z.string()
4290
4428
  }]
4291
4429
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardfin/cli",
3
- "version": "0.0.2-dev.12",
3
+ "version": "0.0.2-dev.13",
4
4
  "description": "Command line interface for the Hardfin API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hardfin, Inc.",