@synopackageland/cli 0.11.0 → 0.12.1

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.1 (2026-10-16)
4
+
5
+ - Preserve optional `raw_max_bytes` in WebAPI profiles and administrator policy digests. Reject invalid limits and require raw-capable SDK 0.12.1; zero/omitted profiles stay JSON-only. Generated approval details receive the byte limit.
6
+ - Pin the SDK 0.12.1 three-architecture executor and lifecycle digests. Templates remain 0.12.0; no template change is needed for an optional consumer-declared profile.
7
+
8
+ 繁中摘要:WebAPI profile 支援 raw_max_bytes 明確啟用原始回應與大小上限;驗證及核准 digest 保留此設定,需搭配 SDK 0.12.1。更新 executor digest,templates 維持 0.12.0。
9
+
10
+ ## 0.12.0 (2026-10-16)
11
+
12
+ - Generated Apps use templates 0.12.0, SDK 0.12.0 and UI 0.10.1. Vue pages and sections stack at the UI section gap, and SDK dialogs size to their content.
13
+ - `metadata.screenshots` accepts up to 5 `https://` URLs, matching the catalog; `check` refuses more, or an `http://` URL, with `STANDALONE_TEXT_INVALID`.
14
+ - The executor digest table records SDK 0.12.0, whose executor and lifecycle digests equal 0.11.0's. This CLI builds SDK 0.12.x executors; upgrade backend and frontend pins to 0.12.0 together.
15
+ - 繁中:產生的 App 使用 templates 0.12.0、SDK 0.12.0 與 UI 0.10.1;Vue 頁面與區塊以 UI section gap 排列,SDK 對話框依內容決定寬度。`metadata.screenshots` 最多 5 個 `https://` URL,與 catalog 一致,超過或使用 `http://` 時 `check` 回報 `STANDALONE_TEXT_INVALID`。digest 表記錄 SDK 0.12.0(與 0.11.0 相同);此 CLI 建置 SDK 0.12.x executor,後端/前端 pin 需一併升級至 0.12.0。
16
+
3
17
  ## 0.11.0 (2026-10-16)
4
18
 
5
19
  - Add capabilities.webapi named profiles with purpose and exact API/method/version lists, pinned in the administrator-approved executor policy. Build, inspect, lifecycle, bridge services and consent details support WebAPI-only Apps without granting file/root operations.
package/README.md CHANGED
@@ -185,7 +185,7 @@ Third-party components keep their own terms.
185
185
  - Keep `backend/THIRD_PARTY_NOTICES.txt` current when you change Go modules. Your own binaries,
186
186
  added modules, container images and upstream apps need their own notices.
187
187
 
188
- SDK 0.11.0 adds delegated JSON WebAPI profiles. With CLI 0.11.0, declare:
188
+ Delegated JSON WebAPI profiles need SDK 0.11.0 or later. Declare:
189
189
 
190
190
  ```yaml
191
191
  capabilities:
@@ -199,8 +199,20 @@ capabilities:
199
199
  delete: [6]
200
200
  ```
201
201
 
202
- Use matching backend/frontend SDK 0.11.0 pins. The profile participates in the
202
+ Use matching backend/frontend SDK pins. The profile participates in the
203
203
  normal executor approval digest; a profile change needs administrator approval.
204
204
  Users grant the named profile separately. The permanent denylist, current-user
205
205
  permission checks, bounded JSON and uncertain-outcome rules are in the SDK's
206
206
  executor/README.md. Binary downloads require later SDK support.
207
+
208
+ ## Raw WebAPI profiles
209
+
210
+ SDK 0.12.1 add opt-in raw responses. In `capabilities.webapi.<profile>`,
211
+ set `raw_max_bytes: 26214400` for a 25 MiB MIME limit and explicitly allow
212
+ `SYNO.MailClient.Message.get_original` v10. Omitting the limit preserves JSON-only
213
+ profiles. Changing it changes the approved policy and requires fresh user consent.
214
+ Call `webapi.call` with `response_type: "raw"`; Go Apps use
215
+ `JobContext.WebAPI().CallRaw`. Small bodies use base64; large bodies use the
216
+ package's private executor-staging folder with size/SHA-256 and immediate cleanup.
217
+ Do not use Attachment.download or follow X-Accel-Redirect. See the SDK raw response
218
+ contract for the complete transport and CGI validation rules.
package/dist/init.js CHANGED
@@ -305,8 +305,17 @@ function assertLocalSdkReady(sdkDir, vue) {
305
305
  */
306
306
  function useLocalSdk(targetDir, sdkDir) {
307
307
  const goMod = join(targetDir, "backend/go.mod");
308
- if (existsSync(goMod))
309
- writeFileSync(goMod, `${readFileSync(goMod, "utf8")}\nreplace ${SDK_MODULE} => ${sdkDir}\n`);
308
+ if (existsSync(goMod)) {
309
+ let text = readFileSync(goMod, "utf8");
310
+ const sdkPackage = join(sdkDir, "ts/package.json");
311
+ if (existsSync(sdkPackage)) {
312
+ const version = JSON.parse(readFileSync(sdkPackage, "utf8")).version;
313
+ if (typeof version !== "string" || !/^\d+\.\d+\.\d+$/.test(version))
314
+ throw new Error('[SDK_DIR_NOT_READY] Local SDK package version must be X.Y.Z.');
315
+ text = text.replace(/(github\.com\/synopackageland\/syno-pkg-land-sdk v)\d+\.\d+\.\d+\b/g, `$1${version}`);
316
+ }
317
+ writeFileSync(goMod, `${text}\nreplace ${SDK_MODULE} => ${sdkDir}\n`);
318
+ }
310
319
  const frontend = join(targetDir, "frontend/package.json");
311
320
  if (!existsSync(frontend))
312
321
  return;
@@ -17,5 +17,7 @@ export interface PackageMetadata {
17
17
  screenshots?: string[];
18
18
  }
19
19
  export declare function safeMetadataUrl(value: unknown, mail?: boolean): value is string;
20
+ /** The catalog shows at most 5 screenshots and loads them over https only. */
21
+ export declare const MAX_SCREENSHOTS = 5;
20
22
  export declare function validateMetadata(raw: unknown): PackageMetadata;
21
23
  export declare function metadataInfoFields(metadata?: PackageMetadata): [string, string][];
@@ -14,6 +14,9 @@ export function safeMetadataUrl(value, mail = false) {
14
14
  return false;
15
15
  }
16
16
  }
17
+ /** The catalog shows at most 5 screenshots and loads them over https only. */
18
+ export const MAX_SCREENSHOTS = 5;
19
+ const safeScreenshotUrl = (value) => safeMetadataUrl(value) && value.startsWith("https:");
17
20
  export function validateMetadata(raw) {
18
21
  if (!raw || typeof raw !== "object" || Array.isArray(raw))
19
22
  throw new Error("invalid metadata");
@@ -38,8 +41,8 @@ export function validateMetadata(raw) {
38
41
  throw new Error("unknown metadata");
39
42
  if (k === "screenshots") {
40
43
  if (!Array.isArray(v) ||
41
- v.length > 12 ||
42
- !v.every((u) => safeMetadataUrl(u)))
44
+ v.length > MAX_SCREENSHOTS ||
45
+ !v.every(safeScreenshotUrl))
43
46
  throw new Error("invalid screenshots");
44
47
  }
45
48
  else if ((k === "long_description" || k === "changelog") &&
@@ -1,5 +1,5 @@
1
1
  {
2
- "0.11.0": {
2
+ "0.12.0": {
3
3
  "x86_64": "abe0a42699fed06aeeb7520e5a4f3393cae64f83a66773b70630f0db0c5ed107",
4
4
  "aarch64": "1fdf171a665279f16ca1c2605a54996b2359fa69531c6fe4e890f5bda61c1bef",
5
5
  "armv7": "946f73df833929283f94289f025fd73897416777be5e0867d1e73f0b6c3031d7",
@@ -9,5 +9,16 @@
9
9
  "armv7": "cafc97c89f5645c14a8cf31d6d9f258394ed6f2d086478a7aebd04d57c274b4e"
10
10
  },
11
11
  "goToolchain": "go1.26.9"
12
+ },
13
+ "0.12.1": {
14
+ "x86_64": "efe409287770f6b70e7f8465e8767eeb2413b9ab8775020cf4dffb1555d7bf1f",
15
+ "aarch64": "d68c9889ed2391e918b9c278679ea0a01cd04425528c11090700a3b6341fc543",
16
+ "armv7": "9149a05efb9f2d7d86a400707099b3d657382b1c0dbad6588be8c500e90445cc",
17
+ "lifecycle": {
18
+ "x86_64": "d65500c4f04713a32b45d360059281391acfa5e00ee24895fdd2de7b82735372",
19
+ "aarch64": "94f6cd119186ff482b8aea56541dd1f9d53c147566bc1efdca6f5a1c86198331",
20
+ "armv7": "cafc97c89f5645c14a8cf31d6d9f258394ed6f2d086478a7aebd04d57c274b4e"
21
+ },
22
+ "goToolchain": "go1.26.9"
12
23
  }
13
24
  }
@@ -1,7 +1,8 @@
1
- /** JSON WebAPI profiles, independently enforced again by the pinned executor. */
1
+ /** WebAPI profiles, independently enforced again by the pinned executor. */
2
2
  export interface WebAPIProfile {
3
3
  purpose: string;
4
4
  apis: Record<string, Record<string, number[]>>;
5
+ raw_max_bytes?: number;
5
6
  }
6
7
  export type WebAPIProfiles = Record<string, WebAPIProfile>;
7
8
  export declare function validWebAPIProfiles(value: unknown): value is WebAPIProfiles;
@@ -6,7 +6,9 @@ export function validWebAPIProfiles(value) {
6
6
  return false;
7
7
  let total = 0;
8
8
  for (const [name, p] of Object.entries(value)) {
9
- if (!/^[a-z][a-z0-9_-]{0,63}$/.test(name) || name === 'home' || !record(p) || Object.keys(p).some(k => !['purpose', 'apis'].includes(k)) || typeof p.purpose !== 'string' || !p.purpose.trim() || Buffer.byteLength(p.purpose) > 1024 || /[\x00-\x1f\x7f]/.test(p.purpose) || !record(p.apis) || !Object.keys(p.apis).length)
9
+ if (!/^[a-z][a-z0-9_-]{0,63}$/.test(name) || name === 'home' || !record(p) || Object.keys(p).some(k => !['purpose', 'apis', 'raw_max_bytes'].includes(k)) || typeof p.purpose !== 'string' || !p.purpose.trim() || Buffer.byteLength(p.purpose) > 1024 || /[\x00-\x1f\x7f]/.test(p.purpose) || !record(p.apis) || !Object.keys(p.apis).length)
10
+ return false;
11
+ if (p.raw_max_bytes !== undefined && (!Number.isSafeInteger(p.raw_max_bytes) || Number(p.raw_max_bytes) < 0 || Number(p.raw_max_bytes) > 67108864))
10
12
  return false;
11
13
  for (const [api, methods] of Object.entries(p.apis)) {
12
14
  if (!/^SYNO\.[A-Za-z][A-Za-z0-9]*(\.[A-Za-z][A-Za-z0-9]*)*$/.test(api) || api.toLowerCase().split('.').slice(1).some(x => blocked.has(x)) || !record(methods) || !Object.keys(methods).length)
@@ -23,5 +25,5 @@ export function validWebAPIProfiles(value) {
23
25
  return true;
24
26
  }
25
27
  export function sortedWebAPIProfiles(profiles) {
26
- return Object.fromEntries(Object.entries(profiles).sort(([a], [b]) => a < b ? -1 : 1).map(([name, p]) => [name, { purpose: p.purpose, apis: Object.fromEntries(Object.entries(p.apis).sort(([a], [b]) => a < b ? -1 : 1).map(([api, methods]) => [api, Object.fromEntries(Object.entries(methods).sort(([a], [b]) => a < b ? -1 : 1).map(([m, versions]) => [m, [...versions].sort((a, b) => a - b)]))])) }]));
28
+ return Object.fromEntries(Object.entries(profiles).sort(([a], [b]) => a < b ? -1 : 1).map(([name, p]) => [name, { purpose: p.purpose, apis: Object.fromEntries(Object.entries(p.apis).sort(([a], [b]) => a < b ? -1 : 1).map(([api, methods]) => [api, Object.fromEntries(Object.entries(methods).sort(([a], [b]) => a < b ? -1 : 1).map(([m, versions]) => [m, [...versions].sort((a, b) => a - b)]))])), ...(p.raw_max_bytes ? { raw_max_bytes: p.raw_max_bytes } : {}) }]));
27
29
  }
@@ -217,6 +217,10 @@ function readManifest(raw, c) {
217
217
  const sdk = sdkVersionOrUndefined(backend);
218
218
  if (!sdk || Number(sdk.split('.')[0]) === 0 && Number(sdk.split('.')[1]) < 11)
219
219
  c.fail("SDK_UNSUPPORTED", "capabilities.webapi requires SDK 0.11.0 or later; update backend and frontend together.");
220
+ const raw = Object.values(capabilities.webapi).some(profile => (profile.raw_max_bytes ?? 0) > 0);
221
+ const [major, minor, patch] = (sdk ?? '0.0.0').split('.').map(Number);
222
+ if (raw && (!sdk || major === 0 && (minor < 12 || minor === 12 && patch < 1)))
223
+ c.fail("SDK_UNSUPPORTED", "Raw WebAPI profiles require SDK 0.12.1 or later; update backend and frontend together.");
220
224
  }
221
225
  const uninstall = readUninstall(raw.uninstall, { rootOps: capabilities.rootOps === true, ops: rootOps, en: i18n?.catalogs?.en }, e => c.fail(e.code, e.message));
222
226
  const appScripts = readAppScripts(c.root, e => c.fail(e.code, e.message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "prepublishOnly": "npm run build"
26
26
  },
27
27
  "dependencies": {
28
- "@synopackageland/templates": "0.11.0",
28
+ "@synopackageland/templates": "0.12.0",
29
29
  "ajv": "^8.17.1",
30
30
  "commander": "^13.1.0",
31
31
  "tar": "^7.4.3",
@@ -90,10 +90,10 @@
90
90
  },
91
91
  "screenshots": {
92
92
  "type": "array",
93
- "maxItems": 12,
93
+ "maxItems": 5,
94
94
  "items": {
95
95
  "type": "string",
96
- "pattern": "^https?://",
96
+ "pattern": "^https://",
97
97
  "maxLength": 2048
98
98
  }
99
99
  }
@@ -275,10 +275,10 @@
275
275
  },
276
276
  "screenshots": {
277
277
  "type": "array",
278
- "maxItems": 12,
278
+ "maxItems": 5,
279
279
  "items": {
280
280
  "type": "string",
281
- "pattern": "^https?://",
281
+ "pattern": "^https://",
282
282
  "maxLength": 2048
283
283
  }
284
284
  }