@synopackageland/cli 0.12.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,12 @@
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
+
3
10
  ## 0.12.0 (2026-10-16)
4
11
 
5
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.
package/README.md CHANGED
@@ -204,3 +204,15 @@ 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;
@@ -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.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {