checkly 10.2.0 → 10.3.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 +2 -1
- package/dist/ai-context/context.d.ts +7 -1
- package/dist/ai-context/context.js +5 -1
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/public-skills/checkly/SKILL.md +1 -1
- package/dist/ai-context/skills-command/references/initialize.md +1 -1
- package/dist/ai-context/skills-command/references/manage-spending-cap.md +39 -0
- package/dist/ai-context/skills-command/references/manage.md +4 -1
- package/dist/commands/account/spending-cap/remove.d.ts +14 -0
- package/dist/commands/account/spending-cap/remove.js +54 -0
- package/dist/commands/account/spending-cap/remove.js.map +1 -0
- package/dist/commands/account/spending-cap/set.d.ts +17 -0
- package/dist/commands/account/spending-cap/set.js +64 -0
- package/dist/commands/account/spending-cap/set.js.map +1 -0
- package/dist/commands/account/spending-cap.d.ts +12 -0
- package/dist/commands/account/spending-cap.js +34 -0
- package/dist/commands/account/spending-cap.js.map +1 -0
- package/dist/commands/account/usage/projections.d.ts +1 -1
- package/dist/commands/account/usage/projections.js +15 -6
- package/dist/commands/account/usage/projections.js.map +1 -1
- package/dist/commands/account/usage/series.js +4 -3
- package/dist/commands/account/usage/series.js.map +1 -1
- package/dist/commands/account/usage/summary.js +1 -1
- package/dist/commands/account/usage/summary.js.map +1 -1
- package/dist/formatters/spending-cap.d.ts +5 -0
- package/dist/formatters/spending-cap.js +62 -0
- package/dist/formatters/spending-cap.js.map +1 -0
- package/dist/formatters/usage.d.ts +3 -2
- package/dist/formatters/usage.js +62 -33
- package/dist/formatters/usage.js.map +1 -1
- package/dist/helpers/cli-mode.js +4 -0
- package/dist/helpers/cli-mode.js.map +1 -1
- package/dist/helpers/spending-cap.d.ts +11 -0
- package/dist/helpers/spending-cap.js +56 -0
- package/dist/helpers/spending-cap.js.map +1 -0
- package/dist/helpers/usage.d.ts +2 -0
- package/dist/helpers/usage.js +4 -0
- package/dist/helpers/usage.js.map +1 -1
- package/dist/rest/api.d.ts +2 -0
- package/dist/rest/api.js +2 -0
- package/dist/rest/api.js.map +1 -1
- package/dist/rest/spending-cap.d.ts +32 -0
- package/dist/rest/spending-cap.js +12 -0
- package/dist/rest/spending-cap.js.map +1 -0
- package/dist/rest/usage.d.ts +26 -18
- package/dist/rest/usage.js +4 -3
- package/dist/rest/usage.js.map +1 -1
- package/dist/services/skills.js +6 -0
- package/dist/services/skills.js.map +1 -1
- package/oclif.manifest.json +330 -173
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -93,10 +93,11 @@ Official docs are over at [checklyhq.com/docs/cli](https://checklyhq.com/docs/cl
|
|
|
93
93
|
|
|
94
94
|
Migration from v9:
|
|
95
95
|
|
|
96
|
-
- Summary JSON renames `totals.credits.used` to `totals.creditsUsed` and removes `totals.credits.percentOfBudget` and embedded `projections`. Get forecasts with `checkly account usage projections
|
|
96
|
+
- Summary JSON renames `totals.credits.used` to `totals.creditsUsed` and removes `totals.credits.percentOfBudget` and embedded `projections`. Get forecasts with `checkly account usage projections [id]`; without an ID it projects the term in force today.
|
|
97
97
|
- Summary and series expose `usageTermsIds` instead of `usageTermsId`. Series replaces `warnings` with `coverage.gaps`.
|
|
98
98
|
- Terms and series JSON use `{ data, pagination: { nextId, length } }`. Terms default to table output; use `term <id>` for detail.
|
|
99
99
|
- `--from` and `--to` bound an inclusive UTC range. On `terms`, they select overlapping contracts rather than one contract covering `--to`.
|
|
100
|
+
- Amounts are in the term's `unit` (`credits` for contracts, `usdCents` for self-service plans): `unitsUsed`, `unitBudget`, `unitsRemaining` and the other `units*` fields replace the deprecated `credit*` fields. Human output prints `usdCents` amounts as dollars.
|
|
100
101
|
- `--check-type` is removed. Use `--pricing-rule` to select charges or `series --group-by checkType` for a check-type breakdown.
|
|
101
102
|
|
|
102
103
|
# AI Agents & Coding Assistants
|
|
@@ -67,6 +67,9 @@ export declare const MANAGE_REFERENCES: readonly [{
|
|
|
67
67
|
}, {
|
|
68
68
|
readonly id: "manage-account-members";
|
|
69
69
|
readonly description: "List account members and pending invites (`members`), update member roles, and delete members";
|
|
70
|
+
}, {
|
|
71
|
+
readonly id: "manage-spending-cap";
|
|
72
|
+
readonly description: "Show, set, and remove the overage spending cap (`account spending-cap`)";
|
|
70
73
|
}];
|
|
71
74
|
export declare const SKILL: {
|
|
72
75
|
readonly name: "checkly";
|
|
@@ -149,13 +152,16 @@ export declare const ACTIONS: readonly [{
|
|
|
149
152
|
}];
|
|
150
153
|
}, {
|
|
151
154
|
readonly id: "manage";
|
|
152
|
-
readonly description: "Understand your account plan, entitlements, feature limits, members, and
|
|
155
|
+
readonly description: "Understand your account plan, entitlements, feature limits, members, pending invites, and spending cap.";
|
|
153
156
|
readonly references: readonly [{
|
|
154
157
|
readonly id: "manage-plan";
|
|
155
158
|
readonly description: "Check account plan, entitlements, feature limits, and available locations (`account plan`)";
|
|
156
159
|
}, {
|
|
157
160
|
readonly id: "manage-account-members";
|
|
158
161
|
readonly description: "List account members and pending invites (`members`), update member roles, and delete members";
|
|
162
|
+
}, {
|
|
163
|
+
readonly id: "manage-spending-cap";
|
|
164
|
+
readonly description: "Show, set, and remove the overage spending cap (`account spending-cap`)";
|
|
159
165
|
}];
|
|
160
166
|
}];
|
|
161
167
|
interface ExampleConfig {
|
|
@@ -93,6 +93,10 @@ export const MANAGE_REFERENCES = [
|
|
|
93
93
|
id: 'manage-account-members',
|
|
94
94
|
description: 'List account members and pending invites (`members`), update member roles, and delete members',
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
id: 'manage-spending-cap',
|
|
98
|
+
description: 'Show, set, and remove the overage spending cap (`account spending-cap`)',
|
|
99
|
+
},
|
|
96
100
|
];
|
|
97
101
|
export const SKILL = {
|
|
98
102
|
name: 'checkly',
|
|
@@ -120,7 +124,7 @@ export const ACTIONS = [
|
|
|
120
124
|
},
|
|
121
125
|
{
|
|
122
126
|
id: 'manage',
|
|
123
|
-
description: 'Understand your account plan, entitlements, feature limits, members, and
|
|
127
|
+
description: 'Understand your account plan, entitlements, feature limits, members, pending invites, and spending cap.',
|
|
124
128
|
references: MANAGE_REFERENCES,
|
|
125
129
|
},
|
|
126
130
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/ai-context/context.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,EAAE,EAAE,sBAAsB;QAC1B,WAAW,EAAE,gFAAgF;KAC9F;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,WAAW,EAAE,qEAAqE;KACnF;IACD;QACE,EAAE,EAAE,6BAA6B;QACjC,WAAW,EAAE,oFAAoF;KAClG;IACD;QACE,EAAE,EAAE,4BAA4B;QAChC,WAAW,EAAE,qEAAqE;KACnF;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,sDAAsD;KACpE;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,sDAAsD;KACpE;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,sDAAsD;KACpE;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EAAE,gFAAgF;KAC9F;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EAAE,wGAAwG;KACtH;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,uGAAuG;KACrH;IACD;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EAAE,8FAA8F;KAC5G;IACD;QACE,EAAE,EAAE,8BAA8B;QAClC,WAAW,EAAE,kDAAkD;KAChE;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,+DAA+D;KAC7E;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,WAAW,EAAE,gPAAgP;KAC9P;IACD;QACE,EAAE,EAAE,iCAAiC;QACrC,WAAW,EAAE,6IAA6I;KAC3J;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,WAAW,EAAE,8RAA8R;KAC5S;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;QACE,EAAE,EAAE,oBAAoB;QACxB,WAAW,EAAE,4HAA4H;KAC1I;IACD;QACE,EAAE,EAAE,sBAAsB;QAC1B,WAAW,EAAE,+GAA+G;KAC7H;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,WAAW,EAAE,wHAAwH;KACtI;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;QACE,EAAE,EAAE,uBAAuB;QAC3B,WAAW,EAAE,uFAAuF;KACrG;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;QACE,EAAE,EAAE,aAAa;QACjB,WAAW,EAAE,4FAA4F;KAC1G;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EAAE,+FAA+F;KAC7G;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,iJAAiJ;CACtJ,CAAA;AAEV,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;QACE,EAAE,EAAE,YAAY;QAChB,WAAW,EAAE,4EAA4E;KAC1F;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,wFAAwF;QACrG,UAAU,EAAE,UAAU;KACvB;IACD;QACE,EAAE,EAAE,aAAa;QACjB,WAAW,EAAE,0GAA0G;QACvH,UAAU,EAAE,sBAAsB;KACnC;IACD;QACE,EAAE,EAAE,aAAa;QACjB,WAAW,EAAE,mEAAmE;QAChF,UAAU,EAAE,sBAAsB;KACnC;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/ai-context/context.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,EAAE,EAAE,sBAAsB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EAAE,kEAAkE;KAC9E;CACF,CAAA"}
|
|
@@ -160,4 +160,4 @@ Access check and test-session status, analyze failures, inspect attempts/assets,
|
|
|
160
160
|
Open incidents and lead customer communications via status pages.
|
|
161
161
|
|
|
162
162
|
### `npx checkly skills manage`
|
|
163
|
-
Understand your account plan, entitlements, feature limits, members, and
|
|
163
|
+
Understand your account plan, entitlements, feature limits, members, pending invites, and spending cap.
|
|
@@ -47,7 +47,7 @@ The install writes a file into the user's repository, so ask first and never ins
|
|
|
47
47
|
|
|
48
48
|
**Do you want to install the Checkly agent skill into this project?**
|
|
49
49
|
|
|
50
|
-
- **yes** — run `npx checkly skills install --target <platform>`, where `<platform>` is the agent you are running in: `amp`, `claude`, `cline`, `codex`, `continue`, `cursor`, `gemini-cli`, `github-copilot`, `goose`, `opencode`, `roo` or `
|
|
50
|
+
- **yes** — run `npx checkly skills install --target <platform>`, where `<platform>` is the agent you are running in: `amp`, `antigravity`, `claude`, `cline`, `codex`, `continue`, `cursor`, `devin`, `gemini-cli`, `github-copilot`, `goose`, `kilo-code`, `kiro`, `mistral-vibe`, `opencode`, `roo`, `windsurf` or `zed`. Use `--path <dir>` instead when the user names a directory. Always pass one of the two: without them the command only prints the available flags unless it has an interactive terminal. If a skill file already exists, the command says so and writes nothing; only re-run it with `--force` once the user agrees to overwrite.
|
|
51
51
|
- **no** — continue the setup without it. Run `npx checkly skills` for the current action list (it needs no install and no authentication), and keep in mind that the conventions above live only in the skill file, not in this reference. Offer `npx checkly skills install` again whenever the user wants them.
|
|
52
52
|
|
|
53
53
|
If the skill was installed, read it before moving on, so the remaining steps follow its rules.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Spending Cap
|
|
2
|
+
|
|
3
|
+
Show and manage the account's overage spending cap: the most the account may spend on runs beyond what the plan includes. When overage reaches the cap, checks stop running.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx checkly account spending-cap # Cap, overage so far, whether checks are stopped
|
|
9
|
+
npx checkly account spending-cap --output json # Raw API response (recommended for agents)
|
|
10
|
+
npx checkly account spending-cap set 50 # Set or change the cap, in US dollars
|
|
11
|
+
npx checkly account spending-cap set 12.50 --dry-run # Preview the change without applying it
|
|
12
|
+
npx checkly account spending-cap remove --force # Remove the cap (overage is no longer capped)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `set <dollars>` takes 0 to 10000 with at most 2 decimals. `0` allows no overage at all.
|
|
16
|
+
- `set` and `remove` require confirmation. In non-interactive mode, review the confirmation preview and rerun with `--force`. Do not change the cap unless the user asked for it: lowering it to or below the overage so far stops checks at once.
|
|
17
|
+
- Plans that cannot hold a cap (e.g. prepaid or contract plans) are rejected.
|
|
18
|
+
- Needs a user or service API key; legacy account API keys are rejected (401).
|
|
19
|
+
|
|
20
|
+
## JSON response shape
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"spendingCapCents": 3000,
|
|
25
|
+
"standing": {
|
|
26
|
+
"measuredAt": "2026-11-15T00:00:00.000Z",
|
|
27
|
+
"pools": {
|
|
28
|
+
"API": { "used": 17230, "included": 100000, "overageRuns": 0, "overageCents": 0 },
|
|
29
|
+
"BROWSER": { "used": 14890, "included": 12000, "overageRuns": 2890, "overageCents": 1806.25 }
|
|
30
|
+
},
|
|
31
|
+
"overageCents": 1806.25,
|
|
32
|
+
"limit": { "capCents": 3000, "state": "CLOSE", "closeAtCents": 2400 }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Amounts are in US cents. `spendingCapCents: null` means no cap.
|
|
38
|
+
- `standing: null` means overage is not measured (runs not measured yet, or the plan has no overage). It does not mean $0 overage.
|
|
39
|
+
- Checks are stopped when `standing.limit.state` is `REACHED`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Account Management
|
|
2
2
|
|
|
3
|
-
Understand your account's plan, entitlements, limits, members, and
|
|
3
|
+
Understand your account's plan, entitlements, limits, members, pending invites, and overage spending cap.
|
|
4
4
|
|
|
5
5
|
## Plan-aware workflow
|
|
6
6
|
|
|
@@ -51,3 +51,6 @@ Check account plan, entitlements, feature limits, and available locations (`acco
|
|
|
51
51
|
|
|
52
52
|
### `npx checkly skills manage account-members`
|
|
53
53
|
List account members and pending invites (`members`), update member roles, and delete members
|
|
54
|
+
|
|
55
|
+
### `npx checkly skills manage spending-cap`
|
|
56
|
+
Show, set, and remove the overage spending cap (`account spending-cap`)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AuthCommand } from '../../authCommand.js';
|
|
2
|
+
export default class AccountSpendingCapRemove extends AuthCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static readOnly: boolean;
|
|
5
|
+
static destructive: boolean;
|
|
6
|
+
static idempotent: boolean;
|
|
7
|
+
static description: string;
|
|
8
|
+
static flags: {
|
|
9
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AuthCommand } from '../../authCommand.js';
|
|
2
|
+
import { dryRunFlag, forceFlag, outputFlag } from '../../../helpers/flags.js';
|
|
3
|
+
import { exitCodeFor } from '../../../helpers/invalid-input-error.js';
|
|
4
|
+
import { describeSpendingCapError, spendingCapChanges } from '../../../helpers/spending-cap.js';
|
|
5
|
+
import * as api from '../../../rest/api.js';
|
|
6
|
+
export default class AccountSpendingCapRemove extends AuthCommand {
|
|
7
|
+
static hidden = false;
|
|
8
|
+
static readOnly = false;
|
|
9
|
+
static destructive = true;
|
|
10
|
+
static idempotent = true;
|
|
11
|
+
static description = 'Remove the overage spending cap, so overage is no longer capped.';
|
|
12
|
+
static flags = {
|
|
13
|
+
'output': outputFlag({ default: 'detail' }),
|
|
14
|
+
'force': forceFlag(),
|
|
15
|
+
'dry-run': dryRunFlag(),
|
|
16
|
+
};
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags } = await this.parse(AccountSpendingCapRemove);
|
|
19
|
+
this.style.outputFormat = flags.output;
|
|
20
|
+
let current;
|
|
21
|
+
try {
|
|
22
|
+
({ data: current } = await api.spendingCap.get());
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
this.style.longError('Failed to load the spending cap.', describeSpendingCapError(err, 'billing:read'));
|
|
26
|
+
process.exitCode = exitCodeFor(err);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await this.confirmOrAbort({
|
|
30
|
+
command: 'account spending-cap remove',
|
|
31
|
+
description: 'Remove the spending cap',
|
|
32
|
+
changes: spendingCapChanges(current, null),
|
|
33
|
+
flags,
|
|
34
|
+
classification: {
|
|
35
|
+
readOnly: AccountSpendingCapRemove.readOnly,
|
|
36
|
+
destructive: AccountSpendingCapRemove.destructive,
|
|
37
|
+
idempotent: AccountSpendingCapRemove.idempotent,
|
|
38
|
+
},
|
|
39
|
+
}, { force: flags.force, dryRun: flags['dry-run'] });
|
|
40
|
+
try {
|
|
41
|
+
const { data } = await api.spendingCap.update(null);
|
|
42
|
+
if (flags.output === 'json') {
|
|
43
|
+
this.log(JSON.stringify(data, null, 2));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.style.shortSuccess('Spending cap removed. Overage is no longer capped.');
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.style.longError('Failed to remove the spending cap.', describeSpendingCapError(err, 'billing:update'));
|
|
50
|
+
process.exitCode = exitCodeFor(err);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources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AAC,CAAA;YACvG,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;YACnC,OAAM;QACR,CAAC;QAED,MAAM,IAAI,CAAC,cAAc,CAAC;YACxB,OAAO,EAAE,6BAA6B;YACtC,WAAW,EAAE,yBAAyB;YACtC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC;YAC1C,KAAK;YACL,cAAc,EAAE;gBACd,QAAQ,EAAE,wBAAwB,CAAC,QAAQ;gBAC3C,WAAW,EAAE,wBAAwB,CAAC,WAAW;gBACjD,UAAU,EAAE,wBAAwB,CAAC,UAAU;aAChD;SACF,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAEpD,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACnD,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC5B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;gBACvC,OAAM;YACR,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,oDAAoD,CAAC,CAAA;QAC/E,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,oCAAoC,EAAE,wBAAwB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAA;YAC3G,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AuthCommand } from '../../authCommand.js';
|
|
2
|
+
export default class AccountSpendingCapSet extends AuthCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static readOnly: boolean;
|
|
5
|
+
static destructive: boolean;
|
|
6
|
+
static idempotent: boolean;
|
|
7
|
+
static description: string;
|
|
8
|
+
static args: {
|
|
9
|
+
dollars: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { AuthCommand } from '../../authCommand.js';
|
|
3
|
+
import { dryRunFlag, forceFlag, outputFlag } from '../../../helpers/flags.js';
|
|
4
|
+
import { exitCodeFor } from '../../../helpers/invalid-input-error.js';
|
|
5
|
+
import { describeSpendingCapError, MAX_SPENDING_CAP_DOLLARS, parseDollarsToCents, spendingCapChanges, } from '../../../helpers/spending-cap.js';
|
|
6
|
+
import * as api from '../../../rest/api.js';
|
|
7
|
+
import { formatDollars } from '../../../formatters/spending-cap.js';
|
|
8
|
+
export default class AccountSpendingCapSet extends AuthCommand {
|
|
9
|
+
static hidden = false;
|
|
10
|
+
static readOnly = false;
|
|
11
|
+
static destructive = false;
|
|
12
|
+
static idempotent = true;
|
|
13
|
+
static description = 'Set or change the overage spending cap. Checks stop running once overage reaches it.';
|
|
14
|
+
static args = {
|
|
15
|
+
dollars: Args.string({
|
|
16
|
+
required: true,
|
|
17
|
+
description: `The cap in US dollars, e.g. 50 or 12.50 (0 to ${MAX_SPENDING_CAP_DOLLARS}).`,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static flags = {
|
|
21
|
+
'output': outputFlag({ default: 'detail' }),
|
|
22
|
+
'force': forceFlag(),
|
|
23
|
+
'dry-run': dryRunFlag(),
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { args, flags } = await this.parse(AccountSpendingCapSet);
|
|
27
|
+
this.style.outputFormat = flags.output;
|
|
28
|
+
const capCents = parseDollarsToCents(args.dollars);
|
|
29
|
+
let current;
|
|
30
|
+
try {
|
|
31
|
+
({ data: current } = await api.spendingCap.get());
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
this.style.longError('Failed to load the spending cap.', describeSpendingCapError(err, 'billing:read'));
|
|
35
|
+
process.exitCode = exitCodeFor(err);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
await this.confirmOrAbort({
|
|
39
|
+
command: 'account spending-cap set',
|
|
40
|
+
description: 'Set the spending cap',
|
|
41
|
+
changes: spendingCapChanges(current, capCents),
|
|
42
|
+
flags,
|
|
43
|
+
args: { dollars: args.dollars },
|
|
44
|
+
classification: {
|
|
45
|
+
readOnly: AccountSpendingCapSet.readOnly,
|
|
46
|
+
destructive: AccountSpendingCapSet.destructive,
|
|
47
|
+
idempotent: AccountSpendingCapSet.idempotent,
|
|
48
|
+
},
|
|
49
|
+
}, { force: flags.force, dryRun: flags['dry-run'] });
|
|
50
|
+
try {
|
|
51
|
+
const { data } = await api.spendingCap.update(capCents);
|
|
52
|
+
if (flags.output === 'json') {
|
|
53
|
+
this.log(JSON.stringify(data, null, 2));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.style.shortSuccess(`Spending cap set to ${formatDollars(data.spendingCapCents ?? capCents)}.`);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.style.longError('Failed to set the spending cap.', describeSpendingCapError(err, 'billing:update'));
|
|
60
|
+
process.exitCode = exitCodeFor(err);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.js","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AM;YACR,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,uBAAuB,aAAa,CAAC,IAAI,CAAC,gBAAgB,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;QACrG,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,iCAAiC,EAAE,wBAAwB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAA;YACxG,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuthCommand } from '../authCommand.js';
|
|
2
|
+
export default class AccountSpendingCap extends AuthCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static readOnly: boolean;
|
|
5
|
+
static destructive: boolean;
|
|
6
|
+
static idempotent: boolean;
|
|
7
|
+
static description: string;
|
|
8
|
+
static flags: {
|
|
9
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AuthCommand } from '../authCommand.js';
|
|
2
|
+
import { outputFlag } from '../../helpers/flags.js';
|
|
3
|
+
import { exitCodeFor } from '../../helpers/invalid-input-error.js';
|
|
4
|
+
import { describeSpendingCapError } from '../../helpers/spending-cap.js';
|
|
5
|
+
import * as api from '../../rest/api.js';
|
|
6
|
+
import { formatSpendingCap } from '../../formatters/spending-cap.js';
|
|
7
|
+
export default class AccountSpendingCap extends AuthCommand {
|
|
8
|
+
static hidden = false;
|
|
9
|
+
static readOnly = true;
|
|
10
|
+
static destructive = false;
|
|
11
|
+
static idempotent = true;
|
|
12
|
+
static description = 'Show the overage spending cap, the overage spent so far, and whether checks are stopped.';
|
|
13
|
+
static flags = {
|
|
14
|
+
output: outputFlag({ default: 'detail' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { flags } = await this.parse(AccountSpendingCap);
|
|
18
|
+
this.style.outputFormat = flags.output;
|
|
19
|
+
try {
|
|
20
|
+
const { data } = await api.spendingCap.get();
|
|
21
|
+
if (flags.output === 'json') {
|
|
22
|
+
this.log(JSON.stringify(data, null, 2));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const fmt = flags.output === 'md' ? 'md' : 'terminal';
|
|
26
|
+
this.log(formatSpendingCap(data, fmt));
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
this.style.longError('Failed to load the spending cap.', describeSpendingCapError(err, 'billing:read'));
|
|
30
|
+
process.exitCode = exitCodeFor(err);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=spending-cap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spending-cap.js","sourceRoot":"","sources":["../../../src/commands/account/spending-cap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAA;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEpE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;IACtB,MAAM,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,MAAM,CAAC,UAAU,GAAG,IAAI,CAAA;IACxB,MAAM,CAAC,WAAW,GAAG,0FAA0F,CAAA;IAE/G,MAAM,CAAC,KAAK,GAAG;QACb,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;KAC1C,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACtD,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAA;QACtC,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;YAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC5B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;gBACvC,OAAM;YACR,CAAC;YACD,MAAM,GAAG,GAAiB,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAA;YACnE,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;QACxC,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAA;YACvG,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC"}
|
|
@@ -6,7 +6,7 @@ export default class UsageProjectionsCommand extends AuthCommand {
|
|
|
6
6
|
static idempotent: boolean;
|
|
7
7
|
static description: string;
|
|
8
8
|
static args: {
|
|
9
|
-
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
10
10
|
};
|
|
11
11
|
static flags: {
|
|
12
12
|
'as-of': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -10,8 +10,11 @@ export default class UsageProjectionsCommand extends AuthCommand {
|
|
|
10
10
|
static readOnly = true;
|
|
11
11
|
static destructive = false;
|
|
12
12
|
static idempotent = true;
|
|
13
|
-
static description = 'Project
|
|
14
|
-
|
|
13
|
+
static description = 'Project usage for a usage term through a completed UTC day. '
|
|
14
|
+
+ 'Defaults to the term in force today.';
|
|
15
|
+
static args = {
|
|
16
|
+
id: Args.string({ description: 'Usage term UUID. Defaults to the term in force today.', required: false }),
|
|
17
|
+
};
|
|
15
18
|
static flags = {
|
|
16
19
|
'as-of': Flags.string({
|
|
17
20
|
description: 'Inclusive completed UTC date (YYYY-MM-DD). Defaults to yesterday UTC; today and future rejected.',
|
|
@@ -22,17 +25,23 @@ export default class UsageProjectionsCommand extends AuthCommand {
|
|
|
22
25
|
const { args, flags } = await this.parse(UsageProjectionsCommand);
|
|
23
26
|
this.style.outputFormat = flags.output;
|
|
24
27
|
try {
|
|
25
|
-
const
|
|
26
|
-
const { data: projections } = await api.usage.getProjections(
|
|
28
|
+
const usageTermsId = args.id === undefined ? undefined : validateUsageTermId(args.id);
|
|
29
|
+
const { data: projections } = await api.usage.getProjections({
|
|
30
|
+
...(usageTermsId === undefined ? {} : { usageTermsId }),
|
|
31
|
+
...projectionsParams(flags),
|
|
32
|
+
});
|
|
27
33
|
if (flags.output === 'json') {
|
|
28
34
|
this.log(JSON.stringify(projections, null, 2));
|
|
29
35
|
return;
|
|
30
36
|
}
|
|
31
|
-
const term = await api.usage.getTerm(
|
|
37
|
+
const term = await api.usage.getTerm(projections.usageTermsId)
|
|
38
|
+
.then(response => response.data).catch(() => undefined);
|
|
32
39
|
this.log(formatUsageProjections(projections, flags.output === 'md' ? 'md' : 'terminal', term));
|
|
33
40
|
}
|
|
34
41
|
catch (err) {
|
|
35
|
-
this.style.longError('Failed to load usage projections.', describeUsageError(err, {
|
|
42
|
+
this.style.longError('Failed to load usage projections.', describeUsageError(err, {
|
|
43
|
+
termId: args.id, inForceTerm: true,
|
|
44
|
+
}));
|
|
36
45
|
process.exitCode = exitCodeFor(err);
|
|
37
46
|
}
|
|
38
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projections.js","sourceRoot":"","sources":["../../../../src/commands/account/usage/projections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AACtG,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAErE,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,WAAW;IAC9D,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;IACtB,MAAM,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,MAAM,CAAC,UAAU,GAAG,IAAI,CAAA;IACxB,MAAM,CAAC,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"projections.js","sourceRoot":"","sources":["../../../../src/commands/account/usage/projections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAA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AAC;gBAC3D,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;gBACvD,GAAG,iBAAiB,CAAC,KAAK,CAAC;aAC5B,CAAC,CAAA;YACF,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC5B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;gBAC9C,OAAM;YACR,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC;iBAC3D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;YACzD,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAA;QAChG,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,GAAG,EAAE;gBAChF,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI;aACnC,CAAC,CAAC,CAAA;YACH,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC"}
|
|
@@ -10,7 +10,7 @@ export default class UsageSeriesCommand extends AuthCommand {
|
|
|
10
10
|
static readOnly = true;
|
|
11
11
|
static destructive = false;
|
|
12
12
|
static idempotent = true;
|
|
13
|
-
static description = 'List usage
|
|
13
|
+
static description = 'List usage per period with composable grouping and optional runs or calculations.';
|
|
14
14
|
static flags = { ...usageSeriesFlags(), output: outputFlag({ default: 'table' }) };
|
|
15
15
|
async run() {
|
|
16
16
|
const { flags } = await this.parse(UsageSeriesCommand);
|
|
@@ -24,6 +24,7 @@ export default class UsageSeriesCommand extends AuthCommand {
|
|
|
24
24
|
pagination: { nextId: series.nextId, length: series.data.length },
|
|
25
25
|
period: series.period,
|
|
26
26
|
usageTermsIds: series.usageTermsIds,
|
|
27
|
+
unit: series.unit,
|
|
27
28
|
interval: series.interval,
|
|
28
29
|
groupBy: series.groupBy,
|
|
29
30
|
coverage: series.coverage,
|
|
@@ -37,10 +38,10 @@ export default class UsageSeriesCommand extends AuthCommand {
|
|
|
37
38
|
const pinned = { ...params, ...series.period, interval: series.interval, groupBy: series.groupBy };
|
|
38
39
|
this.log([
|
|
39
40
|
fmt === 'md' ? heading('Usage series', 1, fmt) : '',
|
|
40
|
-
formatUsageCoverage(series.coverage, fmt),
|
|
41
|
+
formatUsageCoverage(series.coverage, fmt, series.unit),
|
|
41
42
|
fmt === 'md' ? heading('Usage rows', 2, fmt) : '',
|
|
42
43
|
formatUsageSeries(series.data, fmt, {
|
|
43
|
-
interval: series.interval, groupBy: series.groupBy, include: params.include ?? [], names,
|
|
44
|
+
interval: series.interval, groupBy: series.groupBy, include: params.include ?? [], unit: series.unit, names,
|
|
44
45
|
}),
|
|
45
46
|
formatUsagePaginationInfo(series.data.length, series.nextId, 'usage row'),
|
|
46
47
|
formatUsageNavigationHints(series.nextId, usageListCommand('series', pinned, fmt), fmt),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"series.js","sourceRoot":"","sources":["../../../../src/commands/account/usage/series.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AACnH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,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC;aACxF,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;QACjC,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAA;YAC7E,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC"}
|
|
@@ -10,7 +10,7 @@ export default class UsageSummaryCommand extends AuthCommand {
|
|
|
10
10
|
static readOnly = true;
|
|
11
11
|
static destructive = false;
|
|
12
12
|
static idempotent = true;
|
|
13
|
-
static description = 'Show usage
|
|
13
|
+
static description = 'Show usage, pricing breakdowns, and coverage gaps across selected terms.';
|
|
14
14
|
static flags = { ...usageRangeFlags(), output: outputFlag({ default: 'detail' }) };
|
|
15
15
|
async run() {
|
|
16
16
|
const { flags } = await this.parse(UsageSummaryCommand);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../../../src/commands/account/usage/summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAqB,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACrF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEnF,MAAM,CAAC,OAAO,OAAO,mBAAoB,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kB,CAAC,GAAG,CAAC,CAAC,CAAA;YAC9E,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SpendingCap } from '../rest/spending-cap.js';
|
|
2
|
+
import { type OutputFormat } from './render.js';
|
|
3
|
+
/** Cents (possibly fractional, e.g. overage) as dollars: `1806.25` → `$18.06`. */
|
|
4
|
+
export declare function formatDollars(cents: number): string;
|
|
5
|
+
export declare function formatSpendingCap(data: SpendingCap, format: OutputFormat): string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { formatDate, renderDetailFields } from './render.js';
|
|
3
|
+
const usd = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' });
|
|
4
|
+
/** Cents (possibly fractional, e.g. overage) as dollars: `1806.25` → `$18.06`. */
|
|
5
|
+
export function formatDollars(cents) {
|
|
6
|
+
return usd.format(cents / 100);
|
|
7
|
+
}
|
|
8
|
+
const STATE_LABELS = {
|
|
9
|
+
UNDER: 'Under the cap',
|
|
10
|
+
CLOSE: 'Close to the cap',
|
|
11
|
+
REACHED: 'Cap reached',
|
|
12
|
+
};
|
|
13
|
+
function color(format, paint, value) {
|
|
14
|
+
return format === 'terminal' ? paint(value) : value;
|
|
15
|
+
}
|
|
16
|
+
const fields = [
|
|
17
|
+
{
|
|
18
|
+
label: 'Spending cap',
|
|
19
|
+
value: ({ spendingCapCents: cap }) => {
|
|
20
|
+
if (cap === null)
|
|
21
|
+
return 'No cap';
|
|
22
|
+
return cap === 0 ? `${formatDollars(0)} (no overage allowed)` : formatDollars(cap);
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Overage so far',
|
|
27
|
+
value: ({ standing }) => standing
|
|
28
|
+
? formatDollars(standing.overageCents)
|
|
29
|
+
: 'Not measured (runs not measured yet, or no overage on this plan)',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Status',
|
|
33
|
+
value: ({ standing }, format) => {
|
|
34
|
+
const limit = standing?.limit;
|
|
35
|
+
if (!limit)
|
|
36
|
+
return null;
|
|
37
|
+
const label = STATE_LABELS[limit.state] ?? limit.state;
|
|
38
|
+
if (limit.state === 'CLOSE') {
|
|
39
|
+
return color(format, chalk.yellow, `${label} (from ${formatDollars(limit.closeAtCents)})`);
|
|
40
|
+
}
|
|
41
|
+
return limit.state === 'REACHED' ? color(format, chalk.red, label) : label;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'Checks stopped',
|
|
46
|
+
value: ({ standing }, format) => {
|
|
47
|
+
if (!standing)
|
|
48
|
+
return null;
|
|
49
|
+
return standing.limit?.state === 'REACHED'
|
|
50
|
+
? color(format, chalk.red, 'Yes, the spending cap is reached')
|
|
51
|
+
: 'No';
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: 'Measured at',
|
|
56
|
+
value: ({ standing }, format) => standing ? formatDate(standing.measuredAt, format) : null,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
export function formatSpendingCap(data, format) {
|
|
60
|
+
return renderDetailFields('Spending cap', fields, data, format);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=spending-cap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spending-cap.js","sourceRoot":"","sources":["../../src/formatters/spending-cap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAuC,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEjG,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;AAElF,kFAAkF;AAClF,MAAM,UAAU,aAAa,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BAC5B,OAAO,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,UAAU,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;YAC5F,CAAC;YACD,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAC5E,CAAC;KACF;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE;YAC9B,IAAI,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAA;YAC1B,OAAO,QAAQ,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS;gBACxC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,kCAAkC,CAAC;gBAC9D,CAAC,CAAC,IAAI,CAAA;QACV,CAAC;KACF;IACD;QACE,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;KAC3F;CACF,CAAA;AAED,MAAM,UAAU,iBAAiB,CAAE,IAAiB,EAAE,MAAoB;IACxE,OAAO,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UsageCoverage, UsageGroupDimension, UsageInterval, UsageProjections, UsageSeriesInclude, UsageSeriesParams, UsageSeriesRow, UsageSummary, UsageTerm, UsageTermsParams } from '../rest/usage.js';
|
|
1
|
+
import type { UsageCoverage, UsageGroupDimension, UsageInterval, UsageProjections, UsageSeriesInclude, UsageSeriesParams, UsageSeriesRow, UsageSummary, UsageTerm, UsageTermsParams, UsageUnit } from '../rest/usage.js';
|
|
2
2
|
import { type OutputFormat } from './render.js';
|
|
3
3
|
export interface UsageNames {
|
|
4
4
|
terms: ReadonlyMap<string, string>;
|
|
@@ -8,11 +8,12 @@ export interface SeriesFormatOptions {
|
|
|
8
8
|
interval: UsageInterval;
|
|
9
9
|
groupBy: UsageGroupDimension[];
|
|
10
10
|
include: UsageSeriesInclude[];
|
|
11
|
+
unit?: UsageUnit | null;
|
|
11
12
|
names?: UsageNames;
|
|
12
13
|
}
|
|
13
14
|
export declare function formatUsageTermsList(terms: UsageTerm[], format: OutputFormat): string;
|
|
14
15
|
export declare function formatUsageTermDetail(term: UsageTerm, format: OutputFormat): string;
|
|
15
|
-
export declare function formatUsageCoverage(coverage: UsageCoverage, format: OutputFormat): string;
|
|
16
|
+
export declare function formatUsageCoverage(coverage: UsageCoverage, format: OutputFormat, unit?: UsageUnit | null): string;
|
|
16
17
|
export declare function formatUsageSummary(summary: UsageSummary, format: OutputFormat): string;
|
|
17
18
|
export declare function formatUsageSeries(rows: UsageSeriesRow[], format: OutputFormat, options: SeriesFormatOptions): string;
|
|
18
19
|
export declare function formatUsageProjections(value: UsageProjections, format: OutputFormat, term?: UsageTerm): string;
|