@garuhq/cli 0.10.0 → 0.12.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/CHANGELOG.md +32 -0
- package/dist/index.cjs +28 -37
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to `@garuhq/cli` are documented in this file. Format:
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: [SemVer](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.12.0] — 2026-08-22
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- **`garu scheduled-charges` now targets `/api/v1/scheduled-charges`.**
|
|
11
|
+
`list`/`attempts` pretty-print output reports `count`/`totalCount`/
|
|
12
|
+
`totalPages` instead of a `page`/`total` counter. No command flags or
|
|
13
|
+
arguments changed — scheduled-charge ids were already opaque strings
|
|
14
|
+
(`sch_...`), so this is a wire-level move, not an identifier change.
|
|
15
|
+
- **`@garuhq/node` bumped to `4.0.0`.** Breaking for
|
|
16
|
+
`garu.scheduledCharges.list()`/`.listAttempts()` (see that package's
|
|
17
|
+
changelog); `garu-cli`'s own commands are unaffected beyond the
|
|
18
|
+
pretty-print header above.
|
|
19
|
+
|
|
20
|
+
## [0.11.0] — 2026-08-22
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **`garu webhooks events` now targets `/api/v1/webhook-events`, uuid-keyed.**
|
|
25
|
+
`get`, `retry`, and `resend` take a `<uuid>` positional argument instead of
|
|
26
|
+
a numeric id. `list` output now reports `count`/`totalCount`/`totalPages`
|
|
27
|
+
instead of a `page`/`total` counter, and every row/detail view prints the
|
|
28
|
+
event's `uuid`.
|
|
29
|
+
- **`@garuhq/node` bumped to `3.0.0`.** Breaking for `garu.webhookEvents.*`
|
|
30
|
+
(see that package's changelog).
|
|
31
|
+
|
|
32
|
+
### Breaking
|
|
33
|
+
|
|
34
|
+
- `garu webhooks events get <id>` / `retry <id>` / `resend <id>` now expect
|
|
35
|
+
a `uuid`, not a numeric id. Run `garu webhooks events list` to read the
|
|
36
|
+
`uuid` of the event you want to act on.
|
|
37
|
+
|
|
6
38
|
## [0.10.0] — 2026-08-22
|
|
7
39
|
|
|
8
40
|
### Added
|
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var pc__default = /*#__PURE__*/_interopDefault(pc);
|
|
|
15
15
|
// src/index.ts
|
|
16
16
|
|
|
17
17
|
// src/version.ts
|
|
18
|
-
var CLI_VERSION = "0.
|
|
18
|
+
var CLI_VERSION = "0.12.0";
|
|
19
19
|
var CliError = class extends Error {
|
|
20
20
|
code;
|
|
21
21
|
exitCode;
|
|
@@ -1226,10 +1226,8 @@ function prettyScheduledCharge(c) {
|
|
|
1226
1226
|
return lines.join("\n");
|
|
1227
1227
|
}
|
|
1228
1228
|
function prettyScheduledChargeList(list) {
|
|
1229
|
-
if (list.data.length === 0)
|
|
1230
|
-
|
|
1231
|
-
}
|
|
1232
|
-
const header = `Scheduled charges (page ${list.meta.page}/${list.meta.totalPages || "?"}, ${list.meta.total} total)`;
|
|
1229
|
+
if (list.data.length === 0) return "No scheduled charges found";
|
|
1230
|
+
const header = `Scheduled charges (${list.count} of ${list.totalCount} total, ${list.totalPages} page(s))`;
|
|
1233
1231
|
const rows = list.data.map(
|
|
1234
1232
|
(c) => ` ${c.id.padEnd(20)} ${String(c.status).padEnd(18)} ${String(c.type).padEnd(9)} ${String(c.amount).padStart(10)} ${c.dueDate}`
|
|
1235
1233
|
);
|
|
@@ -1252,10 +1250,8 @@ function prettyScheduledChargeDetail(detail) {
|
|
|
1252
1250
|
return lines.join("\n");
|
|
1253
1251
|
}
|
|
1254
1252
|
function prettyAttemptList(list) {
|
|
1255
|
-
if (list.data.length === 0)
|
|
1256
|
-
|
|
1257
|
-
}
|
|
1258
|
-
const header = `Billing attempts (page ${list.meta.page}/${list.meta.totalPages || "?"}, ${list.meta.total} total)`;
|
|
1253
|
+
if (list.data.length === 0) return "No billing attempts found";
|
|
1254
|
+
const header = `Billing attempts (${list.count} of ${list.totalCount} total, ${list.totalPages} page(s))`;
|
|
1259
1255
|
const rows = list.data.map(
|
|
1260
1256
|
(a) => ` cycle ${String(a.cycleNumber).padStart(3)} #${a.attemptNumber} ${a.status.padEnd(10)} ${a.paymentMethod.padEnd(7)} ${a.failureCode ?? ""} ${a.attemptedAt}`
|
|
1261
1257
|
);
|
|
@@ -1292,20 +1288,20 @@ async function webhooksEventsListCommand(opts) {
|
|
|
1292
1288
|
}
|
|
1293
1289
|
async function webhooksEventsGetCommand(opts) {
|
|
1294
1290
|
const garu = await getClient7(opts);
|
|
1295
|
-
const event = await garu.webhookEvents.get(opts.
|
|
1291
|
+
const event = await garu.webhookEvents.get(opts.uuid);
|
|
1296
1292
|
printResult(event, { ...opts, prettyPrint: prettyWebhookEvent });
|
|
1297
1293
|
return event;
|
|
1298
1294
|
}
|
|
1299
1295
|
async function webhooksEventsRetryCommand(opts) {
|
|
1300
1296
|
const garu = await getClient7(opts);
|
|
1301
|
-
const event = await garu.webhookEvents.retry(opts.
|
|
1297
|
+
const event = await garu.webhookEvents.retry(opts.uuid);
|
|
1302
1298
|
printResult(event, { ...opts, prettyPrint: prettyWebhookEvent });
|
|
1303
1299
|
return event;
|
|
1304
1300
|
}
|
|
1305
1301
|
async function webhooksEventsResendCommand(opts) {
|
|
1306
1302
|
const garu = await getClient7(opts);
|
|
1307
|
-
const clone = await garu.webhookEvents.resend(opts.
|
|
1308
|
-
printSuccess(`Resent event ${opts.
|
|
1303
|
+
const clone = await garu.webhookEvents.resend(opts.uuid);
|
|
1304
|
+
printSuccess(`Resent event ${opts.uuid} \u2192 new event ${clone.uuid}`, opts);
|
|
1309
1305
|
printResult(clone, { ...opts, prettyPrint: prettyWebhookEvent });
|
|
1310
1306
|
return clone;
|
|
1311
1307
|
}
|
|
@@ -1316,18 +1312,16 @@ function statusBadge(status) {
|
|
|
1316
1312
|
return pc__default.default.yellow(padded);
|
|
1317
1313
|
}
|
|
1318
1314
|
function prettyWebhookEventList(list) {
|
|
1319
|
-
if (list.data.length === 0)
|
|
1320
|
-
|
|
1321
|
-
}
|
|
1322
|
-
const header = `Webhook events (page ${list.meta.page}/${list.meta.totalPages || "?"}, ${list.meta.total} total)`;
|
|
1315
|
+
if (list.data.length === 0) return "No webhook events found";
|
|
1316
|
+
const header = `Webhook events (${list.count} of ${list.totalCount} total, ${list.totalPages} page(s))`;
|
|
1323
1317
|
const rows = list.data.map(
|
|
1324
|
-
(e) => ` ${
|
|
1318
|
+
(e) => ` ${e.uuid} ${statusBadge(e.status)} attempts=${String(e.attempts).padStart(2)} ${e.eventType.padEnd(38)} ${e.createdAt}`
|
|
1325
1319
|
);
|
|
1326
1320
|
return [header, ...rows].join("\n");
|
|
1327
1321
|
}
|
|
1328
1322
|
function prettyWebhookEvent(event) {
|
|
1329
1323
|
const lines = [
|
|
1330
|
-
`Webhook event ${event.
|
|
1324
|
+
`Webhook event ${event.uuid}`,
|
|
1331
1325
|
` status: ${statusBadge(event.status)}`,
|
|
1332
1326
|
` eventType: ${event.eventType}`,
|
|
1333
1327
|
` attempts: ${event.attempts}`,
|
|
@@ -1639,30 +1633,27 @@ Recipes:
|
|
|
1639
1633
|
}).catch((err) => printErrorAndExit(err, base));
|
|
1640
1634
|
}
|
|
1641
1635
|
);
|
|
1642
|
-
events.command("get <
|
|
1636
|
+
events.command("get <uuid>").description("Fetch a single webhook event by uuid").action(async (uuid) => {
|
|
1643
1637
|
const base = toCommandOptions(program);
|
|
1644
|
-
await webhooksEventsGetCommand({
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
}).catch((err) => printErrorAndExit(err, base));
|
|
1638
|
+
await webhooksEventsGetCommand({ ...base, uuid }).catch(
|
|
1639
|
+
(err) => printErrorAndExit(err, base)
|
|
1640
|
+
);
|
|
1648
1641
|
});
|
|
1649
|
-
events.command("retry <
|
|
1642
|
+
events.command("retry <uuid>").description(
|
|
1650
1643
|
"[deprecated: prefer `resend`] Re-deliver a webhook event in place (resets the original row to pending and triggers an immediate attempt; destroys the prior failure record)"
|
|
1651
|
-
).action(async (
|
|
1644
|
+
).action(async (uuid) => {
|
|
1652
1645
|
const base = toCommandOptions(program);
|
|
1653
|
-
await webhooksEventsRetryCommand({
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}).catch((err) => printErrorAndExit(err, base));
|
|
1646
|
+
await webhooksEventsRetryCommand({ ...base, uuid }).catch(
|
|
1647
|
+
(err) => printErrorAndExit(err, base)
|
|
1648
|
+
);
|
|
1657
1649
|
});
|
|
1658
|
-
events.command("resend <
|
|
1659
|
-
"Re-deliver a webhook event by cloning it (audit-trail preserving: original row is untouched, clone gets a new
|
|
1660
|
-
).action(async (
|
|
1650
|
+
events.command("resend <uuid>").description(
|
|
1651
|
+
"Re-deliver a webhook event by cloning it (audit-trail preserving: original row is untouched, clone gets a new uuid and points back via manualResendOf)"
|
|
1652
|
+
).action(async (uuid) => {
|
|
1661
1653
|
const base = toCommandOptions(program);
|
|
1662
|
-
await webhooksEventsResendCommand({
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
}).catch((err) => printErrorAndExit(err, base));
|
|
1654
|
+
await webhooksEventsResendCommand({ ...base, uuid }).catch(
|
|
1655
|
+
(err) => printErrorAndExit(err, base)
|
|
1656
|
+
);
|
|
1666
1657
|
});
|
|
1667
1658
|
const customers = program.command("customers").description("Manage your customer base");
|
|
1668
1659
|
customers.command("create").description("Register a customer for the current seller (dedup by document)").requiredOption("--name <name>", "customer name").requiredOption("--email <email>", "customer email").requiredOption("--document <document>", "CPF (11 digits) or CNPJ (14 digits), digits only").requiredOption("--phone <phone>", "phone with area code, 10-11 digits").requiredOption("--person-type <type>", "'fisica' or 'juridica'").option("--zip-code <cep>", "ZIP code, 8 digits").option("--street <street>", "street address").option("--number <number>", "address number").option("--complement <text>", "address complement").option("--neighborhood <text>", "neighborhood").option("--city <city>", "city").option("--state <uf>", "2-letter state code, e.g. SP").action(async (cmdOpts) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@garuhq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Official command-line interface for the Garu payment gateway.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://garu.com.br",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"prepublishOnly": "npm run check:version-sync && npm run typecheck && npm test && npm run build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@garuhq/node": "
|
|
49
|
+
"@garuhq/node": "4.0.0",
|
|
50
50
|
"@inquirer/prompts": "8.4.1",
|
|
51
51
|
"commander": "12.0.0",
|
|
52
52
|
"picocolors": "1.0.0",
|