@nodaro/sdk 2.49.0 → 2.52.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 (57) 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-5MOJSYHI.js → chunk-7QK2NXJA.js} +43 -2
  4. package/dist/chunk-7QK2NXJA.js.map +1 -0
  5. package/dist/{chunk-PPP6VZ3I.cjs → chunk-AY7XKACE.cjs} +12 -8
  6. package/dist/chunk-AY7XKACE.cjs.map +1 -0
  7. package/dist/{chunk-NOBQQTAG.cjs → chunk-FDTE4C5W.cjs} +3 -3
  8. package/dist/{chunk-NOBQQTAG.cjs.map → chunk-FDTE4C5W.cjs.map} +1 -1
  9. package/dist/chunk-ISKOLJJJ.cjs +4 -0
  10. package/dist/chunk-ISKOLJJJ.cjs.map +1 -0
  11. package/dist/chunk-K6BWJ7ZY.js +3 -0
  12. package/dist/chunk-K6BWJ7ZY.js.map +1 -0
  13. package/dist/chunk-LR5TGCJP.js +31 -0
  14. package/dist/chunk-LR5TGCJP.js.map +1 -0
  15. package/dist/{chunk-5MZYOJCJ.js → chunk-NFVYOMNV.js} +3 -3
  16. package/dist/{chunk-5MZYOJCJ.js.map → chunk-NFVYOMNV.js.map} +1 -1
  17. package/dist/chunk-TVPYDC5T.cjs +146 -0
  18. package/dist/chunk-TVPYDC5T.cjs.map +1 -0
  19. package/dist/chunk-UIDVH3GP.cjs +33 -0
  20. package/dist/chunk-UIDVH3GP.cjs.map +1 -0
  21. package/dist/{chunk-2JAKOBD3.js → chunk-WUVTKMAQ.js} +9 -5
  22. package/dist/chunk-WUVTKMAQ.js.map +1 -0
  23. package/dist/chunk-ZVKEPVDQ.js +144 -0
  24. package/dist/chunk-ZVKEPVDQ.js.map +1 -0
  25. package/dist/entries/billing.cjs +2 -2
  26. package/dist/entries/billing.d.cts +209 -3
  27. package/dist/entries/billing.d.ts +209 -3
  28. package/dist/entries/billing.js +1 -1
  29. package/dist/entries/client.cjs +10 -9
  30. package/dist/entries/client.d.cts +3 -0
  31. package/dist/entries/client.d.ts +3 -0
  32. package/dist/entries/client.js +5 -4
  33. package/dist/entries/core.cjs +5 -5
  34. package/dist/entries/core.js +1 -1
  35. package/dist/entries/credits.cjs +2 -2
  36. package/dist/entries/credits.d.cts +179 -1
  37. package/dist/entries/credits.d.ts +179 -1
  38. package/dist/entries/credits.js +1 -1
  39. package/dist/entries/user-settings.cjs +13 -0
  40. package/dist/entries/user-settings.cjs.map +1 -0
  41. package/dist/entries/user-settings.d.cts +115 -0
  42. package/dist/entries/user-settings.d.ts +115 -0
  43. package/dist/entries/user-settings.js +4 -0
  44. package/dist/entries/user-settings.js.map +1 -0
  45. package/dist/index.cjs +18 -12
  46. package/dist/index.d.cts +3 -2
  47. package/dist/index.d.ts +3 -2
  48. package/dist/index.js +6 -4
  49. package/package.json +6 -1
  50. package/dist/chunk-2JAKOBD3.js.map +0 -1
  51. package/dist/chunk-5MOJSYHI.js.map +0 -1
  52. package/dist/chunk-FIMBPKIH.cjs.map +0 -1
  53. package/dist/chunk-J4WFSKY6.js +0 -50
  54. package/dist/chunk-J4WFSKY6.js.map +0 -1
  55. package/dist/chunk-NGKODS3J.cjs +0 -52
  56. package/dist/chunk-NGKODS3J.cjs.map +0 -1
  57. package/dist/chunk-PPP6VZ3I.cjs.map +0 -1
@@ -25,6 +25,7 @@ import { MediaResource } from './media.js';
25
25
  import { AudioResource } from './audio.js';
26
26
  import { CreditsResource } from './credits.js';
27
27
  import { BillingResource } from './billing.js';
28
+ import { UserSettingsResource } from './user-settings.js';
28
29
  import { UploadsResource } from './uploads.js';
29
30
  import { LibraryResource } from './library.js';
30
31
  import { GalleryResource } from './gallery.js';
@@ -105,6 +106,8 @@ declare class NodaroClient extends NodaroClientCore {
105
106
  readonly media: MediaResource;
106
107
  readonly audio: AudioResource;
107
108
  readonly credits: CreditsResource;
109
+ /** The signed-in person's own settings (the interface language, the monthly statement opt-in, …). */
110
+ readonly userSettings: UserSettingsResource;
108
111
  /** Plans and prices, the subscription, and how this deployment bills. */
109
112
  readonly billing: BillingResource;
110
113
  readonly uploads: UploadsResource;
@@ -1,5 +1,6 @@
1
- export { NodaroClient, createClient } from '../chunk-2JAKOBD3.js';
1
+ export { NodaroClient, createClient } from '../chunk-WUVTKMAQ.js';
2
2
  import '../chunk-WY4QRJZW.js';
3
+ import '../chunk-LR5TGCJP.js';
3
4
  import '../chunk-ERLXU47J.js';
4
5
  import '../chunk-T7N7DFQJ.js';
5
6
  import '../chunk-YN6CBIIB.js';
@@ -41,14 +42,14 @@ import '../chunk-SFB4YLCS.js';
41
42
  import '../chunk-BU5A6K4C.js';
42
43
  import '../chunk-D2ILCSOQ.js';
43
44
  import '../chunk-7CUWAVWB.js';
44
- export { CallbackAuth, StaticTokenAuth, supabaseAuth } from '../chunk-5MZYOJCJ.js';
45
+ export { CallbackAuth, StaticTokenAuth, supabaseAuth } from '../chunk-NFVYOMNV.js';
45
46
  import '../chunk-L6T44A3G.js';
46
47
  import '../chunk-CK3AMMSC.js';
47
- import '../chunk-5MOJSYHI.js';
48
+ import '../chunk-7QK2NXJA.js';
48
49
  import '../chunk-65E3JBFZ.js';
49
50
  import '../chunk-7LODCIQK.js';
50
51
  import '../chunk-3QFTP5P5.js';
51
- import '../chunk-J4WFSKY6.js';
52
+ import '../chunk-ZVKEPVDQ.js';
52
53
  import '../chunk-OCRUDBPG.js';
53
54
  import '../chunk-KG4R454Z.js';
54
55
  import '../chunk-EJSGJDZY.js';
@@ -1,26 +1,26 @@
1
1
  'use strict';
2
2
 
3
3
  require('../chunk-X7XP5WBP.cjs');
4
- var chunkNOBQQTAG_cjs = require('../chunk-NOBQQTAG.cjs');
4
+ var chunkFDTE4C5W_cjs = require('../chunk-FDTE4C5W.cjs');
5
5
  require('../chunk-FM2KM5TY.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "CallbackAuth", {
10
10
  enumerable: true,
11
- get: function () { return chunkNOBQQTAG_cjs.CallbackAuth; }
11
+ get: function () { return chunkFDTE4C5W_cjs.CallbackAuth; }
12
12
  });
13
13
  Object.defineProperty(exports, "NodaroClientCore", {
14
14
  enumerable: true,
15
- get: function () { return chunkNOBQQTAG_cjs.NodaroClientCore; }
15
+ get: function () { return chunkFDTE4C5W_cjs.NodaroClientCore; }
16
16
  });
17
17
  Object.defineProperty(exports, "StaticTokenAuth", {
18
18
  enumerable: true,
19
- get: function () { return chunkNOBQQTAG_cjs.StaticTokenAuth; }
19
+ get: function () { return chunkFDTE4C5W_cjs.StaticTokenAuth; }
20
20
  });
21
21
  Object.defineProperty(exports, "supabaseAuth", {
22
22
  enumerable: true,
23
- get: function () { return chunkNOBQQTAG_cjs.supabaseAuth; }
23
+ get: function () { return chunkFDTE4C5W_cjs.supabaseAuth; }
24
24
  });
25
25
  //# sourceMappingURL=core.cjs.map
26
26
  //# sourceMappingURL=core.cjs.map
@@ -1,5 +1,5 @@
1
1
  import '../chunk-AUDHV3OE.js';
2
- export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from '../chunk-5MZYOJCJ.js';
2
+ export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from '../chunk-NFVYOMNV.js';
3
3
  import '../chunk-L6T44A3G.js';
4
4
  //# sourceMappingURL=core.js.map
5
5
  //# sourceMappingURL=core.js.map
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  require('../chunk-ALUUBPDG.cjs');
4
- var chunkFIMBPKIH_cjs = require('../chunk-FIMBPKIH.cjs');
4
+ var chunk4BAHF762_cjs = require('../chunk-4BAHF762.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "CreditsResource", {
9
9
  enumerable: true,
10
- get: function () { return chunkFIMBPKIH_cjs.CreditsResource; }
10
+ get: function () { return chunk4BAHF762_cjs.CreditsResource; }
11
11
  });
12
12
  //# sourceMappingURL=credits.cjs.map
13
13
  //# sourceMappingURL=credits.cjs.map
@@ -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
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ require('../chunk-ISKOLJJJ.cjs');
4
+ var chunkUIDVH3GP_cjs = require('../chunk-UIDVH3GP.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "UserSettingsResource", {
9
+ enumerable: true,
10
+ get: function () { return chunkUIDVH3GP_cjs.UserSettingsResource; }
11
+ });
12
+ //# sourceMappingURL=user-settings.cjs.map
13
+ //# sourceMappingURL=user-settings.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"user-settings.cjs"}
@@ -0,0 +1,115 @@
1
+ import { N as NodaroClientCore } from '../developer-apps-zSQXWmEG.cjs';
2
+ import '@nodaro/shared/apps';
3
+ import '@nodaro/shared/organizations';
4
+
5
+ /**
6
+ * The signed-in person's own settings — the shape of `GET` / `PATCH
7
+ * /v1/user/settings` (`backend/src/routes/user-settings.ts`, the source of
8
+ * truth: keep these in sync if they change). A first-party app renders the
9
+ * ones it cares about (the monthly statement opt-in on a billing screen, the
10
+ * interface language) and sends back only the fields it changes.
11
+ */
12
+ /** How `{nodeRef}` placeholders render in prompt fields. */
13
+ type VariableDisplayMode = "raw" | "annotated" | "resolved";
14
+ /** What double-clicking a canvas node does. */
15
+ type NodeDoubleClickAction = "zoom" | "settings";
16
+ /** The interface languages Nodaro ships; the server refuses any other value. */
17
+ type UserSettingsLocale = "en" | "es" | "fr" | "de" | "pt-BR" | "ru" | "hi" | "ja" | "ko" | "zh-CN" | "he" | "ar";
18
+ /** One of the person's own Generate Text templates. */
19
+ interface UserTextTemplate {
20
+ id: string;
21
+ /** Up to 80 characters. */
22
+ label: string;
23
+ /** Up to 10,000 characters. */
24
+ systemPrompt: string;
25
+ defaultInput?: string;
26
+ /** 1–16,384. */
27
+ defaultMaxTokens?: number;
28
+ llmModel?: string;
29
+ reasoningEffort?: string;
30
+ fansOut?: boolean;
31
+ requiresImageRef?: boolean;
32
+ }
33
+ /** Per-user MCP defaults, sparse: a key left out keeps its stored value. */
34
+ interface UserMcpPreferences {
35
+ image?: {
36
+ model?: string;
37
+ aspectRatio?: string;
38
+ resolution?: string;
39
+ quality?: string;
40
+ };
41
+ video?: {
42
+ model?: string;
43
+ aspectRatio?: string;
44
+ duration?: number;
45
+ resolution?: string;
46
+ };
47
+ audio?: {
48
+ ttsModel?: string;
49
+ musicModel?: string;
50
+ };
51
+ flows?: {
52
+ enabled?: boolean;
53
+ };
54
+ }
55
+ interface UserSettings {
56
+ /** The stored billing tier (`"free"`, `"basic"`, …). */
57
+ tier: string | null;
58
+ /** Whether generations are visible in the public gallery. */
59
+ publicOutputs: boolean;
60
+ /** Per-template overrides of the system prompts, by template key. */
61
+ promptTemplates: Record<string, string>;
62
+ /** The person's own Generate Text templates. */
63
+ textTemplates: UserTextTemplate[];
64
+ /** The interface language; `null` = the browser's. */
65
+ preferredLocale: UserSettingsLocale | null;
66
+ mcpPreferences: UserMcpPreferences;
67
+ showRecentNodes: boolean;
68
+ showMostUsedNodes: boolean;
69
+ variableDisplayMode: VariableDisplayMode;
70
+ nodeDoubleClickAction: NodeDoubleClickAction;
71
+ /** A statement of last month's credit usage by email on the 1st. Default `false`. */
72
+ monthlyStatementEmail: boolean;
73
+ }
74
+ /**
75
+ * What `update()` sends: only the fields to change. `promptTemplates` and
76
+ * `textTemplates` REPLACE the stored value whole (send the full map or list;
77
+ * a template key the server does not know, or a value equal to the default,
78
+ * is dropped); `mcpPreferences` merges one axis at a time.
79
+ */
80
+ interface UserSettingsPatch {
81
+ /** `false` needs the Standard plan or above on Nodaro Cloud (`ForbiddenError` otherwise). */
82
+ publicOutputs?: boolean;
83
+ promptTemplates?: Record<string, string>;
84
+ /** Up to 100. */
85
+ textTemplates?: UserTextTemplate[];
86
+ preferredLocale?: UserSettingsLocale | null;
87
+ mcpPreferences?: UserMcpPreferences;
88
+ showRecentNodes?: boolean;
89
+ showMostUsedNodes?: boolean;
90
+ variableDisplayMode?: VariableDisplayMode;
91
+ nodeDoubleClickAction?: NodeDoubleClickAction;
92
+ monthlyStatementEmail?: boolean;
93
+ }
94
+ /** What `update()` answers: the settings as saved (without `tier`). */
95
+ type UserSettingsSaved = Omit<UserSettings, "tier">;
96
+ declare class UserSettingsResource {
97
+ private client;
98
+ constructor(client: NodaroClientCore);
99
+ /**
100
+ * `GET /v1/user/settings` → the person's own settings. Throws
101
+ * `UnauthorizedError` (401) when signed out, `NotFoundError` with no
102
+ * profile row.
103
+ */
104
+ get(): Promise<UserSettings>;
105
+ /**
106
+ * `PATCH /v1/user/settings` → changes the fields sent and answers the
107
+ * settings as saved. A `NodaroError` with status 400 names an invalid
108
+ * value (`validation_error`), or says so for a patch with nothing to
109
+ * change; `ForbiddenError` for `publicOutputs: false` below the Standard
110
+ * plan; `NotFoundError` with no profile row.
111
+ */
112
+ update(patch: UserSettingsPatch): Promise<UserSettingsSaved>;
113
+ }
114
+
115
+ export { type NodeDoubleClickAction, type UserMcpPreferences, type UserSettings, type UserSettingsLocale, type UserSettingsPatch, UserSettingsResource, type UserSettingsSaved, type UserTextTemplate, type VariableDisplayMode };