@naturali/cli 0.94.0 → 0.96.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/dist/index.mjs +82 -19
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region package.json
|
|
17
|
-
var version = "0.
|
|
17
|
+
var version = "0.96.0";
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region ../sdk/src/generated/core/bodySerializer.gen.ts
|
|
20
20
|
const serializeFormDataPair = (data, key, value) => {
|
|
@@ -1054,11 +1054,24 @@ var Admin = class {
|
|
|
1054
1054
|
});
|
|
1055
1055
|
}
|
|
1056
1056
|
/**
|
|
1057
|
+
* Read a user's plan history
|
|
1058
|
+
*
|
|
1059
|
+
* A cursor page of the account's plan history, newest first, and the rung it is on now. Needs the `admin` role.
|
|
1060
|
+
* The history is append-only, so this is the record of who put the account where and why — nothing edits or removes a line. `plan` at the top level is the same value every entitlement check resolves, so one response answers both "what plan is this?" and "how did it get there?".
|
|
1061
|
+
*
|
|
1062
|
+
*/
|
|
1063
|
+
static listUserPlanHistory(options) {
|
|
1064
|
+
return (options.client ?? client).get({
|
|
1065
|
+
url: "/v1/admin/users/{user_id}/plan",
|
|
1066
|
+
...options
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1057
1070
|
* Grant a user a plan
|
|
1058
1071
|
*
|
|
1059
1072
|
* Puts the account on a rung of the infra ladder. Needs the `admin` role.
|
|
1060
|
-
* `PUT` because
|
|
1061
|
-
* The rung is
|
|
1073
|
+
* `PUT` because an account is on exactly one rung at a time, but the change is **recorded rather than overwritten**: the plan history is append-only and the newest line is the account's plan. Setting the rung it already holds still writes a line — a re-confirmation is an act worth a record, and the `reason` given with it would otherwise have nowhere to go. Read the history back with `GET` on this path.
|
|
1074
|
+
* The rung is what the feature gate and the resource caps resolve against. Downgrading is the same call with a lower rung; what becomes of resources a lower plan would not hold is a separate mechanism that is not built.
|
|
1062
1075
|
*
|
|
1063
1076
|
*/
|
|
1064
1077
|
static grantUserPlan(options) {
|
|
@@ -1088,7 +1101,8 @@ var Admin = class {
|
|
|
1088
1101
|
* Grant a user credit
|
|
1089
1102
|
*
|
|
1090
1103
|
* Writes one `granted` line to the account's credit ledger and answers with the balance it produced. Needs the `admin` role.
|
|
1091
|
-
* The ledger is append-only and the balance is its sum — there is no balance to set and no line to edit or delete. A mistake is corrected by
|
|
1104
|
+
* The ledger is append-only and the balance is its sum — there is no balance to set and no line to edit or delete. A mistake is corrected by writing a **negative** `amount_usd`, which leaves the wrong line on the record beside the one that compensates for it.
|
|
1105
|
+
* `kind` is required. Money received and credit given away report differently — one is revenue, the other customer-acquisition cost — so the line says which it is rather than defaulting to one of them.
|
|
1092
1106
|
* The balance this moves is not yet a ceiling anything enforces; turning it into one is a separate mechanism.
|
|
1093
1107
|
*
|
|
1094
1108
|
*/
|
|
@@ -5641,27 +5655,69 @@ const routes = {
|
|
|
5641
5655
|
"in": "body"
|
|
5642
5656
|
}]
|
|
5643
5657
|
},
|
|
5658
|
+
"list-user-plan-history": {
|
|
5659
|
+
serviceClass: "Admin",
|
|
5660
|
+
operationId: "listUserPlanHistory",
|
|
5661
|
+
description: "A cursor page of the account's plan history, newest first, and the rung it is on now. Needs the `admin` role. The history is append-only, so this is the record of who put the account where and why — nothing edits or removes a line. `plan` at the top level is the same value every entitlement check resolves, so one response answers both \"what plan is this?\" and \"how did it get there?\".",
|
|
5662
|
+
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
|
|
5663
|
+
httpMethod: "get",
|
|
5664
|
+
pathParams: ["user_id"],
|
|
5665
|
+
queryParams: ["limit", "cursor"],
|
|
5666
|
+
flags: [
|
|
5667
|
+
{
|
|
5668
|
+
"name": "user_id",
|
|
5669
|
+
"description": "",
|
|
5670
|
+
"required": true,
|
|
5671
|
+
"type": "string",
|
|
5672
|
+
"in": "path"
|
|
5673
|
+
},
|
|
5674
|
+
{
|
|
5675
|
+
"name": "limit",
|
|
5676
|
+
"description": "Maximum items per page — an integer from 1 to 100 (default 20).",
|
|
5677
|
+
"required": false,
|
|
5678
|
+
"type": "integer",
|
|
5679
|
+
"in": "query"
|
|
5680
|
+
},
|
|
5681
|
+
{
|
|
5682
|
+
"name": "cursor",
|
|
5683
|
+
"description": "The `next_cursor` of the previous page.",
|
|
5684
|
+
"required": false,
|
|
5685
|
+
"type": "string",
|
|
5686
|
+
"in": "query"
|
|
5687
|
+
}
|
|
5688
|
+
]
|
|
5689
|
+
},
|
|
5644
5690
|
"grant-user-plan": {
|
|
5645
5691
|
serviceClass: "Admin",
|
|
5646
5692
|
operationId: "grantUserPlan",
|
|
5647
|
-
description: "Puts the account on a rung of the infra ladder. Needs the `admin` role. `PUT` because
|
|
5693
|
+
description: "Puts the account on a rung of the infra ladder. Needs the `admin` role. `PUT` because an account is on exactly one rung at a time, but the change is **recorded rather than overwritten**: the plan history is append-only and the newest line is the account's plan. Setting the rung it already holds still writes a line — a re-confirmation is an act worth a record, and the `reason` given with it would otherwise have nowhere to go. Read the history back with `GET` on this path. The rung is what the feature gate and the resource caps resolve against. Downgrading is the same call with a lower rung; what becomes of resources a lower plan would not hold is a separate mechanism that is not built.",
|
|
5648
5694
|
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
|
|
5649
5695
|
httpMethod: "put",
|
|
5650
5696
|
pathParams: ["user_id"],
|
|
5651
5697
|
queryParams: [],
|
|
5652
|
-
flags: [
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5698
|
+
flags: [
|
|
5699
|
+
{
|
|
5700
|
+
"name": "user_id",
|
|
5701
|
+
"description": "",
|
|
5702
|
+
"required": true,
|
|
5703
|
+
"type": "string",
|
|
5704
|
+
"in": "path"
|
|
5705
|
+
},
|
|
5706
|
+
{
|
|
5707
|
+
"name": "plan",
|
|
5708
|
+
"description": "The rung to put the account on.",
|
|
5709
|
+
"required": true,
|
|
5710
|
+
"type": "string",
|
|
5711
|
+
"in": "body"
|
|
5712
|
+
},
|
|
5713
|
+
{
|
|
5714
|
+
"name": "reason",
|
|
5715
|
+
"description": "Why the account was moved. Recorded on the line and never edited, so it is the only account of intent the history carries.",
|
|
5716
|
+
"required": false,
|
|
5717
|
+
"type": "string",
|
|
5718
|
+
"in": "body"
|
|
5719
|
+
}
|
|
5720
|
+
]
|
|
5665
5721
|
},
|
|
5666
5722
|
"list-user-credits": {
|
|
5667
5723
|
serviceClass: "Admin",
|
|
@@ -5698,7 +5754,7 @@ const routes = {
|
|
|
5698
5754
|
"grant-user-credit": {
|
|
5699
5755
|
serviceClass: "Admin",
|
|
5700
5756
|
operationId: "grantUserCredit",
|
|
5701
|
-
description: "Writes one `granted` line to the account's credit ledger and answers with the balance it produced. Needs the `admin` role. The ledger is append-only and the balance is its sum — there is no balance to set and no line to edit or delete. A mistake is corrected by
|
|
5757
|
+
description: "Writes one `granted` line to the account's credit ledger and answers with the balance it produced. Needs the `admin` role. The ledger is append-only and the balance is its sum — there is no balance to set and no line to edit or delete. A mistake is corrected by writing a **negative** `amount_usd`, which leaves the wrong line on the record beside the one that compensates for it. `kind` is required. Money received and credit given away report differently — one is revenue, the other customer-acquisition cost — so the line says which it is rather than defaulting to one of them. The balance this moves is not yet a ceiling anything enforces; turning it into one is a separate mechanism.",
|
|
5702
5758
|
moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
|
|
5703
5759
|
httpMethod: "post",
|
|
5704
5760
|
pathParams: ["user_id"],
|
|
@@ -5711,6 +5767,13 @@ const routes = {
|
|
|
5711
5767
|
"type": "string",
|
|
5712
5768
|
"in": "path"
|
|
5713
5769
|
},
|
|
5770
|
+
{
|
|
5771
|
+
"name": "kind",
|
|
5772
|
+
"description": "What this line is. `purchased` for money that arrived, `granted` for credit naturali gave away — the two report differently, so it is required rather than defaulted. `included` is not accepted here: a plan's monthly allowance is the billing cycle's to write.",
|
|
5773
|
+
"required": true,
|
|
5774
|
+
"type": "string",
|
|
5775
|
+
"in": "body"
|
|
5776
|
+
},
|
|
5714
5777
|
{
|
|
5715
5778
|
"name": "amount_usd",
|
|
5716
5779
|
"description": "US dollars to grant, rounded to the cent. Negative corrects an earlier grant; zero is refused, because a grant of nothing records no intent.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturali/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"tsx": "^4.23.1",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
32
|
"vitest": "^4.1.10",
|
|
33
|
-
"@naturali/sdk": "0.
|
|
33
|
+
"@naturali/sdk": "0.96.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"generate": "tsx scripts/generate.ts",
|