@naturali/sdk 0.301.1 → 0.303.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.cjs +78 -4
- package/dist/index.d.cts +328 -30
- package/dist/index.d.mts +328 -30
- package/dist/index.mjs +78 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1682,9 +1682,9 @@ var ApiKeys = class {
|
|
|
1682
1682
|
* Create an API key
|
|
1683
1683
|
*
|
|
1684
1684
|
* Creates an API key. When `project_id` is set the key is scoped to that project (the default and recommended stance); omit it for an account-scoped key. The raw `key` (nat_sk_…) is returned only in this response.
|
|
1685
|
-
* A
|
|
1686
|
-
*
|
|
1687
|
-
* A narrowed key may grant only a non-empty subset of its own `policy_ids
|
|
1685
|
+
* A key is bounded by `policy_ids`, whose grants it holds together; empty, it reaches whatever its holder's membership reaches. A key past `expires_at` is `401`. Omitted, each is the caller's own when the caller is a narrowed or expiring key, else empty and never.
|
|
1686
|
+
* A project key's `policy_ids` are policies of its project; any other id is `400`. An account key's are global policies or policies of the account (`/v1/account/policies`), each granting only account actions the account holds; any other is `400`. An account key with `policy_ids` acts on its account only: each account operation is checked against them, an operation without an account action is `403`, and so is every route in a project.
|
|
1687
|
+
* A narrowed key may grant only a non-empty subset of its own `policy_ids`, and an expiring key only a key that expires no later: anything wider or longer-lived is `403`, on update too, and so is rotating a key wider than it.
|
|
1688
1688
|
* A project-scoped key requires membership of that project. The key carries no role of its own — every request it makes resolves its holder's membership again — so it can never reach past what its minter already had. An account-scoped key requires a credential that is not itself confined to one project.
|
|
1689
1689
|
* A connected app cannot create keys at all: a grant is revocable and a key is not, so a key minted under a grant would still work after the app was disconnected. Reading and revoking keys stay available.
|
|
1690
1690
|
*
|
|
@@ -1730,7 +1730,7 @@ var ApiKeys = class {
|
|
|
1730
1730
|
/**
|
|
1731
1731
|
* Update an API key
|
|
1732
1732
|
*
|
|
1733
|
-
* Rename an API key or replace its bound (`policy_ids` and `expires_at`
|
|
1733
|
+
* Rename an API key or replace its bound (`policy_ids` and `expires_at`); the change holds from the key's next call. The scope (project vs account) is immutable. A narrowed caller may set only a non-empty subset of its own bound, and an expiring one no later expiry (`403`).
|
|
1734
1734
|
*
|
|
1735
1735
|
*/
|
|
1736
1736
|
static updateApiKey(options) {
|
|
@@ -5384,6 +5384,80 @@ var Policies = class {
|
|
|
5384
5384
|
}
|
|
5385
5385
|
});
|
|
5386
5386
|
}
|
|
5387
|
+
/**
|
|
5388
|
+
* List policies
|
|
5389
|
+
*
|
|
5390
|
+
* Acts on the caller's account: the account's project group is the one addressed, never named in the request.
|
|
5391
|
+
*
|
|
5392
|
+
* Returns the policies of the project `project_id` names, or of the project a project-scoped credential is bound to. `project_group_id` lists that project group's policies instead, which needs `project-groups:ListPolicies` on `srn:project-group:<project_group_id>:policy*`. Without any, the unrestricted admin lists every policy, global, project and project group ones. Pass `user_id` (unrestricted admin only) to list only the policies attached to that user.
|
|
5393
|
+
*
|
|
5394
|
+
*/
|
|
5395
|
+
static listAccountPolicies(options) {
|
|
5396
|
+
return (options?.client ?? client).get({
|
|
5397
|
+
url: "/v1/account/policies",
|
|
5398
|
+
...options
|
|
5399
|
+
});
|
|
5400
|
+
}
|
|
5401
|
+
/**
|
|
5402
|
+
* Create a policy
|
|
5403
|
+
*
|
|
5404
|
+
* Acts on the caller's account: the account's project group is the one addressed, never named in the request.
|
|
5405
|
+
*
|
|
5406
|
+
* Creates a project policy when `project_id` is given or the credential is bound to a project: its `Allow` statements may name only that project's resources (`srn:<project_id>:<type>:<id>`), else `400`; an `Allow` without `resource` grants every resource of that project. With `project_group_id`, creates a project group policy, which needs `project-groups:CreatePolicy` on `srn:project-group:<project_group_id>:policy*`: its `Allow` statements may name only the project group's own resources (`srn:project-group:<project_group_id>:<type>/<id>`) and those of a project in it, else `400`; an `Allow` without `resource` grants a project group action on the project group and any other action on its projects, read when the policy is evaluated. Only the project group and its keys may carry it in `policy_ids`. Without a project or a project group, creates a global policy, which only the unrestricted admin may.
|
|
5407
|
+
*/
|
|
5408
|
+
static createAccountPolicy(options) {
|
|
5409
|
+
return (options.client ?? client).post({
|
|
5410
|
+
url: "/v1/account/policies",
|
|
5411
|
+
...options,
|
|
5412
|
+
headers: {
|
|
5413
|
+
"Content-Type": "application/json",
|
|
5414
|
+
...options.headers
|
|
5415
|
+
}
|
|
5416
|
+
});
|
|
5417
|
+
}
|
|
5418
|
+
/**
|
|
5419
|
+
* Delete a policy
|
|
5420
|
+
*
|
|
5421
|
+
* Acts on the caller's account: the account's project group is the one addressed, never named in the request.
|
|
5422
|
+
*
|
|
5423
|
+
* Deletes a policy. A project policy needs `policies:DeletePolicy` in its project; a project group policy, `project-groups:DeletePolicy` on `srn:project-group:<project_group_id>:policy/<policy_id>`; a global one, the unrestricted admin. Refused with `409 POLICY_HAS_DEPENDENTS` while a trigger, agent, webhook, user, project group or API key names it in its `policy_ids`.
|
|
5424
|
+
*/
|
|
5425
|
+
static deleteAccountPolicy(options) {
|
|
5426
|
+
return (options.client ?? client).delete({
|
|
5427
|
+
url: "/v1/account/policies/{policy_id}",
|
|
5428
|
+
...options
|
|
5429
|
+
});
|
|
5430
|
+
}
|
|
5431
|
+
/**
|
|
5432
|
+
* Get a policy
|
|
5433
|
+
*
|
|
5434
|
+
* Acts on the caller's account: the account's project group is the one addressed, never named in the request.
|
|
5435
|
+
*
|
|
5436
|
+
* Returns a policy. A project policy needs `policies:GetPolicy` in its project; a project group policy, `project-groups:GetPolicy` on `srn:project-group:<project_group_id>:policy/<policy_id>`; a global one, the unrestricted admin.
|
|
5437
|
+
*/
|
|
5438
|
+
static getAccountPolicy(options) {
|
|
5439
|
+
return (options.client ?? client).get({
|
|
5440
|
+
url: "/v1/account/policies/{policy_id}",
|
|
5441
|
+
...options
|
|
5442
|
+
});
|
|
5443
|
+
}
|
|
5444
|
+
/**
|
|
5445
|
+
* Update a policy
|
|
5446
|
+
*
|
|
5447
|
+
* Acts on the caller's account: the account's project group is the one addressed, never named in the request.
|
|
5448
|
+
*
|
|
5449
|
+
* Updates a policy. A project policy needs `policies:UpdatePolicy` in its project and its `Allow` statements stay within that project; a project group policy, `project-groups:UpdatePolicy` on `srn:project-group:<project_group_id>:policy/<policy_id>`, and its `Allow` statements stay within the project group; a global one, the unrestricted admin. The project or project group never changes.
|
|
5450
|
+
*/
|
|
5451
|
+
static updateAccountPolicy(options) {
|
|
5452
|
+
return (options.client ?? client).put({
|
|
5453
|
+
url: "/v1/account/policies/{policy_id}",
|
|
5454
|
+
...options,
|
|
5455
|
+
headers: {
|
|
5456
|
+
"Content-Type": "application/json",
|
|
5457
|
+
...options.headers
|
|
5458
|
+
}
|
|
5459
|
+
});
|
|
5460
|
+
}
|
|
5387
5461
|
};
|
|
5388
5462
|
var Projects = class {
|
|
5389
5463
|
/**
|