@naturali/cli 0.87.0 → 0.89.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.
Files changed (2) hide show
  1. package/dist/index.mjs +229 -39
  2. 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.87.0";
17
+ var version = "0.89.0";
18
18
  //#endregion
19
19
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
20
20
  const serializeFormDataPair = (data, key, value) => {
@@ -1019,6 +1019,87 @@ var Channels = class {
1019
1019
  });
1020
1020
  }
1021
1021
  };
1022
+ var Admin = class {
1023
+ /**
1024
+ * List accounts
1025
+ *
1026
+ * A cursor page of every account, newest first, each with the plan it is on and the balance of its credit ledger. Needs the `admin` role.
1027
+ * `email` narrows the page to one account. It matches the whole address case-insensitively and takes no wildcards: an operator looking for `Ana@Acme.com` finds a row stored as `ana@acme.com`, and there is no substring search across customers' addresses.
1028
+ * An account with no subscription reads as `free` with a balance of `0`: the absence of a row is the free plan, and the least-privileged rung is also what any unresolvable lookup should answer.
1029
+ *
1030
+ */
1031
+ static listUsers(options) {
1032
+ return (options?.client ?? client).get({
1033
+ url: "/v1/admin/users",
1034
+ ...options
1035
+ });
1036
+ }
1037
+ /**
1038
+ * Replace a user's roles
1039
+ *
1040
+ * Replaces the platform roles of any user. Needs the `admin` role, and each role that changes needs the caller to hold the role that grants it (today `admin` grants `admin`). Values outside the catalog are rejected with a 400, and a caller cannot remove their own `admin` role.
1041
+ *
1042
+ */
1043
+ static updateUserRoles(options) {
1044
+ return (options.client ?? client).put({
1045
+ url: "/v1/admin/users/{user_id}/roles",
1046
+ ...options,
1047
+ headers: {
1048
+ "Content-Type": "application/json",
1049
+ ...options.headers
1050
+ }
1051
+ });
1052
+ }
1053
+ /**
1054
+ * Grant a user a plan
1055
+ *
1056
+ * Puts the account on a rung of the infra ladder. Needs the `admin` role.
1057
+ * `PUT` because a user has exactly one plan: setting it twice leaves one subscription, never two (two rows for one payer is a state where "which plan is this?" has no answer).
1058
+ * The rung is recorded and read back, and **nothing enforces it yet** — no route refuses a feature for the plan an account is on. Downgrading is the same call with a lower rung, and what becomes of resources a lower plan would not hold is a separate mechanism that is not built.
1059
+ *
1060
+ */
1061
+ static grantUserPlan(options) {
1062
+ return (options.client ?? client).put({
1063
+ url: "/v1/admin/users/{user_id}/plan",
1064
+ ...options,
1065
+ headers: {
1066
+ "Content-Type": "application/json",
1067
+ ...options.headers
1068
+ }
1069
+ });
1070
+ }
1071
+ /**
1072
+ * Read a user's credit ledger
1073
+ *
1074
+ * A cursor page of the account's credit lines, newest first, with the balance they sum to. Needs the `admin` role — including for the account's own owner, since the customer-facing view of a balance belongs with a billing surface this API does not serve yet.
1075
+ * What an operator reads it for is writing a correction: the line that was wrong stays on the record, so it has to be legible before it can be compensated for.
1076
+ *
1077
+ */
1078
+ static listUserCredits(options) {
1079
+ return (options.client ?? client).get({
1080
+ url: "/v1/admin/users/{user_id}/credits",
1081
+ ...options
1082
+ });
1083
+ }
1084
+ /**
1085
+ * Grant a user credit
1086
+ *
1087
+ * Writes one `granted` line to the account's credit ledger and answers with the balance it produced. Needs the `admin` role.
1088
+ * 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 granting a **negative** `amount_usd`, which leaves the wrong line on the record beside the one that compensates for it. Granted credit is customer-acquisition cost rather than revenue, which is why each line records its kind and the operator who authorized it.
1089
+ * The balance this moves is not yet a ceiling anything enforces; turning it into one is a separate mechanism.
1090
+ *
1091
+ */
1092
+ static grantUserCredit(options) {
1093
+ return (options.client ?? client).post({
1094
+ url: "/v1/admin/users/{user_id}/credits",
1095
+ ...options,
1096
+ headers: {
1097
+ "Content-Type": "application/json",
1098
+ ...options.headers
1099
+ }
1100
+ });
1101
+ }
1102
+ };
1022
1103
  var Agents = class {
1023
1104
  /**
1024
1105
  * List agents
@@ -4114,22 +4195,6 @@ var Users = class {
4114
4195
  }
4115
4196
  });
4116
4197
  }
4117
- /**
4118
- * Replace a user's roles
4119
- *
4120
- * Replaces the platform roles of any user. Needs the `admin` role, and each role that changes needs the caller to hold the role that grants it (today `admin` grants `admin`). Values outside the catalog are rejected with a 400, and a caller cannot remove their own `admin` role.
4121
- *
4122
- */
4123
- static updateUserRoles(options) {
4124
- return (options.client ?? client).put({
4125
- url: "/v1/users/{user_id}/roles",
4126
- ...options,
4127
- headers: {
4128
- "Content-Type": "application/json",
4129
- ...options.headers
4130
- }
4131
- });
4132
- }
4133
4198
  };
4134
4199
  var Webhooks = class {
4135
4200
  /**
@@ -4406,6 +4471,7 @@ const API_BASE_URL$1 = "https://api.naturali.ai";
4406
4471
  */
4407
4472
  var NaturaliClient = class {
4408
4473
  activity;
4474
+ admin;
4409
4475
  actors;
4410
4476
  agents;
4411
4477
  agentVersions;
@@ -4454,6 +4520,7 @@ var NaturaliClient = class {
4454
4520
  }
4455
4521
  }));
4456
4522
  this.activity = bindResource(Activity, this.http);
4523
+ this.admin = bindResource(Admin, this.http);
4457
4524
  this.actors = bindResource(Actors, this.http);
4458
4525
  this.agents = bindResource(Agents, this.http);
4459
4526
  this.agentVersions = bindResource(AgentVersions, this.http);
@@ -4498,6 +4565,7 @@ var NaturaliClient = class {
4498
4565
  var src_exports = /* @__PURE__ */ __exportAll({
4499
4566
  Activity: () => Activity,
4500
4567
  Actors: () => Actors,
4568
+ Admin: () => Admin,
4501
4569
  AgentVersions: () => AgentVersions,
4502
4570
  Agents: () => Agents,
4503
4571
  AiProviders: () => AiProviders,
@@ -5480,6 +5548,150 @@ const routes = {
5480
5548
  }
5481
5549
  ]
5482
5550
  },
5551
+ "list-users": {
5552
+ serviceClass: "Admin",
5553
+ operationId: "listUsers",
5554
+ description: "A cursor page of every account, newest first, each with the plan it is on and the balance of its credit ledger. Needs the `admin` role. `email` narrows the page to one account. It matches the whole address case-insensitively and takes no wildcards: an operator looking for `Ana@Acme.com` finds a row stored as `ana@acme.com`, and there is no substring search across customers' addresses. An account with no subscription reads as `free` with a balance of `0`: the absence of a row is the free plan, and the least-privileged rung is also what any unresolvable lookup should answer.",
5555
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
5556
+ httpMethod: "get",
5557
+ pathParams: [],
5558
+ queryParams: [
5559
+ "email",
5560
+ "limit",
5561
+ "cursor"
5562
+ ],
5563
+ flags: [
5564
+ {
5565
+ "name": "email",
5566
+ "description": "Match one account by its full address, case-insensitively.",
5567
+ "required": false,
5568
+ "type": "string",
5569
+ "in": "query"
5570
+ },
5571
+ {
5572
+ "name": "limit",
5573
+ "description": "Maximum items per page — an integer from 1 to 100 (default 20).",
5574
+ "required": false,
5575
+ "type": "integer",
5576
+ "in": "query"
5577
+ },
5578
+ {
5579
+ "name": "cursor",
5580
+ "description": "The `next_cursor` of the previous page.",
5581
+ "required": false,
5582
+ "type": "string",
5583
+ "in": "query"
5584
+ }
5585
+ ]
5586
+ },
5587
+ "update-user-roles": {
5588
+ serviceClass: "Admin",
5589
+ operationId: "updateUserRoles",
5590
+ description: "Replaces the platform roles of any user. Needs the `admin` role, and each role that changes needs the caller to hold the role that grants it (today `admin` grants `admin`). Values outside the catalog are rejected with a 400, and a caller cannot remove their own `admin` role.",
5591
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
5592
+ httpMethod: "put",
5593
+ pathParams: ["user_id"],
5594
+ queryParams: [],
5595
+ flags: [{
5596
+ "name": "user_id",
5597
+ "description": "",
5598
+ "required": true,
5599
+ "type": "string",
5600
+ "in": "path"
5601
+ }, {
5602
+ "name": "roles",
5603
+ "description": "The complete new list; an empty array clears every role.",
5604
+ "required": true,
5605
+ "type": "array",
5606
+ "in": "body"
5607
+ }]
5608
+ },
5609
+ "grant-user-plan": {
5610
+ serviceClass: "Admin",
5611
+ operationId: "grantUserPlan",
5612
+ description: "Puts the account on a rung of the infra ladder. Needs the `admin` role. `PUT` because a user has exactly one plan: setting it twice leaves one subscription, never two (two rows for one payer is a state where \"which plan is this?\" has no answer). The rung is recorded and read back, and **nothing enforces it yet** — no route refuses a feature for the plan an account is on. Downgrading is the same call with a lower rung, and what becomes of resources a lower plan would not hold is a separate mechanism that is not built.",
5613
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
5614
+ httpMethod: "put",
5615
+ pathParams: ["user_id"],
5616
+ queryParams: [],
5617
+ flags: [{
5618
+ "name": "user_id",
5619
+ "description": "",
5620
+ "required": true,
5621
+ "type": "string",
5622
+ "in": "path"
5623
+ }, {
5624
+ "name": "plan",
5625
+ "description": "The rung to put the account on.",
5626
+ "required": true,
5627
+ "type": "string",
5628
+ "in": "body"
5629
+ }]
5630
+ },
5631
+ "list-user-credits": {
5632
+ serviceClass: "Admin",
5633
+ operationId: "listUserCredits",
5634
+ description: "A cursor page of the account's credit lines, newest first, with the balance they sum to. Needs the `admin` role — including for the account's own owner, since the customer-facing view of a balance belongs with a billing surface this API does not serve yet. What an operator reads it for is writing a correction: the line that was wrong stays on the record, so it has to be legible before it can be compensated for.",
5635
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
5636
+ httpMethod: "get",
5637
+ pathParams: ["user_id"],
5638
+ queryParams: ["limit", "cursor"],
5639
+ flags: [
5640
+ {
5641
+ "name": "user_id",
5642
+ "description": "",
5643
+ "required": true,
5644
+ "type": "string",
5645
+ "in": "path"
5646
+ },
5647
+ {
5648
+ "name": "limit",
5649
+ "description": "Maximum items per page — an integer from 1 to 100 (default 20).",
5650
+ "required": false,
5651
+ "type": "integer",
5652
+ "in": "query"
5653
+ },
5654
+ {
5655
+ "name": "cursor",
5656
+ "description": "The `next_cursor` of the previous page.",
5657
+ "required": false,
5658
+ "type": "string",
5659
+ "in": "query"
5660
+ }
5661
+ ]
5662
+ },
5663
+ "grant-user-credit": {
5664
+ serviceClass: "Admin",
5665
+ operationId: "grantUserCredit",
5666
+ 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 granting a **negative** `amount_usd`, which leaves the wrong line on the record beside the one that compensates for it. Granted credit is customer-acquisition cost rather than revenue, which is why each line records its kind and the operator who authorized it. The balance this moves is not yet a ceiling anything enforces; turning it into one is a separate mechanism.",
5667
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
5668
+ httpMethod: "post",
5669
+ pathParams: ["user_id"],
5670
+ queryParams: [],
5671
+ flags: [
5672
+ {
5673
+ "name": "user_id",
5674
+ "description": "",
5675
+ "required": true,
5676
+ "type": "string",
5677
+ "in": "path"
5678
+ },
5679
+ {
5680
+ "name": "amount_usd",
5681
+ "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.",
5682
+ "required": true,
5683
+ "type": "number",
5684
+ "in": "body"
5685
+ },
5686
+ {
5687
+ "name": "reason",
5688
+ "description": "Why, for the record. Optional.",
5689
+ "required": false,
5690
+ "type": "string",
5691
+ "in": "body"
5692
+ }
5693
+ ]
5694
+ },
5483
5695
  "list-agents": {
5484
5696
  serviceClass: "Agents",
5485
5697
  operationId: "listAgents",
@@ -14976,28 +15188,6 @@ const routes = {
14976
15188
  "in": "body"
14977
15189
  }]
14978
15190
  },
14979
- "update-user-roles": {
14980
- serviceClass: "Users",
14981
- operationId: "updateUserRoles",
14982
- description: "Replaces the platform roles of any user. Needs the `admin` role, and each role that changes needs the caller to hold the role that grants it (today `admin` grants `admin`). Values outside the catalog are rejected with a 400, and a caller cannot remove their own `admin` role.",
14983
- moduleDocsUrl: "https://docs.naturali.ai/docs/modules/users",
14984
- httpMethod: "put",
14985
- pathParams: ["user_id"],
14986
- queryParams: [],
14987
- flags: [{
14988
- "name": "user_id",
14989
- "description": "",
14990
- "required": true,
14991
- "type": "string",
14992
- "in": "path"
14993
- }, {
14994
- "name": "roles",
14995
- "description": "The complete new list; an empty array clears every role.",
14996
- "required": true,
14997
- "type": "array",
14998
- "in": "body"
14999
- }]
15000
- },
15001
15191
  "list-webhooks": {
15002
15192
  serviceClass: "Webhooks",
15003
15193
  operationId: "listWebhooks",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.87.0",
3
+ "version": "0.89.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.87.0"
33
+ "@naturali/sdk": "0.89.0"
34
34
  },
35
35
  "scripts": {
36
36
  "generate": "tsx scripts/generate.ts",