bamboohr.com 1.5.5 → 1.5.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/BambooHR.js CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BambooHR = void 0;
7
- const node_crypto_1 = __importDefault(require("node:crypto"));
8
7
  const api_client_1 = require("@ffflorian/api-client");
8
+ const node_crypto_1 = __importDefault(require("node:crypto"));
9
9
  const api_1 = require("./api");
10
10
  class BambooHR {
11
11
  constructor(options) {
@@ -13,6 +13,7 @@ class BambooHR {
13
13
  const baseURL = `https://api.bamboohr.com/api/gateway.php/${options.companyDomain}/v1/`;
14
14
  this.apiClient = new api_client_1.APIClient(baseURL, {
15
15
  auth: {
16
+ // eslint-disable-next-line no-magic-numbers
16
17
  password: node_crypto_1.default.randomBytes(16).toString('base64').substring(0, 7),
17
18
  username: this.options.apiKey,
18
19
  },
@@ -2,20 +2,20 @@ import type { Fields } from './interfaces/Fields';
2
2
  export declare const Endpoint: {
3
3
  DIRECTORY: string;
4
4
  EMPLOYEES: string;
5
+ Employees: {
6
+ employeeDirectory(): string;
7
+ employees(id?: number, fields?: Array<keyof Fields>): string;
8
+ };
5
9
  META: string;
6
10
  POLICIES: string;
7
11
  REQUESTS: string;
8
12
  TIME_OFF: string;
9
- TYPES: string;
10
- WHOS_OUT: string;
11
- Employees: {
12
- employees(id?: number, fields?: Array<keyof Fields>): string;
13
- employeeDirectory(): string;
14
- };
15
13
  TimeOff: {
16
- whosOut(): string;
17
- timeOffTypes(): string;
18
14
  timeOffPolicies(): string;
19
15
  timeOffRequests(): string;
16
+ timeOffTypes(): string;
17
+ whosOut(): string;
20
18
  };
19
+ TYPES: string;
20
+ WHOS_OUT: string;
21
21
  };
package/dist/Endpoints.js CHANGED
@@ -4,13 +4,10 @@ exports.Endpoint = void 0;
4
4
  exports.Endpoint = {
5
5
  DIRECTORY: 'directory',
6
6
  EMPLOYEES: 'employees',
7
- META: 'meta',
8
- POLICIES: 'policies',
9
- REQUESTS: 'requests',
10
- TIME_OFF: 'time_off',
11
- TYPES: 'types',
12
- WHOS_OUT: 'whos_out',
13
7
  Employees: {
8
+ employeeDirectory() {
9
+ return `/${exports.Endpoint.EMPLOYEES}/${exports.Endpoint.DIRECTORY}/`;
10
+ },
14
11
  employees(id, fields) {
15
12
  const url = new URL(`/${exports.Endpoint.EMPLOYEES}/`, 'https://example.com');
16
13
  if (id) {
@@ -23,22 +20,25 @@ exports.Endpoint = {
23
20
  }
24
21
  return `${url.pathname}${url.search}`;
25
22
  },
26
- employeeDirectory() {
27
- return `/${exports.Endpoint.EMPLOYEES}/${exports.Endpoint.DIRECTORY}/`;
28
- },
29
23
  },
24
+ META: 'meta',
25
+ POLICIES: 'policies',
26
+ REQUESTS: 'requests',
27
+ TIME_OFF: 'time_off',
30
28
  TimeOff: {
31
- whosOut() {
32
- return `/${exports.Endpoint.TIME_OFF}/${exports.Endpoint.WHOS_OUT}/`;
33
- },
34
- timeOffTypes() {
35
- return `/${exports.Endpoint.META}/${exports.Endpoint.TIME_OFF}/${exports.Endpoint.TYPES}/`;
36
- },
37
29
  timeOffPolicies() {
38
30
  return `/${exports.Endpoint.META}/${exports.Endpoint.TIME_OFF}/${exports.Endpoint.POLICIES}/`;
39
31
  },
40
32
  timeOffRequests() {
41
33
  return `/${exports.Endpoint.TIME_OFF}/${exports.Endpoint.REQUESTS}/`;
42
34
  },
35
+ timeOffTypes() {
36
+ return `/${exports.Endpoint.META}/${exports.Endpoint.TIME_OFF}/${exports.Endpoint.TYPES}/`;
37
+ },
38
+ whosOut() {
39
+ return `/${exports.Endpoint.TIME_OFF}/${exports.Endpoint.WHOS_OUT}/`;
40
+ },
43
41
  },
42
+ TYPES: 'types',
43
+ WHOS_OUT: 'whos_out',
44
44
  };
@@ -1,5 +1,5 @@
1
1
  import type { APIClient } from '@ffflorian/api-client';
2
- import type { Fields, Employee, WritableFields, EmployeeDirectory } from '../interfaces';
2
+ import type { Employee, EmployeeDirectory, Fields, WritableFields } from '../interfaces';
3
3
  export declare class EmployeesAPI {
4
4
  private readonly apiClient;
5
5
  constructor(apiClient: APIClient);
@@ -1,22 +1,8 @@
1
1
  import type { APIClient } from '@ffflorian/api-client';
2
- import type { OffEmployee, TimeOffPolicy, TimeOffTypes, TimeOffRequestsOptions, TimeOffRequest } from '../interfaces';
2
+ import type { OffEmployee, TimeOffPolicy, TimeOffRequest, TimeOffRequestsOptions, TimeOffTypes } from '../interfaces';
3
3
  export declare class TimeOffAPI {
4
4
  private readonly apiClient;
5
5
  constructor(apiClient: APIClient);
6
- /**
7
- * This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.
8
- * @see https://documentation.bamboohr.com/reference#get-a-list-of-whos-out-1
9
- */
10
- whosOut(start?: string, end?: string): Promise<OffEmployee[]>;
11
- /**
12
- * This endpoint gets a list of time off types.
13
- * @param mode set to 'request' to get a list of all time off types with which this user can create a time off
14
- * request. The default is to return the list of time off types the user has permissions on. This distinction is
15
- * important, as employees can request time off for types that they don't have permission to view balances and
16
- * requests for.
17
- * @see https://documentation.bamboohr.com/reference#get-time-off-types
18
- */
19
- timeOffTypes(mode?: 'request'): Promise<TimeOffTypes>;
20
6
  /**
21
7
  * This endpoint gets a list of time off policies.
22
8
  * @see https://documentation.bamboohr.com/reference#get-time-off-policies
@@ -35,4 +21,18 @@ export declare class TimeOffAPI {
35
21
  * @see https://documentation.bamboohr.com/reference#time-off-get-time-off-requests-1
36
22
  */
37
23
  timeOffRequests(options: TimeOffRequestsOptions): Promise<TimeOffRequest[]>;
24
+ /**
25
+ * This endpoint gets a list of time off types.
26
+ * @param mode set to 'request' to get a list of all time off types with which this user can create a time off
27
+ * request. The default is to return the list of time off types the user has permissions on. This distinction is
28
+ * important, as employees can request time off for types that they don't have permission to view balances and
29
+ * requests for.
30
+ * @see https://documentation.bamboohr.com/reference#get-time-off-types
31
+ */
32
+ timeOffTypes(mode?: 'request'): Promise<TimeOffTypes>;
33
+ /**
34
+ * This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.
35
+ * @see https://documentation.bamboohr.com/reference#get-a-list-of-whos-out-1
36
+ */
37
+ whosOut(start?: string, end?: string): Promise<OffEmployee[]>;
38
38
  }
@@ -15,32 +15,6 @@ class TimeOffAPI {
15
15
  constructor(apiClient) {
16
16
  this.apiClient = apiClient;
17
17
  }
18
- /**
19
- * This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.
20
- * @see https://documentation.bamboohr.com/reference#get-a-list-of-whos-out-1
21
- */
22
- whosOut(start, end) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- const endpoint = Endpoints_1.Endpoint.TimeOff.whosOut();
25
- const { data } = yield this.apiClient.get(endpoint, { params: { end, start } });
26
- return data;
27
- });
28
- }
29
- /**
30
- * This endpoint gets a list of time off types.
31
- * @param mode set to 'request' to get a list of all time off types with which this user can create a time off
32
- * request. The default is to return the list of time off types the user has permissions on. This distinction is
33
- * important, as employees can request time off for types that they don't have permission to view balances and
34
- * requests for.
35
- * @see https://documentation.bamboohr.com/reference#get-time-off-types
36
- */
37
- timeOffTypes(mode) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- const endpoint = Endpoints_1.Endpoint.TimeOff.timeOffTypes();
40
- const { data } = yield this.apiClient.get(endpoint, { params: { mode } });
41
- return data;
42
- });
43
- }
44
18
  /**
45
19
  * This endpoint gets a list of time off policies.
46
20
  * @see https://documentation.bamboohr.com/reference#get-time-off-policies
@@ -71,5 +45,31 @@ class TimeOffAPI {
71
45
  return data;
72
46
  });
73
47
  }
48
+ /**
49
+ * This endpoint gets a list of time off types.
50
+ * @param mode set to 'request' to get a list of all time off types with which this user can create a time off
51
+ * request. The default is to return the list of time off types the user has permissions on. This distinction is
52
+ * important, as employees can request time off for types that they don't have permission to view balances and
53
+ * requests for.
54
+ * @see https://documentation.bamboohr.com/reference#get-time-off-types
55
+ */
56
+ timeOffTypes(mode) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const endpoint = Endpoints_1.Endpoint.TimeOff.timeOffTypes();
59
+ const { data } = yield this.apiClient.get(endpoint, { params: { mode } });
60
+ return data;
61
+ });
62
+ }
63
+ /**
64
+ * This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.
65
+ * @see https://documentation.bamboohr.com/reference#get-a-list-of-whos-out-1
66
+ */
67
+ whosOut(start, end) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const endpoint = Endpoints_1.Endpoint.TimeOff.whosOut();
70
+ const { data } = yield this.apiClient.get(endpoint, { params: { end, start } });
71
+ return data;
72
+ });
73
+ }
74
74
  }
75
75
  exports.TimeOffAPI = TimeOffAPI;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './api/';
1
2
  export * from './BambooHR';
2
3
  export * from './interfaces/';
package/dist/index.js CHANGED
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api/"), exports);
17
18
  __exportStar(require("./BambooHR"), exports);
18
19
  __exportStar(require("./interfaces/"), exports);
@@ -1,8 +1,5 @@
1
1
  import { Fields } from './Fields';
2
- type PartialNull<T> = {
3
- [P in keyof T]?: T[P] | null;
4
- };
5
- interface BaseEmployee {
2
+ export interface BaseEmployee {
6
3
  firstName: string;
7
4
  id: string;
8
5
  lastName: string;
@@ -24,4 +21,6 @@ export interface OffEmployee {
24
21
  start: string;
25
22
  type: string;
26
23
  }
27
- export {};
24
+ export type PartialNull<T> = {
25
+ [P in keyof T]?: null | T[P];
26
+ };
@@ -1,32 +1,15 @@
1
- export type Writeable<T> = {
2
- -readonly [P in keyof T]: T[P];
3
- };
4
1
  /**
5
- * A complete date with a four-digit year.
6
- *
7
- * Format: yyyy-mm-dd
8
- *
9
- * Example: "2010-03-19"
10
- */
11
- export type DateField = string;
12
- /**
13
- * A standard United States Social Security number, with dashes.
14
- *
15
- * Example: "123-45-6789"
16
- */
17
- export type SSNField = string;
18
- /**
19
- * A plain text string with a phone number, no formatting is enforced.
2
+ * "yes" or "checkbox" will mark the checkbox checked and everything else will default to unchecked
20
3
  *
21
- * Example: "1-866-387-9595"
4
+ * Example: "yes", "checkbox", "no"
22
5
  */
23
- export type PhoneField = string;
6
+ export type CheckboxField = 'checkbox' | 'no' | 'yes';
24
7
  /**
25
- * The plain text name of the gender.
8
+ * The name of the country. Must exist in the BambooHR country list.
26
9
  *
27
- * Example: "Male" or "Female"
10
+ * Example: "Australia", "United States", etc.
28
11
  */
29
- export type GenderField = string;
12
+ export type CountryField = string;
30
13
  /**
31
14
  * A simple quantity value without thousands separators or currency signs using a period as a decimal point.
32
15
  * Example: "27000.00"
@@ -35,76 +18,30 @@ export type GenderField = string;
35
18
  *
36
19
  * Example: `“payRate”: { “value”: “27000.00”, “currency”: “EUR”}`
37
20
  */
38
- export type CurrencyField = string | {
21
+ export type CurrencyField = {
39
22
  currency: string;
40
23
  value: string;
41
- };
42
- /**
43
- * "yes" or "checkbox" will mark the checkbox checked and everything else will default to unchecked
44
- *
45
- * Example: "yes", "checkbox", "no"
46
- */
47
- export type CheckboxField = 'yes' | 'checkbox' | 'no';
48
- /**
49
- * The name of the country. Must exist in the BambooHR country list.
50
- *
51
- * Example: "Australia", "United States", etc.
52
- */
53
- export type CountryField = string;
54
- /**
55
- * The full name of the state/province.
56
- *
57
- * Example: "Florida"
58
- */
59
- export type StateField = string;
24
+ } | string;
60
25
  /**
61
- * Plain text status of marriage.
26
+ * A complete date with a four-digit year.
62
27
  *
63
- * Example: "Single" or "Married"
64
- */
65
- export type MaritalStatusField = string;
66
- /**
67
- * The employee's employment status as used to filter employees in BambooHR.
28
+ * Format: yyyy-mm-dd
68
29
  *
69
- * Example: "Active" or "Inactive"
30
+ * Example: "2010-03-19"
70
31
  */
71
- export type StatusField = 'Active' | 'Inactive';
32
+ export type DateField = string;
72
33
  /**
73
- * One of several predefined options for the unit of pay.
34
+ * An email address.
74
35
  *
75
- * Example: "Hourly", "Salary", "Commission", "Exception Hourly", "Monthly", "Piece Rate", "Contract" or "Daily"
36
+ * Example: "support@bamboohr.com"
76
37
  */
77
- export type PayTypeField = string;
38
+ export type EmailField = string;
78
39
  /**
79
40
  * A reference to another employee expressed as preferred name-space-last name.
80
41
  *
81
42
  * Example: "Robert Smith"
82
43
  */
83
44
  export type EmployeeField = string;
84
- /**
85
- * The UTC time that an event occurred.
86
- *
87
- * Format: ####-##-##T##:##:##+##:##
88
- *
89
- * Example: "2012-10-17T20:27:17+00:00"
90
- */
91
- export type TimestampField = string;
92
- /**
93
- * A larger section of text that can include line feed characters.
94
- */
95
- export type TextareaField = string;
96
- /**
97
- * The exact text for an option from a list.
98
- *
99
- * Example: "Marketing"
100
- */
101
- export type ListField = string;
102
- /**
103
- * An email address.
104
- *
105
- * Example: "support@bamboohr.com"
106
- */
107
- export type EmailField = string;
108
45
  export interface Fields {
109
46
  /** @deprecated please use ‘acaStatusCategory’ */
110
47
  acaStatus: string;
@@ -267,4 +204,67 @@ export interface Fields {
267
204
  /** The employee's ZIP code. */
268
205
  zipcode: string;
269
206
  }
207
+ /**
208
+ * The plain text name of the gender.
209
+ *
210
+ * Example: "Male" or "Female"
211
+ */
212
+ export type GenderField = string;
213
+ /**
214
+ * The exact text for an option from a list.
215
+ *
216
+ * Example: "Marketing"
217
+ */
218
+ export type ListField = string;
219
+ /**
220
+ * Plain text status of marriage.
221
+ *
222
+ * Example: "Single" or "Married"
223
+ */
224
+ export type MaritalStatusField = string;
225
+ /**
226
+ * One of several predefined options for the unit of pay.
227
+ *
228
+ * Example: "Hourly", "Salary", "Commission", "Exception Hourly", "Monthly", "Piece Rate", "Contract" or "Daily"
229
+ */
230
+ export type PayTypeField = string;
231
+ /**
232
+ * A plain text string with a phone number, no formatting is enforced.
233
+ *
234
+ * Example: "1-866-387-9595"
235
+ */
236
+ export type PhoneField = string;
237
+ /**
238
+ * A standard United States Social Security number, with dashes.
239
+ *
240
+ * Example: "123-45-6789"
241
+ */
242
+ export type SSNField = string;
243
+ /**
244
+ * The full name of the state/province.
245
+ *
246
+ * Example: "Florida"
247
+ */
248
+ export type StateField = string;
249
+ /**
250
+ * The employee's employment status as used to filter employees in BambooHR.
251
+ *
252
+ * Example: "Active" or "Inactive"
253
+ */
254
+ export type StatusField = 'Active' | 'Inactive';
255
+ /**
256
+ * A larger section of text that can include line feed characters.
257
+ */
258
+ export type TextareaField = string;
259
+ /**
260
+ * The UTC time that an event occurred.
261
+ *
262
+ * Format: ####-##-##T##:##:##+##:##
263
+ *
264
+ * Example: "2012-10-17T20:27:17+00:00"
265
+ */
266
+ export type TimestampField = string;
270
267
  export type WritableFields = Partial<Writeable<Fields>>;
268
+ export type Writeable<T> = {
269
+ -readonly [P in keyof T]: T[P];
270
+ };
@@ -1,21 +1,4 @@
1
1
  import { TimeOffType } from './TimeOffType';
2
- interface TimeOffRequestActions {
3
- approve: boolean;
4
- bypass: boolean;
5
- cancel: boolean;
6
- deny: boolean;
7
- edit: boolean;
8
- view: boolean;
9
- }
10
- interface TimeOffRequestAmount {
11
- amount: string;
12
- unit: string;
13
- }
14
- interface TimeOffRequestStatus {
15
- lastChanged: string;
16
- lastChangedByUserId: string;
17
- status: string;
18
- }
19
2
  export interface TimeOffRequest {
20
3
  actions: TimeOffRequestActions;
21
4
  amount: TimeOffRequestAmount;
@@ -30,4 +13,20 @@ export interface TimeOffRequest {
30
13
  status: TimeOffRequestStatus;
31
14
  type: TimeOffType;
32
15
  }
33
- export {};
16
+ export interface TimeOffRequestActions {
17
+ approve: boolean;
18
+ bypass: boolean;
19
+ cancel: boolean;
20
+ deny: boolean;
21
+ edit: boolean;
22
+ view: boolean;
23
+ }
24
+ export interface TimeOffRequestAmount {
25
+ amount: string;
26
+ unit: string;
27
+ }
28
+ export interface TimeOffRequestStatus {
29
+ lastChanged: string;
30
+ lastChangedByUserId: string;
31
+ status: string;
32
+ }
@@ -1,5 +1,5 @@
1
1
  export interface TimeOffType {
2
- color: string | null;
2
+ color: null | string;
3
3
  icon: string;
4
4
  id: string;
5
5
  name: string;
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.2.0",
4
+ "@ffflorian/api-client": "2.5.1",
5
5
  "@hapi/hawk": "8.0.0"
6
6
  },
7
7
  "description": "An bamboohr.com API client",
8
8
  "devDependencies": {
9
9
  "@types/hapi__hawk": "8.0.7",
10
10
  "@types/node": "~24",
11
- "rimraf": "6.1.2",
12
- "typedoc": "0.28.15",
13
- "typescript": "5.9.3"
11
+ "rimraf": "6.1.3",
12
+ "typedoc": "0.28.18",
13
+ "typescript": "6.0.2"
14
14
  },
15
15
  "engines": {
16
16
  "node": ">= 21"
@@ -30,12 +30,12 @@
30
30
  "readme": "https://github.com/ffflorian/api-clients#readme",
31
31
  "repository": "https://github.com/ffflorian/api-clients.git",
32
32
  "scripts": {
33
+ "build": "yarn build:ts",
33
34
  "build:ts": "tsc -p tsconfig.build.json",
34
35
  "build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/bamboohr.com src/index.ts",
35
36
  "clean": "rimraf dist",
36
- "dist": "yarn clean && yarn build:ts",
37
+ "dist": "yarn clean && yarn build",
37
38
  "test": "exit 0"
38
39
  },
39
- "version": "1.5.5",
40
- "gitHead": "8d7471cbe490305b3e441c27acbc81e36a4bd9df"
40
+ "version": "1.5.7"
41
41
  }