@qontoctl/cli 0.0.0 → 0.1.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.
Files changed (128) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +66 -0
  3. package/dist/cli.js +8 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/client.d.ts +10 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +42 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/commands/account.d.ts +6 -0
  10. package/dist/commands/account.d.ts.map +1 -0
  11. package/dist/commands/account.js +61 -0
  12. package/dist/commands/account.js.map +1 -0
  13. package/dist/commands/index.d.ts +6 -0
  14. package/dist/commands/index.d.ts.map +1 -0
  15. package/dist/commands/index.js +8 -0
  16. package/dist/commands/index.js.map +1 -0
  17. package/dist/commands/label.d.ts +3 -0
  18. package/dist/commands/label.d.ts.map +1 -0
  19. package/dist/commands/label.js +45 -0
  20. package/dist/commands/label.js.map +1 -0
  21. package/dist/commands/membership.d.ts +3 -0
  22. package/dist/commands/membership.d.ts.map +1 -0
  23. package/dist/commands/membership.js +30 -0
  24. package/dist/commands/membership.js.map +1 -0
  25. package/dist/commands/org.d.ts +6 -0
  26. package/dist/commands/org.d.ts.map +1 -0
  27. package/dist/commands/org.js +31 -0
  28. package/dist/commands/org.js.map +1 -0
  29. package/dist/commands/profile/add.d.ts +6 -0
  30. package/dist/commands/profile/add.d.ts.map +1 -0
  31. package/dist/commands/profile/add.js +63 -0
  32. package/dist/commands/profile/add.js.map +1 -0
  33. package/dist/commands/profile/index.d.ts +6 -0
  34. package/dist/commands/profile/index.d.ts.map +1 -0
  35. package/dist/commands/profile/index.js +19 -0
  36. package/dist/commands/profile/index.js.map +1 -0
  37. package/dist/commands/profile/list.d.ts +6 -0
  38. package/dist/commands/profile/list.d.ts.map +1 -0
  39. package/dist/commands/profile/list.js +49 -0
  40. package/dist/commands/profile/list.js.map +1 -0
  41. package/dist/commands/profile/remove.d.ts +6 -0
  42. package/dist/commands/profile/remove.d.ts.map +1 -0
  43. package/dist/commands/profile/remove.js +46 -0
  44. package/dist/commands/profile/remove.js.map +1 -0
  45. package/dist/commands/profile/show.d.ts +6 -0
  46. package/dist/commands/profile/show.d.ts.map +1 -0
  47. package/dist/commands/profile/show.js +52 -0
  48. package/dist/commands/profile/show.js.map +1 -0
  49. package/dist/commands/profile/test.d.ts +6 -0
  50. package/dist/commands/profile/test.d.ts.map +1 -0
  51. package/dist/commands/profile/test.js +79 -0
  52. package/dist/commands/profile/test.js.map +1 -0
  53. package/dist/commands/statement.d.ts +6 -0
  54. package/dist/commands/statement.d.ts.map +1 -0
  55. package/dist/commands/statement.js +92 -0
  56. package/dist/commands/statement.js.map +1 -0
  57. package/dist/commands/transaction/index.d.ts +6 -0
  58. package/dist/commands/transaction/index.d.ts.map +1 -0
  59. package/dist/commands/transaction/index.js +13 -0
  60. package/dist/commands/transaction/index.js.map +1 -0
  61. package/dist/commands/transaction/list.d.ts +3 -0
  62. package/dist/commands/transaction/list.d.ts.map +1 -0
  63. package/dist/commands/transaction/list.js +69 -0
  64. package/dist/commands/transaction/list.js.map +1 -0
  65. package/dist/commands/transaction/show.d.ts +3 -0
  66. package/dist/commands/transaction/show.d.ts.map +1 -0
  67. package/dist/commands/transaction/show.js +25 -0
  68. package/dist/commands/transaction/show.js.map +1 -0
  69. package/dist/completions/bash.d.ts +6 -0
  70. package/dist/completions/bash.d.ts.map +1 -0
  71. package/dist/completions/bash.js +170 -0
  72. package/dist/completions/bash.js.map +1 -0
  73. package/dist/completions/fish.d.ts +6 -0
  74. package/dist/completions/fish.d.ts.map +1 -0
  75. package/dist/completions/fish.js +86 -0
  76. package/dist/completions/fish.js.map +1 -0
  77. package/dist/completions/index.d.ts +7 -0
  78. package/dist/completions/index.d.ts.map +1 -0
  79. package/dist/completions/index.js +31 -0
  80. package/dist/completions/index.js.map +1 -0
  81. package/dist/completions/zsh.d.ts +6 -0
  82. package/dist/completions/zsh.d.ts.map +1 -0
  83. package/dist/completions/zsh.js +124 -0
  84. package/dist/completions/zsh.js.map +1 -0
  85. package/dist/error-handler.d.ts +8 -0
  86. package/dist/error-handler.d.ts.map +1 -0
  87. package/dist/error-handler.js +59 -0
  88. package/dist/error-handler.js.map +1 -0
  89. package/dist/formatters/csv.d.ts +8 -0
  90. package/dist/formatters/csv.d.ts.map +1 -0
  91. package/dist/formatters/csv.js +40 -0
  92. package/dist/formatters/csv.js.map +1 -0
  93. package/dist/formatters/index.d.ts +14 -0
  94. package/dist/formatters/index.d.ts.map +1 -0
  95. package/dist/formatters/index.js +30 -0
  96. package/dist/formatters/index.js.map +1 -0
  97. package/dist/formatters/json.d.ts +5 -0
  98. package/dist/formatters/json.d.ts.map +1 -0
  99. package/dist/formatters/json.js +9 -0
  100. package/dist/formatters/json.js.map +1 -0
  101. package/dist/formatters/table.d.ts +8 -0
  102. package/dist/formatters/table.d.ts.map +1 -0
  103. package/dist/formatters/table.js +37 -0
  104. package/dist/formatters/table.js.map +1 -0
  105. package/dist/formatters/yaml.d.ts +5 -0
  106. package/dist/formatters/yaml.d.ts.map +1 -0
  107. package/dist/formatters/yaml.js +10 -0
  108. package/dist/formatters/yaml.js.map +1 -0
  109. package/dist/index.d.ts +15 -0
  110. package/dist/index.d.ts.map +1 -0
  111. package/dist/index.js +16 -0
  112. package/dist/index.js.map +1 -0
  113. package/dist/inherited-options.d.ts +15 -0
  114. package/dist/inherited-options.d.ts.map +1 -0
  115. package/dist/inherited-options.js +31 -0
  116. package/dist/inherited-options.js.map +1 -0
  117. package/dist/options.d.ts +26 -0
  118. package/dist/options.d.ts.map +1 -0
  119. package/dist/options.js +7 -0
  120. package/dist/options.js.map +1 -0
  121. package/dist/pagination.d.ts +52 -0
  122. package/dist/pagination.d.ts.map +1 -0
  123. package/dist/pagination.js +87 -0
  124. package/dist/pagination.js.map +1 -0
  125. package/dist/program.d.ts.map +1 -1
  126. package/dist/program.js +31 -4
  127. package/dist/program.js.map +1 -1
  128. package/package.json +30 -15
@@ -0,0 +1,46 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { unlink } from "node:fs/promises";
4
+ import { join } from "node:path";
5
+ import { homedir } from "node:os";
6
+ import { createInterface } from "node:readline/promises";
7
+ import { CONFIG_DIR, isValidProfileName, loadConfigFile } from "@qontoctl/core";
8
+ import { addInheritableOptions } from "../../inherited-options.js";
9
+ /**
10
+ * Register the `profile remove <name>` subcommand.
11
+ */
12
+ export function registerRemoveCommand(parent) {
13
+ const remove = parent.command("remove <name>").description("delete a named profile (with confirmation)");
14
+ addInheritableOptions(remove);
15
+ remove.action(async (name) => {
16
+ await removeProfile(name);
17
+ });
18
+ }
19
+ async function removeProfile(name) {
20
+ if (!isValidProfileName(name)) {
21
+ console.error("Invalid profile name: must not contain path separators or '..'.");
22
+ process.exitCode = 1;
23
+ return;
24
+ }
25
+ const { raw } = await loadConfigFile({ profile: name });
26
+ if (raw === undefined) {
27
+ console.error(`Profile "${name}" not found.`);
28
+ process.exitCode = 1;
29
+ return;
30
+ }
31
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
32
+ try {
33
+ const answer = await rl.question(`Remove profile "${name}"? (yes/no): `);
34
+ if (answer.trim().toLowerCase() !== "yes") {
35
+ console.log("Aborted.");
36
+ return;
37
+ }
38
+ const path = join(homedir(), CONFIG_DIR, `${name}.yaml`);
39
+ await unlink(path);
40
+ console.log(`Profile "${name}" removed.`);
41
+ }
42
+ finally {
43
+ rl.close();
44
+ }
45
+ }
46
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/profile/remove.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAA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Ae,CAAC,CAAC;QAEzE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACxB,OAAO;QACT,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;QACzD,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QAEnB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,YAAY,CAAC,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `profile show <name>` subcommand.
4
+ */
5
+ export declare function registerShowCommand(parent: Command): void;
6
+ //# sourceMappingURL=show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/profile/show.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAOzD"}
@@ -0,0 +1,52 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { loadConfigFile, validateConfig } from "@qontoctl/core";
4
+ import { formatOutput } from "../../formatters/index.js";
5
+ import { addInheritableOptions, resolveGlobalOptions } from "../../inherited-options.js";
6
+ /**
7
+ * Register the `profile show <name>` subcommand.
8
+ */
9
+ export function registerShowCommand(parent) {
10
+ const show = parent.command("show <name>").description("show profile details with secrets redacted");
11
+ addInheritableOptions(show);
12
+ show.action(async (name, _options, cmd) => {
13
+ const globalOpts = resolveGlobalOptions(cmd);
14
+ await showProfile(name, globalOpts);
15
+ });
16
+ }
17
+ async function showProfile(name, options) {
18
+ const { raw, path } = await loadConfigFile({ profile: name });
19
+ if (raw === undefined) {
20
+ console.error(`Profile "${name}" not found.`);
21
+ process.exitCode = 1;
22
+ return;
23
+ }
24
+ const { config, warnings, errors } = validateConfig(raw);
25
+ for (const warning of warnings) {
26
+ console.error(`Warning: ${warning}`);
27
+ }
28
+ for (const error of errors) {
29
+ console.error(`Error: ${error}`);
30
+ }
31
+ if (errors.length > 0) {
32
+ process.exitCode = 1;
33
+ return;
34
+ }
35
+ const details = {
36
+ name,
37
+ path: path ?? "unknown",
38
+ "organization-slug": config.apiKey?.organizationSlug ?? "",
39
+ "secret-key": redactSecret(config.apiKey?.secretKey ?? ""),
40
+ };
41
+ console.log(formatOutput([details], options.output));
42
+ }
43
+ /**
44
+ * Redact a secret key, showing only the last 4 characters.
45
+ */
46
+ function redactSecret(secret) {
47
+ if (secret.length <= 4) {
48
+ return "****";
49
+ }
50
+ return "****" + secret.slice(-4);
51
+ }
52
+ //# sourceMappingURL=show.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.js","sourceRoot":"","sources":["../../../src/commands/profile/show.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGzF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC;IACrG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,QAAiB,EAAE,GAAY,EAAE,EAAE;QAClE,MAAM,UAAU,GA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,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `profile test` subcommand.
4
+ */
5
+ export declare function registerTestCommand(parent: Command): void;
6
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/commands/profile/test.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBzC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAOzD"}
@@ -0,0 +1,79 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { HttpClient, resolveConfig, buildApiKeyAuthorization, ConfigError, AuthError, QontoApiError, QontoRateLimitError, } from "@qontoctl/core";
4
+ import { addInheritableOptions, resolveGlobalOptions } from "../../inherited-options.js";
5
+ /**
6
+ * Register the `profile test` subcommand.
7
+ */
8
+ export function registerTestCommand(parent) {
9
+ const test = parent.command("test").description("test credentials via GET /v2/organization");
10
+ addInheritableOptions(test);
11
+ test.action(async (_options, cmd) => {
12
+ const globalOpts = resolveGlobalOptions(cmd);
13
+ await testProfile(globalOpts);
14
+ });
15
+ }
16
+ async function testProfile(options) {
17
+ let logger;
18
+ if (options.debug === true) {
19
+ console.error("Warning: Debug mode logs full API responses which may include financial data (IBANs, balances). " +
20
+ "Do not use in shared environments.");
21
+ logger = {
22
+ verbose: (msg) => {
23
+ console.error(`[verbose] ${msg}`);
24
+ },
25
+ debug: (msg) => {
26
+ console.error(`[debug] ${msg}`);
27
+ },
28
+ };
29
+ }
30
+ else if (options.verbose === true) {
31
+ logger = {
32
+ verbose: (msg) => {
33
+ console.error(`[verbose] ${msg}`);
34
+ },
35
+ debug: () => { },
36
+ };
37
+ }
38
+ try {
39
+ const { config, endpoint } = await resolveConfig({ profile: options.profile });
40
+ if (config.apiKey === undefined) {
41
+ console.error("Configuration error: no credentials found.");
42
+ process.exitCode = 1;
43
+ return;
44
+ }
45
+ const authorization = buildApiKeyAuthorization(config.apiKey);
46
+ const client = new HttpClient({
47
+ baseUrl: endpoint,
48
+ authorization,
49
+ logger,
50
+ });
51
+ const response = await client.get("/v2/organization");
52
+ const { name, slug } = response.organization;
53
+ console.log(`Success: connected to organization "${name}" (${slug})`);
54
+ }
55
+ catch (error) {
56
+ if (error instanceof ConfigError) {
57
+ console.error(`Configuration error: ${error.message}`);
58
+ process.exitCode = 1;
59
+ return;
60
+ }
61
+ if (error instanceof AuthError) {
62
+ console.error(`Authentication failed: ${error.message}`);
63
+ process.exitCode = 1;
64
+ return;
65
+ }
66
+ if (error instanceof QontoApiError) {
67
+ console.error(`API error (${error.status}): ${error.message}`);
68
+ process.exitCode = 1;
69
+ return;
70
+ }
71
+ if (error instanceof QontoRateLimitError) {
72
+ console.error(`Rate limited: ${error.message}`);
73
+ process.exitCode = 1;
74
+ return;
75
+ }
76
+ throw error;
77
+ }
78
+ }
79
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/commands/profile/test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAEL,UAAU,EACV,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAUzF;;GAEG;AACH,MAAM,UAAU,mBAAm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,iBAAiB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAChD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Command } from "commander";
2
+ /**
3
+ * Register the `statement` command group on the given program.
4
+ */
5
+ export declare function registerStatementCommands(program: Command): void;
6
+ //# sourceMappingURL=statement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement.d.ts","sourceRoot":"","sources":["../../src/commands/statement.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAyB5C;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkFhE"}
@@ -0,0 +1,92 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { basename, join, resolve, sep } from "node:path";
4
+ import { writeFile } from "node:fs/promises";
5
+ import { Command, Option } from "commander";
6
+ import { createClient } from "../client.js";
7
+ import { formatOutput } from "../formatters/index.js";
8
+ import { addInheritableOptions, resolveGlobalOptions } from "../inherited-options.js";
9
+ import { fetchPaginated } from "../pagination.js";
10
+ function formatStatementRow(s) {
11
+ return {
12
+ id: s.id,
13
+ bank_account_id: s.bank_account_id,
14
+ period: s.period,
15
+ file_name: s.file.file_name,
16
+ file_content_type: s.file.file_content_type,
17
+ file_size: s.file.file_size,
18
+ };
19
+ }
20
+ /**
21
+ * Register the `statement` command group on the given program.
22
+ */
23
+ export function registerStatementCommands(program) {
24
+ const statement = program.command("statement").description("Manage bank statements");
25
+ const list = statement
26
+ .command("list")
27
+ .description("List bank statements")
28
+ .addOption(new Option("--bank-account <id>", "filter by bank account ID"))
29
+ .addOption(new Option("--from <period>", "start period (MM-YYYY)"))
30
+ .addOption(new Option("--to <period>", "end period (MM-YYYY)"));
31
+ addInheritableOptions(list);
32
+ list.action(async (commandOpts, cmd) => {
33
+ const globalOpts = resolveGlobalOptions(cmd);
34
+ const client = await createClient(globalOpts);
35
+ const params = {};
36
+ if (commandOpts.bankAccount !== undefined) {
37
+ params["bank_account_ids[]"] = commandOpts.bankAccount;
38
+ }
39
+ if (commandOpts.from !== undefined) {
40
+ params["period_from"] = commandOpts.from;
41
+ }
42
+ if (commandOpts.to !== undefined) {
43
+ params["period_to"] = commandOpts.to;
44
+ }
45
+ const result = await fetchPaginated(client, "/v2/statements", "statements", globalOpts, params);
46
+ const rows = result.items.map(formatStatementRow);
47
+ const output = formatOutput(rows, globalOpts.output);
48
+ if (output !== "") {
49
+ process.stdout.write(`${output}\n`);
50
+ }
51
+ });
52
+ const show = statement.command("show").description("Show a bank statement").argument("<id>", "statement ID");
53
+ addInheritableOptions(show);
54
+ show.action(async (id, _options, cmd) => {
55
+ const globalOpts = resolveGlobalOptions(cmd);
56
+ const client = await createClient(globalOpts);
57
+ const response = await client.get(`/v2/statements/${encodeURIComponent(id)}`);
58
+ const rows = [formatStatementRow(response.statement)];
59
+ const output = formatOutput(rows, globalOpts.output);
60
+ if (output !== "") {
61
+ process.stdout.write(`${output}\n`);
62
+ }
63
+ });
64
+ const download = statement
65
+ .command("download")
66
+ .description("Download a statement PDF")
67
+ .argument("<id>", "statement ID")
68
+ .addOption(new Option("--output-dir <path>", "directory to save the file (default: current directory)"));
69
+ addInheritableOptions(download);
70
+ download.action(async (id, commandOpts, cmd) => {
71
+ const globalOpts = resolveGlobalOptions(cmd);
72
+ const client = await createClient(globalOpts);
73
+ const response = await client.get(`/v2/statements/${encodeURIComponent(id)}`);
74
+ const { file } = response.statement;
75
+ const fileResponse = await fetch(file.file_url);
76
+ if (!fileResponse.ok) {
77
+ throw new Error(`Failed to download statement: ${fileResponse.status} ${fileResponse.statusText}`);
78
+ }
79
+ const outputDir = commandOpts.outputDir ?? ".";
80
+ const safeName = basename(file.file_name);
81
+ const outputPath = join(outputDir, safeName);
82
+ const resolvedDir = resolve(outputDir);
83
+ const resolvedPath = resolve(outputPath);
84
+ if (!resolvedPath.startsWith(resolvedDir + sep) && resolvedPath !== resolvedDir) {
85
+ throw new Error(`Refusing to write outside output directory: ${file.file_name}`);
86
+ }
87
+ const buffer = Buffer.from(await fileResponse.arrayBuffer());
88
+ await writeFile(outputPath, buffer);
89
+ process.stdout.write(`Downloaded: ${outputPath}\n`);
90
+ });
91
+ }
92
+ //# sourceMappingURL=statement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement.js","sourceRoot":"","sources":["../../src/commands/statement.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQlD,SAAS,kBAAkB,CAAC,CAAY;IACtC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,eAAe,EAAE,CAAC,CAAC,eAAe;QAClC,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS;QAC3B,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB;QAC3C,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS;KAC5B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,SAAS,GA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EAAE,CAAC,CAAC;QAC7D,MAAM,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,UAAU,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `transaction` command group with list and show subcommands.
4
+ */
5
+ export declare function registerTransactionCommands(program: Command): void;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/transaction/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAKlE"}
@@ -0,0 +1,13 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { registerTransactionListCommand } from "./list.js";
4
+ import { registerTransactionShowCommand } from "./show.js";
5
+ /**
6
+ * Register the `transaction` command group with list and show subcommands.
7
+ */
8
+ export function registerTransactionCommands(program) {
9
+ const txn = program.command("transaction").description("Manage transactions");
10
+ registerTransactionListCommand(txn);
11
+ registerTransactionShowCommand(txn);
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/transaction/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAgB;IAC1D,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAE9E,8BAA8B,CAAC,GAAG,CAAC,CAAC;IACpC,8BAA8B,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerTransactionListCommand(parent: Command): void;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/transaction/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsDzC,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAwCpE"}
@@ -0,0 +1,69 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { Option } from "commander";
4
+ import { buildTransactionQueryParams, getOrganization, resolveDefaultBankAccount, } from "@qontoctl/core";
5
+ import { createClient } from "../../client.js";
6
+ import { formatOutput } from "../../formatters/index.js";
7
+ import { addInheritableOptions, resolveGlobalOptions } from "../../inherited-options.js";
8
+ import { fetchPaginated } from "../../pagination.js";
9
+ function toTableRow(txn) {
10
+ return {
11
+ id: txn.id,
12
+ settled_at: txn.settled_at,
13
+ label: txn.label,
14
+ side: txn.side,
15
+ amount: txn.amount,
16
+ currency: txn.currency,
17
+ status: txn.status,
18
+ operation_type: txn.operation_type,
19
+ };
20
+ }
21
+ function buildParams(opts) {
22
+ return {
23
+ ...(opts.bankAccount !== undefined && { bank_account_id: opts.bankAccount }),
24
+ ...(opts.status !== undefined && { status: opts.status }),
25
+ ...(opts.side !== undefined && { side: opts.side }),
26
+ ...(opts.operationType !== undefined && { operation_type: opts.operationType }),
27
+ ...(opts.from !== undefined && { settled_at_from: opts.from }),
28
+ ...(opts.to !== undefined && { settled_at_to: opts.to }),
29
+ ...(opts.include !== undefined && { includes: opts.include }),
30
+ ...(opts.withAttachments !== undefined && { with_attachments: opts.withAttachments }),
31
+ ...(opts.sortBy !== undefined && { sort_by: opts.sortBy }),
32
+ };
33
+ }
34
+ export function registerTransactionListCommand(parent) {
35
+ const list = parent
36
+ .command("list")
37
+ .description("List transactions")
38
+ .addOption(new Option("--bank-account <id>", "filter by bank account ID"))
39
+ .addOption(new Option("--status <status...>", "filter by status").choices(["pending", "declined", "completed"]))
40
+ .addOption(new Option("--side <side>", "filter by side").choices(["credit", "debit"]))
41
+ .addOption(new Option("--operation-type <type...>", "filter by operation type"))
42
+ .addOption(new Option("--from <date>", "settled from date (ISO 8601)"))
43
+ .addOption(new Option("--to <date>", "settled to date (ISO 8601)"))
44
+ .addOption(new Option("--include <resources...>", "include nested resources").choices([
45
+ "labels",
46
+ "attachments",
47
+ "vat_details",
48
+ ]))
49
+ .addOption(new Option("--with-attachments", "filter to transactions with attachments"))
50
+ .addOption(new Option("--sort-by <sort>", "sort order (e.g. settled_at:desc)"));
51
+ addInheritableOptions(list);
52
+ list.action(async (_opts, cmd) => {
53
+ const opts = resolveGlobalOptions(cmd);
54
+ const client = await createClient(opts);
55
+ let params = buildParams(opts);
56
+ if (params.bank_account_id === undefined && params.iban === undefined) {
57
+ const org = await getOrganization(client);
58
+ const mainAccount = resolveDefaultBankAccount(org);
59
+ if (mainAccount !== undefined) {
60
+ params = { ...params, bank_account_id: mainAccount.id };
61
+ }
62
+ }
63
+ const queryParams = buildTransactionQueryParams(params);
64
+ const result = await fetchPaginated(client, "/v2/transactions", "transactions", opts, queryParams);
65
+ const data = opts.output === "table" || opts.output === "csv" ? result.items.map(toTableRow) : result.items;
66
+ process.stdout.write(formatOutput(data, opts.output) + "\n");
67
+ });
68
+ }
69
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/transaction/list.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC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MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerTransactionShowCommand(parent: Command): void;
3
+ //# sourceMappingURL=show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/transaction/show.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoBpE"}
@@ -0,0 +1,25 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { Option } from "commander";
4
+ import { getTransaction } from "@qontoctl/core";
5
+ import { createClient } from "../../client.js";
6
+ import { formatOutput } from "../../formatters/index.js";
7
+ import { addInheritableOptions, resolveGlobalOptions } from "../../inherited-options.js";
8
+ export function registerTransactionShowCommand(parent) {
9
+ const show = parent
10
+ .command("show <id>")
11
+ .description("Show transaction details")
12
+ .addOption(new Option("--include <resources...>", "include nested resources").choices([
13
+ "labels",
14
+ "attachments",
15
+ "vat_details",
16
+ ]));
17
+ addInheritableOptions(show);
18
+ show.action(async (id, _opts, cmd) => {
19
+ const opts = resolveGlobalOptions(cmd);
20
+ const client = await createClient(opts);
21
+ const transaction = await getTransaction(client, id, opts.include);
22
+ process.stdout.write(formatOutput(transaction, opts.output) + "\n");
23
+ });
24
+ }
25
+ //# sourceMappingURL=show.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.js","sourceRoot":"","sources":["../../../src/commands/transaction/show.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAOzF,MAAM,UAAU,8BAA8B,CAAC,MAAe;IAC5D,MAAM,IAAI,GAAG,MAAM;SAChB,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,0BAA0B,CAAC;SACvC,SAAS,CACR,IAAI,MAAM,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAAC,OAAO,CAAC;QACzE,QAAQ;QACR,aAAa;QACb,aAAa;KACd,CAAC,CACH,CAAC;IACJ,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,KAAc,EAAE,GAAY,EAAE,EAAE;QAC7D,MAAM,IAAI,GAAG,oBAAoB,CAAyB,GAAG,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Generates a bash completion script for the given Commander program.
4
+ */
5
+ export declare function generateBashCompletion(program: Command): string;
6
+ //# sourceMappingURL=bash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/completions/bash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAwG/D"}