@fabriktor/fx 0.0.39 → 0.0.40
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.
- package/dist/src/billable/billable.d.ts +164 -1
- package/dist/src/billable/billable.js +436 -0
- package/dist/src/calls/calls.d.ts +11 -0
- package/dist/src/calls/calls.js +26 -0
- package/dist/src/chat/chat.d.ts +22 -1
- package/dist/src/chat/chat.js +33 -25
- package/dist/src/contacts/contacts.d.ts +12 -2
- package/dist/src/contacts/contacts.js +33 -7
- package/dist/src/core/id.d.ts +3 -0
- package/dist/src/core/id.js +24 -0
- package/dist/src/feed/feed.d.ts +39 -3
- package/dist/src/feed/feed.js +85 -7
- package/dist/src/fulfillments/fulfillments.d.ts +32 -0
- package/dist/src/fulfillments/fulfillments.js +54 -0
- package/dist/src/fx.d.ts +5 -1
- package/dist/src/fx.js +11 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/jobs/jobs.d.ts +52 -4
- package/dist/src/jobs/jobs.js +120 -9
- package/dist/src/marketplace/marketplace.d.ts +29 -1
- package/dist/src/marketplace/marketplace.js +64 -1
- package/dist/src/memos/memos.js +4 -28
- package/dist/src/payments/payments.d.ts +112 -1
- package/dist/src/payments/payments.js +291 -15
- package/dist/src/payrolls/payrolls.d.ts +134 -1
- package/dist/src/payrolls/payrolls.js +364 -0
- package/dist/src/preferences/preferences.d.ts +83 -1
- package/dist/src/preferences/preferences.js +227 -0
- package/dist/src/privacy/privacy.d.ts +21 -2
- package/dist/src/privacy/privacy.js +56 -5
- package/dist/src/routes/routes.d.ts +63 -3
- package/dist/src/routes/routes.js +151 -1
- package/dist/src/timesheets/timesheets.d.ts +11 -1
- package/dist/src/timesheets/timesheets.js +39 -1
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
6
|
import { PunchModeDefault, PunchModeDelete, PunchModeReplace, PunchModeWeekSheet, PunchStatusPending, PunchStatusWorking, PunchTypeIn, PunchTypeOut, PunchTypeRideIn, PunchTypeRideOut, ZeroID, } from "@fabriktor/schema";
|
|
7
|
-
import { errRequired, errValidation } from "../core/err.js";
|
|
7
|
+
import { errRequired, errResolveFailed, errValidation, } from "../core/err.js";
|
|
8
8
|
const allWeekDays = [0, 1, 2, 3, 4, 5, 6];
|
|
9
9
|
const minuteStep = 15;
|
|
10
10
|
const msgPunchInProgress = "A punch action is already in progress.";
|
|
@@ -21,6 +21,10 @@ const msgWeekSheetArchived = "Archived week sheets cannot be modified or approve
|
|
|
21
21
|
const msgWeekSheetEmployerMismatch = "Week sheet employer does not match the requested employer.";
|
|
22
22
|
const msgPunchNotPending = "All punches must be pending before the week sheet can be approved.";
|
|
23
23
|
const msgSyncEmployerMismatch = "Source and destination week sheets must belong to the same employer.";
|
|
24
|
+
const resourceWeekSheet = "week_sheet";
|
|
25
|
+
const resourceSummary = "summary";
|
|
26
|
+
const msgWeekSheetMissing = "Week sheet could not be resolved after the mutation.";
|
|
27
|
+
const msgSummaryMissing = "Summary could not be resolved after the mutation.";
|
|
24
28
|
export class TimesheetsFX {
|
|
25
29
|
timesheets;
|
|
26
30
|
punch_in_progress;
|
|
@@ -28,6 +32,14 @@ export class TimesheetsFX {
|
|
|
28
32
|
this.timesheets = opts.timesheets;
|
|
29
33
|
this.punch_in_progress = false;
|
|
30
34
|
}
|
|
35
|
+
async replaceWeekSheet(opts) {
|
|
36
|
+
await this.timesheets.replaceOneWeekSheet(opts);
|
|
37
|
+
return await this.findWeekSheet(opts.id);
|
|
38
|
+
}
|
|
39
|
+
async replaceSummary(opts) {
|
|
40
|
+
await this.timesheets.replaceOneSummary(opts);
|
|
41
|
+
return await this.findSummary(opts.id);
|
|
42
|
+
}
|
|
31
43
|
punchControls(opts) {
|
|
32
44
|
validateWeekDay(opts.week_day, "week_day");
|
|
33
45
|
if (opts.week_sheet?.is_archived) {
|
|
@@ -226,6 +238,32 @@ export class TimesheetsFX {
|
|
|
226
238
|
};
|
|
227
239
|
await this.timesheets.approve(input);
|
|
228
240
|
}
|
|
241
|
+
async findWeekSheet(id) {
|
|
242
|
+
const out = await this.timesheets.findOneWeekSheet({
|
|
243
|
+
id,
|
|
244
|
+
});
|
|
245
|
+
const week_sheet = out.value;
|
|
246
|
+
if (week_sheet === undefined) {
|
|
247
|
+
throw errResolveFailed({
|
|
248
|
+
resource: resourceWeekSheet,
|
|
249
|
+
msg: msgWeekSheetMissing,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return week_sheet;
|
|
253
|
+
}
|
|
254
|
+
async findSummary(id) {
|
|
255
|
+
const out = await this.timesheets.findOneSummary({
|
|
256
|
+
id,
|
|
257
|
+
});
|
|
258
|
+
const summary = out.value;
|
|
259
|
+
if (summary === undefined) {
|
|
260
|
+
throw errResolveFailed({
|
|
261
|
+
resource: resourceSummary,
|
|
262
|
+
msg: msgSummaryMissing,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
return summary;
|
|
266
|
+
}
|
|
229
267
|
async syncSheets(opts) {
|
|
230
268
|
const from_id = requiredID(opts.from.id, "from", msgWeekSheetIDRequired);
|
|
231
269
|
if (opts.to.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriktor/fx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
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.46",
|
|
21
21
|
"@fabriktor/schema": "0.0.32"
|
|
22
22
|
}
|
|
23
23
|
}
|