@stewardhq/cli 0.14.0 → 0.15.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 +5 -2
- package/dist/bin.js +29 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ ESM, Node ≥ 22. Its only runtime dependency is `@stewardhq/sdk`.
|
|
|
26
26
|
| `steward endpoints add --url <url> --out <file> [--event-types a,b] [--description <text>] [--force]` | Generates the secret locally and writes it only to `--out` |
|
|
27
27
|
| `steward endpoints rotate <id> --out <file> [--force]` | New secret to `--out`; the product transitions with `new,old` |
|
|
28
28
|
| `steward endpoints deactivate <id>` | Not reversible |
|
|
29
|
-
| `steward discounts list [--archived] [--json]` / `steward discounts create --name <text> (--percent <n> \| --amount <CUR:minor>…) --duration once\|repeating\|forever [--months <n>] [--code <code>] [--plans a,b] [--starts <iso>] [--ends <iso>] [--max <n>] [--per-customer <n>\|unlimited]
|
|
29
|
+
| `steward discounts list [--archived] [--json]` / `steward discounts create --name <text> (--percent <n> \| --amount <CUR:minor>…) --duration once\|repeating\|forever [--months <n>] [--code <code>] [--plans a,b] [--starts <iso>] [--ends <iso>] [--max <n>] [--per-customer <n>\|unlimited] [--benefit <code>]…` / `steward discounts update <id> […]` / `steward discounts archive <id> [--yes]` | Discounts and discount codes (`/v1/admin/discounts`): a share or an amount per currency off a plan's base price, for the first invoice, a number of months or every invoice. `update` takes `none` to clear an optional field; the value, duration and benefits are fixed once redeemed. `--benefit` (repeatable) adds catalog benefits the account holds while its subscription runs with the discount. `create` warns when a sellable price would fall under the payment provider's minimum |
|
|
30
30
|
| `steward email-smtp get [--json]` / `steward email-smtp set --file <path> \| --stdin` / `steward email-smtp clear [--yes]` / `steward email-smtp verify [--to <address>] [--json]` | The product's own SMTP account for its billing emails (`/v1/admin/email-smtp`; otherwise the installation's). `set` reads the URL (`smtp://user:pass@host:587` or `smtps://…:465`) from a file or a pipe, never from an argument or a terminal; steward never returns it (`get` shows the host). `verify` asks `MAIL FROM` (the product's sender) and `RCPT TO`, stops before `DATA`, and exits 1 with the failed step and the server's reply when the account refuses |
|
|
31
31
|
| `steward keys list [--json]` | The product's API keys: prefix, scope, status (active, expired, revoked), expiry, last use |
|
|
32
32
|
| `steward keys create --name <n> --scope product\|checkout\|admin --out <file> [--expires-days <n> \| --no-expiry] [--force]` | Generates the key locally and writes it only to `--out`; steward stores its hash. An admin key always expires (default 90 days) |
|
|
@@ -151,6 +151,9 @@ Release: bump the version in `cli/package.json` and push the `cli-v<version>` ta
|
|
|
151
151
|
be published on npm. The notes of 0.4.0 to 0.10.0 are in
|
|
152
152
|
[this file at `cli-v0.10.0`](https://github.com/z9cloud/steward/blob/cli-v0.10.0/cli/README.md#versions).
|
|
153
153
|
|
|
154
|
+
- **0.15.0** (`@stewardhq/sdk` 0.15): `steward discounts create|update --benefit <code>` (repeatable; `--benefit none` clears on
|
|
155
|
+
update): catalog benefits granted while a subscription runs with the discount; `list` shows them. Needs steward
|
|
156
|
+
0.15.0.
|
|
154
157
|
- **0.14.0** (`@stewardhq/sdk` 0.14): `steward accounts list`, `steward events list`, `steward audit list`,
|
|
155
158
|
`steward emails list` and `steward payments list` (product-wide lists, paged with `--limit` / `--after`; need a
|
|
156
159
|
steward with `/v1/admin/accounts`, `/events`, `/audit`, `/emails` and `/payments`, 0.14.0 or later);
|
|
@@ -175,7 +178,7 @@ be published on npm. The notes of 0.4.0 to 0.10.0 are in
|
|
|
175
178
|
the provider's webhook, automatic renewal and the legal settings.
|
|
176
179
|
|
|
177
180
|
When packed, the `@stewardhq/sdk` dependency turns from `workspace:^` into the range of the
|
|
178
|
-
SDK version current at that time (0.
|
|
181
|
+
SDK version current at that time (0.15.0 → `^0.15.0`).
|
|
179
182
|
|
|
180
183
|
## License
|
|
181
184
|
|
package/dist/bin.js
CHANGED
|
@@ -1878,10 +1878,11 @@ const DISCOUNTS_USAGE = `Usage:
|
|
|
1878
1878
|
steward discounts list [--archived] [--json]
|
|
1879
1879
|
steward discounts create --name <text> (--percent <n> | --amount <CUR:minor>...) --duration once|repeating|forever
|
|
1880
1880
|
[--months <n>] [--code <code>] [--plans <a,b>] [--starts <iso>] [--ends <iso>]
|
|
1881
|
-
[--max <n>] [--per-customer <n>|unlimited] [--json]
|
|
1881
|
+
[--max <n>] [--per-customer <n>|unlimited] [--benefit <code>]... [--json]
|
|
1882
1882
|
steward discounts update <id> [--name …] [--code <code>|none] [--plans <a,b>|none] [--starts <iso>|none]
|
|
1883
1883
|
[--ends <iso>|none] [--max <n>|none] [--per-customer <n>|unlimited]
|
|
1884
|
-
[--percent … | --amount …] [--duration … --months …]
|
|
1884
|
+
[--percent … | --amount …] [--duration … --months …]
|
|
1885
|
+
[--benefit <code>... | --benefit none] [--json]
|
|
1885
1886
|
steward discounts archive <id> [--yes]
|
|
1886
1887
|
|
|
1887
1888
|
The product's discounts (/v1/admin/discounts): a share (--percent 20, up to 99.99) or an amount per
|
|
@@ -1889,8 +1890,14 @@ currency in minor units (--amount USD:500 --amount EUR:450) off a plan's base pr
|
|
|
1889
1890
|
invoice (once), --months calendar months (repeating) or every invoice (forever). A discount with
|
|
1890
1891
|
--code is entered by the customer on the hosted checkout; one without is applied by the product
|
|
1891
1892
|
(checkout.create({ discountId })). Codes are case-insensitive. --plans restricts it (default:
|
|
1892
|
-
every listed plan). --per-customer defaults to 1.
|
|
1893
|
-
|
|
1893
|
+
every listed plan). --per-customer defaults to 1.
|
|
1894
|
+
|
|
1895
|
+
--benefit (repeatable) adds a catalog benefit the account is granted while its subscription runs
|
|
1896
|
+
with the discount: from the first period for a checkout, from the next renewal for a discount
|
|
1897
|
+
attached later, until the discount ends. A meter credit benefit with a rollover cap carries what
|
|
1898
|
+
is left of the last discounted period into the next one, once. On update the benefits given
|
|
1899
|
+
replace the list (--benefit none: no benefits). Once redeemed, its value, duration and benefits
|
|
1900
|
+
no longer change; archive it and create another instead.
|
|
1894
1901
|
|
|
1895
1902
|
create warns when the discount would bring a sellable price of the catalog to zero or under the
|
|
1896
1903
|
payment provider's minimum charge (such a price refuses the code at checkout).
|
|
@@ -1918,6 +1925,10 @@ const OPTIONS$1 = {
|
|
|
1918
1925
|
ends: { type: "string" },
|
|
1919
1926
|
max: { type: "string" },
|
|
1920
1927
|
"per-customer": { type: "string" },
|
|
1928
|
+
benefit: {
|
|
1929
|
+
type: "string",
|
|
1930
|
+
multiple: true
|
|
1931
|
+
},
|
|
1921
1932
|
json: { type: "boolean" }
|
|
1922
1933
|
};
|
|
1923
1934
|
const NONE = "none";
|
|
@@ -1939,6 +1950,16 @@ function parseAmounts(values) {
|
|
|
1939
1950
|
}
|
|
1940
1951
|
return out;
|
|
1941
1952
|
}
|
|
1953
|
+
/** `--benefit` values → benefit codes; `none` alone (update) → no benefits. */
|
|
1954
|
+
function benefitCodesOf(values, update) {
|
|
1955
|
+
const codes = values.map((v) => v.trim());
|
|
1956
|
+
if (codes.includes(NONE)) {
|
|
1957
|
+
if (!update) throw new UsageError("--benefit none: only on update (a new discount has no benefits without --benefit)");
|
|
1958
|
+
if (codes.length > 1) throw new UsageError("--benefit none: give it alone");
|
|
1959
|
+
return [];
|
|
1960
|
+
}
|
|
1961
|
+
return codes;
|
|
1962
|
+
}
|
|
1942
1963
|
/** The fields shared by create and update (update: `none` clears an optional one). */
|
|
1943
1964
|
function fieldsOf(values, update) {
|
|
1944
1965
|
const clearable = (value, read) => value === void 0 ? void 0 : update && value.trim() === NONE ? null : read(value);
|
|
@@ -1951,7 +1972,8 @@ function fieldsOf(values, update) {
|
|
|
1951
1972
|
startsAt: clearable(values.starts, (v) => v.trim()),
|
|
1952
1973
|
endsAt: clearable(values.ends, (v) => v.trim()),
|
|
1953
1974
|
maxRedemptions: clearable(values.max, (v) => parsePositiveInt(v, "--max")),
|
|
1954
|
-
maxRedemptionsPerCustomer: values["per-customer"] === void 0 ? void 0 : values["per-customer"].trim() === "unlimited" ? null : parsePositiveInt(values["per-customer"], "--per-customer")
|
|
1975
|
+
maxRedemptionsPerCustomer: values["per-customer"] === void 0 ? void 0 : values["per-customer"].trim() === "unlimited" ? null : parsePositiveInt(values["per-customer"], "--per-customer"),
|
|
1976
|
+
benefitCodes: values.benefit !== void 0 ? benefitCodesOf(values.benefit, update) : void 0
|
|
1955
1977
|
};
|
|
1956
1978
|
if (values.percent !== void 0 && values.amount !== void 0) throw new UsageError("give --percent or --amount, not both");
|
|
1957
1979
|
if (values.percent !== void 0) Object.assign(fields, {
|
|
@@ -2011,6 +2033,7 @@ function describe$1(d) {
|
|
|
2011
2033
|
d.maxRedemptions !== null ? `max ${d.maxRedemptions}` : null,
|
|
2012
2034
|
`per customer ${d.maxRedemptionsPerCustomer ?? "unlimited"}`,
|
|
2013
2035
|
d.planCodes.length > 0 ? `plans ${d.planCodes.join(",")}` : null,
|
|
2036
|
+
d.benefitCodes.length > 0 ? `benefits ${d.benefitCodes.join(",")}` : null,
|
|
2014
2037
|
d.startsAt ? `from ${d.startsAt}` : null,
|
|
2015
2038
|
d.endsAt ? `until ${d.endsAt}` : null
|
|
2016
2039
|
].filter(Boolean);
|
|
@@ -3653,7 +3676,7 @@ function help(out) {
|
|
|
3653
3676
|
return 0;
|
|
3654
3677
|
}
|
|
3655
3678
|
// src/main.ts
|
|
3656
|
-
const CLI_VERSION = "0.
|
|
3679
|
+
const CLI_VERSION = "0.15.0";
|
|
3657
3680
|
const USAGE = `steward — Steward CLI (@stewardhq/cli ${CLI_VERSION})
|
|
3658
3681
|
|
|
3659
3682
|
Usage: steward <command> [options]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stewardhq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Steward CLI: doctor, catalog push, settings and webhook endpoint management.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/z9cloud/steward/tree/main/cli#readme",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"registry": "https://registry.npmjs.org"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@stewardhq/sdk": "^0.
|
|
31
|
+
"@stewardhq/sdk": "^0.15.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^26.6.6",
|