bamboohr-cli 1.0.0 → 1.0.1

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 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoB5C"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAwE5C"}
@@ -1,19 +1,58 @@
1
1
  import { getClient } from '../../utils/client.js';
2
2
  import { output, handleError } from '../../utils/output.js';
3
+ import { resolveEmployeeId } from '../../utils/resolve-employee.js';
3
4
  export function search(parent) {
4
5
  parent
5
- .command('search <query>')
6
- .description('Search employees by name')
7
- .addHelpText('after', '\nExamples:\n bamboohr employee search john\n bamboohr employee search "Jane Smith"')
8
- .action(async (query) => {
6
+ .command('search [query]')
7
+ .description('Search and filter employees')
8
+ .option('--supervisor <name>', 'Filter by supervisor name (use "me" for current user)')
9
+ .option('--department <name>', 'Filter by department')
10
+ .option('--location <name>', 'Filter by location')
11
+ .option('--division <name>', 'Filter by division')
12
+ .addHelpText('after', `\nExamples:
13
+ bamboohr employee search john
14
+ bamboohr employee search --supervisor me
15
+ bamboohr employee search --department "R&D" --location Sofia
16
+ bamboohr employee search --supervisor "Borislav Mihaylov"`)
17
+ .action(async (query, opts) => {
9
18
  try {
10
19
  const client = getClient();
11
20
  const dir = await client.employees.getDirectory();
12
- const q = query.toLowerCase();
13
- const matches = dir.employees.filter((e) => {
14
- const name = `${e.firstName ?? ''} ${e.lastName ?? ''} ${e.preferredName ?? ''} ${e.displayName ?? ''}`.toLowerCase();
15
- return name.includes(q);
16
- });
21
+ let matches = dir.employees;
22
+ // Name filter
23
+ if (query) {
24
+ const q = query.toLowerCase();
25
+ matches = matches.filter((e) => {
26
+ const name = `${e.firstName ?? ''} ${e.lastName ?? ''} ${e.preferredName ?? ''} ${e.displayName ?? ''}`.toLowerCase();
27
+ return name.includes(q);
28
+ });
29
+ }
30
+ // Supervisor filter — resolve "me" to current user's display name
31
+ if (opts.supervisor) {
32
+ let supervisorName = opts.supervisor;
33
+ if (supervisorName.toLowerCase() === 'me') {
34
+ const myId = await resolveEmployeeId(client);
35
+ const me = dir.employees.find((e) => e.id === myId);
36
+ supervisorName = me?.displayName ?? `${me?.firstName ?? ''} ${me?.lastName ?? ''}`;
37
+ }
38
+ const s = supervisorName.toLowerCase();
39
+ matches = matches.filter((e) => (e.supervisor ?? '').toLowerCase().includes(s));
40
+ }
41
+ // Department filter
42
+ if (opts.department) {
43
+ const d = opts.department.toLowerCase();
44
+ matches = matches.filter((e) => (e.department ?? '').toLowerCase().includes(d));
45
+ }
46
+ // Location filter
47
+ if (opts.location) {
48
+ const l = opts.location.toLowerCase();
49
+ matches = matches.filter((e) => (e.location ?? '').toLowerCase().includes(l));
50
+ }
51
+ // Division filter
52
+ if (opts.division) {
53
+ const dv = opts.division.toLowerCase();
54
+ matches = matches.filter((e) => (e.division ?? '').toLowerCase().includes(dv));
55
+ }
17
56
  output(matches);
18
57
  }
19
58
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/commands/employee/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,0BAA0B,CAAC;SACvC,WAAW,CAAC,O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,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3F,CAAC;YAED,MAAM,CAAC,OAAO,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function departments(parent: Command): void;
3
+ //# sourceMappingURL=departments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"departments.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/departments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAejD"}
@@ -0,0 +1,20 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { output, handleError } from '../../utils/output.js';
3
+ export function departments(parent) {
4
+ parent
5
+ .command('departments')
6
+ .description('List all departments')
7
+ .addHelpText('after', '\nExamples:\n bamboohr meta departments')
8
+ .action(async () => {
9
+ try {
10
+ const client = getClient();
11
+ const dir = await client.employees.getDirectory();
12
+ const unique = [...new Set(dir.employees.map((e) => e.department).filter(Boolean))].sort();
13
+ output(unique);
14
+ }
15
+ catch (err) {
16
+ handleError(err);
17
+ }
18
+ });
19
+ }
20
+ //# sourceMappingURL=departments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"departments.js","sourceRoot":"","sources":["../../../src/commands/meta/departments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,MAAM;SACH,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,sBAAsB,CAAC;SACnC,WAAW,CAAC,OAAO,EAAE,0CAA0C,CAAC;SAChE,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACrG,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function divisions(parent: Command): void;
3
+ //# sourceMappingURL=divisions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divisions.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/divisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAe/C"}
@@ -0,0 +1,20 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { output, handleError } from '../../utils/output.js';
3
+ export function divisions(parent) {
4
+ parent
5
+ .command('divisions')
6
+ .description('List all divisions')
7
+ .addHelpText('after', '\nExamples:\n bamboohr meta divisions')
8
+ .action(async () => {
9
+ try {
10
+ const client = getClient();
11
+ const dir = await client.employees.getDirectory();
12
+ const unique = [...new Set(dir.employees.map((e) => e.division).filter(Boolean))].sort();
13
+ output(unique);
14
+ }
15
+ catch (err) {
16
+ handleError(err);
17
+ }
18
+ });
19
+ }
20
+ //# sourceMappingURL=divisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divisions.js","sourceRoot":"","sources":["../../../src/commands/meta/divisions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,MAAM;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,oBAAoB,CAAC;SACjC,WAAW,CAAC,OAAO,EAAE,wCAAwC,CAAC;SAC9D,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACnG,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAY3D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkB3D"}
@@ -1,4 +1,7 @@
1
+ import { departments } from './departments.js';
2
+ import { divisions } from './divisions.js';
1
3
  import { fields } from './fields.js';
4
+ import { locations } from './locations.js';
2
5
  export function registerMetaCommands(program) {
3
6
  const meta = program
4
7
  .command('meta')
@@ -6,7 +9,13 @@ export function registerMetaCommands(program) {
6
9
  .addHelpText('after', `
7
10
  Examples:
8
11
  $ bamboohr meta fields
12
+ $ bamboohr meta departments
13
+ $ bamboohr meta locations
14
+ $ bamboohr meta divisions
9
15
  `);
10
16
  fields(meta);
17
+ departments(meta);
18
+ locations(meta);
19
+ divisions(meta);
11
20
  }
12
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/meta/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qBAAqB,CAAC;SAClC,WAAW,CACV,OAAO,EACP;;;CAGL,CACI,CAAC;IACJ,MAAM,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/meta/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qBAAqB,CAAC;SAClC,WAAW,CACV,OAAO,EACP;;;;;;CAML,CACI,CAAC;IACJ,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,WAAW,CAAC,IAAI,CAAC,CAAC;IAClB,SAAS,CAAC,IAAI,CAAC,CAAC;IAChB,SAAS,CAAC,IAAI,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function locations(parent: Command): void;
3
+ //# sourceMappingURL=locations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/locations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAe/C"}
@@ -0,0 +1,20 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { output, handleError } from '../../utils/output.js';
3
+ export function locations(parent) {
4
+ parent
5
+ .command('locations')
6
+ .description('List all office locations')
7
+ .addHelpText('after', '\nExamples:\n bamboohr meta locations')
8
+ .action(async () => {
9
+ try {
10
+ const client = getClient();
11
+ const dir = await client.employees.getDirectory();
12
+ const unique = [...new Set(dir.employees.map((e) => e.location).filter(Boolean))].sort();
13
+ output(unique);
14
+ }
15
+ catch (err) {
16
+ handleError(err);
17
+ }
18
+ });
19
+ }
20
+ //# sourceMappingURL=locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.js","sourceRoot":"","sources":["../../../src/commands/meta/locations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,MAAM;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,2BAA2B,CAAC;SACxC,WAAW,CAAC,OAAO,EAAE,wCAAwC,CAAC;SAC9D,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACnG,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA2D9C"}
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoE9C"}
@@ -1,13 +1,15 @@
1
1
  import { Option } from 'commander';
2
2
  import { getClient } from '../../utils/client.js';
3
3
  import { output, handleError } from '../../utils/output.js';
4
+ import { resolveEmployeeId } from '../../utils/resolve-employee.js';
4
5
  export function requests(parent) {
5
6
  parent
6
7
  .command('requests')
7
- .description('Get time off requests with filtering')
8
+ .description('Get time off requests (defaults to current user)')
8
9
  .option('--id <id>', 'Specific request ID', parseInt)
9
10
  .addOption(new Option('--action <action>', 'Access level filter').choices(['view', 'approve']))
10
11
  .option('--employee <id>', 'Filter by employee ID')
12
+ .option('--all', 'Show all visible requests instead of just current user')
11
13
  .option('--start <date>', 'Start date (YYYY-MM-DD)')
12
14
  .option('--end <date>', 'End date (YYYY-MM-DD)')
13
15
  .addOption(new Option('--status <status>', 'Filter by request status').choices([
@@ -21,19 +23,24 @@ export function requests(parent) {
21
23
  .addHelpText('after', `
22
24
  Examples:
23
25
  $ bamboohr timeoff requests
24
- $ bamboohr timeoff requests --status requested --action approve
26
+ $ bamboohr timeoff requests --status requested
27
+ $ bamboohr timeoff requests --all --action approve --status requested
25
28
  $ bamboohr timeoff requests --employee 123 --start 2026-01-01 --end 2026-03-31`)
26
29
  .action(async (opts) => {
27
30
  try {
28
- // Default to current year if no dates specified
29
31
  const year = new Date().getFullYear();
30
32
  const start = opts.start ?? `${year}-01-01`;
31
33
  const end = opts.end ?? `${year}-12-31`;
32
34
  const client = getClient();
35
+ // Default to current user unless --all or --employee is specified
36
+ let employeeId = opts.employee;
37
+ if (!employeeId && !opts.all) {
38
+ employeeId = await resolveEmployeeId(client);
39
+ }
33
40
  const result = await client.timeOff.getRequests({
34
41
  id: opts.id,
35
42
  action: opts.action,
36
- employeeId: opts.employee,
43
+ employeeId,
37
44
  start,
38
45
  end,
39
46
  status: opts.status,
@@ -1 +1 @@
1
- {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../../src/commands/timeoff/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,QAAQ,CAAC,MAAe;IACtC,MAAM;SACH,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,sCAAsC,CAA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,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,IAAI,QAAQ,CAAC;YAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,QAAQ,CAAC;YAExC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,kEAAkE;YAClE,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC/B,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC7B,UAAU,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC/C,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;gBAC9C,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,MAAM,EAAE,IAAI,CAAC,MAAwC;gBACrD,UAAU;gBACV,KAAK;gBACL,GAAG;gBACH,MAAM,EAAE,IAAI,CAAC,MAAqF;gBAClG,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bamboohr-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "publish": true,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",