@fabriktor/fx 0.0.137 → 0.0.139

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.
@@ -35,6 +35,7 @@ export type PayrollFilters = {
35
35
  pay_config_id?: string[];
36
36
  payroll_id?: string[];
37
37
  hour_bank_id?: string[];
38
+ source_hour_bank_ids?: string[];
38
39
  folder_id?: string[];
39
40
  period_index?: number[];
40
41
  period_indexes?: number[];
@@ -42,6 +42,7 @@ export const payrollPolicies = {
42
42
  "employee_id",
43
43
  "employee_pay_config_id",
44
44
  "hour_bank_id",
45
+ "source_hour_bank_ids",
45
46
  "is_banked",
46
47
  "is_problematic",
47
48
  "period_indexes",
@@ -1,6 +1,7 @@
1
1
  import { type Date as SchemaDate, type OperationResult, type Summary, type WeekSheet } from "@fabriktor/schema";
2
2
  import type { BillableOperator, TimesheetsOperator } from "@fabriktor/client";
3
3
  import type { ContactsFXOperator } from "../contacts/contacts.js";
4
+ import type { MultiCreateAttempt } from "../core/multi-create.js";
4
5
  import { type LoadTimesheetsReadContextOptions, type QueryTimesheetSyncDestinationsOptions, type QueryTimesheetSyncSourcesOptions, type TimesheetsReadContext, type TimesheetsReadOptions, type TimesheetSyncTarget } from "./access.js";
5
6
  import { TimesheetsWorkspace } from "./workspace.js";
6
7
  type PunchPayload = Parameters<TimesheetsOperator["punch"]>[0];
@@ -64,7 +65,7 @@ export type SyncWeekOptions = {
64
65
  export type SyncDaysOptions = SyncWeekOptions & {
65
66
  days: number[];
66
67
  };
67
- export type ApproveWeekSheetsOptions = {
68
+ export type ApproveWeekSheetsOptions = Partial<MultiCreateAttempt> & {
68
69
  employer_id: string;
69
70
  week_sheets: WeekSheet[];
70
71
  };
@@ -275,7 +275,8 @@ export class TimesheetsFX {
275
275
  const ids = [];
276
276
  for (const expected of opts.week_sheets) {
277
277
  // Query cleaners can return partial days. Always authorize the whole fresh record.
278
- const week_sheet = await this.findWeekSheet(expected.id);
278
+ const week_sheet = await this.findWeekSheet(expected.id, opts.signal);
279
+ opts.signal?.throwIfAborted();
279
280
  if (week_sheet.updated_at !== expected.updated_at)
280
281
  throw new PreActionBlocked(TimesheetsBlock.Changed);
281
282
  if (!timesheetCanApprove(week_sheet))
@@ -308,12 +309,17 @@ export class TimesheetsFX {
308
309
  const input = {
309
310
  ids: normalizeIDs(ids),
310
311
  employer_id,
312
+ idempotency_key: opts.idempotency_key,
313
+ signal: opts.signal,
311
314
  };
315
+ opts.signal?.throwIfAborted();
316
+ opts.before_request?.();
312
317
  await this.timesheets.approve(input);
313
318
  }
314
- async findWeekSheet(id) {
319
+ async findWeekSheet(id, signal) {
315
320
  const out = await this.timesheets.findOneWeekSheet({
316
321
  id,
322
+ signal,
317
323
  });
318
324
  const week_sheet = out.value;
319
325
  if (week_sheet === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.137",
3
+ "version": "0.0.139",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,8 +17,8 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/client": "0.0.95",
20
+ "@fabriktor/client": "0.0.97",
21
21
  "@fabriktor/fx": "0.0.94",
22
- "@fabriktor/schema": "0.0.67"
22
+ "@fabriktor/schema": "0.0.68"
23
23
  }
24
24
  }