@dsptch-work/api-client 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,8 @@ export const zProblem = z.object({
7
7
  type: z.url(),
8
8
  title: z.string(),
9
9
  status: z.int(),
10
- detail: z.string()
10
+ detail: z.string(),
11
+ instance: z.url().optional()
11
12
  });
12
13
  /**
13
14
  * Error types
@@ -147,6 +148,20 @@ export const zProblem = z.object({
147
148
  *
148
149
  * Cancelling this timecode's scheduled termination would silently discard changes recorded since it was terminated. Re-read the timecode and reconcile before retrying.
149
150
  *
151
+ * ### version_overlap
152
+ *
153
+ * **Version Overlap**
154
+ *
155
+ * The write conflicts with what is already recorded for the resource — another version occupies the same span, or the write contradicts the resource's recorded identity. Re-read the current state and retry on top of it.
156
+ *
157
+ * ## 412
158
+ *
159
+ * ### precondition_failed
160
+ *
161
+ * **Precondition Failed**
162
+ *
163
+ * The `If-Match` validator names a version of this resource that is no longer current — the version family changed after you read it. Re-read the resource, take its fresh `ETag`, and reapply your change on top of the current state. A malformed or unrecognizable validator refuses the same way, since neither matches.
164
+ *
150
165
  * ## 422
151
166
  *
152
167
  * ### attachment_not_image
@@ -251,6 +266,14 @@ export const zProblem = z.object({
251
266
  *
252
267
  * The apprentice's wage schedule does not belong to the program in the URL. Use a schedule from that program.
253
268
  *
269
+ * ## 428
270
+ *
271
+ * ### precondition_required
272
+ *
273
+ * **Precondition Required**
274
+ *
275
+ * The write must state which version of the resource it was composed against, and no `If-Match` was sent. Read the resource, send its `ETag` back as `If-Match`, or send `If-Match: *` to write unconditionally against whatever exists.
276
+ *
254
277
  * ## 429
255
278
  *
256
279
  * ### too_many_requests
@@ -289,6 +312,8 @@ export const zProblemTypeCatalog = z.enum([
289
312
  'insufficient_api_key_scope',
290
313
  'not_found',
291
314
  'recorded_since_termination',
315
+ 'version_overlap',
316
+ 'precondition_failed',
292
317
  'attachment_not_image',
293
318
  'company_not_employer',
294
319
  'confirm_apprenticeship_conflict',
@@ -306,6 +331,7 @@ export const zProblemTypeCatalog = z.enum([
306
331
  'user_not_company_member',
307
332
  'validation_failed',
308
333
  'wage_schedule_outside_program',
334
+ 'precondition_required',
309
335
  'too_many_requests',
310
336
  'internal_error'
311
337
  ]);
@@ -1687,6 +1713,11 @@ export const zJobParameters = z.object({
1687
1713
  tz_name: z.string().optional(),
1688
1714
  time_card_start_day: zTimeCardStartDay.optional(),
1689
1715
  require_clock_in: z.boolean().nullish(),
1716
+ clock_in_requirement: z.enum([
1717
+ 'none',
1718
+ 'warning',
1719
+ 'required'
1720
+ ]).optional(),
1690
1721
  send_geofence_reminders: z.boolean().nullish(),
1691
1722
  allow_customer_access: z.boolean().optional(),
1692
1723
  timekeeping_timecode_ids: z.array(z.string()).nullish(),
@@ -2834,8 +2865,8 @@ export const zUserCertificationParameters = z.object({
2834
2865
  certification_id: z.string(),
2835
2866
  received_at: z.iso.datetime(),
2836
2867
  file: z.object({
2837
- name: z.string().optional(),
2838
- content: z.string().optional()
2868
+ name: z.string().max(255).regex(/^[\w\s.-]*\.[A-Za-z0-9]+$/),
2869
+ content: z.string()
2839
2870
  }).nullish(),
2840
2871
  verified: z.boolean().nullish(),
2841
2872
  expiration_date: z.iso.date().nullish(),
@@ -2888,7 +2919,12 @@ export const zJobResponseObject = z.object({
2888
2919
  purchase_order_number: z.string().nullable(),
2889
2920
  time_card_start_day: zTimeCardStartDay,
2890
2921
  tz_name: z.string(),
2891
- require_clock_in: z.boolean().nullable(),
2922
+ require_clock_in: z.boolean(),
2923
+ clock_in_requirement: z.enum([
2924
+ 'none',
2925
+ 'warning',
2926
+ 'required'
2927
+ ]),
2892
2928
  name: z.string().nullable(),
2893
2929
  federal_pwa_mode: z.enum([
2894
2930
  'all',
@@ -3778,20 +3814,13 @@ export const zAssetsVendorParameters = z.object({
3778
3814
  logo_signed_id: z.string().optional()
3779
3815
  });
3780
3816
  /**
3781
- * A physical container that holds a company's assets and inventory — either a fixed, Atlas-mapped location (warehouse or yard) or a standalone mobile container (trailer, truck, van, or conex).
3817
+ * A location that holds a company's assets and inventory — a warehouse or yard, optionally backed by a site on the Atlas map.
3782
3818
  */
3783
3819
  export const zAssetsSiteResponseObject = z.object({
3784
3820
  id: z.string(),
3785
3821
  company_id: z.string(),
3786
3822
  site_id: z.string().nullable(),
3787
- kind: z.enum([
3788
- 'warehouse',
3789
- 'yard',
3790
- 'trailer',
3791
- 'truck',
3792
- 'van',
3793
- 'conex'
3794
- ]),
3823
+ kind: z.enum(['warehouse', 'yard']),
3795
3824
  name: z.string(),
3796
3825
  site_type: z.string().nullable(),
3797
3826
  created_at: z.iso.datetime(),
@@ -3799,30 +3828,21 @@ export const zAssetsSiteResponseObject = z.object({
3799
3828
  });
3800
3829
  export const zAssetsSiteParameters = z.intersection(z.union([
3801
3830
  z.object({
3802
- kind: z.enum(['warehouse', 'yard']),
3803
- site_id: z.string()
3831
+ site_id: z.string().min(1)
3804
3832
  }),
3805
3833
  z.object({
3806
- kind: z.enum([
3807
- 'trailer',
3808
- 'truck',
3809
- 'van',
3810
- 'conex'
3811
- ]),
3812
- name: z.string()
3834
+ name: z.string().min(1)
3813
3835
  })
3814
3836
  ]), z.object({
3815
- kind: z.enum([
3816
- 'warehouse',
3817
- 'yard',
3818
- 'trailer',
3819
- 'truck',
3820
- 'van',
3821
- 'conex'
3822
- ]),
3837
+ kind: z.enum(['warehouse', 'yard']),
3823
3838
  site_id: z.string().nullish(),
3824
3839
  name: z.string().nullish()
3825
3840
  }));
3841
+ export const zAssetsSiteUpdateParameters = z.object({
3842
+ kind: z.enum(['warehouse', 'yard']).optional(),
3843
+ site_id: z.string().nullish(),
3844
+ name: z.string().nullish()
3845
+ });
3826
3846
  /**
3827
3847
  * A company-level rule that auto-generates asset form assignments. When an item of one of its products changes custody (an assignment or unassignment), the rule creates or refreshes a form task for the chosen users, due on the configured schedule.
3828
3848
  */
@@ -4143,7 +4163,44 @@ export const zAssetsItemFormAssignmentParameters = z.object({
4143
4163
  recurrence_end_time: z.iso.datetime().nullish(),
4144
4164
  task_assignee_user_ids: z.array(z.string()).optional(),
4145
4165
  reminders_attributes: z.array(z.object({
4146
- offset: z.string().optional()
4166
+ offset: z.enum([
4167
+ 'PT0S',
4168
+ 'PT-1M',
4169
+ 'PT-5M',
4170
+ 'PT-10M',
4171
+ 'PT-15M',
4172
+ 'PT-30M',
4173
+ 'PT-1H',
4174
+ 'PT-2H',
4175
+ 'P-1D',
4176
+ 'P-2D',
4177
+ 'P-3D',
4178
+ 'P-4D',
4179
+ 'P-5D',
4180
+ 'P-6D',
4181
+ 'P-1W',
4182
+ 'P-2W',
4183
+ 'P-1M',
4184
+ 'P-2M',
4185
+ 'P-3M',
4186
+ 'P-6M',
4187
+ 'P-1Y',
4188
+ 'PT5M',
4189
+ 'PT15M',
4190
+ 'PT30M',
4191
+ 'PT1H',
4192
+ 'PT6H',
4193
+ 'PT12H',
4194
+ 'P1D',
4195
+ 'P2D',
4196
+ 'P3D',
4197
+ 'P4D',
4198
+ 'P5D',
4199
+ 'P6D',
4200
+ 'P1W',
4201
+ 'P2W',
4202
+ 'P3W'
4203
+ ])
4147
4204
  })).optional()
4148
4205
  })
4149
4206
  });
@@ -5295,7 +5352,7 @@ export const zGetAssetsSitePath = z.object({
5295
5352
  * Success
5296
5353
  */
5297
5354
  export const zGetAssetsSiteResponse = zAssetsSiteResponseObject;
5298
- export const zUpdateSiteBody = zAssetsSiteParameters;
5355
+ export const zUpdateSiteBody = zAssetsSiteUpdateParameters;
5299
5356
  export const zUpdateSitePath = z.object({
5300
5357
  id: z.string()
5301
5358
  });
@@ -5999,6 +6056,9 @@ export const zCreateWageDeterminationPath = z.object({
5999
6056
  * Created
6000
6057
  */
6001
6058
  export const zCreateWageDeterminationResponse = zJobWageDeterminationResponseObject;
6059
+ export const zDeleteWageDeterminationHeaders = z.object({
6060
+ 'If-Match': z.string()
6061
+ });
6002
6062
  export const zDeleteWageDeterminationPath = z.object({
6003
6063
  job_id: z.string(),
6004
6064
  uid: z.string()
@@ -6596,11 +6656,56 @@ export const zCreateFormAssignmentTaskBody = z.object({
6596
6656
  created_by_user_id: z.string(),
6597
6657
  time_due: z.string().optional(),
6598
6658
  tz_name: z.string().optional(),
6599
- frequency: z.string().optional(),
6659
+ frequency: z.enum([
6660
+ 'DAILY',
6661
+ 'WORKDAILY',
6662
+ 'WORKDAILYSIX',
6663
+ 'WEEKLY',
6664
+ 'BIWEEKLY',
6665
+ 'MONTHLY',
6666
+ 'QUARTERLY'
6667
+ ]).optional(),
6600
6668
  recurrence_end_time: z.string().optional(),
6601
6669
  task_assignee_user_ids: z.array(z.string()).optional(),
6602
6670
  reminders_attributes: z.array(z.object({
6603
- offset: z.string().optional()
6671
+ offset: z.enum([
6672
+ 'PT0S',
6673
+ 'PT-1M',
6674
+ 'PT-5M',
6675
+ 'PT-10M',
6676
+ 'PT-15M',
6677
+ 'PT-30M',
6678
+ 'PT-1H',
6679
+ 'PT-2H',
6680
+ 'P-1D',
6681
+ 'P-2D',
6682
+ 'P-3D',
6683
+ 'P-4D',
6684
+ 'P-5D',
6685
+ 'P-6D',
6686
+ 'P-1W',
6687
+ 'P-2W',
6688
+ 'P-1M',
6689
+ 'P-2M',
6690
+ 'P-3M',
6691
+ 'P-6M',
6692
+ 'P-1Y',
6693
+ 'PT5M',
6694
+ 'PT15M',
6695
+ 'PT30M',
6696
+ 'PT1H',
6697
+ 'PT6H',
6698
+ 'PT12H',
6699
+ 'P1D',
6700
+ 'P2D',
6701
+ 'P3D',
6702
+ 'P4D',
6703
+ 'P5D',
6704
+ 'P6D',
6705
+ 'P1W',
6706
+ 'P2W',
6707
+ 'P3W'
6708
+ ])
6604
6709
  })).optional()
6605
6710
  })
6606
6711
  });
@@ -6844,6 +6949,9 @@ export const zListTimecodeHistoryResponse = z.object({
6844
6949
  links: zLinks.optional(),
6845
6950
  data: z.array(zTimecodeHistoryVersionObject).optional()
6846
6951
  });
6952
+ export const zCancelTimecodeScheduledChangesHeaders = z.object({
6953
+ 'If-Match': z.string()
6954
+ });
6847
6955
  export const zCancelTimecodeScheduledChangesPath = z.object({
6848
6956
  timecode_id: z.string()
6849
6957
  });
@@ -6859,6 +6967,9 @@ export const zListTimecodeScheduledChangesPath = z.object({
6859
6967
  */
6860
6968
  export const zListTimecodeScheduledChangesResponse = z.array(zTimecodeResponseObject);
6861
6969
  export const zScheduleTimecodeChangeBody = zTimecodeScheduledChangeParameters;
6970
+ export const zScheduleTimecodeChangeHeaders = z.object({
6971
+ 'If-Match': z.string()
6972
+ });
6862
6973
  export const zScheduleTimecodeChangePath = z.object({
6863
6974
  timecode_id: z.string()
6864
6975
  });
@@ -6866,6 +6977,9 @@ export const zScheduleTimecodeChangePath = z.object({
6866
6977
  * Created
6867
6978
  */
6868
6979
  export const zScheduleTimecodeChangeResponse = zTimecodeResponseObject;
6980
+ export const zCancelTimecodeScheduledTerminationHeaders = z.object({
6981
+ 'If-Match': z.string()
6982
+ });
6869
6983
  export const zCancelTimecodeScheduledTerminationPath = z.object({
6870
6984
  timecode_id: z.string()
6871
6985
  });
@@ -6914,6 +7028,9 @@ export const zGetTimecodeQuery = z.object({
6914
7028
  */
6915
7029
  export const zGetTimecodeResponse = zTimecodeResponseObject;
6916
7030
  export const zUpdateTimecodeBody = zTimecodeParameters;
7031
+ export const zUpdateTimecodeHeaders = z.object({
7032
+ 'If-Match': z.string()
7033
+ });
6917
7034
  export const zUpdateTimecodePath = z.object({
6918
7035
  id: z.string()
6919
7036
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsptch-work/api-client",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Generated TypeScript client for the DSPTCH REST API.",
5
5
  "keywords": [
6
6
  "dsptch",
@@ -61,9 +61,12 @@
61
61
  },
62
62
  "scripts": {
63
63
  "generate": "openapi-ts",
64
+ "prebuild": "node ../../bin/generate-api-clients.mjs --only public",
64
65
  "build": "tsc -p tsconfig.build.json",
66
+ "pretypecheck": "node ../../bin/generate-api-clients.mjs --only public",
65
67
  "typecheck": "tsc --noEmit",
66
68
  "lint:package": "publint",
69
+ "pretest": "node ../../bin/generate-api-clients.mjs --only public",
67
70
  "test": "vitest run",
68
71
  "test:watch": "vitest"
69
72
  },