@dsptch-work/api-client 0.14.0 → 0.16.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.
@@ -160,6 +160,12 @@ export const zProblem = z.object({
160
160
  *
161
161
  * 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.
162
162
  *
163
+ * ### import_in_progress
164
+ *
165
+ * **Import In Progress**
166
+ *
167
+ * The parent already has an import that has not reported yet. Acceptance is synchronous but the write happens in the background, so a second file would be validated against records the queued import has not written to yet and both would apply. Poll the earlier import until it reports, then submit again.
168
+ *
163
169
  * ### product_archived
164
170
  *
165
171
  * **Product Archived**
@@ -358,6 +364,7 @@ export const zProblemTypeCatalog = z.enum([
358
364
  'user_scoped_key_required',
359
365
  'not_found',
360
366
  'already_terminated',
367
+ 'import_in_progress',
361
368
  'product_archived',
362
369
  'recorded_since_termination',
363
370
  'span_beyond_timeline_end',
@@ -406,7 +413,10 @@ export const zDirectUploadParameters = z.object({
406
413
  'assets.items.service_events',
407
414
  'assets.products',
408
415
  'assets.vendors',
416
+ 'pay_periods.imports.aggregate_times',
417
+ 'pay_periods.imports.dsptch_cprs',
409
418
  'pay_periods.imports.time_entries',
419
+ 'payrolls.payroll_runs.imports.paystubs',
410
420
  'users'
411
421
  ]),
412
422
  blob: z.object({
@@ -1418,6 +1428,12 @@ export const zPwaTradeParameters = z.object({
1418
1428
  export const zPwaTradeUpdateParameters = z.object({
1419
1429
  name: z.string().optional()
1420
1430
  });
1431
+ /**
1432
+ * Parameters for merging one PWA trade (craft) into another in the same pool.
1433
+ */
1434
+ export const zPwaTradeMergeParameters = z.object({
1435
+ target_trade_id: z.string()
1436
+ });
1421
1437
  /**
1422
1438
  * A reviewed apprentice-scope decision pairing a registered apprenticeship occupation with a craft (trade). The row's existence means the pair was reviewed; scope_status carries the verdict. A pair with no row is undecided and denies apprentice treatment.
1423
1439
  */
@@ -1443,25 +1459,25 @@ export const zPwaTradeApprenticeshipOccupationUpdateParameters = z.object({
1443
1459
  scope_status: z.enum(['in_scope', 'out_of_scope']).nullish()
1444
1460
  });
1445
1461
  /**
1446
- * Prevailing-wage / apprenticeship (PWA) compliance details for a job, used in certified-payroll reporting. Fields for every supported state are always present; those outside the job's region come back null. Null on the job when it tracks no PWA compliance.
1462
+ * Prevailing-wage / apprenticeship (PWA) compliance details for a job, used in certified-payroll reporting. Common fields are always present when this object exists; regional fields appear only when applicable to the job's region and regional PWA mode. The property is null when no PWA details have been configured; PWA tracking modes alone do not materialize it.
1447
1463
  */
1448
1464
  export const zPwaJobDetailsResponseObject = z.object({
1449
- dir_awarding_body_id: z.string().nullable(),
1450
- dir_project_id: z.string().nullable(),
1451
- dir_project_name: z.string().nullable(),
1452
- dir_contract_id: z.string().nullable(),
1453
- dir_project_awarding_body_name: z.string().nullable(),
1454
- dir_project_number: z.string().nullable(),
1455
- il_dol_project_id: z.string().nullable(),
1456
- il_dol_state_capital_funds: z.boolean().nullable(),
1457
- il_dol_public_body_name: z.string().nullable(),
1458
- il_dol_public_body_contact_id: z.string().nullable(),
1459
- il_dol_public_body_address_id: z.string().nullable(),
1460
- il_dol_contract_number: z.string().nullable(),
1461
- il_shines_project_id: z.string().nullable(),
1462
- ny_dol_prc_number: z.string().nullable(),
1465
+ contractor_type: z.enum(['prime_contractor', 'sub_contractor']).nullable(),
1463
1466
  pay_full_cash_fringe_by_default: z.boolean(),
1464
- contractor_type: z.string().nullable()
1467
+ dir_awarding_body_id: z.string().nullish(),
1468
+ dir_project_id: z.string().nullish(),
1469
+ dir_project_name: z.string().nullish(),
1470
+ dir_contract_id: z.string().nullish(),
1471
+ dir_project_awarding_body_name: z.string().nullish(),
1472
+ dir_project_number: z.string().nullish(),
1473
+ il_dol_project_id: z.string().nullish(),
1474
+ il_dol_state_capital_funds: z.boolean().nullish(),
1475
+ il_dol_public_body_name: z.string().nullish(),
1476
+ il_dol_public_body_contact_id: z.string().nullish(),
1477
+ il_dol_public_body_address_id: z.string().nullish(),
1478
+ il_dol_contract_number: z.string().nullish(),
1479
+ il_shines_project_id: z.string().nullish(),
1480
+ ny_dol_prc_number: z.string().nullish()
1465
1481
  }).nullable();
1466
1482
  /**
1467
1483
  * A reusable job template — a saved job pattern for quickly creating new jobs with the same setup. Read-only through the API (listing only).
@@ -1937,8 +1953,8 @@ export const zJobParameters = z.object({
1937
1953
  value: z.string().nullish()
1938
1954
  })).nullish(),
1939
1955
  pwa_details: z.object({
1940
- contractor_type: z.string().nullish(),
1941
- pay_full_cash_fringe_by_default: z.boolean().nullish(),
1956
+ contractor_type: z.enum(['prime_contractor', 'sub_contractor']).nullish(),
1957
+ pay_full_cash_fringe_by_default: z.boolean().optional(),
1942
1958
  dir_awarding_body_id: z.string().nullish(),
1943
1959
  dir_project_id: z.string().nullish(),
1944
1960
  dir_project_name: z.string().nullish(),
@@ -1948,12 +1964,12 @@ export const zJobParameters = z.object({
1948
1964
  il_dol_project_id: z.string().nullish(),
1949
1965
  il_dol_state_capital_funds: z.boolean().nullish(),
1950
1966
  il_dol_public_body_name: z.string().nullish(),
1951
- il_dol_contract_number: z.string().nullish(),
1952
- il_shines_project_id: z.string().nullish(),
1953
1967
  il_dol_public_body_contact_id: z.string().nullish(),
1954
1968
  il_dol_public_body_address_id: z.string().nullish(),
1969
+ il_dol_contract_number: z.string().nullish(),
1970
+ il_shines_project_id: z.string().nullish(),
1955
1971
  ny_dol_prc_number: z.string().nullish()
1956
- }).nullish()
1972
+ }).optional()
1957
1973
  });
1958
1974
  /**
1959
1975
  * Parameters for updating an existing job. Accepts every job_parameters field, plus a directly settable status.
@@ -1998,14 +2014,101 @@ export const zUserCompanyScheduledTerminationParameters = z.object({
1998
2014
  termination_date: z.string()
1999
2015
  });
2000
2016
  /**
2001
- * One problem found while processing an accepted import.
2017
+ * One problem found while processing an accepted import, whatever its type.
2002
2018
  */
2003
- export const zTimeEntryImportProcessingError = z.object({
2019
+ export const zImportProcessingError = z.object({
2004
2020
  code: z.string(),
2005
2021
  row: z.int().nullable(),
2006
2022
  column: z.string().nullable(),
2007
2023
  context: z.record(z.string(), z.unknown())
2008
2024
  });
2025
+ /**
2026
+ * One bulk upload of day-level hours against a pay period, and how it turned out.
2027
+ */
2028
+ export const zAggregateTimeImportResponseObject = z.object({
2029
+ id: z.string(),
2030
+ pay_period_id: z.string(),
2031
+ status: z.enum([
2032
+ 'pending',
2033
+ 'processing',
2034
+ 'processed',
2035
+ 'success',
2036
+ 'failed'
2037
+ ]),
2038
+ processed_rows_count: z.int(),
2039
+ processing_errors: z.array(zImportProcessingError),
2040
+ completed_at: z.iso.datetime().nullable(),
2041
+ created_at: z.iso.datetime(),
2042
+ updated_at: z.iso.datetime()
2043
+ });
2044
+ /**
2045
+ * Submit a spreadsheet of day-level hours for a pay period. The pay period's pay schedule must keep time in aggregate mode and take pay in base mode; a schedule that keeps time as entries, or that aggregates pay, is refused. The file carries employee_payroll_id, job_id and week_ending_date, the three wage pay rates one_x_wage_pay_rate, one_five_x_wage_pay_rate and two_x_wage_pay_rate, 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, employee_payroll_id, job_id and week_ending_date must also carry a value on every row; a rate left blank falls back to the one the employee's position and wage determination already carry. 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.
2046
+ *
2047
+ * 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.
2048
+ *
2049
+ * 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`, a second answers 409 naming `import_in_progress`, and nothing is written. Poll the earlier import until it reports, then submit again.
2050
+ */
2051
+ export const zAggregateTimeImportParameters = z.object({
2052
+ file_signed_id: z.string()
2053
+ });
2054
+ /**
2055
+ * One bulk upload of a certified payroll report against a pay period, and how it turned out.
2056
+ */
2057
+ export const zDsptchCprImportResponseObject = z.object({
2058
+ id: z.string(),
2059
+ pay_period_id: z.string(),
2060
+ status: z.enum([
2061
+ 'pending',
2062
+ 'processing',
2063
+ 'processed',
2064
+ 'success',
2065
+ 'failed'
2066
+ ]),
2067
+ processed_rows_count: z.int(),
2068
+ processing_errors: z.array(zImportProcessingError),
2069
+ completed_at: z.iso.datetime().nullable(),
2070
+ created_at: z.iso.datetime(),
2071
+ updated_at: z.iso.datetime()
2072
+ });
2073
+ /**
2074
+ * 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.
2075
+ *
2076
+ * 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.
2077
+ *
2078
+ * 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.
2079
+ */
2080
+ export const zDsptchCprImportParameters = z.object({
2081
+ file_signed_id: z.string()
2082
+ });
2083
+ /**
2084
+ * One bulk upload of paystub amounts against a payroll run, and how it turned out.
2085
+ */
2086
+ export const zPaystubImportResponseObject = z.object({
2087
+ id: z.string(),
2088
+ payrolls_payroll_run_id: z.string(),
2089
+ status: z.enum([
2090
+ 'pending',
2091
+ 'processing',
2092
+ 'processed',
2093
+ 'success',
2094
+ 'failed'
2095
+ ]),
2096
+ processed_rows_count: z.int(),
2097
+ processing_errors: z.array(zImportProcessingError),
2098
+ completed_at: z.iso.datetime().nullable(),
2099
+ created_at: z.iso.datetime(),
2100
+ updated_at: z.iso.datetime()
2101
+ });
2102
+ /**
2103
+ * 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.
2104
+ *
2105
+ * 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.
2106
+ *
2107
+ * 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.
2108
+ */
2109
+ export const zPaystubImportParameters = z.object({
2110
+ file_signed_id: z.string()
2111
+ });
2009
2112
  /**
2010
2113
  * One bulk upload of time entries against a pay period, and how it turned out.
2011
2114
  */
@@ -2020,13 +2123,15 @@ export const zTimeEntryImportResponseObject = z.object({
2020
2123
  'failed'
2021
2124
  ]),
2022
2125
  processed_rows_count: z.int(),
2023
- processing_errors: z.array(zTimeEntryImportProcessingError),
2126
+ processing_errors: z.array(zImportProcessingError),
2024
2127
  completed_at: z.iso.datetime().nullable(),
2025
2128
  created_at: z.iso.datetime(),
2026
2129
  updated_at: z.iso.datetime()
2027
2130
  });
2028
2131
  /**
2029
2132
  * 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.
2133
+ *
2134
+ * 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.
2030
2135
  */
2031
2136
  export const zTimeEntryImportParameters = z.object({
2032
2137
  file_signed_id: z.string()
@@ -7226,6 +7331,88 @@ export const zUpdateOvertimeRulePath = z.object({
7226
7331
  * Success
7227
7332
  */
7228
7333
  export const zUpdateOvertimeRuleResponse = zOvertimeRuleResponseObject;
7334
+ export const zListAggregateTimeImportsPath = z.object({
7335
+ pay_period_id: z.string()
7336
+ });
7337
+ export const zListAggregateTimeImportsQuery = z.object({
7338
+ 'filter[status]': z.string().optional(),
7339
+ filter: z.string().optional(),
7340
+ 'filter[unexpected]': z.string().optional(),
7341
+ 'filter[completed_at][gte]': z.iso.datetime().optional(),
7342
+ 'filter[completed_at][lte]': z.iso.datetime().optional(),
7343
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
7344
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
7345
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
7346
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
7347
+ 'page[cursor]': z.string().optional(),
7348
+ 'page[limit]': z.int().gte(1).optional().default(20),
7349
+ page: z.string().optional()
7350
+ });
7351
+ /**
7352
+ * Success
7353
+ */
7354
+ export const zListAggregateTimeImportsResponse = z.object({
7355
+ meta: zMeta,
7356
+ links: zLinks,
7357
+ data: z.array(zAggregateTimeImportResponseObject)
7358
+ });
7359
+ export const zCreateAggregateTimeImportBody = zAggregateTimeImportParameters;
7360
+ export const zCreateAggregateTimeImportPath = z.object({
7361
+ pay_period_id: z.string()
7362
+ });
7363
+ /**
7364
+ * Created
7365
+ */
7366
+ export const zCreateAggregateTimeImportResponse = zAggregateTimeImportResponseObject;
7367
+ export const zGetAggregateTimeImportPath = z.object({
7368
+ pay_period_id: z.string(),
7369
+ id: z.string()
7370
+ });
7371
+ /**
7372
+ * Success
7373
+ */
7374
+ export const zGetAggregateTimeImportResponse = zAggregateTimeImportResponseObject;
7375
+ export const zListDsptchCprImportsPath = z.object({
7376
+ pay_period_id: z.string()
7377
+ });
7378
+ export const zListDsptchCprImportsQuery = z.object({
7379
+ 'filter[status]': z.string().optional(),
7380
+ filter: z.string().optional(),
7381
+ 'filter[unexpected]': z.string().optional(),
7382
+ 'filter[completed_at][gte]': z.iso.datetime().optional(),
7383
+ 'filter[completed_at][lte]': z.iso.datetime().optional(),
7384
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
7385
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
7386
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
7387
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
7388
+ 'page[cursor]': z.string().optional(),
7389
+ 'page[limit]': z.int().gte(1).optional().default(20),
7390
+ page: z.string().optional()
7391
+ });
7392
+ /**
7393
+ * Success
7394
+ */
7395
+ export const zListDsptchCprImportsResponse = z.object({
7396
+ meta: zMeta,
7397
+ links: zLinks,
7398
+ data: z.array(zDsptchCprImportResponseObject)
7399
+ });
7400
+ export const zCreateDsptchCprImportBody = zDsptchCprImportParameters;
7401
+ export const zCreateDsptchCprImportPath = z.object({
7402
+ pay_period_id: z.string()
7403
+ });
7404
+ /**
7405
+ * Created
7406
+ */
7407
+ export const zCreateDsptchCprImportResponse = zDsptchCprImportResponseObject;
7408
+ export const zGetDsptchCprImportPath = z.object({
7409
+ pay_period_id: z.string(),
7410
+ id: z.string()
7411
+ });
7412
+ /**
7413
+ * Success
7414
+ */
7415
+ export const zGetDsptchCprImportResponse = zDsptchCprImportResponseObject;
7229
7416
  export const zListTimeEntryImportsPath = z.object({
7230
7417
  pay_period_id: z.string()
7231
7418
  });
@@ -7388,6 +7575,47 @@ export const zUpdateFringeBenefitPlanPath = z.object({
7388
7575
  * Success
7389
7576
  */
7390
7577
  export const zUpdateFringeBenefitPlanResponse = zPayrollFringeBenefitPlanResponseObject;
7578
+ export const zListPaystubImportsPath = z.object({
7579
+ payroll_run_id: z.string()
7580
+ });
7581
+ export const zListPaystubImportsQuery = z.object({
7582
+ 'filter[status]': z.string().optional(),
7583
+ filter: z.string().optional(),
7584
+ 'filter[unexpected]': z.string().optional(),
7585
+ 'filter[completed_at][gte]': z.iso.datetime().optional(),
7586
+ 'filter[completed_at][lte]': z.iso.datetime().optional(),
7587
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
7588
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
7589
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
7590
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
7591
+ 'page[cursor]': z.string().optional(),
7592
+ 'page[limit]': z.int().gte(1).optional().default(20),
7593
+ page: z.string().optional()
7594
+ });
7595
+ /**
7596
+ * Success
7597
+ */
7598
+ export const zListPaystubImportsResponse = z.object({
7599
+ meta: zMeta,
7600
+ links: zLinks,
7601
+ data: z.array(zPaystubImportResponseObject)
7602
+ });
7603
+ export const zCreatePaystubImportBody = zPaystubImportParameters;
7604
+ export const zCreatePaystubImportPath = z.object({
7605
+ payroll_run_id: z.string()
7606
+ });
7607
+ /**
7608
+ * Created
7609
+ */
7610
+ export const zCreatePaystubImportResponse = zPaystubImportResponseObject;
7611
+ export const zGetPaystubImportPath = z.object({
7612
+ payroll_run_id: z.string(),
7613
+ id: z.string()
7614
+ });
7615
+ /**
7616
+ * Success
7617
+ */
7618
+ export const zGetPaystubImportResponse = zPaystubImportResponseObject;
7391
7619
  export const zListPayrollRunsQuery = z.object({
7392
7620
  'filter[run_type]': z.string().optional(),
7393
7621
  'filter[timekeeping_pay_period_id]': z.string().optional(),
@@ -7779,6 +8007,14 @@ export const zUpdateApprenticeshipOccupationPath = z.object({
7779
8007
  * Success
7780
8008
  */
7781
8009
  export const zUpdateApprenticeshipOccupationResponse = zPwaTradeApprenticeshipOccupationResponseObject;
8010
+ export const zCreateMergeBody = zPwaTradeMergeParameters;
8011
+ export const zCreateMergePath = z.object({
8012
+ trade_id: z.string()
8013
+ });
8014
+ /**
8015
+ * Success
8016
+ */
8017
+ export const zCreateMergeResponse = zPwaTradeResponseObject;
7782
8018
  export const zListTradesQuery = z.object({
7783
8019
  'filter[project_id]': z.string().optional(),
7784
8020
  'filter[job_id]': z.string().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsptch-work/api-client",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Generated TypeScript client for the DSPTCH REST API.",
5
5
  "keywords": [
6
6
  "dsptch",
@@ -57,7 +57,7 @@
57
57
  "@hey-api/openapi-ts": "^0.99.0",
58
58
  "publint": "^0.3.22",
59
59
  "typescript": "^6.0.3",
60
- "vitest": "^4.1.10"
60
+ "vitest": "^4.1.11"
61
61
  },
62
62
  "scripts": {
63
63
  "generate": "openapi-ts",