@synopackageland/cli 0.47.3 → 0.47.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.47.4
4
+
5
+ - Expose ctx.webApi in every generated DSM window, across all backend runtimes and desktop or full-page launches, using the existing session channel and DSM error codes
6
+ - Cover generated calls, session recovery and refusals; document the public context API and SDK helper usage
7
+
3
8
  ## 0.47.3
4
9
 
5
10
  - Accept DSM service port entries using the all-protocol value, numeric single ports and string ranges
package/README.md CHANGED
@@ -582,6 +582,23 @@ cache refresh, host removal/revocation and explicit `ctl.commands` authoring.
582
582
  API descriptions are private SPK files named `synopkgland-api.json`, served
583
583
  only by the authenticated fixed `synopkgland.describe` CGI operation.
584
584
 
585
+ Every generated DSM window exposes
586
+ `ctx.webApi(api, method, version, params)` for DSM WebAPI calls in the signed-in
587
+ user's own session, across Go, Python, Node, Rust and binary backends. It reuses
588
+ the window's WebAPI channel and SDK session recovery, resolves DSM's data and
589
+ rejects DSM refusals as `{code: "dsm_<n>"}`. DSM enforces the user's permissions;
590
+ the call does not use the package backend or grant administrator access.
591
+
592
+ ```ts
593
+ if (!ctx.webApi) throw new Error('DSM window required')
594
+ const data = await ctx.webApi('SYNO.Core.Service.PortInfo', 'load', 1, {})
595
+ ```
596
+
597
+ The field is optional in the SDK type for standalone dev servers, custom hosts
598
+ and older generated windows. Prefer SDK helpers such as `readDsmPorts(ctx)`;
599
+ they use this channel when available and keep their documented fallback when
600
+ there is no window channel.
601
+
585
602
  Generated SDK windows expose `ctx.batch([{method, params}, ...])` when the
586
603
  selected SDK supplies its batch factory. One to eight independent JSON reads
587
604
  share a request; results keep input order and retain per-method errors. A batch
@@ -389,7 +389,7 @@ ${HOST_ADAPTER_RUNTIME}
389
389
  return createHostAdapter;
390
390
  })();
391
391
 
392
- ${root || manifest.portal ? renderWebApi(ns) : ""}// A display hint for hiding or disabling administrator settings; the CGI
392
+ ${renderWebApi(ns)}// A display hint for hiding or disabling administrator settings; the CGI
393
393
  // decides access on its own and never trusts this value.
394
394
  ${ns}.sessionUser = function () {
395
395
  var session = (SYNO.SDS && SYNO.SDS.Session) || {};
@@ -545,6 +545,7 @@ ${root ? root.mount : ""} ${ns}.loadApp(function (app, error) {
545
545
  displayName: ${ns}.createI18n(lang, ${JSON.stringify(displayNameCatalogs(manifest))}).t("app_title"),
546
546
  call: call,
547
547
  batch: batch,
548
+ webApi: ${ns}.webApi(me),
548
549
  files: {endpoint: ${JSON.stringify(cgiUrl(pkg))}, token: function () { return SYNO.SDS.Session && SYNO.SDS.Session.SynoToken; }},
549
550
  reopen: me.reopenEvents.subscribe,
550
551
  launchParams: me.launchParams,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.47.3",
3
+ "version": "0.47.4",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
package/skills/SKILL.md CHANGED
@@ -123,6 +123,14 @@ Never install, uninstall, publish or modify NAS data without task authorization.
123
123
 
124
124
  Native projects use schema 2 capabilities and `--with files,jobs,login,root-ops,delegate`; use `add` for existing projects. Prefer `check --json`, `build --json`, `inspect <spk> --json`, `deploy --dry-run --json`, and `status --host <profile> --json` for structured results. Read the conflict policy in reference/create.md before adding overlays.
125
125
 
126
+ Every generated DSM window exposes `ctx.webApi(api, method, version, params)`
127
+ in the signed-in user's own DSM session. It resolves DSM data and rejects
128
+ refusals as `{code: "dsm_<n>"}`. Use this channel for DSM JSON calls instead of
129
+ building SynoToken fetches; it applies to all backend languages and needs no
130
+ portal or executor capability. Prefer SDK helpers such as `readDsmPorts(ctx)`
131
+ where available. The SDK field remains optional for standalone dev servers,
132
+ custom hosts and older generated windows; DSM still enforces user permissions.
133
+
126
134
  For DSM Package Center dependencies independent of the App language, declare
127
135
  `dependencies: {packages: [{name: Node.js_v22, min_version: "22.19.0"}]}` in
128
136
  `dsm-package.yaml`; `min_version` is optional. Names are 1-64 ASCII letters,