@fabriktor/fx 0.0.138 → 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.
|
@@ -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.
|
|
3
|
+
"version": "0.0.139",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"typescript": "^6.0.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fabriktor/client": "0.0.
|
|
20
|
+
"@fabriktor/client": "0.0.97",
|
|
21
21
|
"@fabriktor/fx": "0.0.94",
|
|
22
22
|
"@fabriktor/schema": "0.0.68"
|
|
23
23
|
}
|