@dsptch-work/api-client 0.15.0 → 0.17.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.
@@ -413,9 +413,11 @@ export const zDirectUploadParameters = z.object({
413
413
  'assets.items.service_events',
414
414
  'assets.products',
415
415
  'assets.vendors',
416
+ 'compliance.checks',
416
417
  'pay_periods.imports.aggregate_times',
417
418
  'pay_periods.imports.dsptch_cprs',
418
419
  'pay_periods.imports.time_entries',
420
+ 'payrolls.payroll_runs.imports.paystubs',
419
421
  'users'
420
422
  ]),
421
423
  blob: z.object({
@@ -2072,11 +2074,42 @@ export const zDsptchCprImportResponseObject = z.object({
2072
2074
  /**
2073
2075
  * Submit a certified payroll report for a pay period. The pay period's pay schedule must be in aggregate time mode; a schedule that keeps time as entries is refused. The file carries every column of the DSPTCH CPR template: the payroll, job and employee identifiers, the employer and employee pay, contribution and deduction amounts, the three wage pay rates, and one hours column per multiplier per day of the period — seven days each for a weekly schedule, fourteen for a biweekly one. All of them must be present as column headers, or the file is refused naming the ones missing. Of those, job_id, week_ending_date, employee_payroll_id, one_x_wage_pay_rate and one_five_x_wage_pay_rate must also carry a value on every row, and two_x_wage_pay_rate must whenever any 2x hours column does. federal_labor_classification and regional_labor_classification are read when present, and are needed only where a position has more than one wage determination in a jurisdiction. Header matching ignores case and treats spaces as underscores, and column order does not matter. Any other column is refused: a name this import does not read would be dropped without trace, so the file is rejected naming it rather than applied in part.
2074
2076
  *
2075
- * Submitting the same work twice is refused rather than doubled: an import will not write onto a time card that already holds data, so a retry after a submission that already succeeded answers 422 naming `time_card_has_data`, and nothing is written. The guard is per time card, not per file, so a corrected file for the same worker and period is refused the same way — clear that period's data first. Because acceptance is synchronous but the write happens in the background, two submissions racing each other can both be accepted; the second one then fails on the same guard and reports it through `processing_errors`.
2077
+ * Submitting the same work twice is refused rather than doubled: an import will not write onto a time card that already holds data, so a retry after a submission that already succeeded answers 422 naming `time_card_has_data`, and nothing is written. The guard is per time card, not per file, so a corrected file for the same worker and period is refused the same way — clear that period's data first.
2078
+ *
2079
+ * Because acceptance is synchronous but the write happens in the background, only one import at a time is accepted for a pay period: while an earlier one is still `pending` or `processing`, a second answers 409 naming `import_in_progress`, and nothing is written. Poll the earlier import until it reports, then submit again.
2076
2080
  */
2077
2081
  export const zDsptchCprImportParameters = z.object({
2078
2082
  file_signed_id: z.string()
2079
2083
  });
2084
+ /**
2085
+ * One bulk upload of paystub amounts against a payroll run, and how it turned out.
2086
+ */
2087
+ export const zPaystubImportResponseObject = z.object({
2088
+ id: z.string(),
2089
+ payrolls_payroll_run_id: z.string(),
2090
+ status: z.enum([
2091
+ 'pending',
2092
+ 'processing',
2093
+ 'processed',
2094
+ 'success',
2095
+ 'failed'
2096
+ ]),
2097
+ processed_rows_count: z.int(),
2098
+ processing_errors: z.array(zImportProcessingError),
2099
+ completed_at: z.iso.datetime().nullable(),
2100
+ created_at: z.iso.datetime(),
2101
+ updated_at: z.iso.datetime()
2102
+ });
2103
+ /**
2104
+ * Submit a spreadsheet of paystub amounts for a payroll run. The run's pay schedule must not be connected to a payroll provider; where one is configured the paystubs come from that connection and a file is refused. Each row is one amount: payroll_id names the employee, field_name names the pay, deduction or contribution the amount belongs to, and amount carries the value. A field_name the company has not mapped before is created on first use. Schedules that do not already record the contributor on that mapping also require a contributor column of EMPLOYEE or EMPLOYER; where the mapping carries it, the column is not read and its presence is refused. All of the columns the schedule expects must be present as headers and carry a value on every row, or the file is refused naming what is missing. Header matching ignores case and treats spaces as underscores, and column order does not matter. Any other column is refused: a name this import does not read would be dropped without trace, so the file is rejected naming it rather than applied in part.
2105
+ *
2106
+ * Submitting the same pay twice is refused rather than doubled: an import will not write onto a time card that already carries paystub data, so a retry after a submission that already succeeded answers 422 naming `time_card_has_paystub_data`, and no line item is written. A unique index on the line items backs that guard at the database.
2107
+ *
2108
+ * Because acceptance is synchronous but the write happens in the background, only one import at a time is accepted for a payroll run: while an earlier one is still `pending`, a second answers 409 naming `import_in_progress`, and nothing is written. Poll the earlier import until it reports, then submit again.
2109
+ */
2110
+ export const zPaystubImportParameters = z.object({
2111
+ file_signed_id: z.string()
2112
+ });
2080
2113
  /**
2081
2114
  * One bulk upload of time entries against a pay period, and how it turned out.
2082
2115
  */
@@ -2098,6 +2131,8 @@ export const zTimeEntryImportResponseObject = z.object({
2098
2131
  });
2099
2132
  /**
2100
2133
  * Submit a spreadsheet of time entries for a pay period. All seven of payroll_id, start_time, end_time, timecode, job_id, state and description must be present as column headers, or the file is refused naming the ones missing. Of those, payroll_id, start_time, end_time, timecode and state must also carry a value on every row. features, federal_labor_classification and regional_labor_classification are read when present. Header matching ignores case and treats spaces as underscores, and column order does not matter. Any other column is refused: a name this import does not read would be dropped without trace, so the file is rejected naming it rather than applied in part.
2134
+ *
2135
+ * Because acceptance is synchronous but the write happens in the background, only one import at a time is accepted for a pay period: while an earlier one is still `pending` or `processing`, a second answers 409 naming `import_in_progress`, and nothing is written. Poll the earlier import until it reports, then submit again.
2101
2136
  */
2102
2137
  export const zTimeEntryImportParameters = z.object({
2103
2138
  file_signed_id: z.string()
@@ -2808,6 +2843,7 @@ export const zComplianceCheckResponseObject = z.object({
2808
2843
  timekeeping_pay_period_id: z.string().nullable(),
2809
2844
  user_id: z.string().nullable(),
2810
2845
  employment_id: z.string().nullable(),
2846
+ assignee_user_ids: z.array(z.string()),
2811
2847
  title: z.string(),
2812
2848
  description: z.string(),
2813
2849
  category: z.enum([
@@ -2843,12 +2879,187 @@ export const zComplianceCheckResponseObject = z.object({
2843
2879
  updated_at: z.iso.datetime()
2844
2880
  });
2845
2881
  /**
2846
- * Update a compliance check. Both fields are optional.
2882
+ * A document attached to a compliance check.
2883
+ */
2884
+ export const zComplianceCheckDocumentObject = z.object({
2885
+ id: z.string(),
2886
+ filename: z.string(),
2887
+ content_type: z.string().nullable(),
2888
+ byte_size: z.int(),
2889
+ url: z.string(),
2890
+ created_by_user_id: z.string(),
2891
+ created_at: z.iso.datetime()
2892
+ });
2893
+ /**
2894
+ * A single compliance check, with the documents attached to it. Same fields as compliance_check_response_object plus `documents`.
2895
+ */
2896
+ export const zComplianceCheckDetailResponseObject = z.object({
2897
+ id: z.string(),
2898
+ type: z.enum([
2899
+ 'Compliances::CompanyCheck',
2900
+ 'Compliances::JobCheck',
2901
+ 'Compliances::ProjectCheck',
2902
+ 'Compliances::TimeCardCheck',
2903
+ 'Compliances::PayPeriodCheck',
2904
+ 'Compliances::UserCheck',
2905
+ 'Compliances::UserCompanyCheck'
2906
+ ]),
2907
+ status: z.enum([
2908
+ 'passed',
2909
+ 'failed',
2910
+ 'not_applicable',
2911
+ 'dismissed',
2912
+ 'pending'
2913
+ ]),
2914
+ compliances_requirement_id: z.string(),
2915
+ company_id: z.string().nullable(),
2916
+ job_id: z.string().nullable(),
2917
+ project_id: z.string().nullable(),
2918
+ timekeeping_time_card_id: z.string().nullable(),
2919
+ timekeeping_pay_period_id: z.string().nullable(),
2920
+ user_id: z.string().nullable(),
2921
+ employment_id: z.string().nullable(),
2922
+ assignee_user_ids: z.array(z.string()),
2923
+ title: z.string(),
2924
+ description: z.string(),
2925
+ category: z.enum([
2926
+ 'apprenticeship',
2927
+ 'certified_payroll',
2928
+ 'company',
2929
+ 'job',
2930
+ 'payroll',
2931
+ 'project',
2932
+ 'regional',
2933
+ 'tax_credit',
2934
+ 'timekeeping',
2935
+ 'worker'
2936
+ ]),
2937
+ phase: z.enum([
2938
+ 'after_pay_date',
2939
+ 'before_approval_deadline',
2940
+ 'close_out',
2941
+ 'maintenance',
2942
+ 'onboarding',
2943
+ 'setup'
2944
+ ]),
2945
+ priority: z.enum([
2946
+ 'critical',
2947
+ 'high',
2948
+ 'medium',
2949
+ 'low'
2950
+ ]).nullable(),
2951
+ checked_at: z.iso.datetime().nullable(),
2952
+ passed_at: z.iso.datetime().nullable(),
2953
+ time_due: z.iso.datetime().nullable(),
2954
+ created_at: z.iso.datetime(),
2955
+ updated_at: z.iso.datetime(),
2956
+ documents: z.array(zComplianceCheckDocumentObject)
2957
+ });
2958
+ /**
2959
+ * Update a compliance check. Every field is optional.
2847
2960
  */
2848
2961
  export const zComplianceCheckParameters = z.object({
2849
2962
  status: z.enum(['dismissed', 'pending']).optional(),
2850
- time_due: z.iso.datetime().nullish()
2963
+ time_due: z.iso.datetime().nullish(),
2964
+ assignee_user_ids: z.array(z.string()).optional(),
2965
+ file_signed_id: z.string().optional()
2966
+ });
2967
+ export const zRichTextObject = z.object({
2968
+ text: z.string(),
2969
+ attachments: z.array(z.object({
2970
+ filename: z.string(),
2971
+ content_type: z.string().nullish(),
2972
+ byte_size: z.int(),
2973
+ url: z.string()
2974
+ }))
2975
+ });
2976
+ export const zTodoInboxTodoResponseObject = z.object({
2977
+ kind: z.enum(['todo']),
2978
+ id: z.string(),
2979
+ type: z.enum([
2980
+ 'company',
2981
+ 'job',
2982
+ 'project'
2983
+ ]),
2984
+ company_id: z.string().nullable(),
2985
+ job_id: z.string().nullable(),
2986
+ project_id: z.string().nullable(),
2987
+ name: z.string(),
2988
+ created_by_user_id: z.string(),
2989
+ updated_by_user_id: z.string(),
2990
+ completed: z.boolean(),
2991
+ task_assignee_user_ids: z.array(z.string()),
2992
+ description: zRichTextObject,
2993
+ time_due: z.iso.datetime().nullable(),
2994
+ created_at: z.iso.datetime(),
2995
+ updated_at: z.iso.datetime()
2851
2996
  });
2997
+ export const zTodoInboxComplianceCheckResponseObject = z.object({
2998
+ kind: z.enum(['compliance_check']),
2999
+ id: z.string(),
3000
+ type: z.enum([
3001
+ 'Compliances::CompanyCheck',
3002
+ 'Compliances::JobCheck',
3003
+ 'Compliances::ProjectCheck',
3004
+ 'Compliances::TimeCardCheck',
3005
+ 'Compliances::PayPeriodCheck',
3006
+ 'Compliances::UserCheck',
3007
+ 'Compliances::UserCompanyCheck'
3008
+ ]),
3009
+ status: z.enum([
3010
+ 'passed',
3011
+ 'failed',
3012
+ 'not_applicable',
3013
+ 'dismissed',
3014
+ 'pending'
3015
+ ]),
3016
+ compliances_requirement_id: z.string(),
3017
+ company_id: z.string().nullable(),
3018
+ job_id: z.string().nullable(),
3019
+ project_id: z.string().nullable(),
3020
+ timekeeping_time_card_id: z.string().nullable(),
3021
+ timekeeping_pay_period_id: z.string().nullable(),
3022
+ user_id: z.string().nullable(),
3023
+ employment_id: z.string().nullable(),
3024
+ assignee_user_ids: z.array(z.string()),
3025
+ title: z.string(),
3026
+ description: z.string(),
3027
+ category: z.enum([
3028
+ 'apprenticeship',
3029
+ 'certified_payroll',
3030
+ 'company',
3031
+ 'job',
3032
+ 'payroll',
3033
+ 'project',
3034
+ 'regional',
3035
+ 'tax_credit',
3036
+ 'timekeeping',
3037
+ 'worker'
3038
+ ]),
3039
+ phase: z.enum([
3040
+ 'after_pay_date',
3041
+ 'before_approval_deadline',
3042
+ 'close_out',
3043
+ 'maintenance',
3044
+ 'onboarding',
3045
+ 'setup'
3046
+ ]),
3047
+ priority: z.enum([
3048
+ 'critical',
3049
+ 'high',
3050
+ 'medium',
3051
+ 'low'
3052
+ ]).nullable(),
3053
+ checked_at: z.iso.datetime().nullable(),
3054
+ passed_at: z.iso.datetime().nullable(),
3055
+ time_due: z.iso.datetime().nullable(),
3056
+ created_at: z.iso.datetime(),
3057
+ updated_at: z.iso.datetime()
3058
+ });
3059
+ export const zTodoInboxEntryResponseObject = z.discriminatedUnion('kind', [
3060
+ zTodoInboxTodoResponseObject.extend({ kind: z.literal('todo') }),
3061
+ zTodoInboxComplianceCheckResponseObject.extend({ kind: z.literal('compliance_check') })
3062
+ ]);
2852
3063
  /**
2853
3064
  * One compliance requirement from the catalog. Requirements ship with the application, so the catalog reads the same for every company.
2854
3065
  */
@@ -3115,10 +3326,7 @@ export const zPositionParameters = z.object({
3115
3326
  hourly_rate_cents: z.number().nullish(),
3116
3327
  pwa_wage_pay_rate_cents: z.number().nullish(),
3117
3328
  wage_adder_rate_cents: z.number().nullish(),
3118
- job_wage_determinations_positions_attributes: z.array(z.object({
3119
- id: z.int().nullish(),
3120
- job_wage_determination_id: z.string().nullish()
3121
- })).optional(),
3329
+ job_wage_determination_ids: z.array(z.string()).optional(),
3122
3330
  pwa_details_attributes: z.object({
3123
3331
  skill_level: z.string().nullish()
3124
3332
  }).optional()
@@ -3478,7 +3686,7 @@ export const zUserRoleResponse = z.object({
3478
3686
  */
3479
3687
  export const zUserCompanyType = z.enum(['EMPLOYEE', 'CONTRACTOR']).nullable();
3480
3688
  /**
3481
- * A worker as your company sees them: the cross-company person merged with their employment record at your company (title, pay, benefits, and accruals), their roles at your company, and optional prevailing-wage compliance details. There is no delete — removing a worker terminates their employment at the company (see the user-company endpoints), which sets termination_date and drops them from the default list.
3689
+ * A worker as your company sees them: the cross-company person merged with their employment record at your company (title, pay, benefits, and accruals), their roles at your company, and optional prevailing-wage compliance details. Your company sees everyone it employs, everyone it has granted a role, and everyone it has invited, which is the same set the web app shows. A role holder or an invitee your company does not employ has no employment record to merge, so the employment fields (employment_id through employment_window, plus manager_user_id) are null for them, no employment custom fields are published for them, and employment_state reads none. There is no delete — removing a worker terminates their employment at the company (see the user-company endpoints), which sets termination_date and drops them from the default list.
3482
3690
  */
3483
3691
  export const zUserResponseObject = z.object({
3484
3692
  id: z.string(),
@@ -3499,13 +3707,19 @@ export const zUserResponseObject = z.object({
3499
3707
  updated_at: z.iso.datetime(),
3500
3708
  winda_id: z.string().nullable(),
3501
3709
  linkedin_url: z.string().nullable(),
3502
- employment_id: z.string(),
3710
+ employment_state: z.enum([
3711
+ 'active',
3712
+ 'scheduled',
3713
+ 'terminated',
3714
+ 'none'
3715
+ ]),
3716
+ employment_id: z.string().nullable(),
3503
3717
  type: zUserCompanyType,
3504
3718
  title: z.string().nullable(),
3505
- overtime_eligible: z.boolean(),
3506
- enrolled_in_t_and_a: z.boolean(),
3719
+ overtime_eligible: z.boolean().nullable(),
3720
+ enrolled_in_t_and_a: z.boolean().nullable(),
3507
3721
  payroll_id: z.string().nullable(),
3508
- compensation_type: z.string(),
3722
+ compensation_type: z.string().nullable(),
3509
3723
  hourly_rate: z.string().nullable(),
3510
3724
  training_annual_amount: z.string().nullable(),
3511
3725
  employer_combined_health_amount: z.string().nullable(),
@@ -3519,7 +3733,7 @@ export const zUserResponseObject = z.object({
3519
3733
  employment_window: z.object({
3520
3734
  valid_from: z.iso.datetime().nullable(),
3521
3735
  valid_to: z.iso.datetime().nullable()
3522
- }),
3736
+ }).nullable(),
3523
3737
  manager_user_id: z.string().nullable(),
3524
3738
  roles: z.array(z.string()),
3525
3739
  company_user_pwa_info: z.object({
@@ -6571,6 +6785,7 @@ export const zListChecksQuery = z.object({
6571
6785
  'filter[job_id][null]': z.boolean().optional(),
6572
6786
  'filter[project_id]': z.string().optional(),
6573
6787
  'filter[compliances_requirement_id]': z.string().optional(),
6788
+ 'filter[assignee_user_id]': z.string().optional(),
6574
6789
  'filter[time_due][gte]': z.iso.datetime().optional(),
6575
6790
  'filter[time_due][lte]': z.iso.datetime().optional(),
6576
6791
  filter: z.string().optional(),
@@ -6593,7 +6808,7 @@ export const zGetCheckPath = z.object({
6593
6808
  /**
6594
6809
  * Success
6595
6810
  */
6596
- export const zGetCheckResponse = zComplianceCheckResponseObject;
6811
+ export const zGetCheckResponse = zComplianceCheckDetailResponseObject;
6597
6812
  export const zUpdateCheckBody = zComplianceCheckParameters;
6598
6813
  export const zUpdateCheckPath = z.object({
6599
6814
  id: z.string()
@@ -6601,7 +6816,7 @@ export const zUpdateCheckPath = z.object({
6601
6816
  /**
6602
6817
  * Success
6603
6818
  */
6604
- export const zUpdateCheckResponse = zComplianceCheckResponseObject;
6819
+ export const zUpdateCheckResponse = zComplianceCheckDetailResponseObject;
6605
6820
  export const zListRequirementsQuery = z.object({
6606
6821
  'filter[search]': z.string().optional(),
6607
6822
  'filter[type]': z.string().optional(),
@@ -7541,6 +7756,47 @@ export const zUpdateFringeBenefitPlanPath = z.object({
7541
7756
  * Success
7542
7757
  */
7543
7758
  export const zUpdateFringeBenefitPlanResponse = zPayrollFringeBenefitPlanResponseObject;
7759
+ export const zListPaystubImportsPath = z.object({
7760
+ payroll_run_id: z.string()
7761
+ });
7762
+ export const zListPaystubImportsQuery = z.object({
7763
+ 'filter[status]': z.string().optional(),
7764
+ filter: z.string().optional(),
7765
+ 'filter[unexpected]': z.string().optional(),
7766
+ 'filter[completed_at][gte]': z.iso.datetime().optional(),
7767
+ 'filter[completed_at][lte]': z.iso.datetime().optional(),
7768
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
7769
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
7770
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
7771
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
7772
+ 'page[cursor]': z.string().optional(),
7773
+ 'page[limit]': z.int().gte(1).optional().default(20),
7774
+ page: z.string().optional()
7775
+ });
7776
+ /**
7777
+ * Success
7778
+ */
7779
+ export const zListPaystubImportsResponse = z.object({
7780
+ meta: zMeta,
7781
+ links: zLinks,
7782
+ data: z.array(zPaystubImportResponseObject)
7783
+ });
7784
+ export const zCreatePaystubImportBody = zPaystubImportParameters;
7785
+ export const zCreatePaystubImportPath = z.object({
7786
+ payroll_run_id: z.string()
7787
+ });
7788
+ /**
7789
+ * Created
7790
+ */
7791
+ export const zCreatePaystubImportResponse = zPaystubImportResponseObject;
7792
+ export const zGetPaystubImportPath = z.object({
7793
+ payroll_run_id: z.string(),
7794
+ id: z.string()
7795
+ });
7796
+ /**
7797
+ * Success
7798
+ */
7799
+ export const zGetPaystubImportResponse = zPaystubImportResponseObject;
7544
7800
  export const zListPayrollRunsQuery = z.object({
7545
7801
  'filter[run_type]': z.string().optional(),
7546
7802
  'filter[timekeeping_pay_period_id]': z.string().optional(),
@@ -8640,6 +8896,12 @@ export const zGetTimeCardActualPath = z.object({
8640
8896
  * Success
8641
8897
  */
8642
8898
  export const zGetTimeCardActualResponse = zTimeCardActualsResponseObject;
8899
+ /**
8900
+ * Success
8901
+ */
8902
+ export const zListTodoInboxResponse = z.object({
8903
+ data: z.array(zTodoInboxEntryResponseObject)
8904
+ });
8643
8905
  export const zListUserRolesQuery = z.object({
8644
8906
  'filter[user_id]': z.string().optional(),
8645
8907
  'filter[role]': z.string().optional(),
@@ -8754,7 +9016,9 @@ export const zUpdateCompanyResponse = zUserResponseObject;
8754
9016
  export const zListUsersQuery = z.object({
8755
9017
  'filter[state]': z.enum([
8756
9018
  'active',
9019
+ 'scheduled',
8757
9020
  'terminated',
9021
+ 'none',
8758
9022
  'all'
8759
9023
  ]).optional(),
8760
9024
  'page[cursor]': z.string().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsptch-work/api-client",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "Generated TypeScript client for the DSPTCH REST API.",
5
5
  "keywords": [
6
6
  "dsptch",