@getanyapi/sdk 0.25.0 → 0.26.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 +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -181,7 +181,10 @@ interface CatalogOptions {
|
|
|
181
181
|
interface FlatPricingOffer {
|
|
182
182
|
model: "flat";
|
|
183
183
|
unit: "request";
|
|
184
|
+
/** USD billed for ONE request. */
|
|
184
185
|
maxUsd: number;
|
|
186
|
+
/** The same maximum quoted per 1,000 requests, as published by the gateway. */
|
|
187
|
+
maxPer1kUsd: number;
|
|
185
188
|
}
|
|
186
189
|
/** A capped base-plus-unit discovery offer. */
|
|
187
190
|
interface LinearPricingOffer {
|
|
@@ -189,12 +192,17 @@ interface LinearPricingOffer {
|
|
|
189
192
|
unit: string;
|
|
190
193
|
baseUsd: number;
|
|
191
194
|
perUnitUsd: number;
|
|
195
|
+
/** USD billed for ONE request at the cap. */
|
|
192
196
|
maxUsd: number;
|
|
197
|
+
/** The same maximum quoted per 1,000 requests, as published by the gateway. */
|
|
198
|
+
maxPer1kUsd: number;
|
|
193
199
|
}
|
|
194
200
|
type PricingOffer = FlatPricingOffer | LinearPricingOffer;
|
|
195
201
|
interface DiscoveryPricing {
|
|
196
202
|
from: PricingOffer;
|
|
197
203
|
failoverMaxUsd: number;
|
|
204
|
+
/** The failover ceiling quoted per 1,000 requests, as published by the gateway. */
|
|
205
|
+
failoverMaxPer1kUsd: number;
|
|
198
206
|
}
|
|
199
207
|
type DiscoveryExecutionMode = "sync" | "durable";
|
|
200
208
|
interface DiscoveryExecution {
|
package/dist/index.d.ts
CHANGED
|
@@ -181,7 +181,10 @@ interface CatalogOptions {
|
|
|
181
181
|
interface FlatPricingOffer {
|
|
182
182
|
model: "flat";
|
|
183
183
|
unit: "request";
|
|
184
|
+
/** USD billed for ONE request. */
|
|
184
185
|
maxUsd: number;
|
|
186
|
+
/** The same maximum quoted per 1,000 requests, as published by the gateway. */
|
|
187
|
+
maxPer1kUsd: number;
|
|
185
188
|
}
|
|
186
189
|
/** A capped base-plus-unit discovery offer. */
|
|
187
190
|
interface LinearPricingOffer {
|
|
@@ -189,12 +192,17 @@ interface LinearPricingOffer {
|
|
|
189
192
|
unit: string;
|
|
190
193
|
baseUsd: number;
|
|
191
194
|
perUnitUsd: number;
|
|
195
|
+
/** USD billed for ONE request at the cap. */
|
|
192
196
|
maxUsd: number;
|
|
197
|
+
/** The same maximum quoted per 1,000 requests, as published by the gateway. */
|
|
198
|
+
maxPer1kUsd: number;
|
|
193
199
|
}
|
|
194
200
|
type PricingOffer = FlatPricingOffer | LinearPricingOffer;
|
|
195
201
|
interface DiscoveryPricing {
|
|
196
202
|
from: PricingOffer;
|
|
197
203
|
failoverMaxUsd: number;
|
|
204
|
+
/** The failover ceiling quoted per 1,000 requests, as published by the gateway. */
|
|
205
|
+
failoverMaxPer1kUsd: number;
|
|
198
206
|
}
|
|
199
207
|
type DiscoveryExecutionMode = "sync" | "durable";
|
|
200
208
|
interface DiscoveryExecution {
|
package/dist/index.js
CHANGED
|
@@ -254,8 +254,9 @@ function parseOffer(value, path) {
|
|
|
254
254
|
const model = stringField(raw, "model", path);
|
|
255
255
|
const unit = stringField(raw, "unit", path);
|
|
256
256
|
const maxUsd = numberField(raw, "maxUsd", path);
|
|
257
|
+
const maxPer1kUsd = numberField(raw, "maxPer1kUsd", path);
|
|
257
258
|
if (model === "flat") {
|
|
258
|
-
return unit === "request" ? { model, unit, maxUsd } : malformed(path);
|
|
259
|
+
return unit === "request" ? { model, unit, maxUsd, maxPer1kUsd } : malformed(path);
|
|
259
260
|
}
|
|
260
261
|
if (model !== "linear") return malformed(`${path}.model`);
|
|
261
262
|
if (unit.length === 0) return malformed(`${path}.unit`);
|
|
@@ -264,14 +265,16 @@ function parseOffer(value, path) {
|
|
|
264
265
|
unit,
|
|
265
266
|
baseUsd: numberField(raw, "baseUsd", path),
|
|
266
267
|
perUnitUsd: numberField(raw, "perUnitUsd", path),
|
|
267
|
-
maxUsd
|
|
268
|
+
maxUsd,
|
|
269
|
+
maxPer1kUsd
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
272
|
function parsePricing(value, path) {
|
|
271
273
|
const raw = record(value, path);
|
|
272
274
|
return {
|
|
273
275
|
from: parseOffer(raw["from"], `${path}.from`),
|
|
274
|
-
failoverMaxUsd: numberField(raw, "failoverMaxUsd", path)
|
|
276
|
+
failoverMaxUsd: numberField(raw, "failoverMaxUsd", path),
|
|
277
|
+
failoverMaxPer1kUsd: numberField(raw, "failoverMaxPer1kUsd", path)
|
|
275
278
|
};
|
|
276
279
|
}
|
|
277
280
|
function parseExecution(value, path) {
|