saltcorn-samba 0.3.2 → 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 +27 -0
  2. package/index.js +37 -4
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ 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
+
20
+ ## [0.3.3] – 2026-07-05
21
+
22
+ ### Fixed
23
+ - **`plugin[key] is not a function` beim Installieren behoben.**
24
+ Saltcorns Plugin-Loader ruft — sobald ein Plugin `configuration_workflow`
25
+ exportiert — *jeden* weiteren Manifest-Key als Funktion mit der aktuellen
26
+ Konfiguration als Argument auf (siehe
27
+ [saltcorn-data/db/state.ts, Fn `withCfg`](https://github.com/saltcorn/saltcorn/blob/master/packages/saltcorn-data/db/state.ts)).
28
+ In v0.3.2 waren `viewtemplates`, `routes`, `headers` und `dependencies`
29
+ jedoch statische Arrays — der Aufruf `plugin.viewtemplates(cfg)` warf
30
+ daher den Fehler. Alle Keys sind jetzt Factory-Funktionen, die den Wert
31
+ zurückgeben. `plugin_name` als Top-Level-Key wurde entfernt (aus
32
+ demselben Grund unaufrufbar).
33
+
7
34
  ## [0.3.2] – 2026-07-05
8
35
 
9
36
  ### Fixed
package/index.js CHANGED
@@ -607,15 +607,48 @@ function wrapView(v) {
607
607
  // Manifest
608
608
  // ---------------------------------------------------------------------------
609
609
 
610
+ // ---------------------------------------------------------------------------
611
+ // IMPORTANT: how Saltcorn reads the manifest
612
+ // ---------------------------------------------------------------------------
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
640
+ // ---------------------------------------------------------------------------
641
+
610
642
  module.exports = {
611
643
  sc_plugin_api_version: 1,
612
- plugin_name: PLUGIN_NAME,
613
644
  configuration_workflow,
614
- viewtemplates: [wrapView(fileManagerView), wrapView(treeView)],
615
- routes,
616
- headers: [
645
+ // The four keys below are consumed via `withCfg` → must be factory fns.
646
+ viewtemplates: () => [wrapView(fileManagerView), wrapView(treeView)],
647
+ routes: () => routes,
648
+ headers: () => [
617
649
  { css: `/plugins/public/${PLUGIN_NAME}/samba.css` },
618
650
  ],
651
+ // `dependencies` is iterated directly (for..of) → must be a raw array.
619
652
  dependencies: [],
620
653
  };
621
654
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saltcorn-samba",
3
- "version": "0.3.2",
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": {