@naturali/sdk 0.125.0 → 0.127.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 +83 -0
- package/dist/index.d.cts +633 -1
- package/dist/index.d.mts +633 -1
- package/dist/index.mjs +83 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1121,6 +1121,20 @@ var Admin = class {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
});
|
|
1123
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Read the global price book
|
|
1126
|
+
*
|
|
1127
|
+
* The upstream runtime's global default prices — the rows carrying neither a provider nor a project, which is all the upstream listing returns, so no tenant's own rates appear here.
|
|
1128
|
+
*
|
|
1129
|
+
* These are a cost basis, not a tariff: what a customer pays is the plan they bought plus the multiplier in PRICING.md section 3, applied when spend is reconciled. This is the read behind the storage-rate assertion at boot and the pinned embedding rate.
|
|
1130
|
+
*
|
|
1131
|
+
*/
|
|
1132
|
+
static getAdminPriceBook(options) {
|
|
1133
|
+
return (options?.client ?? client).get({
|
|
1134
|
+
url: "/v1/admin/usage/prices",
|
|
1135
|
+
...options
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1124
1138
|
};
|
|
1125
1139
|
var Agents = class {
|
|
1126
1140
|
/**
|
|
@@ -3648,6 +3662,75 @@ var Projects = class {
|
|
|
3648
3662
|
...options
|
|
3649
3663
|
});
|
|
3650
3664
|
}
|
|
3665
|
+
/**
|
|
3666
|
+
* List project usage events
|
|
3667
|
+
*
|
|
3668
|
+
* The rows a rollup summed — one per metered occurrence, most recent first. Takes the same narrowings [the meter](/docs/api/projects/get-project-usage) does, so a query that produced a bucket answers here unchanged and reads back what went into it. This is the audit and reconciliation view: what was measured, when, against which agent, session, actor and provider, and what each component was priced at.
|
|
3669
|
+
*
|
|
3670
|
+
* An id naming nothing in this project yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
|
|
3671
|
+
*
|
|
3672
|
+
*/
|
|
3673
|
+
static listProjectUsageEvents(options) {
|
|
3674
|
+
return (options.client ?? client).get({
|
|
3675
|
+
url: "/v1/projects/{project_id}/usage/events",
|
|
3676
|
+
...options
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
/**
|
|
3680
|
+
* Get a generation or orchestration-run billing receipt
|
|
3681
|
+
*
|
|
3682
|
+
* What one occurrence was billed, line by line: per-event line items with their measured components and unit prices, a per-meter-type split, and the totals. Pass generation_id for one generation, or orchestration_run_id for a receipt summed across every event the run metered. Exactly one of the two is required.
|
|
3683
|
+
*
|
|
3684
|
+
* This is the itemisation behind a single number — where [the meter](/docs/api/projects/get-project-usage) says a window cost $12.40, a receipt says which components of which call made up one occurrence of it. On an orchestration-run receipt every line carries node_id, so grouping by it gives the per-node cost the total hides; a retried node contributes one line per attempt, which is the intended reading for spend.
|
|
3685
|
+
*
|
|
3686
|
+
*/
|
|
3687
|
+
static getProjectUsageReceipt(options) {
|
|
3688
|
+
return (options.client ?? client).get({
|
|
3689
|
+
url: "/v1/projects/{project_id}/usage/receipt",
|
|
3690
|
+
...options
|
|
3691
|
+
});
|
|
3692
|
+
}
|
|
3693
|
+
/**
|
|
3694
|
+
* List usage thresholds
|
|
3695
|
+
*
|
|
3696
|
+
* The spend alerts this project has set. A threshold fires the usage.threshold_crossed event when the project's windowed usage crosses it, so one is only useful alongside a webhook subscribed to that event.
|
|
3697
|
+
*
|
|
3698
|
+
*/
|
|
3699
|
+
static listProjectUsageThresholds(options) {
|
|
3700
|
+
return (options.client ?? client).get({
|
|
3701
|
+
url: "/v1/projects/{project_id}/usage/thresholds",
|
|
3702
|
+
...options
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3705
|
+
/**
|
|
3706
|
+
* Set a usage threshold
|
|
3707
|
+
*
|
|
3708
|
+
* Creates an alert on this project's windowed usage. Crossing it fires usage.threshold_crossed once per window — a calendar_month threshold fires at most once in a month, and a rolling_24h one re-arms when the windowed total falls back below 90% of the threshold, so a total hovering at the line does not alert repeatedly.
|
|
3709
|
+
*
|
|
3710
|
+
* Requires the admin role: an alerting rule belongs to the account that pays, not to one member.
|
|
3711
|
+
*
|
|
3712
|
+
*/
|
|
3713
|
+
static createProjectUsageThreshold(options) {
|
|
3714
|
+
return (options.client ?? client).post({
|
|
3715
|
+
url: "/v1/projects/{project_id}/usage/thresholds",
|
|
3716
|
+
...options,
|
|
3717
|
+
headers: {
|
|
3718
|
+
"Content-Type": "application/json",
|
|
3719
|
+
...options.headers
|
|
3720
|
+
}
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
/**
|
|
3724
|
+
* Delete a usage threshold
|
|
3725
|
+
*
|
|
3726
|
+
* Stops the alert. Requires the admin role.
|
|
3727
|
+
*/
|
|
3728
|
+
static deleteProjectUsageThreshold(options) {
|
|
3729
|
+
return (options.client ?? client).delete({
|
|
3730
|
+
url: "/v1/projects/{project_id}/usage/thresholds/{threshold_id}",
|
|
3731
|
+
...options
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3651
3734
|
};
|
|
3652
3735
|
var Quotas = class {
|
|
3653
3736
|
/**
|