@nodaro/sdk 2.49.0 → 2.51.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 (39) hide show
  1. package/dist/{chunk-FIMBPKIH.cjs → chunk-4BAHF762.cjs} +43 -2
  2. package/dist/chunk-4BAHF762.cjs.map +1 -0
  3. package/dist/chunk-6FZN3QQO.cjs +146 -0
  4. package/dist/chunk-6FZN3QQO.cjs.map +1 -0
  5. package/dist/{chunk-5MOJSYHI.js → chunk-7QK2NXJA.js} +43 -2
  6. package/dist/chunk-7QK2NXJA.js.map +1 -0
  7. package/dist/{chunk-2JAKOBD3.js → chunk-EC6MC46Y.js} +5 -5
  8. package/dist/{chunk-2JAKOBD3.js.map → chunk-EC6MC46Y.js.map} +1 -1
  9. package/dist/{chunk-PPP6VZ3I.cjs → chunk-HPSENMVN.cjs} +8 -8
  10. package/dist/{chunk-PPP6VZ3I.cjs.map → chunk-HPSENMVN.cjs.map} +1 -1
  11. package/dist/{chunk-NOBQQTAG.cjs → chunk-OMX7JBGY.cjs} +3 -3
  12. package/dist/{chunk-NOBQQTAG.cjs.map → chunk-OMX7JBGY.cjs.map} +1 -1
  13. package/dist/chunk-WYYDWJFF.js +144 -0
  14. package/dist/chunk-WYYDWJFF.js.map +1 -0
  15. package/dist/{chunk-5MZYOJCJ.js → chunk-XISHBW5I.js} +3 -3
  16. package/dist/{chunk-5MZYOJCJ.js.map → chunk-XISHBW5I.js.map} +1 -1
  17. package/dist/entries/billing.cjs +2 -2
  18. package/dist/entries/billing.d.cts +202 -3
  19. package/dist/entries/billing.d.ts +202 -3
  20. package/dist/entries/billing.js +1 -1
  21. package/dist/entries/client.cjs +9 -9
  22. package/dist/entries/client.js +4 -4
  23. package/dist/entries/core.cjs +5 -5
  24. package/dist/entries/core.js +1 -1
  25. package/dist/entries/credits.cjs +2 -2
  26. package/dist/entries/credits.d.cts +179 -1
  27. package/dist/entries/credits.d.ts +179 -1
  28. package/dist/entries/credits.js +1 -1
  29. package/dist/index.cjs +12 -12
  30. package/dist/index.d.cts +2 -2
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.js +4 -4
  33. package/package.json +1 -1
  34. package/dist/chunk-5MOJSYHI.js.map +0 -1
  35. package/dist/chunk-FIMBPKIH.cjs.map +0 -1
  36. package/dist/chunk-J4WFSKY6.js +0 -50
  37. package/dist/chunk-J4WFSKY6.js.map +0 -1
  38. package/dist/chunk-NGKODS3J.cjs +0 -52
  39. package/dist/chunk-NGKODS3J.cjs.map +0 -1
@@ -202,6 +202,157 @@ interface CreditTransactionsOptions {
202
202
  /** The `nextCursor` of the previous page. */
203
203
  cursor?: string;
204
204
  }
205
+ /** How `credits.usageSummary()` groups the series over time. */
206
+ type UsageSummaryBucket = "day" | "week" | "month";
207
+ interface UsageSummaryOptions {
208
+ /** An ISO-8601 timestamp, or a date alone (`"2026-10-01"`: that whole UTC day), inclusive; default the last 30 days up to now. A period of at most a year. */
209
+ from?: string;
210
+ to?: string;
211
+ /** Default `"day"`. Buckets are UTC. */
212
+ bucket?: UsageSummaryBucket;
213
+ }
214
+ interface UsageSummaryTotals {
215
+ /** Credits spent on runs in the period: each run's charge (a running hold counts; a refunded run does not). */
216
+ used: number;
217
+ /** Credits bought: packs, loads, subscription grants. */
218
+ purchased: number;
219
+ /** Credits granted free, net: sign-up and admin adjustments, a grant taken back subtracted. */
220
+ granted: number;
221
+ /** Credits given back for a refunded run or by Stripe (a hold released when a run settled below it is not a refund). */
222
+ refunded: number;
223
+ /** Runs that were charged or are still running. */
224
+ runs: number;
225
+ /** `used / runs`, one decimal; 0 with no runs. */
226
+ avgPerRun: number;
227
+ }
228
+ interface UsageByModel {
229
+ model: string;
230
+ provider: string | null;
231
+ credits: number;
232
+ runs: number;
233
+ /** Of `totals.used`, 0–1. */
234
+ share: number;
235
+ }
236
+ interface UsageByCategory {
237
+ /** `"image"`, `"video"`, `"audio"` or `"other"`. */
238
+ category: string;
239
+ credits: number;
240
+ runs: number;
241
+ }
242
+ interface UsageOverTime {
243
+ /** The bucket's first day in UTC (`"2026-10-26"`; a week by its Monday; a month as `"2026-10"`). The first bucket of a period may be a partial week or month. */
244
+ bucket: string;
245
+ used: number;
246
+ purchased: number;
247
+ runs: number;
248
+ }
249
+ /** The spend of one session or one workflow. */
250
+ interface UsageByGroup {
251
+ id: string;
252
+ /** The session's title or the workflow's name; `null` when it has none or is gone. */
253
+ name: string | null;
254
+ /** The tool the session belongs to; `null` on a workflow. */
255
+ tool: string | null;
256
+ credits: number;
257
+ runs: number;
258
+ /** The models used, by spend. */
259
+ models: string[];
260
+ /** ISO-8601: the latest run. */
261
+ lastAt: string;
262
+ }
263
+ /** The answer of `credits.usageSummary()`. */
264
+ interface UsageSummary {
265
+ period: {
266
+ from: string;
267
+ to: string;
268
+ bucket: UsageSummaryBucket;
269
+ };
270
+ totals: UsageSummaryTotals;
271
+ /** The model with the most spend; `null` with no runs. */
272
+ mostUsed: UsageByModel | null;
273
+ /** By spend. */
274
+ byModel: UsageByModel[];
275
+ byCategory: UsageByCategory[];
276
+ /** Every bucket of the period, empty ones included, oldest first. */
277
+ overTime: UsageOverTime[];
278
+ bySession: UsageByGroup[];
279
+ byWorkflow: UsageByGroup[];
280
+ /** A read hit the server's row cap: the figures under-report; narrow the period. */
281
+ truncated: boolean;
282
+ /** A side read failed on the server (the jobs, or a session's or workflow's name): a grouping is missing or unnamed; the totals are whole. */
283
+ partial: boolean;
284
+ }
285
+ /** What a movement of the balance was; `app` is credits earned from, or paid for, a published app. */
286
+ type CreditHistoryKind = "usage" | "purchase" | "grant" | "refund" | "app" | "adjustment" | "expiry";
287
+ /** The job behind a usage row of {@link CreditHistoryEntry}. */
288
+ interface CreditHistoryJob {
289
+ id: string;
290
+ /** The node type that ran (`generate-image`, `image-to-video`, …); `null` when the job is gone. */
291
+ type: string | null;
292
+ status: string | null;
293
+ startedAt: string | null;
294
+ completedAt: string | null;
295
+ /** From start to completion; `null` until it completes. */
296
+ durationMs: number | null;
297
+ workflowId: string | null;
298
+ sessionId: string | null;
299
+ }
300
+ /** One movement of the balance (`credits.history()`). */
301
+ interface CreditHistoryEntry {
302
+ id: string;
303
+ /** ISO-8601. Also the paging cursor. */
304
+ at: string;
305
+ kind: CreditHistoryKind;
306
+ /** The ledger's own word: `usage`, `one_time_purchase`, `subscription_renewal`, `signup_grant`, `refund`, `admin_adjustment`, `expiry`, … */
307
+ source: string;
308
+ /** The movement, signed: a run's hold negative, a purchase positive. */
309
+ amount: number;
310
+ /** The balance right after this movement. */
311
+ balanceAfter: number;
312
+ /** Which pool moved; `"mixed"` when both did. */
313
+ pool: "subscription" | "topup" | "mixed";
314
+ description: string | null;
315
+ /** The model that ran, on a row with a job; `null` otherwise. */
316
+ model: string | null;
317
+ provider: string | null;
318
+ /**
319
+ * The job's charge, on its reserve row only (the hold taken when the run
320
+ * was accepted): the settled charge, the hold while the run is open, `0`
321
+ * once refunded. `null` on every other row — a refund, a metered overrun
322
+ * line, a purchase — so summing it over a list counts each job once. Read
323
+ * this for spend, not `amount`.
324
+ */
325
+ charge: number | null;
326
+ /** The run's credit status (`"reserved"`, `"committed"` or `"refunded"`), beside `charge`; `null` elsewhere. */
327
+ status: string | null;
328
+ /** On a row with a job; `type` and the rest `null` when the job is gone or not the person's. */
329
+ job: CreditHistoryJob | null;
330
+ /** Stripe's hosted receipt, on a purchase that has one. */
331
+ receiptUrl: string | null;
332
+ }
333
+ /** A page of {@link CreditHistoryEntry}, newest first. */
334
+ interface CreditHistoryPage {
335
+ data: CreditHistoryEntry[];
336
+ /** Pass as `cursor` for the next page; `null` when there are no more rows. */
337
+ nextCursor: string | null;
338
+ }
339
+ /** What narrows the history. */
340
+ interface CreditHistoryFilters {
341
+ kind?: CreditHistoryKind;
342
+ /** A model identifier: only runs of that model. */
343
+ model?: string;
344
+ /** ISO-8601 bounds on `at`, inclusive. */
345
+ from?: string;
346
+ to?: string;
347
+ /** Words looked for in the description, case-insensitively. */
348
+ q?: string;
349
+ }
350
+ interface CreditHistoryOptions extends CreditHistoryFilters {
351
+ /** Rows per page, 1–100 (server default 50). */
352
+ limit?: number;
353
+ /** The `nextCursor` of the previous page, as given (opaque; another string is refused with 400). */
354
+ cursor?: string;
355
+ }
205
356
  declare class CreditsResource {
206
357
  private client;
207
358
  constructor(client: NodaroClientCore);
@@ -219,6 +370,33 @@ declare class CreditsResource {
219
370
  * Cloud-only route: a self-hosted instance answers 404.
220
371
  */
221
372
  transactions(options?: CreditTransactionsOptions): Promise<CreditTransactionsPage>;
373
+ /**
374
+ * `GET /v1/credits/usage-summary` → the period's credit usage summed the
375
+ * way a billing screen draws it: totals, the spend by model and by
376
+ * category, a series over time (`bucket`: day, week or month, no holes),
377
+ * and the spend by session and by workflow. The last 30 days unless
378
+ * `from` / `to` say otherwise; a period of at most a year (400 beyond).
379
+ * Cloud-only route: a self-hosted instance answers 404.
380
+ */
381
+ usageSummary(options?: UsageSummaryOptions): Promise<UsageSummary>;
382
+ /**
383
+ * `GET /v1/credits/history` → one page of every movement of the balance,
384
+ * newest first — runs, purchases, grants, refunds, adjustments, expiries —
385
+ * each with the balance after it; a job's reserve row carries its model,
386
+ * its `charge` (the settled charge, the hold while the run is open, `0`
387
+ * once refunded — read that for spend, not `amount`) and its job. Filter by
388
+ * `kind`, `model`, `from` / `to` and `q`; pass the page's `nextCursor` (an
389
+ * opaque string) as `cursor` for the next page (`null` at the end).
390
+ * Cloud-only route: a self-hosted instance answers 404.
391
+ */
392
+ history(options?: CreditHistoryOptions): Promise<CreditHistoryPage>;
393
+ /**
394
+ * `GET /v1/credits/history?format=csv` → the whole filtered history as a
395
+ * CSV file (the same fields as {@link history}, one line per movement,
396
+ * newest first), at most 5,000 rows — the last line says when it was cut.
397
+ * Hand the text to the person as `credit-history.csv`.
398
+ */
399
+ exportHistory(filters?: CreditHistoryFilters): Promise<string>;
222
400
  /**
223
401
  * `POST /v1/credits/model-costs` → per-identifier credit cost, for editor
224
402
  * cost previews. Capped at the first {@link MODEL_COSTS_LIMIT} identifiers
@@ -269,4 +447,4 @@ declare class CreditsResource {
269
447
  markWelcomeOfferSeen(): Promise<WelcomeOfferSeenResult>;
270
448
  }
271
449
 
272
- export { type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
450
+ export { type CreditHistoryEntry, type CreditHistoryFilters, type CreditHistoryJob, type CreditHistoryKind, type CreditHistoryOptions, type CreditHistoryPage, type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UsageByCategory, type UsageByGroup, type UsageByModel, type UsageOverTime, type UsageSummary, type UsageSummaryBucket, type UsageSummaryOptions, type UsageSummaryTotals, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
@@ -202,6 +202,157 @@ interface CreditTransactionsOptions {
202
202
  /** The `nextCursor` of the previous page. */
203
203
  cursor?: string;
204
204
  }
205
+ /** How `credits.usageSummary()` groups the series over time. */
206
+ type UsageSummaryBucket = "day" | "week" | "month";
207
+ interface UsageSummaryOptions {
208
+ /** An ISO-8601 timestamp, or a date alone (`"2026-10-01"`: that whole UTC day), inclusive; default the last 30 days up to now. A period of at most a year. */
209
+ from?: string;
210
+ to?: string;
211
+ /** Default `"day"`. Buckets are UTC. */
212
+ bucket?: UsageSummaryBucket;
213
+ }
214
+ interface UsageSummaryTotals {
215
+ /** Credits spent on runs in the period: each run's charge (a running hold counts; a refunded run does not). */
216
+ used: number;
217
+ /** Credits bought: packs, loads, subscription grants. */
218
+ purchased: number;
219
+ /** Credits granted free, net: sign-up and admin adjustments, a grant taken back subtracted. */
220
+ granted: number;
221
+ /** Credits given back for a refunded run or by Stripe (a hold released when a run settled below it is not a refund). */
222
+ refunded: number;
223
+ /** Runs that were charged or are still running. */
224
+ runs: number;
225
+ /** `used / runs`, one decimal; 0 with no runs. */
226
+ avgPerRun: number;
227
+ }
228
+ interface UsageByModel {
229
+ model: string;
230
+ provider: string | null;
231
+ credits: number;
232
+ runs: number;
233
+ /** Of `totals.used`, 0–1. */
234
+ share: number;
235
+ }
236
+ interface UsageByCategory {
237
+ /** `"image"`, `"video"`, `"audio"` or `"other"`. */
238
+ category: string;
239
+ credits: number;
240
+ runs: number;
241
+ }
242
+ interface UsageOverTime {
243
+ /** The bucket's first day in UTC (`"2026-10-26"`; a week by its Monday; a month as `"2026-10"`). The first bucket of a period may be a partial week or month. */
244
+ bucket: string;
245
+ used: number;
246
+ purchased: number;
247
+ runs: number;
248
+ }
249
+ /** The spend of one session or one workflow. */
250
+ interface UsageByGroup {
251
+ id: string;
252
+ /** The session's title or the workflow's name; `null` when it has none or is gone. */
253
+ name: string | null;
254
+ /** The tool the session belongs to; `null` on a workflow. */
255
+ tool: string | null;
256
+ credits: number;
257
+ runs: number;
258
+ /** The models used, by spend. */
259
+ models: string[];
260
+ /** ISO-8601: the latest run. */
261
+ lastAt: string;
262
+ }
263
+ /** The answer of `credits.usageSummary()`. */
264
+ interface UsageSummary {
265
+ period: {
266
+ from: string;
267
+ to: string;
268
+ bucket: UsageSummaryBucket;
269
+ };
270
+ totals: UsageSummaryTotals;
271
+ /** The model with the most spend; `null` with no runs. */
272
+ mostUsed: UsageByModel | null;
273
+ /** By spend. */
274
+ byModel: UsageByModel[];
275
+ byCategory: UsageByCategory[];
276
+ /** Every bucket of the period, empty ones included, oldest first. */
277
+ overTime: UsageOverTime[];
278
+ bySession: UsageByGroup[];
279
+ byWorkflow: UsageByGroup[];
280
+ /** A read hit the server's row cap: the figures under-report; narrow the period. */
281
+ truncated: boolean;
282
+ /** A side read failed on the server (the jobs, or a session's or workflow's name): a grouping is missing or unnamed; the totals are whole. */
283
+ partial: boolean;
284
+ }
285
+ /** What a movement of the balance was; `app` is credits earned from, or paid for, a published app. */
286
+ type CreditHistoryKind = "usage" | "purchase" | "grant" | "refund" | "app" | "adjustment" | "expiry";
287
+ /** The job behind a usage row of {@link CreditHistoryEntry}. */
288
+ interface CreditHistoryJob {
289
+ id: string;
290
+ /** The node type that ran (`generate-image`, `image-to-video`, …); `null` when the job is gone. */
291
+ type: string | null;
292
+ status: string | null;
293
+ startedAt: string | null;
294
+ completedAt: string | null;
295
+ /** From start to completion; `null` until it completes. */
296
+ durationMs: number | null;
297
+ workflowId: string | null;
298
+ sessionId: string | null;
299
+ }
300
+ /** One movement of the balance (`credits.history()`). */
301
+ interface CreditHistoryEntry {
302
+ id: string;
303
+ /** ISO-8601. Also the paging cursor. */
304
+ at: string;
305
+ kind: CreditHistoryKind;
306
+ /** The ledger's own word: `usage`, `one_time_purchase`, `subscription_renewal`, `signup_grant`, `refund`, `admin_adjustment`, `expiry`, … */
307
+ source: string;
308
+ /** The movement, signed: a run's hold negative, a purchase positive. */
309
+ amount: number;
310
+ /** The balance right after this movement. */
311
+ balanceAfter: number;
312
+ /** Which pool moved; `"mixed"` when both did. */
313
+ pool: "subscription" | "topup" | "mixed";
314
+ description: string | null;
315
+ /** The model that ran, on a row with a job; `null` otherwise. */
316
+ model: string | null;
317
+ provider: string | null;
318
+ /**
319
+ * The job's charge, on its reserve row only (the hold taken when the run
320
+ * was accepted): the settled charge, the hold while the run is open, `0`
321
+ * once refunded. `null` on every other row — a refund, a metered overrun
322
+ * line, a purchase — so summing it over a list counts each job once. Read
323
+ * this for spend, not `amount`.
324
+ */
325
+ charge: number | null;
326
+ /** The run's credit status (`"reserved"`, `"committed"` or `"refunded"`), beside `charge`; `null` elsewhere. */
327
+ status: string | null;
328
+ /** On a row with a job; `type` and the rest `null` when the job is gone or not the person's. */
329
+ job: CreditHistoryJob | null;
330
+ /** Stripe's hosted receipt, on a purchase that has one. */
331
+ receiptUrl: string | null;
332
+ }
333
+ /** A page of {@link CreditHistoryEntry}, newest first. */
334
+ interface CreditHistoryPage {
335
+ data: CreditHistoryEntry[];
336
+ /** Pass as `cursor` for the next page; `null` when there are no more rows. */
337
+ nextCursor: string | null;
338
+ }
339
+ /** What narrows the history. */
340
+ interface CreditHistoryFilters {
341
+ kind?: CreditHistoryKind;
342
+ /** A model identifier: only runs of that model. */
343
+ model?: string;
344
+ /** ISO-8601 bounds on `at`, inclusive. */
345
+ from?: string;
346
+ to?: string;
347
+ /** Words looked for in the description, case-insensitively. */
348
+ q?: string;
349
+ }
350
+ interface CreditHistoryOptions extends CreditHistoryFilters {
351
+ /** Rows per page, 1–100 (server default 50). */
352
+ limit?: number;
353
+ /** The `nextCursor` of the previous page, as given (opaque; another string is refused with 400). */
354
+ cursor?: string;
355
+ }
205
356
  declare class CreditsResource {
206
357
  private client;
207
358
  constructor(client: NodaroClientCore);
@@ -219,6 +370,33 @@ declare class CreditsResource {
219
370
  * Cloud-only route: a self-hosted instance answers 404.
220
371
  */
221
372
  transactions(options?: CreditTransactionsOptions): Promise<CreditTransactionsPage>;
373
+ /**
374
+ * `GET /v1/credits/usage-summary` → the period's credit usage summed the
375
+ * way a billing screen draws it: totals, the spend by model and by
376
+ * category, a series over time (`bucket`: day, week or month, no holes),
377
+ * and the spend by session and by workflow. The last 30 days unless
378
+ * `from` / `to` say otherwise; a period of at most a year (400 beyond).
379
+ * Cloud-only route: a self-hosted instance answers 404.
380
+ */
381
+ usageSummary(options?: UsageSummaryOptions): Promise<UsageSummary>;
382
+ /**
383
+ * `GET /v1/credits/history` → one page of every movement of the balance,
384
+ * newest first — runs, purchases, grants, refunds, adjustments, expiries —
385
+ * each with the balance after it; a job's reserve row carries its model,
386
+ * its `charge` (the settled charge, the hold while the run is open, `0`
387
+ * once refunded — read that for spend, not `amount`) and its job. Filter by
388
+ * `kind`, `model`, `from` / `to` and `q`; pass the page's `nextCursor` (an
389
+ * opaque string) as `cursor` for the next page (`null` at the end).
390
+ * Cloud-only route: a self-hosted instance answers 404.
391
+ */
392
+ history(options?: CreditHistoryOptions): Promise<CreditHistoryPage>;
393
+ /**
394
+ * `GET /v1/credits/history?format=csv` → the whole filtered history as a
395
+ * CSV file (the same fields as {@link history}, one line per movement,
396
+ * newest first), at most 5,000 rows — the last line says when it was cut.
397
+ * Hand the text to the person as `credit-history.csv`.
398
+ */
399
+ exportHistory(filters?: CreditHistoryFilters): Promise<string>;
222
400
  /**
223
401
  * `POST /v1/credits/model-costs` → per-identifier credit cost, for editor
224
402
  * cost previews. Capped at the first {@link MODEL_COSTS_LIMIT} identifiers
@@ -269,4 +447,4 @@ declare class CreditsResource {
269
447
  markWelcomeOfferSeen(): Promise<WelcomeOfferSeenResult>;
270
448
  }
271
449
 
272
- export { type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
450
+ export { type CreditHistoryEntry, type CreditHistoryFilters, type CreditHistoryJob, type CreditHistoryKind, type CreditHistoryOptions, type CreditHistoryPage, type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UsageByCategory, type UsageByGroup, type UsageByModel, type UsageOverTime, type UsageSummary, type UsageSummaryBucket, type UsageSummaryOptions, type UsageSummaryTotals, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
@@ -1,4 +1,4 @@
1
1
  import '../chunk-V4GPQ6Y2.js';
2
- export { CreditsResource } from '../chunk-5MOJSYHI.js';
2
+ export { CreditsResource } from '../chunk-7QK2NXJA.js';
3
3
  //# sourceMappingURL=credits.js.map
4
4
  //# sourceMappingURL=credits.js.map
package/dist/index.cjs CHANGED
@@ -52,7 +52,7 @@ require('./chunk-IS26FJO7.cjs');
52
52
  require('./chunk-RQSGS7ZK.cjs');
53
53
  require('./chunk-43NO4SGC.cjs');
54
54
  require('./chunk-JOX5BJ6K.cjs');
55
- var chunkPPP6VZ3I_cjs = require('./chunk-PPP6VZ3I.cjs');
55
+ var chunkHPSENMVN_cjs = require('./chunk-HPSENMVN.cjs');
56
56
  var chunkJTOEHQQJ_cjs = require('./chunk-JTOEHQQJ.cjs');
57
57
  var chunkW5VHATSR_cjs = require('./chunk-W5VHATSR.cjs');
58
58
  var chunkR63TTR35_cjs = require('./chunk-R63TTR35.cjs');
@@ -95,14 +95,14 @@ var chunk43FVH6LJ_cjs = require('./chunk-43FVH6LJ.cjs');
95
95
  var chunkYFS2LMG4_cjs = require('./chunk-YFS2LMG4.cjs');
96
96
  var chunkOSMKIRKI_cjs = require('./chunk-OSMKIRKI.cjs');
97
97
  require('./chunk-FRQJNGJS.cjs');
98
- var chunkNOBQQTAG_cjs = require('./chunk-NOBQQTAG.cjs');
98
+ var chunkOMX7JBGY_cjs = require('./chunk-OMX7JBGY.cjs');
99
99
  var chunkFM2KM5TY_cjs = require('./chunk-FM2KM5TY.cjs');
100
100
  var chunkHGCVWOGK_cjs = require('./chunk-HGCVWOGK.cjs');
101
- var chunkFIMBPKIH_cjs = require('./chunk-FIMBPKIH.cjs');
101
+ var chunk4BAHF762_cjs = require('./chunk-4BAHF762.cjs');
102
102
  var chunkA3S55XGF_cjs = require('./chunk-A3S55XGF.cjs');
103
103
  var chunkJOXZ4ZIF_cjs = require('./chunk-JOXZ4ZIF.cjs');
104
104
  var chunkGA4LZZKQ_cjs = require('./chunk-GA4LZZKQ.cjs');
105
- var chunkNGKODS3J_cjs = require('./chunk-NGKODS3J.cjs');
105
+ var chunk6FZN3QQO_cjs = require('./chunk-6FZN3QQO.cjs');
106
106
  var chunkTY2S25W5_cjs = require('./chunk-TY2S25W5.cjs');
107
107
  var chunkBPWUWUZ3_cjs = require('./chunk-BPWUWUZ3.cjs');
108
108
  var chunkHAKYPZLB_cjs = require('./chunk-HAKYPZLB.cjs');
@@ -143,11 +143,11 @@ Object.defineProperty(exports, "unwrapEditPlanOutput", {
143
143
  });
144
144
  Object.defineProperty(exports, "NodaroClient", {
145
145
  enumerable: true,
146
- get: function () { return chunkPPP6VZ3I_cjs.NodaroClient; }
146
+ get: function () { return chunkHPSENMVN_cjs.NodaroClient; }
147
147
  });
148
148
  Object.defineProperty(exports, "createClient", {
149
149
  enumerable: true,
150
- get: function () { return chunkPPP6VZ3I_cjs.createClient; }
150
+ get: function () { return chunkHPSENMVN_cjs.createClient; }
151
151
  });
152
152
  Object.defineProperty(exports, "UploadsResource", {
153
153
  enumerable: true,
@@ -395,19 +395,19 @@ Object.defineProperty(exports, "CopilotResource", {
395
395
  });
396
396
  Object.defineProperty(exports, "CallbackAuth", {
397
397
  enumerable: true,
398
- get: function () { return chunkNOBQQTAG_cjs.CallbackAuth; }
398
+ get: function () { return chunkOMX7JBGY_cjs.CallbackAuth; }
399
399
  });
400
400
  Object.defineProperty(exports, "NodaroClientCore", {
401
401
  enumerable: true,
402
- get: function () { return chunkNOBQQTAG_cjs.NodaroClientCore; }
402
+ get: function () { return chunkOMX7JBGY_cjs.NodaroClientCore; }
403
403
  });
404
404
  Object.defineProperty(exports, "StaticTokenAuth", {
405
405
  enumerable: true,
406
- get: function () { return chunkNOBQQTAG_cjs.StaticTokenAuth; }
406
+ get: function () { return chunkOMX7JBGY_cjs.StaticTokenAuth; }
407
407
  });
408
408
  Object.defineProperty(exports, "supabaseAuth", {
409
409
  enumerable: true,
410
- get: function () { return chunkNOBQQTAG_cjs.supabaseAuth; }
410
+ get: function () { return chunkOMX7JBGY_cjs.supabaseAuth; }
411
411
  });
412
412
  Object.defineProperty(exports, "AlreadyRunningError", {
413
413
  enumerable: true,
@@ -523,7 +523,7 @@ Object.defineProperty(exports, "CreaturesResource", {
523
523
  });
524
524
  Object.defineProperty(exports, "CreditsResource", {
525
525
  enumerable: true,
526
- get: function () { return chunkFIMBPKIH_cjs.CreditsResource; }
526
+ get: function () { return chunk4BAHF762_cjs.CreditsResource; }
527
527
  });
528
528
  Object.defineProperty(exports, "DeveloperAppsResource", {
529
529
  enumerable: true,
@@ -539,7 +539,7 @@ Object.defineProperty(exports, "AudioResource", {
539
539
  });
540
540
  Object.defineProperty(exports, "BillingResource", {
541
541
  enumerable: true,
542
- get: function () { return chunkNGKODS3J_cjs.BillingResource; }
542
+ get: function () { return chunk6FZN3QQO_cjs.BillingResource; }
543
543
  });
544
544
  Object.defineProperty(exports, "CastSwapResource", {
545
545
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AppRun, AppRunResult, AppRunResumePlan, AppRunResumeRefusalCode, AppRunResumeResult, AppRunResumeStep, AppsResource, DeleteAppRunResult, ListAppRunsParams, ListAppsParams, ListAppsResult, PublishedApp, PublishedAppDetail, ResumeAppRunOptions, RunAppOptions } from './entries/apps.cjs';
2
2
  export { AudioResource, TranscribeJobOutput, TranscribeWord } from './entries/audio.cjs';
3
- export { BillingAccountSummary, BillingMoney, BillingMonthlyPrice, BillingPlan, BillingPlanPrices, BillingPlansResult, BillingPriceCredits, BillingResource, BillingSubscription, BillingSubscriptionResult, BillingSurface, BillingTopUp, BillingUsageCategory, BillingYearlyPrice } from './entries/billing.cjs';
3
+ export { BillingAccountSummary, BillingAutoRecharge, BillingAutoRechargeInput, BillingAutoRechargeSaved, BillingCard, BillingChangePlanInput, BillingChangePlanResult, BillingCheckoutInput, BillingCheckoutSession, BillingDetails, BillingDocument, BillingLoadInput, BillingLoadSession, BillingMoney, BillingMonthlyPrice, BillingPaymentMethod, BillingPlan, BillingPlanPrices, BillingPlansResult, BillingPortalInput, BillingPortalSession, BillingPriceCredits, BillingPurchase, BillingResource, BillingSubscription, BillingSubscriptionResult, BillingSurface, BillingTopUp, BillingUsageCategory, BillingYearlyPrice } from './entries/billing.cjs';
4
4
  export { CastSwapEngine, CastSwapEngineLegacyId, CastSwapEstimate, CastSwapFaceMasking, CastSwapFaceMaskingZone, CastSwapFullQualityEstimate, CastSwapFullQualityKind, CastSwapFullQualityParams, CastSwapFullQualityRefusalCode, CastSwapFullQualityResult, CastSwapKlingLength, CastSwapLocationRole, CastSwapMotionLength, CastSwapParams, CastSwapPersonRole, CastSwapPetRole, CastSwapProductRole, CastSwapReference, CastSwapResource, CastSwapRole, CastSwapRolePreviewSettings, CastSwapRunOptions, CastSwapTraitSource } from './entries/cast-swap.cjs';
5
5
  export { CatalogsListResponse, CatalogsResource, ProjectedCatalog, ProjectedCatalogDimension, ProjectedCatalogOption, ProjectedCatalogSection } from './entries/catalogs.cjs';
6
6
  export { ApprovePortraitResult, Character, CharacterDetail, CharacterTrainingState, CharacterTrainingStatus, CharacterUsage, CharactersResource, DuplicateCharacterInput, GenerateAssetInput, GenerateCharacterInput, GenerateCharacterResult, GenerateMotionInput, GetCharacterOptions, ListCharactersParams, ListCharactersResult, RecaptionResult, ReferencePhoto, ReferencePhotoKind, TrainCharacterInput, TrainCharacterRefusalCode, TrainCharacterResult, UpsertCharacterInput, UpsertCharacterResult, buildPersonSeedPrompt } from './entries/characters.cjs';
@@ -13,7 +13,7 @@ export { ActionCard, ActionCardKind, ActionCardPriority, AdviceFamily, AdviceRec
13
13
  export { CompetitorsResource } from './entries/competitors.cjs';
14
14
  export { CopilotMemorySavedFrameData, CopilotMessage, CopilotMessagePart, CopilotMetadataFrameData, CopilotModelTier, CopilotResource, CopilotRunMode, CopilotRunProposalFrameData, CopilotRunProposalNode, CopilotStreamFrame, CopilotStreamOptions, CopilotSurface, CopilotThread, CopilotThreadWorkflow, CopilotToolCallFrameData, CopilotWiredAsset, CopilotWorkflowCreatedFrameData, CopilotWorkflowUpdateFrameData, CreateCopilotThreadInput } from './entries/copilot.cjs';
15
15
  export { ApproveCreatureMainImageResult, CREATURE_ASSET_TYPES, CreateCreatureInput, Creature, CreatureAssetType, CreatureDetail, CreatureReferencePhoto, CreatureReferencePhotoKind, CreatureVoice, CreaturesResource, GenerateCreatureAssetInput, GenerateCreatureAssetResult, GenerateCreatureInput, GenerateCreatureMotionInput, GenerateCreatureMotionResult, GenerateCreatureResult, ListCreaturesParams, RecaptionCreatureResult, UpdateCreatureInput, UpdateCreatureResult, UpsertCreatureInput, UpsertCreatureResult } from './entries/creatures.cjs';
16
- export { CreditTransaction, CreditTransactionsOptions, CreditTransactionsPage, CreditsResource, FreeGrantState, ModelCostError, ModelCostResult, ModelCostsResult, SignupGrantClaimResult, SignupKeys, UserBalance, WelcomeOfferClaimInput, WelcomeOfferClaimResult, WelcomeOfferSeenResult, WelcomeOfferState } from './entries/credits.cjs';
16
+ export { CreditHistoryEntry, CreditHistoryFilters, CreditHistoryJob, CreditHistoryKind, CreditHistoryOptions, CreditHistoryPage, CreditTransaction, CreditTransactionsOptions, CreditTransactionsPage, CreditsResource, FreeGrantState, ModelCostError, ModelCostResult, ModelCostsResult, SignupGrantClaimResult, SignupKeys, UsageByCategory, UsageByGroup, UsageByModel, UsageOverTime, UsageSummary, UsageSummaryBucket, UsageSummaryOptions, UsageSummaryTotals, UserBalance, WelcomeOfferClaimInput, WelcomeOfferClaimResult, WelcomeOfferSeenResult, WelcomeOfferState } from './entries/credits.cjs';
17
17
  export { ChapterSet, EditPlanMode, EditPlanTier, Edl, EdlClipSet, SpeakerMapResult, Transcript, unwrapEditPlanOutput } from '@nodaro/shared/edl';
18
18
  export { ApplyEdlInput, AudioSyncInput, AudioSyncOffset, AudioSyncResult, AudioSyncSource, CLIP_PACK_MAX_TARGET_SEC, CLIP_PACK_MIN_TARGET_SEC, CameraSwitchInput, ClipPackEmphasis, ClipPackInput, EditJobResult, EditPlanInput, EditPlanSource, EditResource, EpisodeChaptersInput, EpisodeTrailerInput, SilenceDetectInput, SilenceRanges, SpeakerLayoutInput, SpeakerMapInput, SpeakerMapSource, TRAILER_FORMATS, TightenEpisodeEstimate, TightenEpisodeInput, TightenEpisodeJobResult, TrailerFormat, UseCaseContinueInput, UseCaseEstimate, UseCaseJobResult, UseCaseRecordingsInput, UseCaseRequestOptions } from './entries/edit.cjs';
19
19
  export { AlreadyRunningError, AppRunVersionChangedError, CREDIT_CAP_CODES, ContinuationPreviewPendingError, ContinuationRefusedError, CreditCapCode, CreditCapExceededError, ForbiddenError, HeldFinalRun, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, NodaroError, NotFoundError, RateLimitedError, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, UnauthorizedError, WorkflowConflictCode, WorkflowConflictError, throwFromResponse } from './entries/errors.cjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AppRun, AppRunResult, AppRunResumePlan, AppRunResumeRefusalCode, AppRunResumeResult, AppRunResumeStep, AppsResource, DeleteAppRunResult, ListAppRunsParams, ListAppsParams, ListAppsResult, PublishedApp, PublishedAppDetail, ResumeAppRunOptions, RunAppOptions } from './entries/apps.js';
2
2
  export { AudioResource, TranscribeJobOutput, TranscribeWord } from './entries/audio.js';
3
- export { BillingAccountSummary, BillingMoney, BillingMonthlyPrice, BillingPlan, BillingPlanPrices, BillingPlansResult, BillingPriceCredits, BillingResource, BillingSubscription, BillingSubscriptionResult, BillingSurface, BillingTopUp, BillingUsageCategory, BillingYearlyPrice } from './entries/billing.js';
3
+ export { BillingAccountSummary, BillingAutoRecharge, BillingAutoRechargeInput, BillingAutoRechargeSaved, BillingCard, BillingChangePlanInput, BillingChangePlanResult, BillingCheckoutInput, BillingCheckoutSession, BillingDetails, BillingDocument, BillingLoadInput, BillingLoadSession, BillingMoney, BillingMonthlyPrice, BillingPaymentMethod, BillingPlan, BillingPlanPrices, BillingPlansResult, BillingPortalInput, BillingPortalSession, BillingPriceCredits, BillingPurchase, BillingResource, BillingSubscription, BillingSubscriptionResult, BillingSurface, BillingTopUp, BillingUsageCategory, BillingYearlyPrice } from './entries/billing.js';
4
4
  export { CastSwapEngine, CastSwapEngineLegacyId, CastSwapEstimate, CastSwapFaceMasking, CastSwapFaceMaskingZone, CastSwapFullQualityEstimate, CastSwapFullQualityKind, CastSwapFullQualityParams, CastSwapFullQualityRefusalCode, CastSwapFullQualityResult, CastSwapKlingLength, CastSwapLocationRole, CastSwapMotionLength, CastSwapParams, CastSwapPersonRole, CastSwapPetRole, CastSwapProductRole, CastSwapReference, CastSwapResource, CastSwapRole, CastSwapRolePreviewSettings, CastSwapRunOptions, CastSwapTraitSource } from './entries/cast-swap.js';
5
5
  export { CatalogsListResponse, CatalogsResource, ProjectedCatalog, ProjectedCatalogDimension, ProjectedCatalogOption, ProjectedCatalogSection } from './entries/catalogs.js';
6
6
  export { ApprovePortraitResult, Character, CharacterDetail, CharacterTrainingState, CharacterTrainingStatus, CharacterUsage, CharactersResource, DuplicateCharacterInput, GenerateAssetInput, GenerateCharacterInput, GenerateCharacterResult, GenerateMotionInput, GetCharacterOptions, ListCharactersParams, ListCharactersResult, RecaptionResult, ReferencePhoto, ReferencePhotoKind, TrainCharacterInput, TrainCharacterRefusalCode, TrainCharacterResult, UpsertCharacterInput, UpsertCharacterResult, buildPersonSeedPrompt } from './entries/characters.js';
@@ -13,7 +13,7 @@ export { ActionCard, ActionCardKind, ActionCardPriority, AdviceFamily, AdviceRec
13
13
  export { CompetitorsResource } from './entries/competitors.js';
14
14
  export { CopilotMemorySavedFrameData, CopilotMessage, CopilotMessagePart, CopilotMetadataFrameData, CopilotModelTier, CopilotResource, CopilotRunMode, CopilotRunProposalFrameData, CopilotRunProposalNode, CopilotStreamFrame, CopilotStreamOptions, CopilotSurface, CopilotThread, CopilotThreadWorkflow, CopilotToolCallFrameData, CopilotWiredAsset, CopilotWorkflowCreatedFrameData, CopilotWorkflowUpdateFrameData, CreateCopilotThreadInput } from './entries/copilot.js';
15
15
  export { ApproveCreatureMainImageResult, CREATURE_ASSET_TYPES, CreateCreatureInput, Creature, CreatureAssetType, CreatureDetail, CreatureReferencePhoto, CreatureReferencePhotoKind, CreatureVoice, CreaturesResource, GenerateCreatureAssetInput, GenerateCreatureAssetResult, GenerateCreatureInput, GenerateCreatureMotionInput, GenerateCreatureMotionResult, GenerateCreatureResult, ListCreaturesParams, RecaptionCreatureResult, UpdateCreatureInput, UpdateCreatureResult, UpsertCreatureInput, UpsertCreatureResult } from './entries/creatures.js';
16
- export { CreditTransaction, CreditTransactionsOptions, CreditTransactionsPage, CreditsResource, FreeGrantState, ModelCostError, ModelCostResult, ModelCostsResult, SignupGrantClaimResult, SignupKeys, UserBalance, WelcomeOfferClaimInput, WelcomeOfferClaimResult, WelcomeOfferSeenResult, WelcomeOfferState } from './entries/credits.js';
16
+ export { CreditHistoryEntry, CreditHistoryFilters, CreditHistoryJob, CreditHistoryKind, CreditHistoryOptions, CreditHistoryPage, CreditTransaction, CreditTransactionsOptions, CreditTransactionsPage, CreditsResource, FreeGrantState, ModelCostError, ModelCostResult, ModelCostsResult, SignupGrantClaimResult, SignupKeys, UsageByCategory, UsageByGroup, UsageByModel, UsageOverTime, UsageSummary, UsageSummaryBucket, UsageSummaryOptions, UsageSummaryTotals, UserBalance, WelcomeOfferClaimInput, WelcomeOfferClaimResult, WelcomeOfferSeenResult, WelcomeOfferState } from './entries/credits.js';
17
17
  export { ChapterSet, EditPlanMode, EditPlanTier, Edl, EdlClipSet, SpeakerMapResult, Transcript, unwrapEditPlanOutput } from '@nodaro/shared/edl';
18
18
  export { ApplyEdlInput, AudioSyncInput, AudioSyncOffset, AudioSyncResult, AudioSyncSource, CLIP_PACK_MAX_TARGET_SEC, CLIP_PACK_MIN_TARGET_SEC, CameraSwitchInput, ClipPackEmphasis, ClipPackInput, EditJobResult, EditPlanInput, EditPlanSource, EditResource, EpisodeChaptersInput, EpisodeTrailerInput, SilenceDetectInput, SilenceRanges, SpeakerLayoutInput, SpeakerMapInput, SpeakerMapSource, TRAILER_FORMATS, TightenEpisodeEstimate, TightenEpisodeInput, TightenEpisodeJobResult, TrailerFormat, UseCaseContinueInput, UseCaseEstimate, UseCaseJobResult, UseCaseRecordingsInput, UseCaseRequestOptions } from './entries/edit.js';
19
19
  export { AlreadyRunningError, AppRunVersionChangedError, CREDIT_CAP_CODES, ContinuationPreviewPendingError, ContinuationRefusedError, CreditCapCode, CreditCapExceededError, ForbiddenError, HeldFinalRun, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, NodaroError, NotFoundError, RateLimitedError, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, UnauthorizedError, WorkflowConflictCode, WorkflowConflictError, throwFromResponse } from './entries/errors.js';
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ import './chunk-M6Y5TOYE.js';
50
50
  import './chunk-KARJ7P7Y.js';
51
51
  import './chunk-SUCHGNYT.js';
52
52
  import './chunk-SLPD47SR.js';
53
- export { NodaroClient, createClient } from './chunk-2JAKOBD3.js';
53
+ export { NodaroClient, createClient } from './chunk-EC6MC46Y.js';
54
54
  export { UploadsResource } from './chunk-WY4QRJZW.js';
55
55
  export { VideoProResource } from './chunk-ERLXU47J.js';
56
56
  export { VoicesResource } from './chunk-T7N7DFQJ.js';
@@ -93,14 +93,14 @@ export { CommunityResource } from './chunk-SFB4YLCS.js';
93
93
  export { CompetitorsResource } from './chunk-BU5A6K4C.js';
94
94
  export { CopilotResource } from './chunk-D2ILCSOQ.js';
95
95
  import './chunk-7CUWAVWB.js';
96
- export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from './chunk-5MZYOJCJ.js';
96
+ export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from './chunk-XISHBW5I.js';
97
97
  export { AlreadyRunningError, AppRunVersionChangedError, CREDIT_CAP_CODES, ContinuationPreviewPendingError, ContinuationRefusedError, CreditCapExceededError, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, NodaroError, NotFoundError, RateLimitedError, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, UnauthorizedError, WorkflowConflictError, throwFromResponse } from './chunk-L6T44A3G.js';
98
98
  export { OBJECT_ASPECT_DEFAULTS as CREATURE_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS as CREATURE_ASPECT_OPTIONS, CREATURE_ASSET_TYPES, CREATURE_ATTACH_COLUMNS, CreaturesResource } from './chunk-CK3AMMSC.js';
99
- export { CreditsResource } from './chunk-5MOJSYHI.js';
99
+ export { CreditsResource } from './chunk-7QK2NXJA.js';
100
100
  export { DeveloperAppsResource } from './chunk-65E3JBFZ.js';
101
101
  export { AppsResource } from './chunk-7LODCIQK.js';
102
102
  export { AudioResource } from './chunk-3QFTP5P5.js';
103
- export { BillingResource } from './chunk-J4WFSKY6.js';
103
+ export { BillingResource } from './chunk-WYYDWJFF.js';
104
104
  export { CastSwapResource } from './chunk-OCRUDBPG.js';
105
105
  export { CatalogsResource } from './chunk-KG4R454Z.js';
106
106
  export { CHARACTER_ASPECT_DEFAULTS, CHARACTER_ASPECT_OPTIONS, CHARACTER_STYLES, CharactersResource, PEOPLE, PERSON_DIMENSION_LABELS, PERSON_DIMENSION_ORDER, buildPersonHints, buildPersonSeedPrompt } from './chunk-EJSGJDZY.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodaro/sdk",
3
- "version": "2.49.0",
3
+ "version": "2.51.0",
4
4
  "description": "Typed REST client for the Nodaro API — workflows, jobs, executions, apps, characters, and more.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resources/credits.ts"],"names":[],"mappings":";AAuNA,IAAM,iBAAA,GAAoB,EAAA;AAEnB,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,MAAM,OAAA,GAAgC;AACpC,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA;AAAA,MAC5B,KAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,OAAO,GAAA,CAAI,IAAA;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,YAAA,CAAa,OAAA,GAAqC,EAAC,EAAoC;AACrF,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAgC,KAAA,EAAO,0BAAA,EAA4B;AAAA,MACpF,OAAO,EAAE,KAAA,EAAO,QAAQ,KAAA,EAAO,MAAA,EAAQ,QAAQ,MAAA;AAAO,KACvD,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAW,GAAA,EAA0C;AACnD,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAA0B,MAAA,EAAQ,yBAAA,EAA2B;AAAA,MAC9E,MAAM,EAAE,MAAA,EAAQ,IAAI,KAAA,CAAM,CAAA,EAAG,iBAAiB,CAAA;AAAE,KACjD,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,gBAAA,CAAiB,IAAA,GAAmB,EAAC,EAAoC;AACvE,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAgC,MAAA,EAAQ,gCAAA,EAAkC;AAAA,MAC3F,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,iBAAA,CAAkB,KAAA,GAAgC,EAAC,EAAqC;AACtF,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAiC,MAAA,EAAQ,iCAAA,EAAmC;AAAA,MAC7F,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,oBAAA,GAAwD;AACtD,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAgC,MAAA,EAAQ,gCAAgC,CAAA;AAAA,EAC7F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUF","file":"chunk-5MOJSYHI.js","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\n\n/**\n * Authenticated user's credit balance — the shape of `GET /v1/user/credits`'s\n * `data` field. Mirrors the canonical `UserBalance` from the backend billing\n * module (`backend/src/ee/billing/credits.ts`), the source of truth: keep this\n * in sync if that interface changes.\n */\nexport interface UserBalance {\n total: number\n subscription: number\n topup: number\n dailySpent: number\n dailyLimit: number | null\n monthlyAllocation: number\n /** Stored billing tier. Display should prefer `effectiveTier`. */\n tier: string\n /** Derived entitlement tier: \"payg\" when stored-free with purchased credits. */\n effectiveTier: string\n features: Record<string, unknown>\n periodEnd: string | null\n /** Credits earned for app usage (free tier only — earned by running flows). */\n appCreditsAllowance: number\n /** Present when a deployment uses an external shared wallet. Raw credits;\n * null means unavailable. Do not substitute the personal `total` balance. */\n externalWallet?: { available: number | null }\n /**\n * Where the account's free signup grant stands. `\"withheld\"` means the\n * account works but the grant did not land — show the activation path.\n * Absent where the deployment has no signup grant.\n */\n freeGrantState?: FreeGrantState\n /**\n * Present only with `freeGrantState: \"withheld\"`, when the claim showed no\n * browser signals at all: the app may say \"free credits need a regular\n * browser — reload\", because a reload in one judges the account again.\n */\n freeGrantNotice?: \"browser_unmeasured\"\n /**\n * The welcome-credits opt-in. PRESENT only while the deployment has the\n * offer switched on — absent means \"no popup, no banner, no block\".\n */\n welcomeOffer?: WelcomeOfferState\n}\n\n/** Where an account's free signup grant stands. */\nexport type FreeGrantState = \"unclaimed\" | \"granted\" | \"withheld\" | \"revoked\"\n\n/** `UserBalance.welcomeOffer` — what an app needs to show the welcome offer. */\nexport interface WelcomeOfferState {\n /** The one-time popup was already shown (see `markWelcomeOfferSeen`). */\n popupSeen: boolean\n /**\n * The account already has its credits (granted elsewhere) but still owes\n * the email consent: the web apps block creation until it is given — the\n * claim records it.\n */\n consentPending: boolean\n /** The credits a claim grants. Name this figure in the offer; never hard-code it. */\n credits: number\n}\n\n/** What `claimWelcomeOffer` sends: the browser signals plus the app answering. */\nexport interface WelcomeOfferClaimInput extends SignupKeys {\n /**\n * The answering app's slug (lowercase letters, digits and `-`, up to 40\n * characters), recorded with the consent. A value outside that grammar is\n * stored as absent, never refused.\n */\n sourceApp?: string\n /**\n * The interface language the user answered in — the id of a language Nodaro\n * ships, such as `\"en\"`, `\"ja\"` or `\"pt-BR\"`. Matched exactly and\n * case-sensitively: `\"en-US\"` or `\"pt-br\"` is stored as absent, never refused.\n * Recorded with the consent as the language of the LATEST consent: a later\n * \"yes\" in another language replaces it.\n */\n locale?: string\n}\n\n/** The answer of `POST /v1/credits/welcome-offer/claim`. */\nexport interface WelcomeOfferClaimResult {\n /** The email consent is recorded. */\n consent: \"granted\"\n /** Where the free grant stands after the claim — `\"withheld\"` when the abuse gate refused it. */\n grant: FreeGrantState\n /** The grant's figure. A grant tops the subscription credits UP TO it (it is not added on top), so a claim that lands it leaves the subscription credits at no less than this. */\n credits: number\n}\n\n/** The answer of `POST /v1/credits/welcome-offer/seen`. */\nexport interface WelcomeOfferSeenResult {\n ok: true\n}\n\n/**\n * Result of `POST /v1/credits/model-costs` — a batch cost lookup for editor\n * cost previews. `data` maps each priced identifier → its credit cost.\n *\n * Per-model fault isolation (the route runs the lookups under\n * `Promise.allSettled`): identifiers with no pricing row are reported in\n * `missing` (undisplayable until an operator seeds a price) and lookup\n * failures in `errors`, instead of failing the whole batch. Callers typically\n * render `'—'` for any identifier that lands in `missing`. The hard-fail\n * policy still triggers at reservation time when the user actually runs the\n * node — this preview lookup is intentionally lenient.\n */\nexport interface ModelCostsResult {\n data: Record<string, number>\n missing: string[]\n errors: string[]\n /**\n * Why each identifier in `errors` has no price — today only\n * `llm_model_unpriced`: a metered LLM price key whose model has no rate on\n * the lane it would be served on (it cannot be run). Omitted when `errors`\n * is empty.\n */\n errorCodes?: Record<string, ModelCostError>\n /**\n * The identifiers in `data` whose figure is an ESTIMATE, not a fixed price:\n * metered LLM price keys (`llmPriceKey` from `@nodaro/shared/llm-models`,\n * `<feature>:<model>[:direct]`), charged on what the call actually uses.\n * Show these as `≈N`. Omitted when there are none, so a batch of fixed ids\n * answers exactly as it always has. A metered key that lands in `missing`\n * instead means the server is not pricing LLM calls per model — show no\n * price for it.\n */\n estimates?: string[]\n}\n\n/** {@link ModelCostsResult.errorCodes} — why an identifier has no price. */\nexport interface ModelCostError {\n /** Today only `llm_model_unpriced`; open to codes a newer server may add. */\n code: \"llm_model_unpriced\" | (string & {})\n /** A sentence to show the user. */\n message: string\n}\n\n/**\n * Result of `GET /v1/credits/model-cost?model=<id>` (`data`): the credits one\n * identifier is charged. `estimate: true` marks a metered LLM price key's\n * figure as an estimate (show it as `≈N`); such an answer is never cached.\n */\nexport interface ModelCostResult {\n model: string\n creditCost: number\n estimate?: true\n}\n\n/**\n * The two browser signals a claim reports — SHA-256 hex digests computed by\n * `@nodaro/sdk/signup-signals` (`collectSignupKeys`). Either may be absent:\n * a browser that cannot be measured still claims, and the server treats the\n * absence as what it is. Any other value is stored as absent server-side.\n */\nexport interface SignupKeys {\n browserKey?: string\n deviceKey?: string\n}\n\n/** The answer of `POST /v1/credits/claim-signup-grant`. */\nexport interface SignupGrantClaimResult {\n /** Where the account's free grant stands after this call. */\n state: FreeGrantState\n /** True only when THIS call moved the credits — a repeat is `false` with the same state. */\n granted: boolean\n}\n\n/**\n * One row of `GET /v1/credits/transactions` — a run's reservation and how it\n * settled.\n *\n * Which amount to read: a run first HOLDS credits and is then settled — charged\n * all or part of the hold, the rest returned. `credits_charged` is what the run\n * cost (`null` while the hold is still open, `0` once refunded); sum it for\n * spend. `credits_reserved` is the hold, which never changes. `credits_used`\n * is the same hold under its original name, kept for existing integrations.\n */\nexport interface CreditTransaction {\n id: string\n /** ISO-8601. Also the paging cursor: pass the last row's value as `cursor`. */\n created_at: string\n /** Settled charge; `null` while `status` is `\"reserved\"`, `0` when refunded. */\n credits_charged: number | null\n /** The hold taken when the run was accepted. */\n credits_reserved: number | null\n /** The hold, under its original name. Prefer `credits_charged`. */\n credits_used: number | null\n /** The model or operation the credits were for. */\n action: string | null\n provider: string | null\n /** Reservation lifecycle: `\"reserved\"`, `\"committed\"` or `\"refunded\"`. */\n status: string | null\n /** The caller's own billing details for the run (model, which pool paid, …). */\n metadata: Record<string, unknown>\n /** `\"workspace\"` when a class or team budget paid, not your balance. */\n payer: \"user\" | \"workspace\"\n workspaceId: string | null\n}\n\n/** A page of {@link CreditTransaction}s, newest first. */\nexport interface CreditTransactionsPage {\n data: CreditTransaction[]\n /** Pass as `cursor` for the next page; `null` when there are no more rows. */\n nextCursor: string | null\n}\n\nexport interface CreditTransactionsOptions {\n /** Rows per page, 1–50 (server default 20). */\n limit?: number\n /** The `nextCursor` of the previous page. */\n cursor?: string\n}\n\n/** Max identifiers per `model-costs` batch — the route caps the request at 50. */\nconst MODEL_COSTS_LIMIT = 50\n\nexport class CreditsResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * `GET /v1/user/credits` → the authenticated user's credit balance and tier\n * info. Throws `UnauthorizedError` (401) when signed out, and the SDK's\n * other typed errors on the usual statuses.\n */\n async balance(): Promise<UserBalance> {\n const res = await this.client.request<{ data: UserBalance }>(\n \"GET\",\n \"/v1/user/credits\",\n )\n return res.data\n }\n\n /**\n * `GET /v1/credits/transactions` → one page of the caller's credit\n * transactions, newest first, with `nextCursor` for the next page (`null`\n * at the end). Read `credits_charged` for what each run cost — it can be\n * below the hold (`credits_reserved`) and is `null` while the hold is open.\n * Cloud-only route: a self-hosted instance answers 404.\n */\n transactions(options: CreditTransactionsOptions = {}): Promise<CreditTransactionsPage> {\n return this.client.request<CreditTransactionsPage>(\"GET\", \"/v1/credits/transactions\", {\n query: { limit: options.limit, cursor: options.cursor },\n })\n }\n\n /**\n * `POST /v1/credits/model-costs` → per-identifier credit cost, for editor\n * cost previews. Capped at the first {@link MODEL_COSTS_LIMIT} identifiers\n * (the route's request limit). Preserves the `{ data, missing, errors }`\n * fault-isolation shape verbatim, plus `estimates` / `errorCodes` when a\n * metered LLM price key was asked (see {@link ModelCostsResult}).\n */\n modelCosts(ids: string[]): Promise<ModelCostsResult> {\n return this.client.request<ModelCostsResult>(\"POST\", \"/v1/credits/model-costs\", {\n body: { models: ids.slice(0, MODEL_COSTS_LIMIT) },\n })\n }\n\n /**\n * `POST /v1/credits/claim-signup-grant` → claims the account's free signup\n * grant, once, with the browser signals of the page making the claim.\n *\n * Call it once per page load as soon as the session is known, and never\n * wait on it for rendering: it is idempotent (a decided account answers\n * with its state and `granted: false`), it costs the user nothing when it\n * fails (the next load asks again), and the signals are what make the\n * claim worth sending — collect them with `collectSignupKeys()` from\n * `@nodaro/sdk/signup-signals` and pass whatever came back, `{}` included.\n * Cloud-only route: a self-hosted instance answers 404.\n */\n claimSignupGrant(keys: SignupKeys = {}): Promise<SignupGrantClaimResult> {\n return this.client.request<SignupGrantClaimResult>(\"POST\", \"/v1/credits/claim-signup-grant\", {\n body: keys,\n })\n }\n\n /**\n * `POST /v1/credits/welcome-offer/claim` → the user's \"yes\" to the welcome\n * offer, as ONE server action: the marketing-email consent is recorded,\n * then the free signup grant is claimed with that consent. The abuse gate\n * still decides — consent is necessary, not sufficient — so read `grant`:\n * `\"granted\"` (the grant has landed: this call topped the subscription credits up to `credits` — not added on top — or it had landed before), `\"withheld\"` (refused), `\"revoked\"` (taken back earlier; nothing moves), `\"unclaimed\"` (nothing moved — treat as a failure and let the user retry).\n * Pass the browser signals from `collectSignupKeys()` and your app's slug.\n *\n * **Browser session only.** Usable from a first-party web app signed in\n * with a Supabase session (the consent is a person's choice in a browser);\n * an API key or OAuth app token is refused with 403. 409\n * `welcome_offer_disabled` while the deployment has the offer off — show\n * it only when `balance().welcomeOffer` is present. Cloud-only route: a\n * self-hosted instance answers 404.\n */\n claimWelcomeOffer(input: WelcomeOfferClaimInput = {}): Promise<WelcomeOfferClaimResult> {\n return this.client.request<WelcomeOfferClaimResult>(\"POST\", \"/v1/credits/welcome-offer/claim\", {\n body: input,\n })\n }\n\n /**\n * `POST /v1/credits/welcome-offer/seen` → records that the one-time welcome\n * popup was shown, so `balance().welcomeOffer.popupSeen` turns true on every\n * app. Idempotent (the first stamp wins); a failed call only means the popup\n * may show once more, so callers usually ignore errors.\n *\n * **Browser session only**, like {@link claimWelcomeOffer}: 403 for an API\n * key or OAuth app token, 409 `welcome_offer_disabled` while the offer is\n * off, 404 on a self-hosted instance.\n */\n markWelcomeOfferSeen(): Promise<WelcomeOfferSeenResult> {\n return this.client.request<WelcomeOfferSeenResult>(\"POST\", \"/v1/credits/welcome-offer/seen\")\n }\n\n // NOTE: no `estimate(...)` helper. The backend exposes\n // `POST /v1/credits/estimate-workflow` (body `{ nodes }` → `{ data: {\n // totalCredits, nodeCount, estimate?: true } }` — `estimate` when a metered\n // LLM node's estimate is in the total), but no consumer has a settled shape for it\n // yet (studio pre-checks `balance >= Σ modelCosts` client-side rather than\n // calling an estimate endpoint). Adding it now would be inventing an API\n // surface ahead of a real caller, so it's deliberately omitted — add it when\n // a consumer needs it, shaped to that need.\n}\n"]}