@apet97/clockify-cli-115 0.6.0 → 1.0.0

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/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  Command-line interface for [Clockify](https://clockify.me/), built on
4
4
  top of `clockify-sdk-ts-115`.
5
5
 
6
- Current release: `0.6.0`. Requires Node.js `>=22.13.0` and
7
- `clockify-sdk-ts-115 >=0.13.0 <1`.
6
+ Current release: `1.0.0`. Requires Node.js `>=22.13.0` and
7
+ `clockify-sdk-ts-115 ^1`.
8
8
 
9
9
  Two binaries, identical behavior:
10
10
 
@@ -239,7 +239,7 @@ node dist/index.js status # smoke test (or invoke installed clk115/clockify11
239
239
  ```
240
240
 
241
241
  `clockify-sdk-ts-115` is workspace-linked for local development and is a
242
- `>=0.13.0 <1` peer dependency for published consumers.
242
+ `^1` peer dependency for published consumers.
243
243
 
244
244
  ## License
245
245
 
package/dist/client.js CHANGED
@@ -17,7 +17,7 @@ export function buildRoutingOptions(region, subdomain) {
17
17
  }
18
18
  if (region === "global")
19
19
  return { profile: "global" };
20
- if (!KNOWN_REGIONS.includes(region)) {
20
+ if (region === undefined || !KNOWN_REGIONS.includes(region)) {
21
21
  throw new Error(`Unrecognized Clockify region ${JSON.stringify(region)}. Provide one of ${KNOWN_REGIONS.join(", ")}.`);
22
22
  }
23
23
  return {
@@ -175,15 +175,12 @@ function sourceFor(field, config, flags, env) {
175
175
  return "rc";
176
176
  return undefined;
177
177
  }
178
- if (field === "subdomain") {
179
- if (isPresent(flags.subdomain))
180
- return "flag";
181
- if (isPresent(env.CLOCKIFY_SUBDOMAIN))
182
- return "env";
183
- if (isPresent(config.subdomain))
184
- return "rc";
185
- return undefined;
186
- }
178
+ if (isPresent(flags.subdomain))
179
+ return "flag";
180
+ if (isPresent(env.CLOCKIFY_SUBDOMAIN))
181
+ return "env";
182
+ if (isPresent(config.subdomain))
183
+ return "rc";
187
184
  return undefined;
188
185
  }
189
186
  function isPresent(value) {
@@ -41,7 +41,7 @@ export const registerExpensesCommand = (program, services) => {
41
41
  const rows = result.items.map((raw) => {
42
42
  const e = raw;
43
43
  const category = typeof e.category === "object" && e.category !== null
44
- ? (e.category.name ?? "")
44
+ ? e.category.name ?? ""
45
45
  : typeof e.category === "string"
46
46
  ? e.category
47
47
  : "";
@@ -26,7 +26,7 @@ export function clampPageSize(value, max) {
26
26
  return Math.min(value, max);
27
27
  }
28
28
  export function splitList(value) {
29
- return String(value)
29
+ return value
30
30
  .split(",")
31
31
  .map((s) => s.trim())
32
32
  .filter((s) => s.length > 0);
@@ -4,8 +4,8 @@ function asNamed(rows) {
4
4
  return rows.map((r) => {
5
5
  const row = r;
6
6
  return {
7
- id: String(row.id ?? ""),
8
- name: String(row.name ?? ""),
7
+ id: row.id ?? "",
8
+ name: row.name ?? "",
9
9
  ...(row.archived !== undefined ? { archived: row.archived } : {}),
10
10
  };
11
11
  });
@@ -72,7 +72,7 @@ export const registerSchedulingCommand = (program, services) => {
72
72
  body.includeNonWorkingDays = true;
73
73
  const req = { workspaceId, body };
74
74
  const createdList = (await client.scheduling.createRecurring(req));
75
- const created = createdList?.[0] ?? {};
75
+ const created = createdList[0] ?? {};
76
76
  if (opts.publish === true) {
77
77
  await client.scheduling.publish({
78
78
  workspaceId,
@@ -71,8 +71,8 @@ const sharedUsersFilterSchema = z
71
71
  .strict();
72
72
  const sharedAttendanceFilterSchema = z
73
73
  .object({
74
- page: z.number().finite().int(INT_MESSAGE).optional(),
75
- pageSize: z.number().finite().int(INT_MESSAGE).optional(),
74
+ page: z.number().int(INT_MESSAGE).optional(),
75
+ pageSize: z.number().int(INT_MESSAGE).optional(),
76
76
  users: sharedUsersFilterSchema.optional(),
77
77
  })
78
78
  .strict();
@@ -80,8 +80,8 @@ const sharedDetailedFilterSchema = z
80
80
  .object({
81
81
  auditFilter: openObjectSchema.optional(),
82
82
  options: openObjectSchema.optional(),
83
- page: z.number().finite().int(INT_MESSAGE).optional(),
84
- pageSize: z.number().finite().int(INT_MESSAGE).optional(),
83
+ page: z.number().int(INT_MESSAGE).optional(),
84
+ pageSize: z.number().int(INT_MESSAGE).optional(),
85
85
  sortColumn: nonEmptyStringSchema.optional(),
86
86
  sortOrder: z.enum(["ASCENDING", "DESCENDING"]).optional(),
87
87
  })
@@ -215,7 +215,7 @@ function schemaIssueLabel(issue, operation) {
215
215
  return operation;
216
216
  }
217
217
  function sharedReportValidationError(error, operation, rawType) {
218
- const invalidTypeIssue = error.issues.find((issue) => issue.path[0] === "type" && issue.code === z.ZodIssueCode.invalid_value);
218
+ const invalidTypeIssue = error.issues.find((issue) => issue.path[0] === "type" && issue.code === "invalid_value");
219
219
  if (invalidTypeIssue !== undefined) {
220
220
  return new Error(`Unknown --type "${String(rawType)}". Provide one of: ${SHARED_REPORT_TYPES.join(", ")}.`);
221
221
  }
@@ -224,12 +224,12 @@ function sharedReportValidationError(error, operation, rawType) {
224
224
  return new Error(`${operation}: invalid request.`);
225
225
  if (issue.path.length === 1 &&
226
226
  issue.path[0] === "filter" &&
227
- issue.code === z.ZodIssueCode.invalid_type &&
227
+ issue.code === "invalid_type" &&
228
228
  issue.expected === "object") {
229
229
  return new Error("--filter must be a JSON object.");
230
230
  }
231
231
  const label = schemaIssueLabel(issue, operation);
232
- if (issue.code === z.ZodIssueCode.unrecognized_keys) {
232
+ if (issue.code === "unrecognized_keys") {
233
233
  const fieldKind = issue.path[0] === "filter" ? "filter field(s)" : "field(s)";
234
234
  return new Error(`${label} has unknown ${fieldKind}: ${issue.keys.join(", ")}.`);
235
235
  }
@@ -40,7 +40,7 @@ export const registerTimeOffCommand = (program, services) => {
40
40
  const rows = items.map((raw) => {
41
41
  const r = raw;
42
42
  const statusValue = typeof r.status === "object" && r.status !== null
43
- ? (r.status.statusType ?? "")
43
+ ? r.status.statusType ?? ""
44
44
  : typeof r.status === "string"
45
45
  ? r.status
46
46
  : "";
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = "0.6.0";
1
+ export const PACKAGE_VERSION = "1.0.0";
package/dist/index.js CHANGED
@@ -78,12 +78,15 @@ export function buildProgram(services = defaultServices) {
78
78
  });
79
79
  return program;
80
80
  }
81
+ function isTty(stream) {
82
+ return stream.isTTY === true;
83
+ }
81
84
  export function resolveFlags(program) {
82
85
  const opts = program.opts();
83
86
  const mode = resolveMode(opts.output, opts.json);
84
87
  const resolved = {
85
88
  mode,
86
- color: opts.color !== false && process.stdout.isTTY === true,
89
+ color: opts.color !== false && isTty(process.stdout),
87
90
  };
88
91
  if (opts.compact)
89
92
  resolved.compact = true;
@@ -99,7 +102,7 @@ function resolveFlagsSafe(program) {
99
102
  const opts = program.opts();
100
103
  return {
101
104
  mode: "table",
102
- color: opts.color !== false && process.stdout.isTTY === true,
105
+ color: opts.color !== false && isTty(process.stdout),
103
106
  };
104
107
  }
105
108
  }
@@ -149,7 +152,7 @@ export async function main(argv, services = defaultServices) {
149
152
  }
150
153
  catch (err) {
151
154
  if (isCommanderHelpError(err)) {
152
- return Number(err.exitCode ?? 0);
155
+ return err.exitCode ?? 0;
153
156
  }
154
157
  const message = err instanceof Error ? err.message : String(err);
155
158
  const statusCode = err.statusCode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apet97/clockify-cli-115",
3
- "version": "0.6.0",
3
+ "version": "1.0.0",
4
4
  "description": "Unofficial, community-built — not affiliated with CAKE.com or Clockify. Command-line interface for Clockify, built on clockify-sdk-ts-115.",
5
5
  "license": "MIT",
6
6
  "author": "Aleksandar Petković <petkovic.aleksandar037@gmail.com>",
@@ -54,7 +54,7 @@
54
54
  "zod": "^4.4.3"
55
55
  },
56
56
  "peerDependencies": {
57
- "clockify-sdk-ts-115": ">=0.13.0 <1"
57
+ "clockify-sdk-ts-115": "^1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^22",
@@ -63,7 +63,7 @@
63
63
  "eslint": "^10.8.0",
64
64
  "eslint-plugin-import-x": "^4.17.1",
65
65
  "tsx": "^4.23.1",
66
- "typescript": "^5.7.0",
66
+ "typescript": "^7.0.2",
67
67
  "typescript-eslint": "^8.65.0",
68
68
  "vitest": "^4.1.10"
69
69
  },