@dsptch-work/api-client 0.14.0 → 0.15.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,6 +413,8 @@ 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',
410
419
  'users'
411
420
  ]),
@@ -1418,6 +1427,12 @@ export const zPwaTradeParameters = z.object({
1418
1427
  export const zPwaTradeUpdateParameters = z.object({
1419
1428
  name: z.string().optional()
1420
1429
  });
1430
+ /**
1431
+ * Parameters for merging one PWA trade (craft) into another in the same pool.
1432
+ */
1433
+ export const zPwaTradeMergeParameters = z.object({
1434
+ target_trade_id: z.string()
1435
+ });
1421
1436
  /**
1422
1437
  * 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
1438
  */
@@ -1443,25 +1458,25 @@ export const zPwaTradeApprenticeshipOccupationUpdateParameters = z.object({
1443
1458
  scope_status: z.enum(['in_scope', 'out_of_scope']).nullish()
1444
1459
  });
1445
1460
  /**
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.
1461
+ * 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
1462
  */
1448
1463
  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(),
1464
+ contractor_type: z.enum(['prime_contractor', 'sub_contractor']).nullable(),
1463
1465
  pay_full_cash_fringe_by_default: z.boolean(),
1464
- contractor_type: z.string().nullable()
1466
+ dir_awarding_body_id: z.string().nullish(),
1467
+ dir_project_id: z.string().nullish(),
1468
+ dir_project_name: z.string().nullish(),
1469
+ dir_contract_id: z.string().nullish(),
1470
+ dir_project_awarding_body_name: z.string().nullish(),
1471
+ dir_project_number: z.string().nullish(),
1472
+ il_dol_project_id: z.string().nullish(),
1473
+ il_dol_state_capital_funds: z.boolean().nullish(),
1474
+ il_dol_public_body_name: z.string().nullish(),
1475
+ il_dol_public_body_contact_id: z.string().nullish(),
1476
+ il_dol_public_body_address_id: z.string().nullish(),
1477
+ il_dol_contract_number: z.string().nullish(),
1478
+ il_shines_project_id: z.string().nullish(),
1479
+ ny_dol_prc_number: z.string().nullish()
1465
1480
  }).nullable();
1466
1481
  /**
1467
1482
  * 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 +1952,8 @@ export const zJobParameters = z.object({
1937
1952
  value: z.string().nullish()
1938
1953
  })).nullish(),
1939
1954
  pwa_details: z.object({
1940
- contractor_type: z.string().nullish(),
1941
- pay_full_cash_fringe_by_default: z.boolean().nullish(),
1955
+ contractor_type: z.enum(['prime_contractor', 'sub_contractor']).nullish(),
1956
+ pay_full_cash_fringe_by_default: z.boolean().optional(),
1942
1957
  dir_awarding_body_id: z.string().nullish(),
1943
1958
  dir_project_id: z.string().nullish(),
1944
1959
  dir_project_name: z.string().nullish(),
@@ -1948,12 +1963,12 @@ export const zJobParameters = z.object({
1948
1963
  il_dol_project_id: z.string().nullish(),
1949
1964
  il_dol_state_capital_funds: z.boolean().nullish(),
1950
1965
  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
1966
  il_dol_public_body_contact_id: z.string().nullish(),
1954
1967
  il_dol_public_body_address_id: z.string().nullish(),
1968
+ il_dol_contract_number: z.string().nullish(),
1969
+ il_shines_project_id: z.string().nullish(),
1955
1970
  ny_dol_prc_number: z.string().nullish()
1956
- }).nullish()
1971
+ }).optional()
1957
1972
  });
1958
1973
  /**
1959
1974
  * Parameters for updating an existing job. Accepts every job_parameters field, plus a directly settable status.
@@ -1998,14 +2013,70 @@ export const zUserCompanyScheduledTerminationParameters = z.object({
1998
2013
  termination_date: z.string()
1999
2014
  });
2000
2015
  /**
2001
- * One problem found while processing an accepted import.
2016
+ * One problem found while processing an accepted import, whatever its type.
2002
2017
  */
2003
- export const zTimeEntryImportProcessingError = z.object({
2018
+ export const zImportProcessingError = z.object({
2004
2019
  code: z.string(),
2005
2020
  row: z.int().nullable(),
2006
2021
  column: z.string().nullable(),
2007
2022
  context: z.record(z.string(), z.unknown())
2008
2023
  });
2024
+ /**
2025
+ * One bulk upload of day-level hours against a pay period, and how it turned out.
2026
+ */
2027
+ export const zAggregateTimeImportResponseObject = z.object({
2028
+ id: z.string(),
2029
+ pay_period_id: z.string(),
2030
+ status: z.enum([
2031
+ 'pending',
2032
+ 'processing',
2033
+ 'processed',
2034
+ 'success',
2035
+ 'failed'
2036
+ ]),
2037
+ processed_rows_count: z.int(),
2038
+ processing_errors: z.array(zImportProcessingError),
2039
+ completed_at: z.iso.datetime().nullable(),
2040
+ created_at: z.iso.datetime(),
2041
+ updated_at: z.iso.datetime()
2042
+ });
2043
+ /**
2044
+ * 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.
2045
+ *
2046
+ * 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.
2047
+ *
2048
+ * 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.
2049
+ */
2050
+ export const zAggregateTimeImportParameters = z.object({
2051
+ file_signed_id: z.string()
2052
+ });
2053
+ /**
2054
+ * One bulk upload of a certified payroll report against a pay period, and how it turned out.
2055
+ */
2056
+ export const zDsptchCprImportResponseObject = z.object({
2057
+ id: z.string(),
2058
+ pay_period_id: z.string(),
2059
+ status: z.enum([
2060
+ 'pending',
2061
+ 'processing',
2062
+ 'processed',
2063
+ 'success',
2064
+ 'failed'
2065
+ ]),
2066
+ processed_rows_count: z.int(),
2067
+ processing_errors: z.array(zImportProcessingError),
2068
+ completed_at: z.iso.datetime().nullable(),
2069
+ created_at: z.iso.datetime(),
2070
+ updated_at: z.iso.datetime()
2071
+ });
2072
+ /**
2073
+ * 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
+ *
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`.
2076
+ */
2077
+ export const zDsptchCprImportParameters = z.object({
2078
+ file_signed_id: z.string()
2079
+ });
2009
2080
  /**
2010
2081
  * One bulk upload of time entries against a pay period, and how it turned out.
2011
2082
  */
@@ -2020,7 +2091,7 @@ export const zTimeEntryImportResponseObject = z.object({
2020
2091
  'failed'
2021
2092
  ]),
2022
2093
  processed_rows_count: z.int(),
2023
- processing_errors: z.array(zTimeEntryImportProcessingError),
2094
+ processing_errors: z.array(zImportProcessingError),
2024
2095
  completed_at: z.iso.datetime().nullable(),
2025
2096
  created_at: z.iso.datetime(),
2026
2097
  updated_at: z.iso.datetime()
@@ -7226,6 +7297,88 @@ export const zUpdateOvertimeRulePath = z.object({
7226
7297
  * Success
7227
7298
  */
7228
7299
  export const zUpdateOvertimeRuleResponse = zOvertimeRuleResponseObject;
7300
+ export const zListAggregateTimeImportsPath = z.object({
7301
+ pay_period_id: z.string()
7302
+ });
7303
+ export const zListAggregateTimeImportsQuery = z.object({
7304
+ 'filter[status]': z.string().optional(),
7305
+ filter: z.string().optional(),
7306
+ 'filter[unexpected]': z.string().optional(),
7307
+ 'filter[completed_at][gte]': z.iso.datetime().optional(),
7308
+ 'filter[completed_at][lte]': z.iso.datetime().optional(),
7309
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
7310
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
7311
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
7312
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
7313
+ 'page[cursor]': z.string().optional(),
7314
+ 'page[limit]': z.int().gte(1).optional().default(20),
7315
+ page: z.string().optional()
7316
+ });
7317
+ /**
7318
+ * Success
7319
+ */
7320
+ export const zListAggregateTimeImportsResponse = z.object({
7321
+ meta: zMeta,
7322
+ links: zLinks,
7323
+ data: z.array(zAggregateTimeImportResponseObject)
7324
+ });
7325
+ export const zCreateAggregateTimeImportBody = zAggregateTimeImportParameters;
7326
+ export const zCreateAggregateTimeImportPath = z.object({
7327
+ pay_period_id: z.string()
7328
+ });
7329
+ /**
7330
+ * Created
7331
+ */
7332
+ export const zCreateAggregateTimeImportResponse = zAggregateTimeImportResponseObject;
7333
+ export const zGetAggregateTimeImportPath = z.object({
7334
+ pay_period_id: z.string(),
7335
+ id: z.string()
7336
+ });
7337
+ /**
7338
+ * Success
7339
+ */
7340
+ export const zGetAggregateTimeImportResponse = zAggregateTimeImportResponseObject;
7341
+ export const zListDsptchCprImportsPath = z.object({
7342
+ pay_period_id: z.string()
7343
+ });
7344
+ export const zListDsptchCprImportsQuery = z.object({
7345
+ 'filter[status]': z.string().optional(),
7346
+ filter: z.string().optional(),
7347
+ 'filter[unexpected]': z.string().optional(),
7348
+ 'filter[completed_at][gte]': z.iso.datetime().optional(),
7349
+ 'filter[completed_at][lte]': z.iso.datetime().optional(),
7350
+ 'filter[created_at][gte]': z.iso.datetime().optional(),
7351
+ 'filter[created_at][lte]': z.iso.datetime().optional(),
7352
+ 'filter[updated_at][gte]': z.iso.datetime().optional(),
7353
+ 'filter[updated_at][lte]': z.iso.datetime().optional(),
7354
+ 'page[cursor]': z.string().optional(),
7355
+ 'page[limit]': z.int().gte(1).optional().default(20),
7356
+ page: z.string().optional()
7357
+ });
7358
+ /**
7359
+ * Success
7360
+ */
7361
+ export const zListDsptchCprImportsResponse = z.object({
7362
+ meta: zMeta,
7363
+ links: zLinks,
7364
+ data: z.array(zDsptchCprImportResponseObject)
7365
+ });
7366
+ export const zCreateDsptchCprImportBody = zDsptchCprImportParameters;
7367
+ export const zCreateDsptchCprImportPath = z.object({
7368
+ pay_period_id: z.string()
7369
+ });
7370
+ /**
7371
+ * Created
7372
+ */
7373
+ export const zCreateDsptchCprImportResponse = zDsptchCprImportResponseObject;
7374
+ export const zGetDsptchCprImportPath = z.object({
7375
+ pay_period_id: z.string(),
7376
+ id: z.string()
7377
+ });
7378
+ /**
7379
+ * Success
7380
+ */
7381
+ export const zGetDsptchCprImportResponse = zDsptchCprImportResponseObject;
7229
7382
  export const zListTimeEntryImportsPath = z.object({
7230
7383
  pay_period_id: z.string()
7231
7384
  });
@@ -7779,6 +7932,14 @@ export const zUpdateApprenticeshipOccupationPath = z.object({
7779
7932
  * Success
7780
7933
  */
7781
7934
  export const zUpdateApprenticeshipOccupationResponse = zPwaTradeApprenticeshipOccupationResponseObject;
7935
+ export const zCreateMergeBody = zPwaTradeMergeParameters;
7936
+ export const zCreateMergePath = z.object({
7937
+ trade_id: z.string()
7938
+ });
7939
+ /**
7940
+ * Success
7941
+ */
7942
+ export const zCreateMergeResponse = zPwaTradeResponseObject;
7782
7943
  export const zListTradesQuery = z.object({
7783
7944
  'filter[project_id]': z.string().optional(),
7784
7945
  '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.15.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",