@dsptch-work/api-client 0.32.0 → 0.33.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.
@@ -176,6 +176,12 @@ export const zProblem = z.object({
176
176
  *
177
177
  * The resource's timeline already ends at a scheduled termination, and scheduling a second one would silently move it. Moving an end is two steps on purpose: cancel the standing termination, then schedule the one you want.
178
178
  *
179
+ * ### authorization_revoked
180
+ *
181
+ * **Authorization Revoked**
182
+ *
183
+ * The assessor grant is revoked. A revoked grant keeps its row as history and cannot be changed or revoked again. To make the user an assessor again, grant them anew.
184
+ *
179
185
  * ### import_in_progress
180
186
  *
181
187
  * **Import In Progress**
@@ -356,11 +362,17 @@ export const zProblem = z.object({
356
362
  *
357
363
  * ## 503
358
364
  *
365
+ * ### database_timeout
366
+ *
367
+ * **Database Timeout**
368
+ *
369
+ * A database statement behind the request ran past the server's time limit and was stopped before it finished. The request may be fine as sent — resend it after the `Retry-After` window, and if it keeps timing out, ask for less at once, such as a narrower filter or a smaller page.
370
+ *
359
371
  * ### write_contended
360
372
  *
361
373
  * **Write Contended**
362
374
  *
363
- * Another write to the same resource held it for longer than this request was willing to wait, so nothing was applied. The request itself is fine — resend it unchanged after the `Retry-After` window.
375
+ * Another write to the same resource held it for longer than this request was willing to wait, or collided with it, so nothing was applied. The request itself is fine — resend it unchanged after the `Retry-After` window.
364
376
  *
365
377
  */
366
378
  export const zProblemTypeCatalog = z.enum([
@@ -388,6 +400,7 @@ export const zProblemTypeCatalog = z.enum([
388
400
  'not_found',
389
401
  'already_subscribed',
390
402
  'already_terminated',
403
+ 'authorization_revoked',
391
404
  'import_in_progress',
392
405
  'pay_schedule_already_exists',
393
406
  'product_archived',
@@ -416,6 +429,7 @@ export const zProblemTypeCatalog = z.enum([
416
429
  'precondition_required',
417
430
  'too_many_requests',
418
431
  'internal_error',
432
+ 'database_timeout',
419
433
  'write_contended'
420
434
  ]);
421
435
  export const zApiKeyScopeResponseObject = z.object({
@@ -478,6 +492,42 @@ export const zDirectUploadResponseObject = z.object({
478
492
  headers: z.record(z.string(), z.string())
479
493
  })
480
494
  });
495
+ /**
496
+ * One assessor-registry grant for one standard. Department scope is informational. revoked_at is null while the grant is active.
497
+ */
498
+ export const zCompetencyAssessorAuthorizationResponseObject = z.object({
499
+ id: z.string(),
500
+ user_id: z.string(),
501
+ competencies_standard_id: z.string(),
502
+ companies_department_id: z.string().nullable(),
503
+ kind: z.enum(['authorized_assessor', 'qualified_assessor']),
504
+ granted_by_user_id: z.string(),
505
+ granted_at: z.iso.datetime(),
506
+ revoked_at: z.iso.datetime().nullable(),
507
+ state: z.enum(['active', 'revoked']),
508
+ created_at: z.iso.datetime(),
509
+ updated_at: z.iso.datetime()
510
+ });
511
+ /**
512
+ * Grant an assessor role for one standard. A user key grants as its user. A company key names the grantor. An active grant of the same kind for the same user and standard is unique.
513
+ */
514
+ export const zCompetencyAssessorAuthorizationParameters = z.object({
515
+ user_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/),
516
+ kind: z.enum(['authorized_assessor', 'qualified_assessor']),
517
+ competencies_standard_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/),
518
+ companies_department_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/).nullish(),
519
+ granted_by_user_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/).optional()
520
+ });
521
+ /**
522
+ * Update the department note on an active grant. Kind, user, standard, and grantor are fixed. A revoked grant answers 409 authorization_revoked.
523
+ */
524
+ export const zCompetencyAssessorAuthorizationUpdateParameters = z.object({
525
+ companies_department_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/).nullish()
526
+ });
527
+ /**
528
+ * Revoke an active grant. The body takes no fields; send an empty object or no body. Revocation sets revoked_at and keeps the row; revoking it again answers 409 authorization_revoked.
529
+ */
530
+ export const zCompetencyAssessorAuthorizationRevocationParameters = z.record(z.string(), z.never());
481
531
  /**
482
532
  * A durable standing. The candidate passed the standard at level_sort_order. There is no level id, so the standing survives the next revision. This API does not create or update qualifications.
483
533
  */
@@ -1363,7 +1413,7 @@ export const zPerDiemResponseObject = z.object({
1363
1413
  currency: z.string(),
1364
1414
  taxable: z.boolean(),
1365
1415
  default: z.boolean().nullable(),
1366
- active: z.boolean().nullable(),
1416
+ active: z.boolean(),
1367
1417
  work_type_ids: z.array(z.string()),
1368
1418
  timekeeping_timecode_ids: z.array(z.string()),
1369
1419
  created_at: z.iso.datetime(),
@@ -1378,8 +1428,8 @@ export const zPerDiemParameters = z.object({
1378
1428
  rate_cents: z.string(),
1379
1429
  currency: z.string(),
1380
1430
  taxable: z.boolean().optional(),
1381
- default: z.boolean().nullish(),
1382
- active: z.boolean().nullish(),
1431
+ default: z.boolean().optional(),
1432
+ active: z.boolean().optional(),
1383
1433
  work_type_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional(),
1384
1434
  timekeeping_timecode_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional()
1385
1435
  });
@@ -1392,8 +1442,8 @@ export const zPerDiemUpdateParameters = z.object({
1392
1442
  rate_cents: z.string().optional(),
1393
1443
  currency: z.string().optional(),
1394
1444
  taxable: z.boolean().optional(),
1395
- default: z.boolean().nullish(),
1396
- active: z.boolean().nullish(),
1445
+ default: z.boolean().optional(),
1446
+ active: z.boolean().optional(),
1397
1447
  work_type_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional(),
1398
1448
  timekeeping_timecode_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional()
1399
1449
  });
@@ -2490,7 +2540,12 @@ export const zCustomFieldConfigsResponseObject = z.object({
2490
2540
  id: z.string(),
2491
2541
  name: z.string(),
2492
2542
  description: z.string().nullable(),
2493
- model_type: z.string(),
2543
+ model_type: z.enum([
2544
+ 'apprenticeship_apprentice',
2545
+ 'company',
2546
+ 'job',
2547
+ 'user_company'
2548
+ ]),
2494
2549
  visible: z.boolean(),
2495
2550
  company_id: z.string(),
2496
2551
  created_at: z.iso.datetime(),
@@ -2511,17 +2566,11 @@ export const zCustomFieldConfigParameters = z.object({
2511
2566
  visible: z.boolean().optional()
2512
2567
  });
2513
2568
  /**
2514
- * Request body for updating a custom field definition. Every field is optional; omit a field to preserve its current value. The resulting definition's name must remain unique for its company and model type.
2569
+ * Request body for updating a custom field definition. Every field is optional; omit a field to preserve its current value. `model_type` is fixed at creation, so sending it answers 400. The resulting definition's name must remain unique for its company and model type.
2515
2570
  */
2516
2571
  export const zCustomFieldConfigUpdateParameters = z.object({
2517
2572
  name: z.string().optional(),
2518
2573
  description: z.string().nullish(),
2519
- model_type: z.enum([
2520
- 'apprenticeship_apprentice',
2521
- 'company',
2522
- 'job',
2523
- 'user_company'
2524
- ]).optional(),
2525
2574
  visible: z.boolean().optional()
2526
2575
  });
2527
2576
  /**
@@ -2662,7 +2711,7 @@ export const zUserCompanyScheduledChange = z.object({
2662
2711
  id: z.string(),
2663
2712
  start_date: z.string(),
2664
2713
  hourly_rate: z.string().nullable(),
2665
- compensation_type: z.string(),
2714
+ compensation_type: z.enum(['hourly', 'salary']),
2666
2715
  overtime_eligible: z.boolean(),
2667
2716
  training_annual_amount: z.string().nullable(),
2668
2717
  employer_combined_health_amount: z.string().nullable(),
@@ -3666,14 +3715,16 @@ export const zFeatureResponseObject = z.object({
3666
3715
  updated_at: z.iso.datetime()
3667
3716
  });
3668
3717
  /**
3669
- * A billing metric — the count of distinct prevailing-wage/apprenticeship (PWA) tracked workers on a project in a given month, aggregated for the billed company. One row per project per month.
3718
+ * A billing metric — the count of distinct prevailing-wage/apprenticeship (PWA) tracked workers on one billable unit in a given month, aggregated for the billed company. A billable unit is a project (one row per project per month, counting workers once across every job in the project tree) or a job outside any project (one row per job per month). Exactly one of `project_id` and `job_id` is set.
3670
3719
  */
3671
3720
  export const zBillingPwaUserCountByProjectByMonthResponseObject = z.object({
3672
3721
  year_month: z.string(),
3673
3722
  year: z.int(),
3674
3723
  month: z.int(),
3675
- project_id: z.string(),
3676
- project_name: z.string(),
3724
+ project_id: z.string().nullable(),
3725
+ project_name: z.string().nullable(),
3726
+ job_id: z.string().nullable(),
3727
+ job_name: z.string().nullable(),
3677
3728
  user_count: z.int()
3678
3729
  });
3679
3730
  /**
@@ -4826,7 +4877,7 @@ export const zProductionCompletionUpdateParameters = z.object({
4826
4877
  * Fields shared by both completion payload kinds.
4827
4878
  */
4828
4879
  export const zProductionCompletionBaseParameters = z.object({
4829
- production_job_scope_price_id: z.string().optional(),
4880
+ production_job_scope_price_id: z.string(),
4830
4881
  performed_by_user_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/),
4831
4882
  notes: z.string().nullish(),
4832
4883
  work_date: z.iso.date().optional(),
@@ -5232,7 +5283,7 @@ export const zUserResponseObject = z.object({
5232
5283
  overtime_eligible: z.boolean().nullable(),
5233
5284
  enrolled_in_t_and_a: z.boolean().nullable(),
5234
5285
  payroll_id: z.string().nullable(),
5235
- compensation_type: z.string().nullable(),
5286
+ compensation_type: z.enum(['hourly', 'salary']).nullable(),
5236
5287
  hourly_rate: z.string().nullish(),
5237
5288
  training_annual_amount: z.string().nullish(),
5238
5289
  employer_combined_health_amount: z.string().nullish(),
@@ -6886,7 +6937,8 @@ export const zAssetsFormAssignmentTriggerResponseObject = z.object({
6886
6937
  * Create or update a form-assignment trigger rule. form_definition_id, triggered_by, assign_to, first_due_by, tz_name, and time_of_day_due are required; the day fields depend on first_due_by, and assigned_user_ids applies only to the custom assign_to mode.
6887
6938
  */
6888
6939
  export const zAssetsFormAssignmentTriggerParameters = z.object({
6889
- form_definition_id: z.string(),
6940
+ form_definition_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/),
6941
+ name: z.string().nullish(),
6890
6942
  triggered_by: z.enum(['assignment', 'unassignment']),
6891
6943
  assign_to: z.enum([
6892
6944
  'custom',
@@ -6898,9 +6950,6 @@ export const zAssetsFormAssignmentTriggerParameters = z.object({
6898
6950
  'day_of_week',
6899
6951
  'day_of_month'
6900
6952
  ]),
6901
- tz_name: z.string(),
6902
- time_of_day_due: z.string(),
6903
- name: z.string().nullish(),
6904
6953
  recurrence_frequency: z.enum([
6905
6954
  'DAILY',
6906
6955
  'WORKDAILY',
@@ -6910,16 +6959,19 @@ export const zAssetsFormAssignmentTriggerParameters = z.object({
6910
6959
  'MONTHLY',
6911
6960
  'QUARTERLY'
6912
6961
  ]).nullish(),
6913
- day_of_week_due: z.int().nullish(),
6914
- day_of_month_due: z.int().nullish(),
6915
- assigned_user_ids: z.array(z.string()).optional(),
6916
- assets_product_ids: z.array(z.string()).optional()
6962
+ day_of_week_due: z.int().gte(0).lte(6).nullish(),
6963
+ day_of_month_due: z.int().gte(1).lte(31).nullish(),
6964
+ tz_name: z.string(),
6965
+ time_of_day_due: z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/),
6966
+ assigned_user_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional(),
6967
+ assets_product_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional()
6917
6968
  });
6918
6969
  /**
6919
6970
  * Update a form-assignment trigger rule. All fields are optional — send only what changes. When changing first_due_by, include the matching day field when required; assigned_user_ids applies only to the custom assign_to mode.
6920
6971
  */
6921
6972
  export const zAssetsFormAssignmentTriggerUpdateParameters = z.object({
6922
- form_definition_id: z.string().optional(),
6973
+ form_definition_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/).optional(),
6974
+ name: z.string().nullish(),
6923
6975
  triggered_by: z.enum(['assignment', 'unassignment']).optional(),
6924
6976
  assign_to: z.enum([
6925
6977
  'custom',
@@ -6931,9 +6983,6 @@ export const zAssetsFormAssignmentTriggerUpdateParameters = z.object({
6931
6983
  'day_of_week',
6932
6984
  'day_of_month'
6933
6985
  ]).optional(),
6934
- tz_name: z.string().optional(),
6935
- time_of_day_due: z.string().optional(),
6936
- name: z.string().nullish(),
6937
6986
  recurrence_frequency: z.enum([
6938
6987
  'DAILY',
6939
6988
  'WORKDAILY',
@@ -6943,10 +6992,12 @@ export const zAssetsFormAssignmentTriggerUpdateParameters = z.object({
6943
6992
  'MONTHLY',
6944
6993
  'QUARTERLY'
6945
6994
  ]).nullish(),
6946
- day_of_week_due: z.int().nullish(),
6947
- day_of_month_due: z.int().nullish(),
6948
- assigned_user_ids: z.array(z.string()).optional(),
6949
- assets_product_ids: z.array(z.string()).optional()
6995
+ day_of_week_due: z.int().gte(0).lte(6).nullish(),
6996
+ day_of_month_due: z.int().gte(1).lte(31).nullish(),
6997
+ tz_name: z.string().optional(),
6998
+ time_of_day_due: z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/).optional(),
6999
+ assigned_user_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional(),
7000
+ assets_product_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).optional()
6950
7001
  });
6951
7002
  /**
6952
7003
  * A file attached to an asset — an item or product image, or a service-event attachment. Uploaded through the direct-upload flow; the response carries a URL to download it.
@@ -7702,16 +7753,20 @@ export const zAssetsArchiveParameters = z.object({
7702
7753
  * Create the template's schedule on the product's serial items that don't have one yet. Items whose matching schedule has a different cadence are blocked and never seeded.
7703
7754
  */
7704
7755
  export const zAssetsServiceScheduleSeedParameters = z.object({
7705
- assets_item_ids: z.array(z.string()).min(1).optional(),
7756
+ assets_item_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).min(1).optional(),
7706
7757
  performed_by_user_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)
7707
7758
  });
7708
7759
  /**
7709
7760
  * Rewrite blocked schedules — those sharing the template's name and kind with a different interval — to the template's cadence, which links them to it.
7710
7761
  */
7711
7762
  export const zAssetsServiceScheduleSyncParameters = z.object({
7712
- schedule_ids: z.array(z.string()).min(1).optional(),
7763
+ schedule_ids: z.array(z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)).min(1).optional(),
7713
7764
  performed_by_user_id: z.string().regex(/[^\x09-\x0D\x20…   - ‧-‪   ]|[‧‪]/)
7714
7765
  });
7766
+ /**
7767
+ * Revoke an active grant. The body takes no fields; send an empty object or no body. Revocation sets revoked_at and keeps the row; revoking it again answers 409 authorization_revoked.
7768
+ */
7769
+ export const zCompetencyAssessorAuthorizationRevocationParametersWritable = z.record(z.string(), z.never());
7715
7770
  /**
7716
7771
  * A certification held by a worker — the record that a worker earned a certification, with its receipt date, optional expiry, and verification state.
7717
7772
  */
@@ -8966,6 +9021,7 @@ export const zGetAtlasSiteResponse = zSiteResponseObject;
8966
9021
  export const zListPwaUserCountsByProjectByMonthsQuery = z.object({
8967
9022
  'filter[year_month]': z.string().optional(),
8968
9023
  'filter[project_id]': z.string().optional(),
9024
+ 'filter[job_id]': z.string().optional(),
8969
9025
  filter: z.string().optional(),
8970
9026
  'filter[unexpected]': z.string().optional()
8971
9027
  });
@@ -9276,6 +9332,66 @@ export const zGetEvidenceItemPath = z.object({
9276
9332
  * Success
9277
9333
  */
9278
9334
  export const zGetEvidenceItemResponse = zCompetencyEvidenceItemResponseObject;
9335
+ export const zListAssessorAuthorizationsQuery = z.object({
9336
+ 'filter[user_id]': z.string().optional(),
9337
+ 'filter[companies_department_id]': z.string().optional(),
9338
+ 'filter[competencies_standard_id]': z.string().optional(),
9339
+ 'filter[kind]': z.array(z.enum(['authorized_assessor', 'qualified_assessor'])).optional(),
9340
+ 'filter[state]': z.enum([
9341
+ 'active',
9342
+ 'revoked',
9343
+ 'all'
9344
+ ]).optional(),
9345
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
9346
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
9347
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
9348
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
9349
+ 'filter[granted_at][gte]': z.iso.datetime().optional(),
9350
+ 'filter[granted_at][lte]': z.iso.datetime().optional(),
9351
+ 'filter[revoked_at][gte]': z.iso.datetime().optional(),
9352
+ 'filter[revoked_at][lte]': z.iso.datetime().optional(),
9353
+ filter: z.string().optional(),
9354
+ 'filter[unexpected]': z.string().optional(),
9355
+ 'page[cursor]': z.string().optional(),
9356
+ 'page[limit]': z.int().gte(1).optional().default(20),
9357
+ page: z.string().optional()
9358
+ });
9359
+ /**
9360
+ * Success
9361
+ */
9362
+ export const zListAssessorAuthorizationsResponse = z.object({
9363
+ meta: zMeta,
9364
+ links: zLinks,
9365
+ data: z.array(zCompetencyAssessorAuthorizationResponseObject)
9366
+ });
9367
+ export const zCreateAssessorAuthorizationBody = zCompetencyAssessorAuthorizationParameters;
9368
+ /**
9369
+ * Created
9370
+ */
9371
+ export const zCreateAssessorAuthorizationResponse = zCompetencyAssessorAuthorizationResponseObject;
9372
+ export const zGetAssessorAuthorizationPath = z.object({
9373
+ id: z.string()
9374
+ });
9375
+ /**
9376
+ * Success
9377
+ */
9378
+ export const zGetAssessorAuthorizationResponse = zCompetencyAssessorAuthorizationResponseObject;
9379
+ export const zUpdateAssessorAuthorizationBody = zCompetencyAssessorAuthorizationUpdateParameters;
9380
+ export const zUpdateAssessorAuthorizationPath = z.object({
9381
+ id: z.string()
9382
+ });
9383
+ /**
9384
+ * Success
9385
+ */
9386
+ export const zUpdateAssessorAuthorizationResponse = zCompetencyAssessorAuthorizationResponseObject;
9387
+ export const zRevokeAssessorAuthorizationBody = zCompetencyAssessorAuthorizationRevocationParametersWritable;
9388
+ export const zRevokeAssessorAuthorizationPath = z.object({
9389
+ assessor_authorization_id: z.string()
9390
+ });
9391
+ /**
9392
+ * Created
9393
+ */
9394
+ export const zRevokeAssessorAuthorizationResponse = zCompetencyAssessorAuthorizationResponseObject;
9279
9395
  export const zListQualificationsQuery = z.object({
9280
9396
  'filter[candidate_user_id]': z.string().optional(),
9281
9397
  'filter[competencies_standard_id]': z.string().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsptch-work/api-client",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Generated TypeScript client for the DSPTCH REST API.",
5
5
  "keywords": [
6
6
  "dsptch",