absence.io 2.4.5 → 2.4.7
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/AbsenceIO.js +2 -2
- package/dist/Endpoints.d.ts +10 -10
- package/dist/Endpoints.js +10 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/Absence.d.ts +19 -19
- package/dist/interfaces/Allowance.d.ts +4 -4
- package/dist/interfaces/Department.d.ts +8 -8
- package/dist/interfaces/Location.d.ts +10 -10
- package/dist/interfaces/Options.d.ts +2 -2
- package/dist/interfaces/User.d.ts +12 -12
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/package.json +7 -7
package/dist/AbsenceIO.js
CHANGED
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.AbsenceIO = void 0;
|
|
37
|
-
const hawk = __importStar(require("@hapi/hawk"));
|
|
38
37
|
const api_client_1 = require("@ffflorian/api-client");
|
|
38
|
+
const hawk = __importStar(require("@hapi/hawk"));
|
|
39
39
|
const api_1 = require("./api");
|
|
40
40
|
class AbsenceIO {
|
|
41
41
|
constructor(options) {
|
|
@@ -47,7 +47,7 @@ class AbsenceIO {
|
|
|
47
47
|
key: this.options.apiKey,
|
|
48
48
|
};
|
|
49
49
|
this.apiClient = new api_client_1.APIClient(baseURL);
|
|
50
|
-
this.apiClient.interceptors.request.push(
|
|
50
|
+
this.apiClient.interceptors.request.push(config => {
|
|
51
51
|
const hawkHeader = hawk.client.header(config.url.toString(), config.method, { credentials });
|
|
52
52
|
config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: hawkHeader.header });
|
|
53
53
|
return config;
|
package/dist/Endpoints.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
export declare const Endpoint: {
|
|
2
|
-
ABSENCES: string;
|
|
3
|
-
CREATE: string;
|
|
4
|
-
ALLOWANCE_TYPES: string;
|
|
5
|
-
DEPARTMENTS: string;
|
|
6
|
-
INVITE: string;
|
|
7
|
-
LOCATIONS: string;
|
|
8
|
-
REASONS: string;
|
|
9
|
-
TEAMS: string;
|
|
10
|
-
USERS: string;
|
|
11
|
-
TIMESPANS: string;
|
|
12
2
|
Absence: {
|
|
13
3
|
absences(id?: string): string;
|
|
14
4
|
create(): string;
|
|
15
5
|
};
|
|
6
|
+
ABSENCES: string;
|
|
7
|
+
ALLOWANCE_TYPES: string;
|
|
16
8
|
AllowanceType: {
|
|
17
9
|
allowanceTypes(id?: string): string;
|
|
18
10
|
};
|
|
11
|
+
CREATE: string;
|
|
19
12
|
Department: {
|
|
20
13
|
departments(id?: string): string;
|
|
21
14
|
};
|
|
15
|
+
DEPARTMENTS: string;
|
|
16
|
+
INVITE: string;
|
|
22
17
|
Location: {
|
|
23
18
|
locations(id?: string): string;
|
|
24
19
|
};
|
|
20
|
+
LOCATIONS: string;
|
|
25
21
|
Reason: {
|
|
26
22
|
reasons(id?: string): string;
|
|
27
23
|
};
|
|
24
|
+
REASONS: string;
|
|
28
25
|
Team: {
|
|
29
26
|
teams(id?: string): string;
|
|
30
27
|
};
|
|
28
|
+
TEAMS: string;
|
|
31
29
|
Timespan: {
|
|
32
30
|
create(): string;
|
|
33
31
|
timespans(id?: string): string;
|
|
34
32
|
};
|
|
33
|
+
TIMESPANS: string;
|
|
35
34
|
User: {
|
|
36
35
|
invite(): string;
|
|
37
36
|
users(id?: string): string;
|
|
38
37
|
};
|
|
38
|
+
USERS: string;
|
|
39
39
|
};
|
package/dist/Endpoints.js
CHANGED
|
@@ -2,16 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Endpoint = void 0;
|
|
4
4
|
exports.Endpoint = {
|
|
5
|
-
ABSENCES: 'absences',
|
|
6
|
-
CREATE: 'create',
|
|
7
|
-
ALLOWANCE_TYPES: 'allowancetypes',
|
|
8
|
-
DEPARTMENTS: 'departments',
|
|
9
|
-
INVITE: 'invite',
|
|
10
|
-
LOCATIONS: 'locations',
|
|
11
|
-
REASONS: 'reasons',
|
|
12
|
-
TEAMS: 'teams',
|
|
13
|
-
USERS: 'users',
|
|
14
|
-
TIMESPANS: 'timespans',
|
|
15
5
|
Absence: {
|
|
16
6
|
absences(id) {
|
|
17
7
|
return `/${exports.Endpoint.ABSENCES}/${id ? `${id}/` : ''}`;
|
|
@@ -20,31 +10,39 @@ exports.Endpoint = {
|
|
|
20
10
|
return `/${exports.Endpoint.ABSENCES}/${exports.Endpoint.CREATE}/`;
|
|
21
11
|
},
|
|
22
12
|
},
|
|
13
|
+
ABSENCES: 'absences',
|
|
14
|
+
ALLOWANCE_TYPES: 'allowancetypes',
|
|
23
15
|
AllowanceType: {
|
|
24
16
|
allowanceTypes(id) {
|
|
25
17
|
return `/${exports.Endpoint.ALLOWANCE_TYPES}/${id ? `${id}/` : ''}`;
|
|
26
18
|
},
|
|
27
19
|
},
|
|
20
|
+
CREATE: 'create',
|
|
28
21
|
Department: {
|
|
29
22
|
departments(id) {
|
|
30
23
|
return `/${exports.Endpoint.DEPARTMENTS}/${id ? `${id}/` : ''}`;
|
|
31
24
|
},
|
|
32
25
|
},
|
|
26
|
+
DEPARTMENTS: 'departments',
|
|
27
|
+
INVITE: 'invite',
|
|
33
28
|
Location: {
|
|
34
29
|
locations(id) {
|
|
35
30
|
return `/${exports.Endpoint.LOCATIONS}/${id ? `${id}/` : ''}`;
|
|
36
31
|
},
|
|
37
32
|
},
|
|
33
|
+
LOCATIONS: 'locations',
|
|
38
34
|
Reason: {
|
|
39
35
|
reasons(id) {
|
|
40
36
|
return `/${exports.Endpoint.REASONS}/${id ? `${id}/` : ''}`;
|
|
41
37
|
},
|
|
42
38
|
},
|
|
39
|
+
REASONS: 'reasons',
|
|
43
40
|
Team: {
|
|
44
41
|
teams(id) {
|
|
45
42
|
return `/${exports.Endpoint.TEAMS}/${id ? `${id}/` : ''}`;
|
|
46
43
|
},
|
|
47
44
|
},
|
|
45
|
+
TEAMS: 'teams',
|
|
48
46
|
Timespan: {
|
|
49
47
|
create() {
|
|
50
48
|
return `/${exports.Endpoint.TIMESPANS}/${exports.Endpoint.CREATE}/`;
|
|
@@ -53,6 +51,7 @@ exports.Endpoint = {
|
|
|
53
51
|
return `/${exports.Endpoint.TIMESPANS}/${id ? `${id}/` : ''}`;
|
|
54
52
|
},
|
|
55
53
|
},
|
|
54
|
+
TIMESPANS: 'timespans',
|
|
56
55
|
User: {
|
|
57
56
|
invite() {
|
|
58
57
|
return `/${exports.Endpoint.USERS}/${exports.Endpoint.INVITE}/`;
|
|
@@ -61,4 +60,5 @@ exports.Endpoint = {
|
|
|
61
60
|
return `/${exports.Endpoint.USERS}/${id ? `${id}/` : ''}`;
|
|
62
61
|
},
|
|
63
62
|
},
|
|
63
|
+
USERS: 'users',
|
|
64
64
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./AbsenceIO"), exports);
|
|
18
|
+
__exportStar(require("./api/"), exports);
|
|
18
19
|
__exportStar(require("./interfaces/"), exports);
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import type { Reason } from './Reason';
|
|
2
2
|
import type { User } from './User';
|
|
3
3
|
import type { WorkingDay } from './WorkingDay';
|
|
4
|
+
export interface Absence extends Required<NewAbsence> {
|
|
5
|
+
/** unique identifier */
|
|
6
|
+
readonly _id: string;
|
|
7
|
+
/** assigned approver (only available if requested via `relations`) */
|
|
8
|
+
readonly approver?: User;
|
|
9
|
+
/** assigned user (only available if requested via `relations`) */
|
|
10
|
+
readonly assignedTo?: User;
|
|
11
|
+
/** date the absence was created */
|
|
12
|
+
readonly created: string;
|
|
13
|
+
/** array detailing each day inside the absence date range */
|
|
14
|
+
readonly days: AbsenceDay[];
|
|
15
|
+
/** the number of working days this absence counts as */
|
|
16
|
+
readonly daysCount: number;
|
|
17
|
+
/** date the absence was updated */
|
|
18
|
+
readonly modified: string;
|
|
19
|
+
/** assigned reason (only available if requested via `relations`) */
|
|
20
|
+
readonly reason?: Reason;
|
|
21
|
+
}
|
|
4
22
|
export interface AbsenceDay {
|
|
5
23
|
date: string;
|
|
6
24
|
duration: number;
|
|
7
25
|
endTime: string;
|
|
8
26
|
halfHoliday: boolean;
|
|
9
27
|
holiday: boolean;
|
|
10
|
-
holidayDayType:
|
|
28
|
+
holidayDayType: null | WorkingDay;
|
|
11
29
|
mandatoryLeave: false;
|
|
12
30
|
startTime: string;
|
|
13
31
|
value: number;
|
|
@@ -22,24 +40,6 @@ export interface ForwardHistory {
|
|
|
22
40
|
admin: string;
|
|
23
41
|
date: string;
|
|
24
42
|
}
|
|
25
|
-
export interface Absence extends Required<NewAbsence> {
|
|
26
|
-
/** unique identifier */
|
|
27
|
-
readonly _id: string;
|
|
28
|
-
/** assigned approver (only available if requested via `relations`) */
|
|
29
|
-
readonly approver?: User;
|
|
30
|
-
/** assigned user (only available if requested via `relations`) */
|
|
31
|
-
readonly assignedTo?: User;
|
|
32
|
-
/** date the absence was created */
|
|
33
|
-
readonly created: string;
|
|
34
|
-
/** array detailing each day inside the absence date range */
|
|
35
|
-
readonly days: AbsenceDay[];
|
|
36
|
-
/** the number of working days this absence counts as */
|
|
37
|
-
readonly daysCount: number;
|
|
38
|
-
/** date the absence was updated */
|
|
39
|
-
readonly modified: string;
|
|
40
|
-
/** assigned reason (only available if requested via `relations`) */
|
|
41
|
-
readonly reason?: Reason;
|
|
42
|
-
}
|
|
43
43
|
export interface NewAbsence {
|
|
44
44
|
/** id of the user who will/has approved this absence. If the creator has sufficient permissions it will be the same as `assignedToId` */
|
|
45
45
|
approverId: string;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface Allowance extends Required<NewAllowance> {
|
|
2
|
+
/** the unique id of the allowance */
|
|
3
|
+
readonly _id: string;
|
|
4
|
+
}
|
|
1
5
|
export interface NewAllowance {
|
|
2
6
|
/** indicates if it can be used currently. */
|
|
3
7
|
active: boolean;
|
|
@@ -8,7 +12,3 @@ export interface NewAllowance {
|
|
|
8
12
|
/** indicates if unu */
|
|
9
13
|
residualLeaveAvailable: boolean;
|
|
10
14
|
}
|
|
11
|
-
export interface Allowance extends Required<NewAllowance> {
|
|
12
|
-
/** the unique id of the allowance */
|
|
13
|
-
readonly _id: string;
|
|
14
|
-
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { EmailList } from './EmailList';
|
|
2
|
+
export interface Department extends Required<NewDepartment> {
|
|
3
|
+
/** unique identifier */
|
|
4
|
+
readonly _id: string;
|
|
5
|
+
/** ics link for viewing absences in external applications, prefix: https://app.absence.io/ */
|
|
6
|
+
readonly icsLink: string;
|
|
7
|
+
/** count of users who are members of the department */
|
|
8
|
+
readonly memberCount: number;
|
|
9
|
+
}
|
|
2
10
|
export interface NewDepartment {
|
|
3
11
|
/** list of users who are approvers for the department */
|
|
4
12
|
approverIds?: string[];
|
|
@@ -9,11 +17,3 @@ export interface NewDepartment {
|
|
|
9
17
|
/** the name of the department */
|
|
10
18
|
name: string;
|
|
11
19
|
}
|
|
12
|
-
export interface Department extends Required<NewDepartment> {
|
|
13
|
-
/** unique identifier */
|
|
14
|
-
readonly _id: string;
|
|
15
|
-
/** ics link for viewing absences in external applications, prefix: https://app.absence.io/ */
|
|
16
|
-
readonly icsLink: string;
|
|
17
|
-
/** count of users who are members of the department */
|
|
18
|
-
readonly memberCount: number;
|
|
19
|
-
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export interface Location extends Required<NewLocation> {
|
|
2
|
+
/** unique identifier */
|
|
3
|
+
readonly _id: string;
|
|
4
|
+
/** ics link for viewing absences in external applications, prefix: https://app.absence.io/ */
|
|
5
|
+
readonly icsLink: string;
|
|
6
|
+
/** bool to display if the location is the main one or not */
|
|
7
|
+
readonly mainLocation: boolean;
|
|
8
|
+
/** count of users who are members of the location */
|
|
9
|
+
readonly memberCount: number;
|
|
10
|
+
}
|
|
1
11
|
export interface NewLocation {
|
|
2
12
|
/** the region used to determine the translated names of the holidays. Seperation to region needed when setting to custom. */
|
|
3
13
|
holidayCountryLanguage: string;
|
|
@@ -12,13 +22,3 @@ export interface NewLocation {
|
|
|
12
22
|
/** the name of the location */
|
|
13
23
|
name: string;
|
|
14
24
|
}
|
|
15
|
-
export interface Location extends Required<NewLocation> {
|
|
16
|
-
/** unique identifier */
|
|
17
|
-
readonly _id: string;
|
|
18
|
-
/** ics link for viewing absences in external applications, prefix: https://app.absence.io/ */
|
|
19
|
-
readonly icsLink: string;
|
|
20
|
-
/** bool to display if the location is the main one or not */
|
|
21
|
-
readonly mainLocation: boolean;
|
|
22
|
-
/** count of users who are members of the location */
|
|
23
|
-
readonly memberCount: number;
|
|
24
|
-
}
|
|
@@ -5,8 +5,7 @@ import type { NewLocation } from './Location';
|
|
|
5
5
|
import type { NewReason } from './Reason';
|
|
6
6
|
import type { NewTimespan } from './Timespan';
|
|
7
7
|
import type { NewUser } from './User';
|
|
8
|
-
export type Filter = Record<string,
|
|
9
|
-
export type Sorting = Record<string, 1 | -1>;
|
|
8
|
+
export type Filter = Record<string, Record<string, string> | string>;
|
|
10
9
|
export interface PaginationOptions {
|
|
11
10
|
filter?: Filter;
|
|
12
11
|
limit: number;
|
|
@@ -15,3 +14,4 @@ export interface PaginationOptions {
|
|
|
15
14
|
sortBy?: Sorting;
|
|
16
15
|
}
|
|
17
16
|
export type RequestOptions = PaginationOptions | Partial<NewAbsence | NewAllowance | NewDepartment | NewLocation | NewReason | NewTimespan | NewUser>;
|
|
17
|
+
export type Sorting = Record<string, -1 | 1>;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { WorkingDays } from './WorkingDay';
|
|
2
|
+
export declare enum UserStatus {
|
|
3
|
+
/** Account is deleted and will be removed from the system 30 days after deletion. */
|
|
4
|
+
DELETED = 0,
|
|
5
|
+
/** The account was created. The user cannot login yet */
|
|
6
|
+
CREATED = 1,
|
|
7
|
+
/** Account is active. User can login */
|
|
8
|
+
ACTIVE = 2,
|
|
9
|
+
/** Account is inactive. User cannot login */
|
|
10
|
+
INACTIVE = 3,
|
|
11
|
+
/** The invitation email was sent. The user cannot login yet */
|
|
12
|
+
EMAIL_SENT = 4
|
|
13
|
+
}
|
|
2
14
|
export interface NewUser {
|
|
3
15
|
/** the default approver for this user. If not set it will inherit the approver from the department */
|
|
4
16
|
approverId?: string;
|
|
@@ -51,15 +63,3 @@ export interface User extends Required<NewUser> {
|
|
|
51
63
|
/** first and last name concatentated for your convenience */
|
|
52
64
|
readonly name: string;
|
|
53
65
|
}
|
|
54
|
-
export declare enum UserStatus {
|
|
55
|
-
/** Account is deleted and will be removed from the system 30 days after deletion. */
|
|
56
|
-
DELETED = 0,
|
|
57
|
-
/** The account was created. The user cannot login yet */
|
|
58
|
-
CREATED = 1,
|
|
59
|
-
/** Account is active. User can login */
|
|
60
|
-
ACTIVE = 2,
|
|
61
|
-
/** Account is inactive. User cannot login */
|
|
62
|
-
INACTIVE = 3,
|
|
63
|
-
/** The invitation email was sent. The user cannot login yet */
|
|
64
|
-
EMAIL_SENT = 4
|
|
65
|
-
}
|
package/dist/interfaces/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@ffflorian/api-client": "2.
|
|
4
|
+
"@ffflorian/api-client": "2.5.1",
|
|
5
5
|
"@hapi/hawk": "8.0.0"
|
|
6
6
|
},
|
|
7
7
|
"description": "An absence.io API client",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@types/hapi__hawk": "8.0.7",
|
|
10
10
|
"@types/node": "~24",
|
|
11
|
-
"rimraf": "6.1.
|
|
12
|
-
"typedoc": "0.28.
|
|
13
|
-
"typescript": "
|
|
11
|
+
"rimraf": "6.1.3",
|
|
12
|
+
"typedoc": "0.28.18",
|
|
13
|
+
"typescript": "6.0.2"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">= 21"
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"readme": "https://github.com/ffflorian/api-clients#readme",
|
|
32
32
|
"repository": "https://github.com/ffflorian/api-clients.git",
|
|
33
33
|
"scripts": {
|
|
34
|
+
"build": "yarn build:ts",
|
|
34
35
|
"build:ts": "tsc -p tsconfig.build.json",
|
|
35
36
|
"build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/absence.io src/index.ts",
|
|
36
37
|
"clean": "rimraf dist",
|
|
37
|
-
"dist": "yarn clean && yarn build
|
|
38
|
+
"dist": "yarn clean && yarn build",
|
|
38
39
|
"test": "exit 0"
|
|
39
40
|
},
|
|
40
|
-
"version": "2.4.
|
|
41
|
-
"gitHead": "8d7471cbe490305b3e441c27acbc81e36a4bd9df"
|
|
41
|
+
"version": "2.4.7"
|
|
42
42
|
}
|