@ornncompute/cli 1.0.224 → 1.0.226
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 +4 -0
- package/package.json +1 -1
- package/src/admin-credits.mjs +7 -3
- package/src/admin-shell.mjs +1 -0
- package/vendor/capabilities/cli.js +804 -878
package/README.md
CHANGED
|
@@ -242,6 +242,10 @@ credits to the organization. Find the organization with the directory commands
|
|
|
242
242
|
above. Like admin reservation creation, it requires an eligible human terminal
|
|
243
243
|
and executes immediately after validating the organization, USD amount, note,
|
|
244
244
|
and UUID.
|
|
245
|
+
Add `--direction debit` to remove credits; the displayed review then says removal.
|
|
246
|
+
`--direction credit` and omitted direction add credits. Read both kinds with
|
|
247
|
+
`ornn admin organizations credit-adjustments --organization UUID`, using the same
|
|
248
|
+
read as MCP and Slack.
|
|
245
249
|
The key supplies the existing API's required `adjustmentId`; repeating it with
|
|
246
250
|
the same details returns the same grant. The admin's session supplies audit
|
|
247
251
|
identity. See the [credit-adjustment contract](../../services/commerce/README.md#staff-credit-adjustments).
|
package/package.json
CHANGED
package/src/admin-credits.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { ADMIN_MUTATION_SAFETY, AdminMutationError, runAdminMutation } from "./a
|
|
|
2
2
|
import { parseSemanticArguments } from "./interaction-runtime.mjs";
|
|
3
3
|
|
|
4
4
|
function parseGrant(argv, capability) {
|
|
5
|
-
const { $positionals, organization, amountCents, note, idempotencyKey, ...extra } =
|
|
5
|
+
const { $positionals, organization, amountCents, direction, note, idempotencyKey, ...extra } =
|
|
6
6
|
parseSemanticArguments(argv);
|
|
7
7
|
if ($positionals.length || Object.keys(extra).length) {
|
|
8
8
|
throw new AdminMutationError(`Usage: ${capability.cli.vnext.human}`);
|
|
@@ -11,6 +11,7 @@ function parseGrant(argv, capability) {
|
|
|
11
11
|
organizationId: organization,
|
|
12
12
|
adjustmentId: idempotencyKey,
|
|
13
13
|
amountCents: amountCents === undefined ? undefined : Number(amountCents),
|
|
14
|
+
direction,
|
|
14
15
|
note,
|
|
15
16
|
});
|
|
16
17
|
if (!parsed.success) {
|
|
@@ -31,14 +32,17 @@ async function runGrant({ execute, input, mutation, runtime }) {
|
|
|
31
32
|
...mutation,
|
|
32
33
|
prepare: async () => ({
|
|
33
34
|
review: {
|
|
34
|
-
title: "Grant Ornn credits",
|
|
35
|
+
title: input.direction === "debit" ? "Remove Ornn credits" : "Grant Ornn credits",
|
|
35
36
|
fields: [
|
|
36
37
|
{ label: "Customer organization", value: input.organizationId },
|
|
37
38
|
{ label: "Amount (USD)", value: `$${(input.amountCents / 100).toFixed(2)}` },
|
|
38
39
|
{ label: "Note", value: input.note },
|
|
39
40
|
{ label: "Grant UUID", value: input.adjustmentId },
|
|
40
41
|
],
|
|
41
|
-
consequence:
|
|
42
|
+
consequence:
|
|
43
|
+
input.direction === "debit"
|
|
44
|
+
? "Removes spendable Ornn credits from the selected organization."
|
|
45
|
+
: "Adds spendable Ornn credits to the selected organization.",
|
|
42
46
|
},
|
|
43
47
|
value: input,
|
|
44
48
|
}),
|
package/src/admin-shell.mjs
CHANGED
|
@@ -211,6 +211,7 @@ function parseAdminInput(capability, argv) {
|
|
|
211
211
|
if (options.organization && ["users.list", "organization.invite"].includes(capability.id)) {
|
|
212
212
|
input.organization_id = options.organization;
|
|
213
213
|
}
|
|
214
|
+
if (capability.id === "credits.adjustments.list") input.organizationId = options.organization;
|
|
214
215
|
if (options.facility) input.facility_id = options.facility;
|
|
215
216
|
if (options.status) input.status = options.status;
|
|
216
217
|
if (options.email) input.email = options.email;
|