saltcorn-samba 0.3.3 → 0.3.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/index.js +31 -10
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable changes to `saltcorn-samba` are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.3.4] – 2026-07-05
8
+
9
+ ### Fixed
10
+ - **`function is not iterable` beim Installieren behoben.**
11
+ In v0.3.3 hatte ich überkompensiert: der Manifest-Key `dependencies`
12
+ wurde in eine Factory-Funktion umgewandelt — Saltcorn liest `dependencies`
13
+ jedoch NICHT über `withCfg`, sondern iteriert es direkt mit `for..of`
14
+ ([`saltcorn-data/models/plugin.ts` Zeile 638](https://github.com/saltcorn/saltcorn/blob/master/packages/saltcorn-data/models/plugin.ts)).
15
+ Deshalb muss `dependencies` ein statisches Array bleiben. Alle anderen
16
+ Keys (viewtemplates, routes, headers) werden weiterhin über `withCfg`
17
+ gelesen und bleiben Factory-Funktionen. Ein ausführlicher Header-Kommentar
18
+ über `module.exports` dokumentiert nun beide Zugriffsmuster.
19
+
7
20
  ## [0.3.3] – 2026-07-05
8
21
 
9
22
  ### Fixed
package/index.js CHANGED
@@ -608,27 +608,48 @@ function wrapView(v) {
608
608
  // ---------------------------------------------------------------------------
609
609
 
610
610
  // ---------------------------------------------------------------------------
611
- // IMPORTANT: how Saltcorn iterates the manifest
611
+ // IMPORTANT: how Saltcorn reads the manifest
612
612
  // ---------------------------------------------------------------------------
613
- // When a plugin exports `configuration_workflow`, Saltcorn's state loader
614
- // treats EVERY other manifest key as a factory function and calls it with the
615
- // current plugin configurationsee
616
- // packages/saltcorn-data/db/state.ts `withCfg` (`plugin[key](cfg || {})`).
617
- // So each key below must be a function that returns the value, otherwise
618
- // Node throws `plugin[key] is not a function`. The only exceptions are the
619
- // bookkeeping keys `sc_plugin_api_version` and `configuration_workflow`
620
- // itself, which the loader accesses directly.
613
+ // Two access patterns coexist in Saltcorn's plugin loader:
614
+ //
615
+ // 1. `withCfg(key)` in `saltcorn-data/db/state.ts` when a plugin exports
616
+ // `configuration_workflow`, this helper calls `plugin[key](cfg)` and then
617
+ // iterates the return value. Any key it consults MUST therefore be a
618
+ // factory function that returns the real value.
619
+ // Keys consumed via `withCfg`: types, viewtemplates, functions,
620
+ // modelpatterns, fileviews, actions, eventTypes, fonts, icons,
621
+ // table_providers, authentication, exchange, copilot_skills,
622
+ // external_tables, headers, routes, capacitor_plugins.
623
+ //
624
+ // 2. Direct property access in `saltcorn-data/models/plugin.ts` — the
625
+ // loader reads a handful of keys straight off the module, WITHOUT going
626
+ // through `withCfg`. Those must be the raw value (not a function).
627
+ // Direct-access keys: dependencies (for..of loop), onLoad (called as fn),
628
+ // authentication (truthy check + later withCfg), user_config_form,
629
+ // plugin_name (string), layout / types / functions / viewtemplates
630
+ // (truthy checks in the plugin-store info card).
631
+ //
632
+ // The intersection is where confusion lives:
633
+ // - `dependencies` is read *directly* as an iterable and MUST be an array.
634
+ // - `viewtemplates`, `routes`, `headers` etc. are read via `withCfg` and
635
+ // MUST be functions when `configuration_workflow` is present.
636
+ //
637
+ // See:
638
+ // https://github.com/saltcorn/saltcorn/blob/master/packages/saltcorn-data/db/state.ts
639
+ // https://github.com/saltcorn/saltcorn/blob/master/packages/saltcorn-data/models/plugin.ts
621
640
  // ---------------------------------------------------------------------------
622
641
 
623
642
  module.exports = {
624
643
  sc_plugin_api_version: 1,
625
644
  configuration_workflow,
645
+ // The four keys below are consumed via `withCfg` → must be factory fns.
626
646
  viewtemplates: () => [wrapView(fileManagerView), wrapView(treeView)],
627
647
  routes: () => routes,
628
648
  headers: () => [
629
649
  { css: `/plugins/public/${PLUGIN_NAME}/samba.css` },
630
650
  ],
631
- dependencies: () => [],
651
+ // `dependencies` is iterated directly (for..of) must be a raw array.
652
+ dependencies: [],
632
653
  };
633
654
 
634
655
  // Note: the `samba_pdf` fieldview shipped in v0.1–0.3.1 has been removed from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saltcorn-samba",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Saltcorn plugin: browse, upload, rename and delete files on a Samba/CIFS share. File-manager view, directory tree, inline PDF viewer, external-app open (smb://).",
5
5
  "main": "index.js",
6
6
  "scripts": {