@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
@@ -0,0 +1,115 @@
1
+ import { N as NodaroClientCore } from '../developer-apps-zSQXWmEG.js';
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 };
@@ -0,0 +1,4 @@
1
+ import '../chunk-K6BWJ7ZY.js';
2
+ export { UserSettingsResource } from '../chunk-LR5TGCJP.js';
3
+ //# sourceMappingURL=user-settings.js.map
4
+ //# sourceMappingURL=user-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"user-settings.js"}
package/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('./chunk-ZE5RISBZ.cjs');
4
+ require('./chunk-ISKOLJJJ.cjs');
4
5
  require('./chunk-QRHJEITQ.cjs');
5
6
  require('./chunk-KTTL7BND.cjs');
6
7
  var chunkWSA4LMWR_cjs = require('./chunk-WSA4LMWR.cjs');
@@ -52,8 +53,9 @@ require('./chunk-IS26FJO7.cjs');
52
53
  require('./chunk-RQSGS7ZK.cjs');
53
54
  require('./chunk-43NO4SGC.cjs');
54
55
  require('./chunk-JOX5BJ6K.cjs');
55
- var chunkPPP6VZ3I_cjs = require('./chunk-PPP6VZ3I.cjs');
56
+ var chunkAY7XKACE_cjs = require('./chunk-AY7XKACE.cjs');
56
57
  var chunkJTOEHQQJ_cjs = require('./chunk-JTOEHQQJ.cjs');
58
+ var chunkUIDVH3GP_cjs = require('./chunk-UIDVH3GP.cjs');
57
59
  var chunkW5VHATSR_cjs = require('./chunk-W5VHATSR.cjs');
58
60
  var chunkR63TTR35_cjs = require('./chunk-R63TTR35.cjs');
59
61
  var chunk3B47IHB3_cjs = require('./chunk-3B47IHB3.cjs');
@@ -95,14 +97,14 @@ var chunk43FVH6LJ_cjs = require('./chunk-43FVH6LJ.cjs');
95
97
  var chunkYFS2LMG4_cjs = require('./chunk-YFS2LMG4.cjs');
96
98
  var chunkOSMKIRKI_cjs = require('./chunk-OSMKIRKI.cjs');
97
99
  require('./chunk-FRQJNGJS.cjs');
98
- var chunkNOBQQTAG_cjs = require('./chunk-NOBQQTAG.cjs');
100
+ var chunkFDTE4C5W_cjs = require('./chunk-FDTE4C5W.cjs');
99
101
  var chunkFM2KM5TY_cjs = require('./chunk-FM2KM5TY.cjs');
100
102
  var chunkHGCVWOGK_cjs = require('./chunk-HGCVWOGK.cjs');
101
- var chunkFIMBPKIH_cjs = require('./chunk-FIMBPKIH.cjs');
103
+ var chunk4BAHF762_cjs = require('./chunk-4BAHF762.cjs');
102
104
  var chunkA3S55XGF_cjs = require('./chunk-A3S55XGF.cjs');
103
105
  var chunkJOXZ4ZIF_cjs = require('./chunk-JOXZ4ZIF.cjs');
104
106
  var chunkGA4LZZKQ_cjs = require('./chunk-GA4LZZKQ.cjs');
105
- var chunkNGKODS3J_cjs = require('./chunk-NGKODS3J.cjs');
107
+ var chunkTVPYDC5T_cjs = require('./chunk-TVPYDC5T.cjs');
106
108
  var chunkTY2S25W5_cjs = require('./chunk-TY2S25W5.cjs');
107
109
  var chunkBPWUWUZ3_cjs = require('./chunk-BPWUWUZ3.cjs');
108
110
  var chunkHAKYPZLB_cjs = require('./chunk-HAKYPZLB.cjs');
@@ -143,16 +145,20 @@ Object.defineProperty(exports, "unwrapEditPlanOutput", {
143
145
  });
144
146
  Object.defineProperty(exports, "NodaroClient", {
145
147
  enumerable: true,
146
- get: function () { return chunkPPP6VZ3I_cjs.NodaroClient; }
148
+ get: function () { return chunkAY7XKACE_cjs.NodaroClient; }
147
149
  });
148
150
  Object.defineProperty(exports, "createClient", {
149
151
  enumerable: true,
150
- get: function () { return chunkPPP6VZ3I_cjs.createClient; }
152
+ get: function () { return chunkAY7XKACE_cjs.createClient; }
151
153
  });
152
154
  Object.defineProperty(exports, "UploadsResource", {
153
155
  enumerable: true,
154
156
  get: function () { return chunkJTOEHQQJ_cjs.UploadsResource; }
155
157
  });
158
+ Object.defineProperty(exports, "UserSettingsResource", {
159
+ enumerable: true,
160
+ get: function () { return chunkUIDVH3GP_cjs.UserSettingsResource; }
161
+ });
156
162
  Object.defineProperty(exports, "VideoProResource", {
157
163
  enumerable: true,
158
164
  get: function () { return chunkW5VHATSR_cjs.VideoProResource; }
@@ -395,19 +401,19 @@ Object.defineProperty(exports, "CopilotResource", {
395
401
  });
396
402
  Object.defineProperty(exports, "CallbackAuth", {
397
403
  enumerable: true,
398
- get: function () { return chunkNOBQQTAG_cjs.CallbackAuth; }
404
+ get: function () { return chunkFDTE4C5W_cjs.CallbackAuth; }
399
405
  });
400
406
  Object.defineProperty(exports, "NodaroClientCore", {
401
407
  enumerable: true,
402
- get: function () { return chunkNOBQQTAG_cjs.NodaroClientCore; }
408
+ get: function () { return chunkFDTE4C5W_cjs.NodaroClientCore; }
403
409
  });
404
410
  Object.defineProperty(exports, "StaticTokenAuth", {
405
411
  enumerable: true,
406
- get: function () { return chunkNOBQQTAG_cjs.StaticTokenAuth; }
412
+ get: function () { return chunkFDTE4C5W_cjs.StaticTokenAuth; }
407
413
  });
408
414
  Object.defineProperty(exports, "supabaseAuth", {
409
415
  enumerable: true,
410
- get: function () { return chunkNOBQQTAG_cjs.supabaseAuth; }
416
+ get: function () { return chunkFDTE4C5W_cjs.supabaseAuth; }
411
417
  });
412
418
  Object.defineProperty(exports, "AlreadyRunningError", {
413
419
  enumerable: true,
@@ -523,7 +529,7 @@ Object.defineProperty(exports, "CreaturesResource", {
523
529
  });
524
530
  Object.defineProperty(exports, "CreditsResource", {
525
531
  enumerable: true,
526
- get: function () { return chunkFIMBPKIH_cjs.CreditsResource; }
532
+ get: function () { return chunk4BAHF762_cjs.CreditsResource; }
527
533
  });
528
534
  Object.defineProperty(exports, "DeveloperAppsResource", {
529
535
  enumerable: true,
@@ -539,7 +545,7 @@ Object.defineProperty(exports, "AudioResource", {
539
545
  });
540
546
  Object.defineProperty(exports, "BillingResource", {
541
547
  enumerable: true,
542
- get: function () { return chunkNGKODS3J_cjs.BillingResource; }
548
+ get: function () { return chunkTVPYDC5T_cjs.BillingResource; }
543
549
  });
544
550
  Object.defineProperty(exports, "CastSwapResource", {
545
551
  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';
@@ -57,6 +57,7 @@ export { ListTrashParams, TrashEntry, TrashPage, TrashResource, TrashSession } f
57
57
  export { ListTrendRunsParams, ListTrendsParams, TrendCard, TrendChipKey, TrendChips, TrendChoice, TrendDetail, TrendDetailSlot, TrendEngine, TrendEstimate, TrendExample, TrendOriginal, TrendPage, TrendResolution, TrendRun, TrendRunDisplaySlot, TrendRunOptions, TrendRunRequest, TrendRunSlot, TrendSlotKind, TrendTag, TrendsResource } from './entries/trends.cjs';
58
58
  export { TutorialCategory, TutorialFlowItem, TutorialVideoItem, TutorialsResource } from './entries/tutorials.cjs';
59
59
  export { UploadJsonResult, UploadResult, UploadsResource } from './entries/uploads.cjs';
60
+ export { NodeDoubleClickAction, UserMcpPreferences, UserSettings, UserSettingsLocale, UserSettingsPatch, UserSettingsResource, UserSettingsSaved, UserTextTemplate, VariableDisplayMode } from './entries/user-settings.cjs';
60
61
  export { ContinueVideoProResult, StopVideoProResult, VideoProResource } from './entries/video-pro.cjs';
61
62
  export { DubbingInput, VcpAnalysis, VcpAnalysisSpeaker, VcpAnalyzeInput, VcpExportInput, VcpExportTrack, VoiceChangerProInput, VoiceChangerProVoice, VoiceDesignInput, VoiceRemixInput, VoicesResource } from './entries/voices.cjs';
62
63
  export { C as CreateWebhookEndpointInput, a as CreatedWebhookEndpoint, J as JobWebhookEvent, L as ListWebhookDeliveriesParams, P as PingWebhookEvent, R as RotateWebhookSecretInput, b as RotatedWebhookSecret, U as UpdateWebhookEndpointInput, W as WebhookDelivery, c as WebhookDeliveryPage, d as WebhookDeliveryStatus, e as WebhookEndpoint, f as WebhookEvent, g as WebhookEventType, h as WebhookJobEvent, i as WebhooksResource } from './webhooks-Dn_DtNTD.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';
@@ -57,6 +57,7 @@ export { ListTrashParams, TrashEntry, TrashPage, TrashResource, TrashSession } f
57
57
  export { ListTrendRunsParams, ListTrendsParams, TrendCard, TrendChipKey, TrendChips, TrendChoice, TrendDetail, TrendDetailSlot, TrendEngine, TrendEstimate, TrendExample, TrendOriginal, TrendPage, TrendResolution, TrendRun, TrendRunDisplaySlot, TrendRunOptions, TrendRunRequest, TrendRunSlot, TrendSlotKind, TrendTag, TrendsResource } from './entries/trends.js';
58
58
  export { TutorialCategory, TutorialFlowItem, TutorialVideoItem, TutorialsResource } from './entries/tutorials.js';
59
59
  export { UploadJsonResult, UploadResult, UploadsResource } from './entries/uploads.js';
60
+ export { NodeDoubleClickAction, UserMcpPreferences, UserSettings, UserSettingsLocale, UserSettingsPatch, UserSettingsResource, UserSettingsSaved, UserTextTemplate, VariableDisplayMode } from './entries/user-settings.js';
60
61
  export { ContinueVideoProResult, StopVideoProResult, VideoProResource } from './entries/video-pro.js';
61
62
  export { DubbingInput, VcpAnalysis, VcpAnalysisSpeaker, VcpAnalyzeInput, VcpExportInput, VcpExportTrack, VoiceChangerProInput, VoiceChangerProVoice, VoiceDesignInput, VoiceRemixInput, VoicesResource } from './entries/voices.js';
62
63
  export { C as CreateWebhookEndpointInput, a as CreatedWebhookEndpoint, J as JobWebhookEvent, L as ListWebhookDeliveriesParams, P as PingWebhookEvent, R as RotateWebhookSecretInput, b as RotatedWebhookSecret, U as UpdateWebhookEndpointInput, W as WebhookDelivery, c as WebhookDeliveryPage, d as WebhookDeliveryStatus, e as WebhookEndpoint, f as WebhookEvent, g as WebhookEventType, h as WebhookJobEvent, i as WebhooksResource } from './webhooks-BJawEIz8.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import './chunk-CGNVHN4V.js';
2
+ import './chunk-K6BWJ7ZY.js';
2
3
  import './chunk-VPAUN75Q.js';
3
4
  import './chunk-MEKI37WI.js';
4
5
  export { WebhookSignatureError, verifyWebhookSignature } from './chunk-VGTRKXF2.js';
@@ -50,8 +51,9 @@ import './chunk-M6Y5TOYE.js';
50
51
  import './chunk-KARJ7P7Y.js';
51
52
  import './chunk-SUCHGNYT.js';
52
53
  import './chunk-SLPD47SR.js';
53
- export { NodaroClient, createClient } from './chunk-2JAKOBD3.js';
54
+ export { NodaroClient, createClient } from './chunk-WUVTKMAQ.js';
54
55
  export { UploadsResource } from './chunk-WY4QRJZW.js';
56
+ export { UserSettingsResource } from './chunk-LR5TGCJP.js';
55
57
  export { VideoProResource } from './chunk-ERLXU47J.js';
56
58
  export { VoicesResource } from './chunk-T7N7DFQJ.js';
57
59
  export { WebhooksResource } from './chunk-YN6CBIIB.js';
@@ -93,14 +95,14 @@ export { CommunityResource } from './chunk-SFB4YLCS.js';
93
95
  export { CompetitorsResource } from './chunk-BU5A6K4C.js';
94
96
  export { CopilotResource } from './chunk-D2ILCSOQ.js';
95
97
  import './chunk-7CUWAVWB.js';
96
- export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from './chunk-5MZYOJCJ.js';
98
+ export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from './chunk-NFVYOMNV.js';
97
99
  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
100
  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';
101
+ export { CreditsResource } from './chunk-7QK2NXJA.js';
100
102
  export { DeveloperAppsResource } from './chunk-65E3JBFZ.js';
101
103
  export { AppsResource } from './chunk-7LODCIQK.js';
102
104
  export { AudioResource } from './chunk-3QFTP5P5.js';
103
- export { BillingResource } from './chunk-J4WFSKY6.js';
105
+ export { BillingResource } from './chunk-ZVKEPVDQ.js';
104
106
  export { CastSwapResource } from './chunk-OCRUDBPG.js';
105
107
  export { CatalogsResource } from './chunk-KG4R454Z.js';
106
108
  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.52.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",
@@ -260,6 +260,11 @@
260
260
  "import": "./dist/entries/uploads.js",
261
261
  "require": "./dist/entries/uploads.cjs"
262
262
  },
263
+ "./user-settings": {
264
+ "types": "./dist/entries/user-settings.d.ts",
265
+ "import": "./dist/entries/user-settings.js",
266
+ "require": "./dist/entries/user-settings.cjs"
267
+ },
263
268
  "./video-pro": {
264
269
  "types": "./dist/entries/video-pro.d.ts",
265
270
  "import": "./dist/entries/video-pro.js",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,gBAAA,CAAiB;AAAA,EACxC,SAAA;AAAA,EACA,QAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,KAAA;AAAA;AAAA,EAEA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA,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AAA,CAAkB,IAAI,CAAA;AAC3C,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,iBAAA,CAAkB,IAAI,CAAA;AAC3C,IAAA,IAAA,CAAK,aAAA,GAAgB,IAAI,qBAAA,CAAsB,IAAI,CAAA;AACnD,IAAA,IAAA,CAAK,UAAA,GAAa,IAAI,kBAAA,CAAmB,IAAI,CAAA;AAC7C,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,YAAA,CAAa,IAAI,CAAA;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,cAAc,WAAA,EAA0C;AAMtD,IAAA,MAAM,aAAA,GAAgB,KAAK,eAAe,CAAA;AAC1C,IAAA,OAAO,IAAI,aAAA,CAAa;AAAA,MACtB,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,MAAM,IAAA,CAAK,IAAA;AAAA,MACX,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,GAAI,aAAA,GAAgB,EAAE,KAAA,EAAO,aAAA,KAAkB,EAAC;AAAA,MAChD,GAAI,KAAK,kBAAkB,CAAA,GAAI,EAAE,WAAA,EAAa,IAAA,CAAK,WAAA,EAAY,GAAI,EAAC;AAAA,MACpE,GAAI,WAAA,GAAc,EAAE,WAAA,KAAgB;AAAC,KACtC,CAAA;AAAA,EACH;AACF;AAGO,SAAS,aAAa,IAAA,EAAmC;AAC9D,EAAA,OAAO,IAAI,aAAa,IAAI,CAAA;AAC9B","file":"chunk-2JAKOBD3.js","sourcesContent":["import { WorkflowsResource } from \"./resources/workflows.js\"\nimport { ProjectsResource } from \"./resources/projects.js\"\nimport { SessionsResource } from \"./resources/sessions.js\"\nimport { TrashResource } from \"./resources/trash.js\"\nimport { JobsResource } from \"./resources/jobs.js\"\nimport { VideoProResource } from \"./resources/video-pro.js\"\nimport { ExecutionsResource } from \"./resources/executions.js\"\nimport { NodesResource } from \"./resources/nodes.js\"\nimport { Scene3DResource } from \"./resources/scene3d.js\"\nimport { DeveloperAppsResource } from \"./resources/developer-apps.js\"\nimport { OAuthResource } from \"./resources/oauth.js\"\nimport { WebhooksResource } from \"./resources/webhooks.js\"\nimport { AppsResource } from \"./resources/apps.js\"\nimport { CharactersResource } from \"./resources/characters.js\"\nimport { LocationsResource } from \"./resources/locations.js\"\nimport { ObjectsResource } from \"./resources/objects.js\"\nimport { CreaturesResource } from \"./resources/creatures.js\"\nimport { PipelinesResource } from \"./resources/pipelines.js\"\nimport { ReduceResource } from \"./resources/reduce.js\"\nimport { PromptHelperResource } from \"./resources/prompt-helper.js\"\nimport { VoicesResource } from \"./resources/voices.js\"\nimport { LlmResource } from \"./resources/llm.js\"\nimport { MediaResource } from \"./resources/media.js\"\nimport { AudioResource } from \"./resources/audio.js\"\nimport { CreditsResource } from \"./resources/credits.js\"\nimport { BillingResource } from \"./resources/billing.js\"\nimport { UploadsResource } from \"./resources/uploads.js\"\nimport { LibraryResource } from \"./resources/library.js\"\nimport { GalleryResource } from \"./resources/gallery.js\"\nimport { PresetsResource } from \"./resources/node-presets.js\"\nimport { SavedPostsResource } from \"./resources/saved-posts.js\"\nimport { CollectionsResource } from \"./resources/collections.js\"\nimport { PalettesResource } from \"./resources/palettes.js\"\nimport { MoodboardsResource } from \"./resources/moodboards.js\"\nimport { CompetitorsResource } from \"./resources/competitors.js\"\nimport { PickerCatalogsResource } from \"./resources/picker-catalogs.js\"\nimport { CatalogsResource } from \"./resources/catalogs.js\"\nimport { ModelsResource } from \"./resources/models.js\"\nimport { ShotsResource } from \"./resources/shots.js\"\nimport { RecastResource } from \"./resources/recast.js\"\nimport { CastSwapResource } from \"./resources/cast-swap.js\"\nimport { TrendsResource } from \"./resources/trends.js\"\nimport { StudioResource } from \"./resources/studio.js\"\nimport { CopilotResource } from \"./resources/copilot.js\"\nimport { CommunityResource } from \"./resources/community.js\"\nimport { TemplatesResource } from \"./resources/templates.js\"\nimport { TutorialsResource } from \"./resources/tutorials.js\"\nimport { OrganizationsResource } from \"./resources/organizations.js\"\nimport { WorkspacesResource } from \"./resources/workspaces.js\"\nimport { EditResource } from \"./resources/edit.js\"\nimport { NodaroClientCore, type ClientOptions } from \"./core.js\"\n\nexport { CLIENT_HEADER } from \"./core.js\"\nexport type { ClientOptions, UserIdentity, ConnectedApp } from \"./core.js\"\n\n/**\n * The full client: the core (`./core.ts` — config, transport, identity) and\n * every resource.\n */\nexport class NodaroClient extends NodaroClientCore {\n readonly workflows: WorkflowsResource\n readonly projects: ProjectsResource\n /** Generation sessions inside projects (Create Image / Video / Music). */\n readonly sessions: SessionsResource\n /** Your Trash: items removed from sessions and deleted jobs. */\n readonly trash: TrashResource\n readonly jobs: JobsResource\n readonly videoPro: VideoProResource\n readonly executions: ExecutionsResource\n readonly nodes: NodesResource\n readonly scene3d: Scene3DResource\n readonly developerApps: DeveloperAppsResource\n readonly oauth: OAuthResource\n /** Outbound webhooks: endpoints that receive your job.completed / job.failed. */\n readonly webhooks: WebhooksResource\n readonly apps: AppsResource\n readonly characters: CharactersResource\n readonly locations: LocationsResource\n readonly objects: ObjectsResource\n readonly creatures: CreaturesResource\n readonly pipelines: PipelinesResource\n readonly reduce: ReduceResource\n readonly promptHelper: PromptHelperResource\n readonly voices: VoicesResource\n readonly llm: LlmResource\n readonly media: MediaResource\n readonly audio: AudioResource\n readonly credits: CreditsResource\n /** Plans and prices, the subscription, and how this deployment bills. */\n readonly billing: BillingResource\n readonly uploads: UploadsResource\n readonly library: LibraryResource\n /** The public gallery and your favorites. */\n readonly gallery: GalleryResource\n readonly presets: PresetsResource\n readonly savedPosts: SavedPostsResource\n readonly collections: CollectionsResource\n /** Your colour palettes — a generate-image direction (`direction.colorLook: paletteDirectionId(id)`). */\n readonly palettes: PalettesResource\n /** Your moodboards — a generate-image direction (`direction.style: moodboardDirectionId(id)`). */\n readonly moodboards: MoodboardsResource\n readonly competitors: CompetitorsResource\n readonly pickerCatalogs: PickerCatalogsResource\n readonly catalogs: CatalogsResource\n readonly models: ModelsResource\n readonly shots: ShotsResource\n readonly recast: RecastResource\n /** Cast Swap: replace the people and/or location in a short video (Cloud). */\n readonly castSwap: CastSwapResource\n /** Trends: ready-made Cast Swap recipes you fill with your own pictures (Cloud). */\n readonly trends: TrendsResource\n readonly studio: StudioResource\n readonly copilot: CopilotResource\n readonly community: CommunityResource\n readonly templates: TemplatesResource\n readonly tutorials: TutorialsResource\n readonly organizations: OrganizationsResource\n readonly workspaces: WorkspacesResource\n readonly edit: EditResource\n\n constructor(opts: ClientOptions) {\n super(opts)\n\n this.workflows = new WorkflowsResource(this)\n this.projects = new ProjectsResource(this)\n this.sessions = new SessionsResource(this)\n this.trash = new TrashResource(this)\n this.jobs = new JobsResource(this)\n this.videoPro = new VideoProResource(this)\n this.executions = new ExecutionsResource(this)\n this.nodes = new NodesResource(this)\n this.scene3d = new Scene3DResource(this)\n this.developerApps = new DeveloperAppsResource(this)\n this.oauth = new OAuthResource(this)\n this.webhooks = new WebhooksResource(this)\n this.apps = new AppsResource(this)\n this.characters = new CharactersResource(this)\n this.locations = new LocationsResource(this)\n this.objects = new ObjectsResource(this)\n this.creatures = new CreaturesResource(this)\n this.pipelines = new PipelinesResource(this)\n this.reduce = new ReduceResource(this)\n this.promptHelper = new PromptHelperResource(this)\n this.voices = new VoicesResource(this)\n this.llm = new LlmResource(this)\n this.media = new MediaResource(this)\n this.audio = new AudioResource(this)\n this.credits = new CreditsResource(this)\n this.billing = new BillingResource(this)\n this.uploads = new UploadsResource(this)\n this.library = new LibraryResource(this)\n this.gallery = new GalleryResource(this)\n this.presets = new PresetsResource(this)\n this.savedPosts = new SavedPostsResource(this)\n this.collections = new CollectionsResource(this)\n this.palettes = new PalettesResource(this)\n this.moodboards = new MoodboardsResource(this)\n this.competitors = new CompetitorsResource(this)\n this.pickerCatalogs = new PickerCatalogsResource(this)\n this.catalogs = new CatalogsResource(this)\n this.models = new ModelsResource(this)\n this.shots = new ShotsResource(this)\n this.recast = new RecastResource(this)\n this.castSwap = new CastSwapResource(this)\n this.trends = new TrendsResource(this)\n this.studio = new StudioResource(this)\n this.copilot = new CopilotResource(this)\n this.community = new CommunityResource(this)\n this.templates = new TemplatesResource(this)\n this.tutorials = new TutorialsResource(this)\n this.organizations = new OrganizationsResource(this)\n this.workspaces = new WorkspacesResource(this)\n this.edit = new EditResource(this)\n }\n\n /**\n * A client that acts in `workspaceId`, sharing this one's auth and config.\n *\n * A NEW client rather than a setter, deliberately. A mutable selection is\n * the bug this whole axis exists to prevent: two concurrent operations\n * against one client would race over which workspace they were in, and the\n * loser would create work in the wrong place with nothing failing. A\n * per-workspace client cannot be raced.\n *\n * Pass `null` for the personal space.\n */\n withWorkspace(workspaceId: string | null): NodaroClient {\n // The two private settings are read by bracket access, which TypeScript\n // allows on a subclass and which adds no member to the declarations. Read\n // through `this` (not a side table keyed by the instance), so a client\n // wrapped in a Proxy (Vue/Pinia `reactive()`) or reached through\n // `Object.create(client)` still works.\n const fetchOverride = this[\"fetchOverride\"]\n return new NodaroClient({\n baseUrl: this.baseUrl,\n auth: this.auth,\n timeoutMs: this.timeoutMs,\n ...(fetchOverride ? { fetch: fetchOverride } : {}),\n ...(this[\"sendClientHeader\"] ? { clientLabel: this.clientLabel } : {}),\n ...(workspaceId ? { workspaceId } : {}),\n })\n }\n}\n\n/** Factory function — preferred entry point. */\nexport function createClient(opts: ClientOptions): NodaroClient {\n return new NodaroClient(opts)\n}\n"]}
@@ -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,OA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AAA;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"]}
@@ -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,IAA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O,OAAA,CAAgC,MAAA,EAAQ,gCAAgC,CAAA;AAAA,EAC7F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUF","file":"chunk-FIMBPKIH.cjs","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"]}
@@ -1,50 +0,0 @@
1
- // src/resources/billing.ts
2
- var BillingResource = class {
3
- constructor(client) {
4
- this.client = client;
5
- }
6
- client;
7
- /**
8
- * `GET /v1/billing/plans` → the plans and credit packs on sale, with their
9
- * prices. Public: works with no credential, the same for every caller.
10
- * Nodaro Cloud only — a self-hosted instance answers 404. Throws on `403
11
- * self_serve_disabled` (this deployment does not sell to its users) and on
12
- * `503` (`stripe_not_configured`, or prices briefly unavailable).
13
- */
14
- plans() {
15
- return this.client.request("GET", "/v1/billing/plans");
16
- }
17
- /**
18
- * `GET /v1/billing/subscription` → the account's latest subscription
19
- * (`null` when it never subscribed) and the tier its entitlements follow.
20
- * Match `effectiveTier` to a {@link BillingPlan} `id` to mark the current
21
- * plan (no match: pay-as-you-go, or a tier not on sale). Needs a signed-in
22
- * session, a personal API token without a workflow limit, or an app's OAuth
23
- * token. Nodaro Cloud only — a self-hosted instance answers 404.
24
- */
25
- subscription() {
26
- return this.client.request("GET", "/v1/billing/subscription");
27
- }
28
- /**
29
- * `GET /v1/billing/surface` → how this deployment bills: whether it meters
30
- * at all (`providerId !== "none"`) and in which unit costs display. Public,
31
- * every edition.
32
- */
33
- async surface() {
34
- const res = await this.client.request("GET", "/v1/billing/surface");
35
- return res.data;
36
- }
37
- /**
38
- * `GET /v1/billing/account` → the caller's plan and balance as the
39
- * deployment's billing provider reports them, in its display unit. `null`
40
- * when the provider could not answer — not a zero balance. Every edition.
41
- */
42
- async account() {
43
- const res = await this.client.request("GET", "/v1/billing/account");
44
- return res.data;
45
- }
46
- };
47
-
48
- export { BillingResource };
49
- //# sourceMappingURL=chunk-J4WFSKY6.js.map
50
- //# sourceMappingURL=chunk-J4WFSKY6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resources/billing.ts"],"names":[],"mappings":";AA6KO,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;AAAA;AAAA,EASpB,KAAA,GAAqC;AACnC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAA4B,KAAA,EAAO,mBAAmB,CAAA;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,YAAA,GAAmD;AACjD,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAmC,KAAA,EAAO,0BAA0B,CAAA;AAAA,EACzF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,OAAA,GAAmC;AACvC,IAAA,MAAM,MAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA,CAAkC,OAAO,qBAAqB,CAAA;AAC5F,IAAA,OAAO,GAAA,CAAI,IAAA;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,OAAA,GAAiD;AACrD,IAAA,MAAM,MAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA,CAAgD,OAAO,qBAAqB,CAAA;AAC1G,IAAA,OAAO,GAAA,CAAI,IAAA;AAAA,EACb;AACF","file":"chunk-J4WFSKY6.js","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\n\n/**\n * Plans and prices, the subscription, and the billing surface — the shapes of\n * the `/v1/billing/*` routes an app may call. Mirrors the backend routes\n * (`backend/src/ee/routes/billing.ts`, `backend/src/routes/billing-surface.ts`),\n * the source of truth: keep these in sync if they change.\n *\n * Buying, changing the plan and the payment settings stay in the Nodaro app:\n * those routes refuse API and app tokens, so they have no method here.\n */\n\n/** A sum of money in its currency's major unit (`12` = 12.00), with its ISO-4217 code (`\"USD\"`). */\nexport interface BillingMoney {\n amount: number\n currency: string\n}\n\n/** The credits a price grants, and how often. */\nexport interface BillingPriceCredits {\n amount: number\n per: \"month\" | \"year\"\n}\n\n/** A monthly price, and what it grants. */\nexport interface BillingMonthlyPrice extends BillingMoney {\n /** `null` when the price does not state it. */\n credits: BillingPriceCredits | null\n}\n\n/** A yearly price, what it comes to per month, and what it grants. */\nexport interface BillingYearlyPrice extends BillingMoney {\n /** The yearly amount spread over the months it pays for; `null` when that cannot be said. */\n perMonth: number | null\n /** What the price grants — the plan's credits every month, as a monthly price; `null` when the price does not state it. */\n credits: BillingPriceCredits | null\n}\n\nexport interface BillingPlanPrices {\n /** `null` = Stripe cannot sell this price right now: show it as unavailable, never as free. */\n monthly: BillingMonthlyPrice | null\n yearly: BillingYearlyPrice | null\n}\n\n/** One plan on sale. */\nexport interface BillingPlan {\n /** `\"free\"`, `\"basic\"`, `\"standard\"`, … — the stable id. */\n id: string\n name: string\n /** `null` for the free plan: there is nothing to pay. */\n prices: BillingPlanPrices | null\n /** The free plan's one-time grant at sign-up; `null` on a paid plan, whose credits come with each price. */\n signupCredits: number | null\n /** How many nodes of one workflow run at once. */\n parallelism: number\n /** Storage for your media, in bytes. */\n storageBytes: number\n}\n\n/** A credit pack: this many credits for this price. */\nexport interface BillingTopUp {\n id: string\n credits: number\n /** `null` when the pack's price cannot be stated right now: show it as unavailable. */\n price: BillingMoney | null\n}\n\n/** The answer of `GET /v1/billing/plans`. */\nexport interface BillingPlansResult {\n /** The free plan first, then each paid plan from the smallest. */\n data: BillingPlan[]\n /** The credit packs, from the smallest. */\n topUps: BillingTopUp[]\n /** Any whole amount in this range can be loaded as credits, at the same rate as the packs. */\n topUpRange: { min: number; max: number; currency: string }\n}\n\n/** The account's latest subscription record. */\nexport interface BillingSubscription {\n id: string\n stripe_subscription_id: string | null\n /** The plan id: `\"basic\"`, `\"standard\"`, … */\n tier: string\n /** `\"active\"`, `\"trialing\"`, `\"past_due\"`, `\"paused\"`, `\"canceled\"`, `\"incomplete\"` or `\"expired\"`. */\n status: string\n stripe_price_id: string | null\n /** ISO-8601. */\n current_period_start: string | null\n /** ISO-8601: when the current period ends (and renews, unless cancelled). */\n current_period_end: string | null\n /** True when the subscription ends at `current_period_end` instead of renewing. */\n cancel_at_period_end: boolean\n /** ISO-8601: when a scheduled cancellation takes effect. */\n cancel_at: string | null\n /** ISO-8601: when it was cancelled. */\n canceled_at: string | null\n}\n\n/** The answer of `GET /v1/billing/subscription`. */\nexport interface BillingSubscriptionResult {\n /** `null` when the account never subscribed. */\n data: BillingSubscription | null\n /**\n * The tier the account's entitlements follow: usually a plan id from\n * `plans()` (`\"free\"` included); `\"payg\"` — no subscription, but credits\n * bought (every model, no watermark); or a tier that is not on sale, such\n * as `\"enterprise\"`.\n */\n effectiveTier: string\n}\n\n/** How this deployment bills, the same for every caller (`GET /v1/billing/surface`). */\nexport interface BillingSurface {\n /** The billing-surface contract version (an integer). */\n contract: number\n /** The registered billing provider; `\"none\"` = this deployment meters nothing. */\n providerId: string\n /** The unit costs display in by default (`\"credits\"`, `\"usd\"`, or a deployment's own label). */\n displayUnit: string\n canReport: boolean\n canQuote: boolean\n canAccount: boolean\n /** Whether a cost view belongs on this deployment. */\n mountCostTab: boolean\n /** One billing account pays for every user here. */\n deploymentPayer: boolean\n}\n\n/** One row of {@link BillingAccountSummary.byCategory}. */\nexport interface BillingUsageCategory {\n category: string\n count: number\n /** Spend in the display unit; `null` = unavailable, never 0. */\n amount: number | null\n spent: BillingMoney | null\n}\n\n/**\n * The caller's account as the deployment's billing provider sees it\n * (`GET /v1/billing/account`). Money and amounts are `null` when the provider\n * could not say: show that distinctly, never as 0. A field the provider leaves\n * out is a concept it does not have.\n */\nexport interface BillingAccountSummary {\n /** A plain string; `\"unknown\"` is a real answer. */\n plan: string\n balance: number | null\n dailyAllowance: number | null\n unit: string\n /** `\"external_wallet\"` when the balance comes from a wallet outside Nodaro. */\n balanceSource?: \"external_wallet\"\n /** ISO-8601 start of the current usage period. */\n periodStart?: string | null\n /** Generations this period. */\n generations?: number | null\n /** Money spent this period. */\n spent?: BillingMoney | null\n /** Pay-as-you-go state. */\n payg?: {\n enabled: boolean\n reserve: number | null\n rate: { creditsPerUnit: number; currency: string } | null\n monthlyCap: BillingMoney | null\n } | null\n /** The daily cap and when it resets; prefer it over `dailyAllowance` when present. `limit: 0` means blocked. */\n daily?: { limit: number; used: number; remaining: number; resetsAt: string } | null\n /** Money value of the pay-as-you-go reserve. */\n reserveValue?: BillingMoney | null\n byCategory?: BillingUsageCategory[] | null\n /** The total the balance is drawn from, where the provider grants each user an allocation. */\n allocated?: number | null\n}\n\nexport class BillingResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * `GET /v1/billing/plans` → the plans and credit packs on sale, with their\n * prices. Public: works with no credential, the same for every caller.\n * Nodaro Cloud only — a self-hosted instance answers 404. Throws on `403\n * self_serve_disabled` (this deployment does not sell to its users) and on\n * `503` (`stripe_not_configured`, or prices briefly unavailable).\n */\n plans(): Promise<BillingPlansResult> {\n return this.client.request<BillingPlansResult>(\"GET\", \"/v1/billing/plans\")\n }\n\n /**\n * `GET /v1/billing/subscription` → the account's latest subscription\n * (`null` when it never subscribed) and the tier its entitlements follow.\n * Match `effectiveTier` to a {@link BillingPlan} `id` to mark the current\n * plan (no match: pay-as-you-go, or a tier not on sale). Needs a signed-in\n * session, a personal API token without a workflow limit, or an app's OAuth\n * token. Nodaro Cloud only — a self-hosted instance answers 404.\n */\n subscription(): Promise<BillingSubscriptionResult> {\n return this.client.request<BillingSubscriptionResult>(\"GET\", \"/v1/billing/subscription\")\n }\n\n /**\n * `GET /v1/billing/surface` → how this deployment bills: whether it meters\n * at all (`providerId !== \"none\"`) and in which unit costs display. Public,\n * every edition.\n */\n async surface(): Promise<BillingSurface> {\n const res = await this.client.request<{ data: BillingSurface }>(\"GET\", \"/v1/billing/surface\")\n return res.data\n }\n\n /**\n * `GET /v1/billing/account` → the caller's plan and balance as the\n * deployment's billing provider reports them, in its display unit. `null`\n * when the provider could not answer — not a zero balance. Every edition.\n */\n async account(): Promise<BillingAccountSummary | null> {\n const res = await this.client.request<{ data: BillingAccountSummary | null }>(\"GET\", \"/v1/billing/account\")\n return res.data\n }\n}\n"]}
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- // src/resources/billing.ts
4
- var BillingResource = class {
5
- constructor(client) {
6
- this.client = client;
7
- }
8
- client;
9
- /**
10
- * `GET /v1/billing/plans` → the plans and credit packs on sale, with their
11
- * prices. Public: works with no credential, the same for every caller.
12
- * Nodaro Cloud only — a self-hosted instance answers 404. Throws on `403
13
- * self_serve_disabled` (this deployment does not sell to its users) and on
14
- * `503` (`stripe_not_configured`, or prices briefly unavailable).
15
- */
16
- plans() {
17
- return this.client.request("GET", "/v1/billing/plans");
18
- }
19
- /**
20
- * `GET /v1/billing/subscription` → the account's latest subscription
21
- * (`null` when it never subscribed) and the tier its entitlements follow.
22
- * Match `effectiveTier` to a {@link BillingPlan} `id` to mark the current
23
- * plan (no match: pay-as-you-go, or a tier not on sale). Needs a signed-in
24
- * session, a personal API token without a workflow limit, or an app's OAuth
25
- * token. Nodaro Cloud only — a self-hosted instance answers 404.
26
- */
27
- subscription() {
28
- return this.client.request("GET", "/v1/billing/subscription");
29
- }
30
- /**
31
- * `GET /v1/billing/surface` → how this deployment bills: whether it meters
32
- * at all (`providerId !== "none"`) and in which unit costs display. Public,
33
- * every edition.
34
- */
35
- async surface() {
36
- const res = await this.client.request("GET", "/v1/billing/surface");
37
- return res.data;
38
- }
39
- /**
40
- * `GET /v1/billing/account` → the caller's plan and balance as the
41
- * deployment's billing provider reports them, in its display unit. `null`
42
- * when the provider could not answer — not a zero balance. Every edition.
43
- */
44
- async account() {
45
- const res = await this.client.request("GET", "/v1/billing/account");
46
- return res.data;
47
- }
48
- };
49
-
50
- exports.BillingResource = BillingResource;
51
- //# sourceMappingURL=chunk-NGKODS3J.cjs.map
52
- //# sourceMappingURL=chunk-NGKODS3J.cjs.map