@byte_fluffy/nexra-sdk 0.1.0-alpha.3 → 0.1.0-alpha.4

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/README.md CHANGED
@@ -33,3 +33,31 @@ The default API base URL is `https://api.nexra-ai.com/v1`. When overriding
33
33
  Static catalog APIs are also available from `@byte_fluffy/nexra-sdk/catalog`.
34
34
  Exact non-negative decimal helpers are available from
35
35
  `@byte_fluffy/nexra-sdk/decimal`.
36
+
37
+ ## Directory layout
38
+
39
+ ```
40
+ src/
41
+ index.ts Public entry; re-exports the catalog, client, etc.
42
+ catalog/
43
+ index.ts CatalogClient, getModelSpec, listModelSpecs
44
+ generated/ Generated artifacts (committed; required to publish)
45
+ image.generated.json One file per model kind (image, video, audio, ...)
46
+ index.ts Imports every kind JSON and exports the merged array
47
+ generated/
48
+ version.generated.ts SDK_VERSION used by the transport
49
+ ... client, tasks, assets, input, sse, webhooks, errors, ...
50
+ scripts/
51
+ generate-public-catalog.ts Projects models from @nexra/models and writes
52
+ src/catalog/generated/*
53
+ ```
54
+
55
+ ### Adding a new public model
56
+
57
+ 1. Add its ID to `PUBLIC_MODEL_IDS` in `scripts/generate-public-catalog.ts`.
58
+ 2. Run `bun run generate` (from `packages/sdk`).
59
+ 3. The script groups projected models by `model.kind`, writes one
60
+ `src/catalog/generated/<kind>.generated.json` per kind (new kinds appear
61
+ automatically), regenerates the merging `index.ts`, and bumps
62
+ `src/generated/version.generated.ts`. No hand-written code changes.
63
+
package/dist/catalog.d.ts CHANGED
@@ -1 +1 @@
1
- export { d as CatalogClient, h as CreateNexraQuoteRequest, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, N as NexraSettlement, R as getModelSpec, V as listModelSpecs } from './catalog-mytCeh5t.js';
1
+ export { d as CatalogClient, h as CreateNexraQuoteRequest, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, N as NexraSettlement, R as getModelSpec, V as listModelSpecs } from './index-mytCeh5t.js';
package/dist/catalog.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  CatalogClient,
3
3
  getModelSpec,
4
4
  listModelSpecs
5
- } from "./chunk-IMJZBLDE.js";
5
+ } from "./chunk-AV3GN4TV.js";
6
6
  export {
7
7
  CatalogClient,
8
8
  getModelSpec,
@@ -1,5 +1,5 @@
1
- // src/generated/public-catalog.generated.json
2
- var public_catalog_generated_default = [
1
+ // src/catalog/generated/image.generated.json
2
+ var image_generated_default = [
3
3
  {
4
4
  id: "openai/gpt-image-2.5-flare",
5
5
  contractVersion: 2,
@@ -6023,6 +6023,11 @@ var public_catalog_generated_default = [
6023
6023
  }
6024
6024
  ];
6025
6025
 
6026
+ // src/catalog/generated/index.ts
6027
+ var generatedCatalog = Object.freeze([
6028
+ ...image_generated_default
6029
+ ]);
6030
+
6026
6031
  // src/errors.ts
6027
6032
  var NexraApiError = class extends Error {
6028
6033
  status;
@@ -6060,7 +6065,7 @@ var NexraWaitTimeoutError = class extends Error {
6060
6065
  };
6061
6066
 
6062
6067
  // src/generated/version.generated.ts
6063
- var SDK_VERSION = "0.1.0-alpha.3";
6068
+ var SDK_VERSION = "0.1.0-alpha.4";
6064
6069
 
6065
6070
  // src/transport.ts
6066
6071
  var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
@@ -6182,8 +6187,8 @@ async function waitForRetry(response, attempt, signal) {
6182
6187
  await sleep(Number.isFinite(seconds) ? seconds * 1e3 : 200 * 2 ** attempt, signal);
6183
6188
  }
6184
6189
 
6185
- // src/catalog.ts
6186
- var modelSpecs = deepFreeze(structuredClone(public_catalog_generated_default));
6190
+ // src/catalog/index.ts
6191
+ var modelSpecs = deepFreeze(structuredClone(generatedCatalog));
6187
6192
  var byIdentifier = /* @__PURE__ */ new Map();
6188
6193
  for (const model of modelSpecs) {
6189
6194
  for (const identifier of [model.id, ...model.aliases]) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { J as JsonObject, B as BillingMetric, a as JsonValue, N as NexraSettlement, C as CursorPage, H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, b as TaskModel, c as ModelSchema, d as CatalogClient, e as NexraClientOptions } from './catalog-mytCeh5t.js';
2
- export { f as BILLING_EXPORT_DIMENSIONS, g as BILLING_METRICS, h as CreateNexraQuoteRequest, F as FetchLike, i as JsonPrimitive, j as MeteredPriceRate, k as MeteredPriceRuleV1, l as MeteredUsageComponent, m as MeteringContract, n as MeteringKind, o as ModelCapabilitySummary, p as ModelDateVersion, q as ModelEndpointSummary, r as ModelModality, s as ModelResourceList, t as ModelResourceOption, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, A as NormalizedUsageV1, P as PriceEvaluation, D as PriceEvaluationIssue, E as PriceEvaluationLine, G as PriceRule, U as UsageComponentEvidence, I as UsageEvidenceAssessment, K as UsageEvidenceStatus, L as allocateDiscountedPriceLines, O as assessUsageEvidence, Q as evaluatePriceRule, R as getModelSpec, S as jsonBody, V as listModelSpecs, W as queryString, X as sleep, Y as validateMeteringContract, Z as validateNormalizedUsage, _ as validatePriceRule } from './catalog-mytCeh5t.js';
1
+ import { J as JsonObject, B as BillingMetric, a as JsonValue, N as NexraSettlement, C as CursorPage, H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, b as TaskModel, c as ModelSchema, d as CatalogClient, e as NexraClientOptions } from './index-mytCeh5t.js';
2
+ export { f as BILLING_EXPORT_DIMENSIONS, g as BILLING_METRICS, h as CreateNexraQuoteRequest, F as FetchLike, i as JsonPrimitive, j as MeteredPriceRate, k as MeteredPriceRuleV1, l as MeteredUsageComponent, m as MeteringContract, n as MeteringKind, o as ModelCapabilitySummary, p as ModelDateVersion, q as ModelEndpointSummary, r as ModelModality, s as ModelResourceList, t as ModelResourceOption, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, A as NormalizedUsageV1, P as PriceEvaluation, D as PriceEvaluationIssue, E as PriceEvaluationLine, G as PriceRule, U as UsageComponentEvidence, I as UsageEvidenceAssessment, K as UsageEvidenceStatus, L as allocateDiscountedPriceLines, O as assessUsageEvidence, Q as evaluatePriceRule, R as getModelSpec, S as jsonBody, V as listModelSpecs, W as queryString, X as sleep, Y as validateMeteringContract, Z as validateNormalizedUsage, _ as validatePriceRule } from './index-mytCeh5t.js';
3
3
  export { ceilDecimal, multiplyDecimal } from './decimal.js';
4
4
 
5
5
  declare const MEDIA_KINDS: readonly ["image", "video", "audio", "document", "archive", "other"];
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  listModelSpecs,
10
10
  queryString,
11
11
  sleep
12
- } from "./chunk-IMJZBLDE.js";
12
+ } from "./chunk-AV3GN4TV.js";
13
13
  import {
14
14
  ceilDecimal,
15
15
  multiplyDecimal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byte_fluffy/nexra-sdk",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.0-alpha.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "scripts": {
34
34
  "generate": "bun scripts/generate-public-catalog.ts",
35
- "build": "bun run generate && tsup src/index.ts src/catalog.ts src/decimal.ts --format esm --dts --dts-resolve --clean --out-dir dist --target es2022 --platform browser",
35
+ "build": "bun run generate && tsup",
36
36
  "test": "vitest run --root ../.. packages/sdk/tests",
37
37
  "prepack": "bun run build"
38
38
  },