bamboohr-cli 0.0.4 → 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.
- package/dist/commands/timeoff/balance.d.ts.map +1 -1
- package/dist/commands/timeoff/balance.js +7 -7
- package/dist/commands/timeoff/balance.js.map +1 -1
- package/dist/commands/timeoff/create.d.ts.map +1 -1
- package/dist/commands/timeoff/create.js +8 -7
- package/dist/commands/timeoff/create.js.map +1 -1
- package/dist/utils/resolve-employee.d.ts +6 -0
- package/dist/utils/resolve-employee.d.ts.map +1 -0
- package/dist/utils/resolve-employee.js +10 -0
- package/dist/utils/resolve-employee.js.map +1 -0
- package/package.json +3 -3
|
@@ -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;
|
|
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
|
|
6
|
-
.description('Estimate time off balance
|
|
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
|
|
13
|
+
$ bamboohr timeoff balance --date 2026-06-30`)
|
|
12
14
|
.action(async (employeeId, opts) => {
|
|
13
15
|
try {
|
|
14
16
|
const client = getClient();
|
|
15
|
-
const
|
|
16
|
-
|
|
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,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
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,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,UAAU,OAAO,CAAC,MAAe;IACrC,MAAM;SACH,OAAO,CAAC,sBAAsB,CAAC;SAC/B,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,eAAe,EAAE,kDAAkD,CAAC;SAC3E,WAAW,CACV,OAAO,EACP;;;;+CAIyC,CAC1C;SACA,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,IAAuB,EAAE,EAAE;QACxE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;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;
|
|
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
|
|
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
|
|
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,uB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I,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"}
|
|
@@ -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
|
+
"version": "0.0.5",
|
|
4
4
|
"publish": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"tsx": "^4.19.2",
|
|
22
22
|
"typescript": "^5.7.2",
|
|
23
23
|
"vitest": "^4.0.16",
|
|
24
|
-
"config-
|
|
25
|
-
"config-
|
|
24
|
+
"config-typescript": "0.0.0",
|
|
25
|
+
"config-eslint": "0.0.0"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=22.0.0"
|