bamboohr-cli 1.0.0 → 1.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAc/C"}
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAc/C"}
@@ -1,4 +1,5 @@
1
1
  import { getClient } from '../../utils/client.js';
2
+ import { getDirectory } from '../../utils/directory.js';
2
3
  import { output, handleError } from '../../utils/output.js';
3
4
  export function directory(parent) {
4
5
  parent
@@ -8,7 +9,7 @@ export function directory(parent) {
8
9
  .action(async () => {
9
10
  try {
10
11
  const client = getClient();
11
- const result = await client.employees.getDirectory();
12
+ const result = await getDirectory(client);
12
13
  output(result);
13
14
  }
14
15
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../../src/commands/employee/directory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,MAAM;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,oCAAoC,CAAC;SACjD,WAAW,CAAC,OAAO,EAAE,8CAA8C,CAAC;SACpE,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YACrD,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
+ {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../../src/commands/employee/directory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,MAAM;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,oCAAoC,CAAC;SACjD,WAAW,CAAC,OAAO,EAAE,8CAA8C,CAAC;SACpE,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;YAC1C,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":"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;AAOpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAwE5C"}
@@ -1,19 +1,59 @@
1
1
  import { getClient } from '../../utils/client.js';
2
+ import { getDirectory } from '../../utils/directory.js';
2
3
  import { output, handleError } from '../../utils/output.js';
4
+ import { resolveEmployeeId } from '../../utils/resolve-employee.js';
3
5
  export function search(parent) {
4
6
  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) => {
7
+ .command('search [query]')
8
+ .description('Search and filter employees')
9
+ .option('--supervisor <name>', 'Filter by supervisor name (use "me" for current user)')
10
+ .option('--department <name>', 'Filter by department')
11
+ .option('--location <name>', 'Filter by location')
12
+ .option('--division <name>', 'Filter by division')
13
+ .addHelpText('after', `\nExamples:
14
+ bamboohr employee search john
15
+ bamboohr employee search --supervisor me
16
+ bamboohr employee search --department "R&D" --location Sofia
17
+ bamboohr employee search --supervisor "Borislav Mihaylov"`)
18
+ .action(async (query, opts) => {
9
19
  try {
10
20
  const client = getClient();
11
- 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
+ const dir = await getDirectory(client);
22
+ let matches = dir.employees;
23
+ // Name filter
24
+ if (query) {
25
+ const q = query.toLowerCase();
26
+ matches = matches.filter((e) => {
27
+ const name = `${e.firstName ?? ''} ${e.lastName ?? ''} ${e.preferredName ?? ''} ${e.displayName ?? ''}`.toLowerCase();
28
+ return name.includes(q);
29
+ });
30
+ }
31
+ // Supervisor filter — resolve "me" to current user's display name
32
+ if (opts.supervisor) {
33
+ let supervisorName = opts.supervisor;
34
+ if (supervisorName.toLowerCase() === 'me') {
35
+ const myId = await resolveEmployeeId(client);
36
+ const me = dir.employees.find((e) => e.id === myId);
37
+ supervisorName = me?.displayName ?? `${me?.firstName ?? ''} ${me?.lastName ?? ''}`;
38
+ }
39
+ const s = supervisorName.toLowerCase();
40
+ matches = matches.filter((e) => (e.supervisor ?? '').toLowerCase().includes(s));
41
+ }
42
+ // Department filter
43
+ if (opts.department) {
44
+ const d = opts.department.toLowerCase();
45
+ matches = matches.filter((e) => (e.department ?? '').toLowerCase().includes(d));
46
+ }
47
+ // Location filter
48
+ if (opts.location) {
49
+ const l = opts.location.toLowerCase();
50
+ matches = matches.filter((e) => (e.location ?? '').toLowerCase().includes(l));
51
+ }
52
+ // Division filter
53
+ if (opts.division) {
54
+ const dv = opts.division.toLowerCase();
55
+ matches = matches.filter((e) => (e.division ?? '').toLowerCase().includes(dv));
56
+ }
17
57
  output(matches);
18
58
  }
19
59
  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,OAAO,EAAE,uFAAuF,CAAC;SAC7G,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAW,EA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+ //# 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;AAMpC,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAejD"}
@@ -0,0 +1,21 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { getDirectory } from '../../utils/directory.js';
3
+ import { output, handleError } from '../../utils/output.js';
4
+ export function departments(parent) {
5
+ parent
6
+ .command('departments')
7
+ .description('List all departments')
8
+ .addHelpText('after', '\nExamples:\n bamboohr meta departments')
9
+ .action(async () => {
10
+ try {
11
+ const client = getClient();
12
+ const dir = await getDirectory(client);
13
+ const unique = [...new Set(dir.employees.map((e) => e.department).filter(Boolean))].sort();
14
+ output(unique);
15
+ }
16
+ catch (err) {
17
+ handleError(err);
18
+ }
19
+ });
20
+ }
21
+ //# 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,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,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,YAAY,CAAC,MAAM,CAAC,CAAC;YACvC,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;AAMpC,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAe/C"}
@@ -0,0 +1,21 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { getDirectory } from '../../utils/directory.js';
3
+ import { output, handleError } from '../../utils/output.js';
4
+ export function divisions(parent) {
5
+ parent
6
+ .command('divisions')
7
+ .description('List all divisions')
8
+ .addHelpText('after', '\nExamples:\n bamboohr meta divisions')
9
+ .action(async () => {
10
+ try {
11
+ const client = getClient();
12
+ const dir = await getDirectory(client);
13
+ const unique = [...new Set(dir.employees.map((e) => e.division).filter(Boolean))].sort();
14
+ output(unique);
15
+ }
16
+ catch (err) {
17
+ handleError(err);
18
+ }
19
+ });
20
+ }
21
+ //# 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,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,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,YAAY,CAAC,MAAM,CAAC,CAAC;YACvC,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;AAMpC,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAe/C"}
@@ -0,0 +1,21 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { getDirectory } from '../../utils/directory.js';
3
+ import { output, handleError } from '../../utils/output.js';
4
+ export function locations(parent) {
5
+ parent
6
+ .command('locations')
7
+ .description('List all office locations')
8
+ .addHelpText('after', '\nExamples:\n bamboohr meta locations')
9
+ .action(async () => {
10
+ try {
11
+ const client = getClient();
12
+ const dir = await getDirectory(client);
13
+ const unique = [...new Set(dir.employees.map((e) => e.location).filter(Boolean))].sort();
14
+ output(unique);
15
+ }
16
+ catch (err) {
17
+ handleError(err);
18
+ }
19
+ });
20
+ }
21
+ //# 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,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,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,YAAY,CAAC,MAAM,CAAC,CAAC;YACvC,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,CAAC;SACnD,MAAM,CAAC,WAAW,EAAE,qBAAqB,EAAE,QAAQ,CAAC;SACpD,SAAS,CAAC,IAAI,MAAM,CAAC,mBAAmB,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AAI,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"}
@@ -0,0 +1,6 @@
1
+ import type { BambooHRClient, EmployeeDirectory } from 'bamboohr-client';
2
+ /**
3
+ * Get the employee directory, cached for 1 hour.
4
+ */
5
+ export declare function getDirectory(client: BambooHRClient): Promise<EmployeeDirectory>;
6
+ //# sourceMappingURL=directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzE;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAE/E"}
@@ -0,0 +1,9 @@
1
+ import { cacheGetOrFetch } from 'cli-utils';
2
+ const CACHE = { name: 'bamboohr', ttl: 3_600_000 }; // 1 hour
3
+ /**
4
+ * Get the employee directory, cached for 1 hour.
5
+ */
6
+ export function getDirectory(client) {
7
+ return cacheGetOrFetch(CACHE, 'directory', () => client.employees.getDirectory());
8
+ }
9
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS;AAE7D;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAsB;IACjD,OAAO,eAAe,CAAoB,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC;AACvG,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.2",
4
4
  "publish": true,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,8 @@
13
13
  "dependencies": {
14
14
  "commander": "^13.1.0",
15
15
  "dotenv": "17.2.3",
16
- "bamboohr-client": "1.0.17"
16
+ "bamboohr-client": "1.0.17",
17
+ "cli-utils": "1.0.0"
17
18
  },
18
19
  "devDependencies": {
19
20
  "@types/node": "24.10.4",
@@ -21,8 +22,8 @@
21
22
  "tsx": "^4.19.2",
22
23
  "typescript": "^5.7.2",
23
24
  "vitest": "^4.0.16",
24
- "config-eslint": "0.0.0",
25
- "config-typescript": "0.0.0"
25
+ "config-typescript": "0.0.0",
26
+ "config-eslint": "0.0.0"
26
27
  },
27
28
  "engines": {
28
29
  "node": ">=22.0.0"