@synopackageland/cli 0.52.7 → 0.52.8

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.52.8
4
+
5
+ - Preserve dedicated shared-folder names and recorded upgrade selections when DSM loads the wizard share list
6
+ - Keep select and delegated shared-folder pickers empty until an explicit choice instead of selecting the first NAS share
7
+
3
8
  ## 0.52.7
4
9
 
5
10
  - Throttle NAS image pull progress, retain phase changes and completion, and omit the unverified byte count
@@ -1,11 +1,11 @@
1
- import { sharedFolderCombobox } from './share-combobox.js';
1
+ import { sharedFolderActivation, sharedFolderCombobox } from './share-combobox.js';
2
2
  export function renderDelegateScopeSteps(t) {
3
3
  const box = sharedFolderCombobox(t, 'delegate_share');
4
4
  box.desc = t('label.sharedFolder');
5
5
  const item = box.subitems[0];
6
6
  item.desc = t('label.sharedFolder');
7
7
  item.validator = { allowBlank: true }; // Home works even on a NAS without local shares.
8
- return [{ step_title: t('install.step'), items: [
8
+ return [{ step_title: t('install.step'), activeate: sharedFolderActivation('delegate_share'), items: [
9
9
  { desc: t('consent.appOwnSpace') }, { desc: t('delegate.preselection') },
10
10
  box, { type: 'multiselect', subitems: [{ key: 'delegate_home', desc: t('delegate.home'), defaultValue: false }] },
11
11
  ] }];
@@ -3,6 +3,7 @@ import { type Translate } from "./wizard-i18n.js";
3
3
  export interface InstallWizardStep {
4
4
  step_title: string;
5
5
  items: Array<Record<string, unknown>>;
6
+ activeate?: string;
6
7
  }
7
8
  /** The static JSON wizard per locale, and the dynamic script per locale. */
8
9
  export interface InstallWizardFiles {
@@ -1,3 +1,10 @@
1
1
  import type { Translate } from "./wizard-i18n.js";
2
2
  /** A wizard combobox listing the NAS's Shared Folders (`SYNO.Core.Share list`) into the variable `key`. */
3
3
  export declare function sharedFolderCombobox(t: Translate, key: string): Record<string, unknown>;
4
+ /**
5
+ * DSM's api_store loader unconditionally selects the first record, even with
6
+ * autoSelect: false. Bind the same read-only API store on step activation so
7
+ * loading the list preserves the declared/retained value (or an empty choice).
8
+ * `activeate` is the spelling of the legacy DSM wizard hook.
9
+ */
10
+ export declare function sharedFolderActivation(key: string): string;
@@ -11,17 +11,20 @@ export function sharedFolderCombobox(t, key) {
11
11
  editable: false,
12
12
  forceSelection: true,
13
13
  autoSelect: false,
14
- mode: "remote",
15
- api_store: {
16
- api: "SYNO.Core.Share",
17
- method: "list",
18
- version: 1,
19
- baseParams: { limit: -1, offset: 0 },
20
- root: "shares",
21
- idProperty: "name",
22
- fields: ["name"],
23
- },
14
+ mode: "local",
15
+ triggerAction: "all",
16
+ store: [],
17
+ defaultValue: "",
24
18
  validator: { allowBlank: false },
25
19
  }],
26
20
  };
27
21
  }
22
+ /**
23
+ * DSM's api_store loader unconditionally selects the first record, even with
24
+ * autoSelect: false. Bind the same read-only API store on step activation so
25
+ * loading the list preserves the declared/retained value (or an empty choice).
26
+ * `activeate` is the spelling of the legacy DSM wizard hook.
27
+ */
28
+ export function sharedFolderActivation(key) {
29
+ return `{var field=arguments[0].getForm().findField(${JSON.stringify(key)});if(!field||field.synopkglandShareStore)return;var value=field.getValue();var store=new SYNO.API.JsonStore({api:'SYNO.Core.Share',method:'list',version:1,baseParams:{limit:-1,offset:0},root:'shares',idProperty:'name',fields:['name'],appWindow:arguments[0].owner,autoDestroy:true,autoLoad:false});field.bindStore(store);field.synopkglandShareStore=true;field.setValue(value);store.load();}`;
30
+ }
@@ -1,6 +1,6 @@
1
1
  import { DSM_LANGS, LOCALES } from "./i18n.js";
2
2
  import { existingShareValidator } from "../build-spk/share-validation.js";
3
- import { sharedFolderCombobox } from "../build-spk/share-combobox.js";
3
+ import { sharedFolderActivation, sharedFolderCombobox } from "../build-spk/share-combobox.js";
4
4
  import { renderWizardFiles, translator } from "../build-spk/wizard-i18n.js";
5
5
  import { integrationWizardSteps } from "../build-spk/install-wizard.js";
6
6
  const FIELDS = new Set(["mode", "key", "name", "permission"]);
@@ -138,7 +138,10 @@ export function renderSharedFolderWizardFiles(pkg, folder) {
138
138
  }
139
139
  /** The install wizard steps that ask for the shared folder, for static or dynamic wizards. */
140
140
  export function sharedFolderInstallSteps(pkg, folder) {
141
- return t => [{ step_title: t("install.step"), items: installItems(t, pkg, folder) }];
141
+ return t => [sharedFolderStep(t("install.step"), installItems(t, pkg, folder), folder)];
142
+ }
143
+ function sharedFolderStep(title, items, folder) {
144
+ return { step_title: title, items, ...(folder.mode !== "create" ? { activeate: sharedFolderActivation(folder.key) } : {}) };
142
145
  }
143
146
  /** The upgrade wizard files that let the administrator keep or change the shared folder. */
144
147
  export function renderSharedFolderUpgradeWizardFiles(pkg, folder) {
@@ -152,19 +155,19 @@ export function renderUpgradeWizardFiles(pkg, folder, integrations = []) {
152
155
  if (!folder && !integrations.length)
153
156
  return {};
154
157
  const files = renderWizardFiles("upgrade_uifile", t => [
155
- ...(folder ? [{ step_title: t("upgrade.step"), items: upgradeItems(t, pkg, folder) }] : []),
158
+ ...(folder ? [sharedFolderStep(t("upgrade.step"), upgradeItems(t, pkg, folder), folder)] : []),
156
159
  ...integrationWizardSteps(t, integrations),
157
160
  ]);
158
161
  if (folder && folder.mode !== "create") {
159
162
  for (const locale of LOCALES) {
160
163
  const t = translator(locale);
161
- const steps = [{ step_title: t("upgrade.step"), items: upgradeItems(t, pkg, folder) }, ...integrationWizardSteps(t, integrations)];
164
+ const steps = [sharedFolderStep(t("upgrade.step"), upgradeItems(t, pkg, folder), folder), ...integrationWizardSteps(t, integrations)];
162
165
  const field = steps[0].items[1].subitems[0];
163
166
  field.defaultValue = "__SYNOPKGLAND_RETAINED_SHARE__";
164
167
  const invalid = JSON.stringify(steps, null, 2).replace('"__SYNOPKGLAND_RETAINED_SHARE__"', '""');
165
168
  field.validator = { allowBlank: false, fn: existingShareValidator(validationMessages(t), false, folder.name) };
166
169
  const retained = JSON.stringify(steps, null, 2);
167
- const fresh = JSON.stringify([{ step_title: t("upgrade.step"), items: installItems(t, pkg, folder) }, ...integrationWizardSteps(t, integrations)], null, 2);
170
+ const fresh = JSON.stringify([sharedFolderStep(t("upgrade.step"), installItems(t, pkg, folder), folder), ...integrationWizardSteps(t, integrations)], null, 2);
168
171
  const name = locale === "en" ? "upgrade_uifile.sh" : `upgrade_uifile_${DSM_LANGS[locale]}.sh`;
169
172
  files[name] = sharedFolderUpgradeScript(pkg, folder.key, retained, fresh, invalid);
170
173
  }
@@ -18,8 +18,10 @@ compose:
18
18
 
19
19
  Use the app's package name for `name` (1–32 safe characters). The install wizard
20
20
  prefills this dedicated name. Keep it to let DSM create or reuse that folder, or
21
- select a supported existing share. A fresh install does not need an existing
22
- package account or a permission grant prepared by an administrator.
21
+ select a supported existing share. Loading the share list keeps this name, even
22
+ when other shares appear first; an existing share with the same name is reused.
23
+ A fresh install does not need an existing package account or a permission grant
24
+ prepared by an administrator.
23
25
 
24
26
  Selecting a folder authorizes DSM's `data-share` worker to grant exactly the
25
27
  manifest's RO or RW to the package account on installation, upgrade, repair and
@@ -51,7 +53,8 @@ upgrade answers reuse DSM's saved installer variables; when migrating an older
51
53
  installation without those values, explicitly submit the recorded folder.
52
54
 
53
55
  `mode: create` creates a fixed folder without a picker. `mode: select` requires
54
- an existing folder and uses the same DSM grant and validation. `key` and
56
+ an existing folder and uses the same DSM grant and validation. Its picker starts
57
+ empty and never selects the first available share automatically. `key` and
55
58
  `permission` must match `compose.shares`; host paths are never wizard answers.
56
59
  The package-account preinst still refuses missing, ambiguous or symlinked
57
60
  existing sources. The dedicated default alone may be materialized on DSM's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.52.7",
3
+ "version": "0.52.8",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@ identity_gateway:
17
17
  listen: {https: 28443}
18
18
  ```
19
19
 
20
- For every App needing shared data, name the dedicated share after the package. The wizard defaults to that name and also accepts a supported existing share. Selecting a folder authorizes DSM's `data-share` worker to grant the declared RO/RW to the package account on install, upgrade/repair and starts. No pre-existing account or permission grant is required. Validation checks the name, existence and supported local mounted folder type, never package-account access. Local tiered/S2S shares are accepted; remote/C2, tiering buckets, WORM, unmounted, unavailable, moving, external and forced-read-only shares are refused. Runtime kernel checks still report the share, required access and recovery action when permission is revoked. No App root or ACL writer is generated.
20
+ For every App needing shared data, name the dedicated share after the package. The wizard defaults to that name, keeps it when the share list loads, and reuses the matching share if it exists. It also accepts a supported existing share. `mode: select` starts empty and requires an explicit choice; `mode: create` has no picker. Selecting a folder authorizes DSM's `data-share` worker to grant the declared RO/RW to the package account on install, upgrade/repair and starts. No pre-existing account or permission grant is required. Validation checks the name, existence and supported local mounted folder type, never package-account access. Local tiered/S2S shares are accepted; remote/C2, tiering buckets, WORM, unmounted, unavailable, moving, external and forced-read-only shares are refused. Runtime kernel checks still report the share, required access and recovery action when permission is revoked. No App root or ACL writer is generated.
21
21
 
22
22
  The upgrade wizard prefills and submits the recorded folder without a separate change checkbox. Keep the dedicated name rather than clearing it. CLI automation uses `--param media=Media` on install and `--param CHANGE_media=true --param media=OtherMedia` to change it on upgrade/repair. Explicitly submit the saved folder when migrating older installations without saved DSM installer values.
23
23