@worknice/utils 0.5.1-rc.4 → 0.6.0-rc.2
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/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/leave-requests/calculateLeaveHours.d.ts +15 -0
- package/dist/leave-requests/calculateLeaveHours.js +47 -0
- package/dist/leave-requests/calculateLeaveHours.js.map +1 -0
- package/dist/regional/au/holidays.d.ts +5 -0
- package/dist/regional/au/holidays.js +208 -0
- package/dist/regional/au/holidays.js.map +1 -0
- package/dist/regional/au/states.d.ts +4 -0
- package/dist/regional/au/states.js +7 -0
- package/dist/regional/au/states.js.map +1 -0
- package/dist/temporal/hasOverlappingDateRange.d.ts +9 -0
- package/dist/temporal/hasOverlappingDateRange.js +17 -0
- package/dist/temporal/hasOverlappingDateRange.js.map +1 -0
- package/dist/webhooks.d.ts +13 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export { calculateLeaveHours } from './leave-requests/calculateLeaveHours.js';
|
|
2
|
+
export { State, isState } from './regional/au/states.js';
|
|
3
|
+
export { PUBLIC_HOLIDAYS } from './regional/au/holidays.js';
|
|
1
4
|
export { default as compareInstants } from './temporal/compareInstants.js';
|
|
2
5
|
export { default as comparePlainDates } from './temporal/comparePlainDates.js';
|
|
3
6
|
export { default as convertPlainDateToInstant } from './temporal/convertPlainDateToInstant.js';
|
|
4
7
|
export { default as envCheck } from './temporal/envCheck.js';
|
|
8
|
+
export { hasOverlappingDateRange } from './temporal/hasOverlappingDateRange.js';
|
|
5
9
|
export { default as isInstantAfter } from './temporal/isInstantAfter.js';
|
|
6
10
|
export { default as isInstantBefore } from './temporal/isInstantBefore.js';
|
|
7
11
|
export { default as isPlainDateAfter } from './temporal/isPlainDateAfter.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { calculateLeaveHours } from "./leave-requests/calculateLeaveHours.js";
|
|
2
|
+
import { isState } from "./regional/au/states.js";
|
|
3
|
+
import { PUBLIC_HOLIDAYS } from "./regional/au/holidays.js";
|
|
1
4
|
import { default as default2 } from "./temporal/compareInstants.js";
|
|
2
5
|
import { default as default3 } from "./temporal/comparePlainDates.js";
|
|
3
6
|
import { default as default4 } from "./temporal/convertPlainDateToInstant.js";
|
|
4
7
|
import { default as default5 } from "./temporal/envCheck.js";
|
|
8
|
+
import { hasOverlappingDateRange } from "./temporal/hasOverlappingDateRange.js";
|
|
5
9
|
import { default as default6 } from "./temporal/isInstantAfter.js";
|
|
6
10
|
import { default as default7 } from "./temporal/isInstantBefore.js";
|
|
7
11
|
import { default as default8 } from "./temporal/isPlainDateAfter.js";
|
|
@@ -22,15 +26,19 @@ export {
|
|
|
22
26
|
default16 as MAX_PLAIN_DATE,
|
|
23
27
|
default17 as MIN_INSTANT,
|
|
24
28
|
default18 as MIN_PLAIN_DATE,
|
|
29
|
+
PUBLIC_HOLIDAYS,
|
|
30
|
+
calculateLeaveHours,
|
|
25
31
|
default2 as compareInstants,
|
|
26
32
|
default3 as comparePlainDates,
|
|
27
33
|
default4 as convertPlainDateToInstant,
|
|
28
34
|
default5 as envCheck,
|
|
35
|
+
hasOverlappingDateRange,
|
|
29
36
|
default6 as isInstantAfter,
|
|
30
37
|
default7 as isInstantBefore,
|
|
31
38
|
default8 as isPlainDateAfter,
|
|
32
39
|
default9 as isPlainDateBefore,
|
|
33
40
|
default10 as isSamePlainDate,
|
|
41
|
+
isState,
|
|
34
42
|
default11 as isValidInstant,
|
|
35
43
|
default12 as isValidPlainDate,
|
|
36
44
|
default13 as isValidPlainDateTime,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { default as compareInstants } from \"./temporal/compareInstants.js\";\nexport { default as comparePlainDates } from \"./temporal/comparePlainDates.js\";\nexport { default as convertPlainDateToInstant } from \"./temporal/convertPlainDateToInstant.js\";\nexport { default as envCheck } from \"./temporal/envCheck.js\";\nexport { default as isInstantAfter } from \"./temporal/isInstantAfter.js\";\nexport { default as isInstantBefore } from \"./temporal/isInstantBefore.js\";\nexport { default as isPlainDateAfter } from \"./temporal/isPlainDateAfter.js\";\nexport { default as isPlainDateBefore } from \"./temporal/isPlainDateBefore.js\";\nexport { default as isSamePlainDate } from \"./temporal/isSamePlainDate.js\";\nexport { default as isValidInstant } from \"./temporal/isValidInstant.js\";\nexport { default as isValidPlainDate } from \"./temporal/isValidPlainDate.js\";\nexport { default as isValidPlainDateTime } from \"./temporal/isValidPlainDateTime.js\";\nexport { default as latestInstant } from \"./temporal/latestInstant.js\";\nexport { default as MAX_INSTANT } from \"./temporal/MAX_INSTANT.js\";\nexport { default as MAX_PLAIN_DATE } from \"./temporal/MAX_PLAIN_DATE.js\";\nexport { default as MIN_INSTANT } from \"./temporal/MIN_INSTANT.js\";\nexport { default as MIN_PLAIN_DATE } from \"./temporal/MIN_PLAIN_DATE.js\";\nexport { default as parseInstant } from \"./temporal/parseInstant.js\";\nexport { default as parsePlainDate } from \"./temporal/parsePlainDate.js\";\n"],"mappings":"AAAA,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA4C;AACrD,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAmC;AAC5C,SAAoB,WAAXA,iBAAuC;AAChD,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAAiC;","names":["default"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { calculateLeaveHours } from \"./leave-requests/calculateLeaveHours.js\";\nexport { isState, type State } from \"./regional/au/states.js\";\nexport { PUBLIC_HOLIDAYS } from \"./regional/au/holidays.js\";\nexport { default as compareInstants } from \"./temporal/compareInstants.js\";\nexport { default as comparePlainDates } from \"./temporal/comparePlainDates.js\";\nexport { default as convertPlainDateToInstant } from \"./temporal/convertPlainDateToInstant.js\";\nexport { default as envCheck } from \"./temporal/envCheck.js\";\nexport { hasOverlappingDateRange } from \"./temporal/hasOverlappingDateRange.js\";\nexport { default as isInstantAfter } from \"./temporal/isInstantAfter.js\";\nexport { default as isInstantBefore } from \"./temporal/isInstantBefore.js\";\nexport { default as isPlainDateAfter } from \"./temporal/isPlainDateAfter.js\";\nexport { default as isPlainDateBefore } from \"./temporal/isPlainDateBefore.js\";\nexport { default as isSamePlainDate } from \"./temporal/isSamePlainDate.js\";\nexport { default as isValidInstant } from \"./temporal/isValidInstant.js\";\nexport { default as isValidPlainDate } from \"./temporal/isValidPlainDate.js\";\nexport { default as isValidPlainDateTime } from \"./temporal/isValidPlainDateTime.js\";\nexport { default as latestInstant } from \"./temporal/latestInstant.js\";\nexport { default as MAX_INSTANT } from \"./temporal/MAX_INSTANT.js\";\nexport { default as MAX_PLAIN_DATE } from \"./temporal/MAX_PLAIN_DATE.js\";\nexport { default as MIN_INSTANT } from \"./temporal/MIN_INSTANT.js\";\nexport { default as MIN_PLAIN_DATE } from \"./temporal/MIN_PLAIN_DATE.js\";\nexport { default as parseInstant } from \"./temporal/parseInstant.js\";\nexport { default as parsePlainDate } from \"./temporal/parsePlainDate.js\";\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC,SAAS,eAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA4C;AACrD,SAAoB,WAAXA,gBAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAmC;AAC5C,SAAoB,WAAXA,iBAAuC;AAChD,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA+B;AACxC,SAAoB,WAAXA,iBAAiC;","names":["default"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
|
|
3
|
+
type Date = string | Temporal.PlainDate;
|
|
4
|
+
declare const calculateLeaveHours: ({ startDate, endDate, workPattern, referenceDate, holidays, }: {
|
|
5
|
+
startDate: Date;
|
|
6
|
+
endDate: Date;
|
|
7
|
+
workPattern: number[];
|
|
8
|
+
referenceDate: Date;
|
|
9
|
+
holidays: Date[];
|
|
10
|
+
}) => {
|
|
11
|
+
totalHours: number;
|
|
12
|
+
hoursBreakdown: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { calculateLeaveHours };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Temporal } from "temporal-polyfill";
|
|
2
|
+
const validateWorkPattern = (workPattern) => {
|
|
3
|
+
if (workPattern.length === 0) {
|
|
4
|
+
return "Work pattern cannot be empty";
|
|
5
|
+
}
|
|
6
|
+
if (workPattern.length % 7 !== 0) {
|
|
7
|
+
return "Work pattern length must be a multiple of 7 days";
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
};
|
|
11
|
+
const calculateLeaveHours = ({
|
|
12
|
+
startDate,
|
|
13
|
+
endDate,
|
|
14
|
+
workPattern,
|
|
15
|
+
referenceDate,
|
|
16
|
+
holidays
|
|
17
|
+
}) => {
|
|
18
|
+
const validationError = validateWorkPattern(workPattern);
|
|
19
|
+
if (validationError) {
|
|
20
|
+
throw new Error(`Invalid work pattern: ${validationError}.`);
|
|
21
|
+
}
|
|
22
|
+
const start = Temporal.PlainDate.from(startDate);
|
|
23
|
+
const end = Temporal.PlainDate.from(endDate);
|
|
24
|
+
const totalDays = end.since(start).days + 1;
|
|
25
|
+
let totalHours = 0;
|
|
26
|
+
let hoursBreakdown = "";
|
|
27
|
+
for (let i = 0; i < totalDays; i++) {
|
|
28
|
+
const currentDate = start.add({ days: i });
|
|
29
|
+
const dateString = currentDate.toString();
|
|
30
|
+
const isHoliday = holidays.includes(dateString);
|
|
31
|
+
if (isHoliday) {
|
|
32
|
+
hoursBreakdown += `
|
|
33
|
+
- ${dateString}: Public Holiday`;
|
|
34
|
+
} else {
|
|
35
|
+
const patternIndex = currentDate.since(referenceDate).days % workPattern.length;
|
|
36
|
+
const hours = workPattern[patternIndex];
|
|
37
|
+
totalHours += hours;
|
|
38
|
+
hoursBreakdown += `
|
|
39
|
+
- ${dateString}: ${hours} hours`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { totalHours, hoursBreakdown };
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
calculateLeaveHours
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=calculateLeaveHours.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/leave-requests/calculateLeaveHours.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\ntype Date = string | Temporal.PlainDate;\n\nconst validateWorkPattern = (workPattern: number[]): string | null => {\n if (workPattern.length === 0) {\n return \"Work pattern cannot be empty\";\n }\n if (workPattern.length % 7 !== 0) {\n return \"Work pattern length must be a multiple of 7 days\";\n }\n return null;\n};\n\nexport const calculateLeaveHours = ({\n startDate,\n endDate,\n workPattern,\n referenceDate,\n holidays,\n}: {\n startDate: Date;\n endDate: Date;\n workPattern: number[];\n referenceDate: Date;\n holidays: Date[];\n}) => {\n const validationError = validateWorkPattern(workPattern);\n if (validationError) {\n throw new Error(`Invalid work pattern: ${validationError}.`);\n }\n\n const start = Temporal.PlainDate.from(startDate);\n const end = Temporal.PlainDate.from(endDate);\n\n const totalDays = end.since(start).days + 1;\n\n let totalHours = 0;\n let hoursBreakdown = \"\";\n\n for (let i = 0; i < totalDays; i++) {\n const currentDate = start.add({ days: i });\n const dateString = currentDate.toString();\n const isHoliday = holidays.includes(dateString);\n\n if (isHoliday) {\n hoursBreakdown += `\\n - ${dateString}: Public Holiday`;\n } else {\n const patternIndex = currentDate.since(referenceDate).days % workPattern.length;\n const hours = workPattern[patternIndex] as number;\n totalHours += hours;\n hoursBreakdown += `\\n - ${dateString}: ${hours} hours`;\n }\n }\n\n return { totalHours, hoursBreakdown };\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAIzB,MAAM,sBAAsB,CAAC,gBAAyC;AACpE,MAAI,YAAY,WAAW,GAAG;AAC5B,WAAO;AAAA,EACT;AACA,MAAI,YAAY,SAAS,MAAM,GAAG;AAChC,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAMM;AACJ,QAAM,kBAAkB,oBAAoB,WAAW;AACvD,MAAI,iBAAiB;AACnB,UAAM,IAAI,MAAM,yBAAyB,eAAe,GAAG;AAAA,EAC7D;AAEA,QAAM,QAAQ,SAAS,UAAU,KAAK,SAAS;AAC/C,QAAM,MAAM,SAAS,UAAU,KAAK,OAAO;AAE3C,QAAM,YAAY,IAAI,MAAM,KAAK,EAAE,OAAO;AAE1C,MAAI,aAAa;AACjB,MAAI,iBAAiB;AAErB,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,cAAc,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;AACzC,UAAM,aAAa,YAAY,SAAS;AACxC,UAAM,YAAY,SAAS,SAAS,UAAU;AAE9C,QAAI,WAAW;AACb,wBAAkB;AAAA,KAAQ,UAAU;AAAA,IACtC,OAAO;AACL,YAAM,eAAe,YAAY,MAAM,aAAa,EAAE,OAAO,YAAY;AACzE,YAAM,QAAQ,YAAY,YAAY;AACtC,oBAAc;AACd,wBAAkB;AAAA,KAAQ,UAAU,KAAK,KAAK;AAAA,IAChD;AAAA,EACF;AAEA,SAAO,EAAE,YAAY,eAAe;AACtC;","names":[]}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const PUBLIC_HOLIDAYS = {
|
|
2
|
+
ACT: [
|
|
3
|
+
// 2025
|
|
4
|
+
"2025-01-01",
|
|
5
|
+
"2025-01-27",
|
|
6
|
+
"2025-03-10",
|
|
7
|
+
"2025-04-18",
|
|
8
|
+
"2025-04-21",
|
|
9
|
+
"2025-04-25",
|
|
10
|
+
"2025-06-02",
|
|
11
|
+
"2025-09-29",
|
|
12
|
+
"2025-10-06",
|
|
13
|
+
"2025-12-25",
|
|
14
|
+
"2025-12-26",
|
|
15
|
+
// 2026
|
|
16
|
+
"2026-01-01",
|
|
17
|
+
"2026-01-26",
|
|
18
|
+
"2026-03-09",
|
|
19
|
+
"2026-04-03",
|
|
20
|
+
"2026-04-06",
|
|
21
|
+
"2026-04-25",
|
|
22
|
+
"2026-06-01",
|
|
23
|
+
"2026-09-28",
|
|
24
|
+
"2026-10-05",
|
|
25
|
+
"2026-12-25",
|
|
26
|
+
"2026-12-28"
|
|
27
|
+
],
|
|
28
|
+
NSW: [
|
|
29
|
+
// 2025
|
|
30
|
+
"2025-01-01",
|
|
31
|
+
"2025-01-27",
|
|
32
|
+
"2025-04-18",
|
|
33
|
+
"2025-04-21",
|
|
34
|
+
"2025-04-25",
|
|
35
|
+
"2025-06-09",
|
|
36
|
+
"2025-08-04",
|
|
37
|
+
"2025-10-06",
|
|
38
|
+
"2025-12-25",
|
|
39
|
+
"2025-12-26",
|
|
40
|
+
// 2026
|
|
41
|
+
"2026-01-01",
|
|
42
|
+
"2026-01-26",
|
|
43
|
+
"2026-04-03",
|
|
44
|
+
"2026-04-06",
|
|
45
|
+
"2026-04-25",
|
|
46
|
+
"2026-06-08",
|
|
47
|
+
"2026-08-03",
|
|
48
|
+
"2026-10-05",
|
|
49
|
+
"2026-12-25",
|
|
50
|
+
"2026-12-28"
|
|
51
|
+
],
|
|
52
|
+
NT: [
|
|
53
|
+
// 2025
|
|
54
|
+
"2025-01-01",
|
|
55
|
+
"2025-01-27",
|
|
56
|
+
"2025-04-18",
|
|
57
|
+
"2025-04-19",
|
|
58
|
+
"2025-04-21",
|
|
59
|
+
"2025-04-25",
|
|
60
|
+
"2025-05-05",
|
|
61
|
+
"2025-06-02",
|
|
62
|
+
"2025-08-04",
|
|
63
|
+
"2025-12-25",
|
|
64
|
+
"2025-12-26",
|
|
65
|
+
// 2026
|
|
66
|
+
"2026-01-01",
|
|
67
|
+
"2026-01-26",
|
|
68
|
+
"2026-04-03",
|
|
69
|
+
"2026-04-04",
|
|
70
|
+
"2026-04-06",
|
|
71
|
+
"2026-04-25",
|
|
72
|
+
"2026-05-04",
|
|
73
|
+
"2026-06-01",
|
|
74
|
+
"2026-08-03",
|
|
75
|
+
"2026-12-25",
|
|
76
|
+
"2026-12-28"
|
|
77
|
+
],
|
|
78
|
+
QLD: [
|
|
79
|
+
// 2025
|
|
80
|
+
"2025-01-01",
|
|
81
|
+
"2025-01-27",
|
|
82
|
+
"2025-04-18",
|
|
83
|
+
"2025-04-21",
|
|
84
|
+
"2025-04-25",
|
|
85
|
+
"2025-05-05",
|
|
86
|
+
"2025-08-13",
|
|
87
|
+
"2025-10-06",
|
|
88
|
+
"2025-12-25",
|
|
89
|
+
"2025-12-26",
|
|
90
|
+
// 2026
|
|
91
|
+
"2026-01-01",
|
|
92
|
+
"2026-01-26",
|
|
93
|
+
"2026-04-03",
|
|
94
|
+
"2026-04-06",
|
|
95
|
+
"2026-04-25",
|
|
96
|
+
"2026-05-04",
|
|
97
|
+
"2026-08-12",
|
|
98
|
+
"2026-10-05",
|
|
99
|
+
"2026-12-25",
|
|
100
|
+
"2026-12-28"
|
|
101
|
+
],
|
|
102
|
+
SA: [
|
|
103
|
+
// 2025
|
|
104
|
+
"2025-01-01",
|
|
105
|
+
"2025-01-27",
|
|
106
|
+
"2025-03-10",
|
|
107
|
+
"2025-04-18",
|
|
108
|
+
"2025-04-21",
|
|
109
|
+
"2025-04-25",
|
|
110
|
+
"2025-06-09",
|
|
111
|
+
"2025-08-04",
|
|
112
|
+
"2025-10-06",
|
|
113
|
+
"2025-12-25",
|
|
114
|
+
"2025-12-26",
|
|
115
|
+
// 2026
|
|
116
|
+
"2026-01-01",
|
|
117
|
+
"2026-01-26",
|
|
118
|
+
"2026-03-09",
|
|
119
|
+
"2026-04-03",
|
|
120
|
+
"2026-04-06",
|
|
121
|
+
"2026-04-25",
|
|
122
|
+
"2026-06-08",
|
|
123
|
+
"2026-08-03",
|
|
124
|
+
"2026-10-05",
|
|
125
|
+
"2026-12-25",
|
|
126
|
+
"2026-12-28"
|
|
127
|
+
],
|
|
128
|
+
TAS: [
|
|
129
|
+
// 2025
|
|
130
|
+
"2025-01-01",
|
|
131
|
+
"2025-01-27",
|
|
132
|
+
"2025-03-10",
|
|
133
|
+
"2025-04-18",
|
|
134
|
+
"2025-04-21",
|
|
135
|
+
"2025-04-25",
|
|
136
|
+
"2025-06-09",
|
|
137
|
+
"2025-08-04",
|
|
138
|
+
"2025-11-03",
|
|
139
|
+
"2025-12-25",
|
|
140
|
+
"2025-12-26",
|
|
141
|
+
// 2026
|
|
142
|
+
"2026-01-01",
|
|
143
|
+
"2026-01-26",
|
|
144
|
+
"2026-03-09",
|
|
145
|
+
"2026-04-03",
|
|
146
|
+
"2026-04-06",
|
|
147
|
+
"2026-04-25",
|
|
148
|
+
"2026-06-08",
|
|
149
|
+
"2026-08-03",
|
|
150
|
+
"2026-11-02",
|
|
151
|
+
"2026-12-25",
|
|
152
|
+
"2026-12-28"
|
|
153
|
+
],
|
|
154
|
+
VIC: [
|
|
155
|
+
// 2025
|
|
156
|
+
"2025-01-01",
|
|
157
|
+
"2025-01-27",
|
|
158
|
+
"2025-03-10",
|
|
159
|
+
"2025-04-18",
|
|
160
|
+
"2025-04-21",
|
|
161
|
+
"2025-04-25",
|
|
162
|
+
"2025-06-09",
|
|
163
|
+
"2025-09-29",
|
|
164
|
+
"2025-11-04",
|
|
165
|
+
"2025-12-25",
|
|
166
|
+
"2025-12-26",
|
|
167
|
+
// 2026
|
|
168
|
+
"2026-01-01",
|
|
169
|
+
"2026-01-26",
|
|
170
|
+
"2026-03-09",
|
|
171
|
+
"2026-04-03",
|
|
172
|
+
"2026-04-06",
|
|
173
|
+
"2026-04-25",
|
|
174
|
+
"2026-06-08",
|
|
175
|
+
"2026-09-28",
|
|
176
|
+
"2026-11-03",
|
|
177
|
+
"2026-12-25",
|
|
178
|
+
"2026-12-28"
|
|
179
|
+
],
|
|
180
|
+
WA: [
|
|
181
|
+
// 2025
|
|
182
|
+
"2025-01-01",
|
|
183
|
+
"2025-01-27",
|
|
184
|
+
"2025-03-03",
|
|
185
|
+
"2025-04-18",
|
|
186
|
+
"2025-04-21",
|
|
187
|
+
"2025-04-25",
|
|
188
|
+
"2025-06-02",
|
|
189
|
+
"2025-09-29",
|
|
190
|
+
"2025-12-25",
|
|
191
|
+
"2025-12-26",
|
|
192
|
+
// 2026
|
|
193
|
+
"2026-01-01",
|
|
194
|
+
"2026-01-26",
|
|
195
|
+
"2026-03-02",
|
|
196
|
+
"2026-04-03",
|
|
197
|
+
"2026-04-06",
|
|
198
|
+
"2026-04-25",
|
|
199
|
+
"2026-06-01",
|
|
200
|
+
"2026-09-28",
|
|
201
|
+
"2026-12-25",
|
|
202
|
+
"2026-12-28"
|
|
203
|
+
]
|
|
204
|
+
};
|
|
205
|
+
export {
|
|
206
|
+
PUBLIC_HOLIDAYS
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=holidays.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/regional/au/holidays.ts"],"sourcesContent":["import type { State } from \"./states.js\";\n\nexport const PUBLIC_HOLIDAYS: Record<State, string[]> = {\n ACT: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-03-10\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-06-02\",\n \"2025-09-29\",\n \"2025-10-06\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-03-09\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-06-01\",\n \"2026-09-28\",\n \"2026-10-05\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n NSW: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-06-09\",\n \"2025-08-04\",\n \"2025-10-06\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-06-08\",\n \"2026-08-03\",\n \"2026-10-05\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n NT: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-04-18\",\n \"2025-04-19\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-05-05\",\n \"2025-06-02\",\n \"2025-08-04\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-04-03\",\n \"2026-04-04\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-05-04\",\n \"2026-06-01\",\n \"2026-08-03\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n QLD: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-05-05\",\n \"2025-08-13\",\n \"2025-10-06\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-05-04\",\n \"2026-08-12\",\n \"2026-10-05\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n SA: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-03-10\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-06-09\",\n \"2025-08-04\",\n \"2025-10-06\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-03-09\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-06-08\",\n \"2026-08-03\",\n \"2026-10-05\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n TAS: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-03-10\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-06-09\",\n \"2025-08-04\",\n \"2025-11-03\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-03-09\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-06-08\",\n \"2026-08-03\",\n \"2026-11-02\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n VIC: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-03-10\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-06-09\",\n \"2025-09-29\",\n \"2025-11-04\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-03-09\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-06-08\",\n \"2026-09-28\",\n \"2026-11-03\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n WA: [\n // 2025\n \"2025-01-01\",\n \"2025-01-27\",\n \"2025-03-03\",\n \"2025-04-18\",\n \"2025-04-21\",\n \"2025-04-25\",\n \"2025-06-02\",\n \"2025-09-29\",\n \"2025-12-25\",\n \"2025-12-26\",\n // 2026\n \"2026-01-01\",\n \"2026-01-26\",\n \"2026-03-02\",\n \"2026-04-03\",\n \"2026-04-06\",\n \"2026-04-25\",\n \"2026-06-01\",\n \"2026-09-28\",\n \"2026-12-25\",\n \"2026-12-28\",\n ],\n};\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/regional/au/states.ts"],"sourcesContent":["export type State = \"NSW\" | \"VIC\" | \"QLD\" | \"SA\" | \"WA\" | \"TAS\" | \"NT\" | \"ACT\";\n\nexport const isState = (value: string): value is State => {\n return [\"NSW\", \"VIC\", \"QLD\", \"SA\", \"WA\", \"TAS\", \"NT\", \"ACT\"].includes(value);\n};\n"],"mappings":"AAEO,MAAM,UAAU,CAAC,UAAkC;AACxD,SAAO,CAAC,OAAO,OAAO,OAAO,MAAM,MAAM,OAAO,MAAM,KAAK,EAAE,SAAS,KAAK;AAC7E;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
|
|
3
|
+
type DateRange = {
|
|
4
|
+
startDate: Temporal.PlainDate | string;
|
|
5
|
+
endDate: Temporal.PlainDate | string;
|
|
6
|
+
};
|
|
7
|
+
declare const hasOverlappingDateRange: (startDate: Temporal.PlainDate | string, endDate: Temporal.PlainDate | string, dateRanges: DateRange[]) => boolean;
|
|
8
|
+
|
|
9
|
+
export { hasOverlappingDateRange };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Temporal } from "temporal-polyfill";
|
|
2
|
+
const hasOverlappingDateRange = (startDate, endDate, dateRanges) => {
|
|
3
|
+
const start = Temporal.PlainDate.from(startDate);
|
|
4
|
+
const end = Temporal.PlainDate.from(endDate);
|
|
5
|
+
for (const dateRange of dateRanges) {
|
|
6
|
+
const rangeStart = Temporal.PlainDate.from(dateRange.startDate);
|
|
7
|
+
const rangeEnd = Temporal.PlainDate.from(dateRange.endDate);
|
|
8
|
+
if (Temporal.PlainDate.compare(start, rangeEnd) <= 0 && Temporal.PlainDate.compare(end, rangeStart) >= 0) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
hasOverlappingDateRange
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=hasOverlappingDateRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/temporal/hasOverlappingDateRange.ts"],"sourcesContent":["import { Temporal } from \"temporal-polyfill\";\n\ntype DateRange = {\n startDate: Temporal.PlainDate | string;\n endDate: Temporal.PlainDate | string;\n};\n\nexport const hasOverlappingDateRange = (\n startDate: Temporal.PlainDate | string,\n endDate: Temporal.PlainDate | string,\n dateRanges: DateRange[],\n): boolean => {\n const start = Temporal.PlainDate.from(startDate);\n const end = Temporal.PlainDate.from(endDate);\n\n for (const dateRange of dateRanges) {\n const rangeStart = Temporal.PlainDate.from(dateRange.startDate);\n const rangeEnd = Temporal.PlainDate.from(dateRange.endDate);\n\n if (\n Temporal.PlainDate.compare(start, rangeEnd) <= 0 &&\n Temporal.PlainDate.compare(end, rangeStart) >= 0\n ) {\n return true;\n }\n }\n\n return false;\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAOlB,MAAM,0BAA0B,CACrC,WACA,SACA,eACY;AACZ,QAAM,QAAQ,SAAS,UAAU,KAAK,SAAS;AAC/C,QAAM,MAAM,SAAS,UAAU,KAAK,OAAO;AAE3C,aAAW,aAAa,YAAY;AAClC,UAAM,aAAa,SAAS,UAAU,KAAK,UAAU,SAAS;AAC9D,UAAM,WAAW,SAAS,UAAU,KAAK,UAAU,OAAO;AAE1D,QACE,SAAS,UAAU,QAAQ,OAAO,QAAQ,KAAK,KAC/C,SAAS,UAAU,QAAQ,KAAK,UAAU,KAAK,GAC/C;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -23,9 +23,6 @@ type ApproveLeaveRequestRequestPayload = {
|
|
|
23
23
|
id: string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Use `personConnection.remote.id` instead.
|
|
28
|
-
*/
|
|
29
26
|
remoteId: string;
|
|
30
27
|
};
|
|
31
28
|
type ApproveLeaveRequestResponsePayload = {
|
|
@@ -59,9 +56,6 @@ type CancelLeaveRequestRequestPayload = {
|
|
|
59
56
|
id: string;
|
|
60
57
|
};
|
|
61
58
|
};
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Use `personConnection.remote.id` instead.
|
|
64
|
-
*/
|
|
65
59
|
remoteId: string;
|
|
66
60
|
};
|
|
67
61
|
type CancelLeaveRequestResponsePayload = {
|
|
@@ -156,9 +150,6 @@ type DenyLeaveRequestRequestPayload = {
|
|
|
156
150
|
id: string;
|
|
157
151
|
};
|
|
158
152
|
};
|
|
159
|
-
/**
|
|
160
|
-
* @deprecated Use `personConnection.remote.id` instead.
|
|
161
|
-
*/
|
|
162
153
|
remoteId: string;
|
|
163
154
|
};
|
|
164
155
|
type DenyLeaveRequestResponsePayload = {
|
|
@@ -174,6 +165,12 @@ type GetAuthorizationUrlRequestPayload = {
|
|
|
174
165
|
type GetAuthorizationUrlResponsePayload = {
|
|
175
166
|
authorizationUrl: string;
|
|
176
167
|
};
|
|
168
|
+
type GetConfigurationUrlRequestPayload = {
|
|
169
|
+
integrationId: string;
|
|
170
|
+
};
|
|
171
|
+
type GetConfigurationUrlResponsePayload = {
|
|
172
|
+
configurationUrl: string;
|
|
173
|
+
};
|
|
177
174
|
type GetLeaveBalancesRequestPayload = {
|
|
178
175
|
/**
|
|
179
176
|
* @deprecated Use `personConnection.integration.id` instead.
|
|
@@ -289,6 +286,9 @@ type GetLeaveRequestHoursResponsePayload = {
|
|
|
289
286
|
hours: string;
|
|
290
287
|
hoursBreakdown?: string | null;
|
|
291
288
|
ok: true;
|
|
289
|
+
} | {
|
|
290
|
+
errors: Array<string>;
|
|
291
|
+
ok: false;
|
|
292
292
|
};
|
|
293
293
|
type GetOpenUrlRequestPayload = {
|
|
294
294
|
integrationId: string;
|
|
@@ -338,13 +338,13 @@ type ProcessLeaveRequestRequestPayload = {
|
|
|
338
338
|
id: string;
|
|
339
339
|
};
|
|
340
340
|
};
|
|
341
|
-
/**
|
|
342
|
-
* @deprecated Use `personConnection.remote.id` instead.
|
|
343
|
-
*/
|
|
344
341
|
remoteId: string;
|
|
345
342
|
};
|
|
346
343
|
type ProcessLeaveRequestResponsePayload = {
|
|
347
344
|
ok: true;
|
|
345
|
+
} | {
|
|
346
|
+
errors: Array<string>;
|
|
347
|
+
ok: false;
|
|
348
348
|
};
|
|
349
349
|
type TriggerIntegrationSyncRequestPayload = {
|
|
350
350
|
integration: {
|
|
@@ -378,4 +378,4 @@ type TriggerIntegrationSyncRequestPayload = {
|
|
|
378
378
|
orgId: string;
|
|
379
379
|
};
|
|
380
380
|
|
|
381
|
-
export type { ApproveLeaveRequestRequestPayload, ApproveLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload, CancelLeaveRequestResponsePayload, CreateIntegrationRequestPayload, CreateLeaveRequestRequestPayload, CreateLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload, DenyLeaveRequestResponsePayload, GetAuthorizationUrlRequestPayload, GetAuthorizationUrlResponsePayload, GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload, GetLeaveCategoriesRequestPayload, GetLeaveCategoriesResponsePayload, GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload, GetOpenUrlRequestPayload, GetOpenUrlResponsePayload, PersonConnectedRequestPayload, ProcessLeaveRequestRequestPayload, ProcessLeaveRequestResponsePayload, TriggerIntegrationSyncRequestPayload };
|
|
381
|
+
export type { ApproveLeaveRequestRequestPayload, ApproveLeaveRequestResponsePayload, CancelLeaveRequestRequestPayload, CancelLeaveRequestResponsePayload, CreateIntegrationRequestPayload, CreateLeaveRequestRequestPayload, CreateLeaveRequestResponsePayload, DenyLeaveRequestRequestPayload, DenyLeaveRequestResponsePayload, GetAuthorizationUrlRequestPayload, GetAuthorizationUrlResponsePayload, GetConfigurationUrlRequestPayload, GetConfigurationUrlResponsePayload, GetLeaveBalancesRequestPayload, GetLeaveBalancesResponsePayload, GetLeaveCategoriesRequestPayload, GetLeaveCategoriesResponsePayload, GetLeaveRequestHoursRequestPayload, GetLeaveRequestHoursResponsePayload, GetOpenUrlRequestPayload, GetOpenUrlResponsePayload, PersonConnectedRequestPayload, ProcessLeaveRequestRequestPayload, ProcessLeaveRequestResponsePayload, TriggerIntegrationSyncRequestPayload };
|