@synopackageland/sdk 0.46.0 → 0.46.2

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
@@ -25,6 +25,29 @@ Nothing is persisted. Recovery failure leaves the backend's existing
25
25
  both the cookie and token. The CLI embeds this factory from the selected SDK
26
26
  into every generated native window, including Go-only Apps.
27
27
 
28
+ ## DSM WebAPI
29
+
30
+ Every CLI-generated DSM window provides
31
+ `ctx.webApi(api, method, version, params)`, using the existing window channel
32
+ and SDK session recovery in the signed-in user's own session. It resolves DSM
33
+ data and rejects DSM refusals as `{code: "dsm_<n>"}`. DSM enforces that user's
34
+ permissions. The field remains optional in `Context` for standalone dev servers,
35
+ custom hosts and windows built by older CLIs.
36
+
37
+ ```ts
38
+ if (!ctx.webApi) throw new Error('DSM window required')
39
+ const data = await ctx.webApi('SYNO.Core.Service.PortInfo', 'load', 1, {})
40
+ ```
41
+
42
+ `readDsmPorts(ctx)` already prefers this channel and returns `[]` on refusal,
43
+ unavailable data or its five-second deadline. It uses a same-origin token
44
+ request only without a window channel. `createNasProvider(ctx)` and executor
45
+ scope selection also use `ctx.webApi` for File Station JSON calls, retaining
46
+ App admission, validation, cancellation and deadlines. A channel refusal never
47
+ retries through fetch. Direct `createDsmFileStation({webApi: ctx.webApi})` callers
48
+ can use the same transport. Multipart uploads and form downloads use their
49
+ existing binary transfer transport.
50
+
28
51
  ## File Station
29
52
 
30
53
  `openFolderInFileStation(path)` opens DSM's File Station at a folder;