@usenadia/node 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ pnpm add @usenadia/node
9
9
 
10
10
  <!-- smoke:start -->
11
11
  ```ts
12
- import { Nadia, NadiaConfirmationRequired, NadiaError } from '@usenadia/node';
12
+ import { Nadia, NadiaError } from '@usenadia/node';
13
13
 
14
14
  const nadia = new Nadia(process.env.NADIA_API_KEY ?? '');
15
15
 
@@ -33,14 +33,7 @@ try {
33
33
  ],
34
34
  });
35
35
 
36
- // A deletion waits for a yes by default: nothing is done on the first call
37
- // (see Confirmations below). This draft is ours, so we confirm it.
38
- try {
39
- await nadia.deletePost(postId);
40
- } catch (err) {
41
- if (!(err instanceof NadiaConfirmationRequired)) throw err;
42
- await err.confirm();
43
- }
36
+ await nadia.deletePost(postId); // the API never asks for a confirmation
44
37
  } catch (err) {
45
38
  if (err instanceof NadiaError) {
46
39
  console.error(err.status, err.message); // 402 "You have reached your limit"
@@ -84,34 +77,18 @@ have answered at once.
84
77
 
85
78
  ## Confirmations
86
79
 
87
- Since 0.4.0. In Settings › Developers, each action of the API either runs at once or
88
- waits for a yes (the same two columns as the MCP; by default, the deletions
89
- of a post, a card, a webhook and a workspace wait). Such an action answers
90
- `428` and **does nothing**: the SDK throws `NadiaConfirmationRequired`, with
91
- `preview` (what the action will do) and `confirmationToken`.
80
+ None since 2026-12-04: the API does what the key asks, deletions included, on
81
+ the first call. The setting « What the agent does without asking » is for
82
+ agents only (the MCP, the Agent of the app); to limit what a program can
83
+ reach, give it a key limited to some workspaces. `NadiaConfirmationRequired`,
84
+ `err.confirm()`, the `confirmationToken` options and `autoConfirm` stay for a
85
+ server that would still answer `428`: the API no longer does.
92
86
 
93
- ```ts
94
- try {
95
- await nadia.deletePost(id);
96
- } catch (err) {
97
- if (!(err instanceof NadiaConfirmationRequired)) throw err;
98
- console.log(err.preview); // { action: 'post.delete', request: 'DELETE …', … }
99
- if (await askTheUser()) await err.confirm(); // the same request, with the token
100
- }
101
- ```
102
-
103
- The token is single use and lasts 15 minutes; another body or query asks
104
- again. `deletePost(id, { confirmationToken })` and `deleteContent` take it
105
- directly, and any generated operation takes it as `query.confirmationToken`.
106
- `new Nadia(key, { autoConfirm: true })` confirms every `428` at once (once
107
- per call): only for a program that already has its user's yes. Details:
108
- [usenadia.com/docs/public-api/confirmations](https://usenadia.com/docs/public-api/confirmations).
87
+ ## Ideas
109
88
 
110
- ## The content board
111
-
112
- Every card of the board in the app is reachable: create one from anywhere
113
- (a voice note, a Notion page, a DM), move it along, read its numbers once
114
- it is published.
89
+ Every card of Ideas in the app is reachable: create one from anywhere
90
+ (a voice note, a Notion page, a DM), move it to its next stage, read its
91
+ numbers once it is published.
115
92
 
116
93
  ```ts
117
94
  const card = await nadia.createContent({
@@ -128,7 +105,7 @@ await nadia.linkContentPost(card.id, 'g-42'); // → PUBLISHED when it goes live
128
105
  const numbers = await nadia.contentsPerformance(); // keyed by card id
129
106
  ```
130
107
 
131
- Columns, in order: `IDEA`, `SCRIPT`, `VALIDATED`, `TO_SHOOT`, `TO_EDIT`,
108
+ Stages (`stage`), in order: `IDEA`, `SCRIPT`, `VALIDATED`, `TO_SHOOT`, `TO_EDIT`,
132
109
  `TO_SCHEDULE`, `PUBLISHED`.
133
110
 
134
111
  ## How it is built
@@ -215,17 +192,13 @@ error names). `err.isTransient` is true for 429 and 5xx — those
215
192
  are retried automatically (twice by default, `new Nadia(key, { retries: 0 })`
216
193
  to turn it off).
217
194
 
218
- ## Coming from upstream's SDK
219
-
220
- The class is called `Nadia` instead of upstream's name. Otherwise
221
- `new Nadia(apiKey, baseUrl?)` and the five original methods (`post`,
222
- `postList`, `upload`, `integrations`, `deletePost`) keep their names and
223
- shapes, so existing code only changes its import. Two other differences,
224
- both fixes:
195
+ ## Short methods
225
196
 
226
- - **HTTP errors are no longer swallowed.** Upstream called `.json()` without
227
- looking at the status, so a 402 came back looking like a success.
228
- - **`deletePost()` awaits.** Upstream returned an unawaited `fetch`.
197
+ `new Nadia(apiKey, baseUrl?)` also takes the base URL as a second argument,
198
+ and five short methods cover the common calls: `post`, `postList`, `upload`,
199
+ `integrations` and `deletePost`. Each one checks the HTTP status (a 402
200
+ throws a `NadiaError`, it never comes back looking like a success) and
201
+ `deletePost()` resolves once the post is deleted.
229
202
 
230
203
  The default base URL is `https://app.usenadia.com/api`.
231
204