bamboohr-cli 0.0.3 → 0.0.5

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.
Files changed (34) hide show
  1. package/dist/commands/employee/directory.d.ts.map +1 -1
  2. package/dist/commands/employee/get.d.ts.map +1 -1
  3. package/dist/commands/employee/goals.d.ts.map +1 -1
  4. package/dist/commands/employee/index.d.ts.map +1 -1
  5. package/dist/commands/employee/index.js +2 -0
  6. package/dist/commands/employee/index.js.map +1 -1
  7. package/dist/commands/employee/photo.d.ts.map +1 -1
  8. package/dist/commands/employee/search.d.ts +3 -0
  9. package/dist/commands/employee/search.d.ts.map +1 -0
  10. package/dist/commands/employee/search.js +24 -0
  11. package/dist/commands/employee/search.js.map +1 -0
  12. package/dist/commands/file/get.d.ts.map +1 -1
  13. package/dist/commands/file/index.d.ts.map +1 -1
  14. package/dist/commands/file/list.d.ts.map +1 -1
  15. package/dist/commands/meta/fields.d.ts.map +1 -1
  16. package/dist/commands/meta/index.d.ts.map +1 -1
  17. package/dist/commands/timeoff/balance.d.ts.map +1 -1
  18. package/dist/commands/timeoff/balance.js +7 -7
  19. package/dist/commands/timeoff/balance.js.map +1 -1
  20. package/dist/commands/timeoff/create.d.ts.map +1 -1
  21. package/dist/commands/timeoff/create.js +8 -7
  22. package/dist/commands/timeoff/create.js.map +1 -1
  23. package/dist/commands/timeoff/index.d.ts.map +1 -1
  24. package/dist/commands/timeoff/requests.d.ts.map +1 -1
  25. package/dist/commands/timeoff/requests.js +6 -2
  26. package/dist/commands/timeoff/requests.js.map +1 -1
  27. package/dist/commands/timeoff/types.d.ts.map +1 -1
  28. package/dist/commands/timeoff/update-status.d.ts.map +1 -1
  29. package/dist/commands/timeoff/whos-out.d.ts.map +1 -1
  30. package/dist/utils/resolve-employee.d.ts +6 -0
  31. package/dist/utils/resolve-employee.d.ts.map +1 -0
  32. package/dist/utils/resolve-employee.js +10 -0
  33. package/dist/utils/resolve-employee.js.map +1 -0
  34. package/package.json +1 -1
@@ -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,QAcxC"}
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 +1 @@
1
- {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,QA4BlC"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA4BzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"goals.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/goals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,QA0BpC"}
1
+ {"version":3,"file":"goals.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/goals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA0B3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,QAmBxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoB/D"}
@@ -2,6 +2,7 @@ import { directory } from './directory.js';
2
2
  import { get } from './get.js';
3
3
  import { goals } from './goals.js';
4
4
  import { photo } from './photo.js';
5
+ import { search } from './search.js';
5
6
  export function registerEmployeeCommands(program) {
6
7
  const employee = program
7
8
  .command('employee')
@@ -15,6 +16,7 @@ Examples:
15
16
  $ bamboohr employee goals 123 --filter open
16
17
  `);
17
18
  get(employee);
19
+ search(employee);
18
20
  directory(employee);
19
21
  photo(employee);
20
22
  goals(employee);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/employee/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,qBAAqB,CAAC;SAClC,WAAW,CACV,OAAO,EACP;;;;;;;CAOL,CACI,CAAC;IACJ,GAAG,CAAC,QAAQ,CAAC,CAAC;IACd,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpB,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChB,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/employee/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,qBAAqB,CAAC;SAClC,WAAW,CACV,OAAO,EACP;;;;;;;CAOL,CACI,CAAC;IACJ,GAAG,CAAC,QAAQ,CAAC,CAAC;IACd,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjB,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpB,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChB,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"photo.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/photo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,QA8BpC"}
1
+ {"version":3,"file":"photo.d.ts","sourceRoot":"","sources":["../../../src/commands/employee/photo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA8B3C"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function search(parent: Command): void;
3
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,24 @@
1
+ import { getClient } from '../../utils/client.js';
2
+ import { output, handleError } from '../../utils/output.js';
3
+ export function search(parent) {
4
+ 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) => {
9
+ try {
10
+ 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
+ });
17
+ output(matches);
18
+ }
19
+ catch (err) {
20
+ handleError(err);
21
+ }
22
+ });
23
+ }
24
+ //# sourceMappingURL=search.js.map
@@ -0,0 +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,EAAE,EAAE;gBACnD,MAAM,IAAI,GACR,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,aAAa,IAAI,EAAE,IAAI,CAAC,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC;gBAC3G,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,CAAC,CAAC;QAClB,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":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/file/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,QAqBlC"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/file/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAqBzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/file/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAcpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/file/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAc3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/file/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,QAcnC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/file/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAc1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QAcrC"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/commands/meta/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAc5C"}
@@ -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,QAYpD"}
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 +1 @@
1
- {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,QAwBtC"}
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAuB7C"}
@@ -1,21 +1,21 @@
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 balance(parent) {
4
5
  parent
5
- .command('balance <employeeId>')
6
- .description('Estimate time off balance for an employee')
6
+ .command('balance [employeeId]')
7
+ .description('Estimate time off balance (defaults to current user)')
7
8
  .option('--date <date>', 'Future date to estimate balance for (YYYY-MM-DD)')
8
9
  .addHelpText('after', `
9
10
  Examples:
11
+ $ bamboohr timeoff balance
10
12
  $ bamboohr timeoff balance 123
11
- $ bamboohr timeoff balance 123 --date 2026-06-30`)
13
+ $ bamboohr timeoff balance --date 2026-06-30`)
12
14
  .action(async (employeeId, opts) => {
13
15
  try {
14
16
  const client = getClient();
15
- const result = await client.timeOff.getBalance({
16
- employeeId,
17
- date: opts.date,
18
- });
17
+ const id = await resolveEmployeeId(client, employeeId);
18
+ const result = await client.timeOff.getBalance({ employeeId: id, date: opts.date });
19
19
  output(result);
20
20
  }
21
21
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"balance.js","sourceRoot":"","sources":["../../../src/commands/timeoff/balance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM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YAC3B,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACpF,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":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QAoDrC"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAK5C,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoD5C"}
@@ -1,10 +1,11 @@
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 create(parent) {
5
6
  parent
6
- .command('create <employeeId>')
7
- .description('Create a time off request')
7
+ .command('create [employeeId]')
8
+ .description('Create a time off request (defaults to current user)')
8
9
  .requiredOption('--start <date>', 'Start date (YYYY-MM-DD)')
9
10
  .requiredOption('--end <date>', 'End date (YYYY-MM-DD)')
10
11
  .requiredOption('--type-id <id>', 'Time off type ID (use "timeoff types" to find IDs)', parseInt)
@@ -14,14 +15,14 @@ export function create(parent) {
14
15
  .option('--dates <json>', 'Per-day amounts as JSON array, e.g. \'[{"ymd":"2026-03-21","amount":4}]\' for half-day')
15
16
  .addHelpText('after', `
16
17
  Examples:
17
- $ bamboohr timeoff create 504 --start 2026-04-01 --end 2026-04-01 --type-id 83 --amount 1
18
- $ bamboohr timeoff create 504 --start 2026-04-01 --end 2026-04-01 --type-id 83 --amount 1 --note "Doctor appointment"
19
- $ bamboohr timeoff create 504 --start 2026-04-01 --end 2026-04-01 --type-id 83 --amount 4 --dates '[{"ymd":"2026-04-01","amount":4}]'`)
18
+ $ bamboohr timeoff create --start 2026-04-01 --end 2026-04-01 --type-id 83 --amount 1
19
+ $ bamboohr timeoff create 504 --start 2026-04-01 --end 2026-04-01 --type-id 83 --amount 1 --note "Doctor appointment"`)
20
20
  .action(async (employeeId, opts) => {
21
21
  try {
22
22
  const client = getClient();
23
+ const id = await resolveEmployeeId(client, employeeId);
23
24
  const result = await client.timeOff.createRequest({
24
- employeeId,
25
+ employeeId: id,
25
26
  status: opts.status,
26
27
  start: opts.start,
27
28
  end: opts.end,
@@ -30,7 +31,7 @@ Examples:
30
31
  notes: opts.note ? [{ from: 'employee', note: opts.note }] : undefined,
31
32
  dates: opts.dates ? JSON.parse(opts.dates) : undefined,
32
33
  });
33
- output(result || { created: true, employeeId, start: opts.start, end: opts.end });
34
+ output(result || { created: true, employeeId: id, start: opts.start, end: opts.end });
34
35
  }
35
36
  catch (err) {
36
37
  handleError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/timeoff/create.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,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,qBAAqB,CAAC;SAC9B,WAAW,CAAC,2BAA2B,CAAC;SACxC,c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G,SAAS,EAAE,CAAC;YAC3B,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;gBAChD,UAAU,EAAE,EAAE;gBACd,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,aAAa,EAAE,IAAI,CAAC,MAAM;gBAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;gBACtE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAuC,CAAC,CAAC,CAAC,SAAS;aAC9F,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACxF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAsBvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsB9D"}
@@ -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,QAsDvC"}
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"}
@@ -25,13 +25,17 @@ Examples:
25
25
  $ bamboohr timeoff requests --employee 123 --start 2026-01-01 --end 2026-03-31`)
26
26
  .action(async (opts) => {
27
27
  try {
28
+ // Default to current year if no dates specified
29
+ const year = new Date().getFullYear();
30
+ const start = opts.start ?? `${year}-01-01`;
31
+ const end = opts.end ?? `${year}-12-31`;
28
32
  const client = getClient();
29
33
  const result = await client.timeOff.getRequests({
30
34
  id: opts.id,
31
35
  action: opts.action,
32
36
  employeeId: opts.employee,
33
- start: opts.start,
34
- end: opts.end,
37
+ start,
38
+ end,
35
39
  status: opts.status,
36
40
  type: opts.type,
37
41
  });
@@ -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,CAA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,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;gBAC9C,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,MAAM,EAAE,IAAI,CAAC,MAAwC;gBACrD,UAAU,EAAE,IAAI,CAAC,QAAQ;gBACzB,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,QAuBpC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAuB3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"update-status.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/update-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,QA6B3C"}
1
+ {"version":3,"file":"update-status.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/update-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA6BlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"whos-out.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/whos-out.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,QAyBtC"}
1
+ {"version":3,"file":"whos-out.d.ts","sourceRoot":"","sources":["../../../src/commands/timeoff/whos-out.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAyB7C"}
@@ -0,0 +1,6 @@
1
+ import type { BambooHRClient } from 'bamboohr-client';
2
+ /**
3
+ * Resolve employee ID — returns the given ID, or fetches the current user's ID if omitted.
4
+ */
5
+ export declare function resolveEmployeeId(client: BambooHRClient, employeeId?: string): Promise<string>;
6
+ //# sourceMappingURL=resolve-employee.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-employee.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-employee.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIpG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Resolve employee ID — returns the given ID, or fetches the current user's ID if omitted.
3
+ */
4
+ export async function resolveEmployeeId(client, employeeId) {
5
+ if (employeeId)
6
+ return employeeId;
7
+ const me = await client.employees.get({ id: '0', fields: 'id' });
8
+ return me.id;
9
+ }
10
+ //# sourceMappingURL=resolve-employee.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-employee.js","sourceRoot":"","sources":["../../src/utils/resolve-employee.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAsB,EAAE,UAAmB;IACjF,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAClC,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,OAAO,EAAE,CAAC,EAAE,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bamboohr-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "publish": true,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",