@enfocussw/switch-scripting-context 25.11.1-beta.4 → 25.11.1-beta.5
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
|
@@ -5,6 +5,21 @@ All notable changes to this package are documented here. Format follows
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [25.11.1-beta.5] - 2026-09-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- The property editor and declaration docs listed a `rational` (decimal) inline editor type,
|
|
13
|
+
which Node.js scripts do not allow. The docs no longer offer it and now say it is not allowed.
|
|
14
|
+
- `createJob()` was documented as valid only from `jobArrived` and `timerFired`. It also works from
|
|
15
|
+
`httpRequestTriggeredAsync`, the only webhook entry point that receives `flowElement`.
|
|
16
|
+
- Documented that `Type="password"` needs `Subtype=""`, not `"inline"`. The latter fails at script
|
|
17
|
+
load with an unsupported-editor error, even though it is the usual `Subtype` for a single inline
|
|
18
|
+
editor.
|
|
19
|
+
- Documented that `IncomingConnections="Yes"` with `RequireAtLeastOne="No"` makes the incoming
|
|
20
|
+
connection optional per flow element instance, letting one script support both a flow-starting
|
|
21
|
+
role and a mid-flow role.
|
|
22
|
+
|
|
8
23
|
## [25.11.1-beta.4] - 2026-09-20
|
|
9
24
|
|
|
10
25
|
### Added
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ AI coding assistant context for [Enfocus Switch](https://www.enfocus.com/en/swit
|
|
|
4
4
|
|
|
5
5
|
Installs curated API reference docs and generates config files for 8 AI coding agents (Claude Code, GitHub Copilot, Cursor, Codex CLI/OpenCode, Gemini CLI, Windsurf, Zed, and Cline) so AI assistants understand the Switch scripting API out of the box.
|
|
6
6
|
|
|
7
|
-
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.
|
|
7
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.5/CHANGELOG.md) (also included in this package) for what's changed between versions.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
@@ -89,7 +89,7 @@ A few things this gets you without asking for them by name:
|
|
|
89
89
|
properties (app path/licence) are off-limits and left to SwitchScripter's GUI instead.
|
|
90
90
|
|
|
91
91
|
Re-run `init` after upgrading this package so the copied docs and generated config files catch up.
|
|
92
|
-
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.
|
|
92
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.5/CHANGELOG.md) for what changed.
|
|
93
93
|
|
|
94
94
|
## Options
|
|
95
95
|
|
|
@@ -81,12 +81,12 @@ flowElement.failProcess(message: string, messageParam?: string | number | boolea
|
|
|
81
81
|
```
|
|
82
82
|
Logs a fatal error and puts the element into the "problem process" state. `messageParam` substitutes `%1`; before Switch 22.1, always pass it, as a string (see [api-versions.md](api-versions.md#declaration-changes-to-existing-methods)). Throws `"Job routing is not allowed in this entry point."` if called from an entry point where routing isn't permitted.
|
|
83
83
|
|
|
84
|
-
## Job creation (jobArrived / timerFired)
|
|
84
|
+
## Job creation (jobArrived / timerFired / httpRequestTriggeredAsync)
|
|
85
85
|
|
|
86
86
|
```ts
|
|
87
87
|
flowElement.createJob(path: string): Promise<Job>
|
|
88
88
|
```
|
|
89
|
-
Creates a new job from an existing file/folder path. Valid
|
|
89
|
+
Creates a new job from an existing file/folder path. Valid in `jobArrived`, `timerFired`, and `httpRequestTriggeredAsync` (confirmed working there; the only webhook entry point that receives `flowElement`). The new job has default properties (no parent). The caller is responsible for cleaning up the source file after routing. See [job-patterns.md](job-patterns.md#temp-file-cleanup) for temp file cleanup rules and [job-patterns.md](job-patterns.md#sending-jobs) for routing constraints.
|
|
90
90
|
|
|
91
91
|
```ts
|
|
92
92
|
// Switch 21.0+
|
|
@@ -36,13 +36,15 @@ The inline editor slot is always the single token `inline` in `Editor` — what
|
|
|
36
36
|
| `Editor="inline" Type="string"` | Single-line text as entered |
|
|
37
37
|
| `Editor="inline" Type="password"` | Text as entered (displayed masked) |
|
|
38
38
|
| `Editor="inline" Type="number"` | Integer as a string |
|
|
39
|
-
| `Editor="inline" Type="rational"` | Decimal as a string |
|
|
40
39
|
| `Editor="inline" Type="time"` | `"hh:mm"` (zero-padded, e.g. `"09:05"`) |
|
|
41
40
|
| `Editor="inline" Type="date"` | Date as entered |
|
|
42
41
|
| `Editor="inline" Type="datetime"` | Date and time as entered |
|
|
43
42
|
| `Editor="inline" Type="bool"` | `"No"` or `"Yes"` |
|
|
44
43
|
| `Editor="inline" Type="enum:Item1;Item2;..."` | The selected item string (one of the declared values) |
|
|
45
44
|
|
|
45
|
+
> The `rational` (decimal) inline editor is not allowed in Node.js scripts. Don't declare
|
|
46
|
+
> `Type="rational"`.
|
|
47
|
+
|
|
46
48
|
---
|
|
47
49
|
|
|
48
50
|
## Modal editors
|
|
@@ -158,7 +160,7 @@ offer it as the property's only editor — pair it with a module-free option (e.
|
|
|
158
160
|
|
|
159
161
|
| Property kind | Recommended `Editor` chain | Why |
|
|
160
162
|
|---|---|---|
|
|
161
|
-
| Secret (password, token, API key) | `inline` only, with `Type="password"` | Masks the value and avoids leaking it via logs or variable inspection if a var/expression editor were combined. `password` is a `Type`, not an editor token — there is no `password` entry in the [modal editor](#modal-editors) list, so `Editor="password"` is wrong. |
|
|
163
|
+
| Secret (password, token, API key) | `inline` only, with `Type="password"` and **`Subtype=""`** (not `"inline"`) | Masks the value and avoids leaking it via logs or variable inspection if a var/expression editor were combined. `password` is a `Type`, not an editor token — there is no `password` entry in the [modal editor](#modal-editors) list, so `Editor="password"` is wrong. `Subtype="inline"` (the usual value for a single inline editor, per [script-declaration.md](script-declaration.md#custom-property-elements-elementfields)) is rejected at script load with "editor that is not supported in Node.js scripting"; Switch Designer itself saves `Type="password"` with `Subtype=""`. |
|
|
162
164
|
| Scalar job-specific value (job ID, copy count, company name, date, etc.) | `inline` (`Type` matching the value) + `sltextwithvar` + `scriptexp` | Hard-coded default, plus dynamic substitution and full expression evaluation. |
|
|
163
165
|
| Array/list job-specific value | `stringlist` + `mltextwithvar` + `scriptexp` | One item per line. **Caveat:** the intent is that every path returns a `string[]`, but the [modal editor table](#modal-editors) lists `mltextwithvar` as returning a single string, and which one holds for this chain is unverified. Handle both — split on newlines when a bare string comes back. |
|
|
164
166
|
| Structured blob text (XML/JSON/HTML, email body) | `description` + `mltextwithvar` + `scriptexp` | Free multi-line text suits a single blob of content better than a line-per-item list. |
|
|
@@ -68,7 +68,7 @@ value is non-string (see the table); an empty string field can omit `Type`.
|
|
|
68
68
|
| `Version` | number | Format `[1-9][0-9]*(\.(0\|[1-9][0-9]*))*`, e.g. `1`, `2.1`. SwitchScripter accepts a whole number only for a script and at most one minor level for an app (`2.1`); it resets anything else. Bump once per release, not per edit (see [Agent editing policy](#agent-editing-policy)). Each flow records the version of the element it uses; Switch compares that recorded value with `UpgradeMaximumVersion` to decide whether to show `FlowUpgradeWarning`. |
|
|
69
69
|
| `Keywords` | string | Space/comma/semicolon-separated. Elements pane search. |
|
|
70
70
|
| `Tooltip` | string | Elements pane tooltip. |
|
|
71
|
-
| `IncomingConnections` | `Yes` \| `No` | Add `RequireAtLeastOne="Yes"` when `Yes`. When `Yes`, the script must implement `jobArrived` (optionally `timerFired` too); when `No`, it must implement `timerFired` instead — see [entry-points.md](../switch-api/entry-points.md#job-processing). |
|
|
71
|
+
| `IncomingConnections` | `Yes` \| `No` | Add `RequireAtLeastOne="Yes"` when `Yes`. When `Yes`, the script must implement `jobArrived` (optionally `timerFired` too); when `No`, it must implement `timerFired` instead — see [entry-points.md](../switch-api/entry-points.md#job-processing). Setting `IncomingConnections="Yes" RequireAtLeastOne="No"` makes the incoming connection optional per instance: some instances can have zero incoming connections (e.g. a flow-starting webhook trigger) and others one wired in (e.g. a mid-flow processing step), with the script branching on both cases at runtime, typically gated by a property such as a mode enum. Confirmed working in Switch Designer. |
|
|
72
72
|
| `OutgoingConnections` | `No` \| `One` \| `Unlimited` | Add `RequireAtLeastOne="Yes"` when `One`/`Unlimited`. Always carries `DetailedInfo=""` (or a prose description of the connections, for generated docs). When not `No`, the script must call a `sendTo*()` method at least once for any job it actually routes (a purely timer/event-driven script that never touches a job — polling an API, rotating logs, etc. — is a legitimate exception); when `Unlimited`, never use `job.sendToSingle()` — see [job-patterns.md § Sending jobs](../switch-api/job-patterns.md#sending-jobs). |
|
|
73
73
|
| `ConnectionType` | `Move` \| `Filter` \| `TrafficLight` | Governs which `ConnectionFields` children are legal — see [ConnectionFields](#connectionfields). |
|
|
74
74
|
| `FunctionsNodeJSScript` | `;`-separated names | Entry point function names found in the script. Omit the element entirely if there is no Node.js program. |
|
|
@@ -120,7 +120,7 @@ Key attributes:
|
|
|
120
120
|
| `UserDefined` | Always `"true"` for custom properties. |
|
|
121
121
|
| `Type` | Value type discriminator — see [Type reference](#type-reference). |
|
|
122
122
|
| `Editor` | `;`-joined chain of editor tokens (inline editor first, then modal editors) — see [property-editors.md](property-editors.md). |
|
|
123
|
-
| `Subtype` | Which editor in the `Editor` chain is currently active for the stored value. For a single-editor property this equals that editor's token (e.g. `"inline"`); for a bare modal editor with no inline component, leave it `""`. This attribute is read by Switch's validator at runtime, not just bookkeeping — keep it consistent with `Editor`. |
|
|
123
|
+
| `Subtype` | Which editor in the `Editor` chain is currently active for the stored value. For a single-editor property this equals that editor's token (e.g. `"inline"`); for a bare modal editor with no inline component, leave it `""`. Exception: `Type="password"` takes `Subtype=""` even though `Editor="inline"` alone — see [property-editors.md](property-editors.md#common-practices). This attribute is read by Switch's validator at runtime, not just bookkeeping — keep it consistent with `Editor`. |
|
|
124
124
|
| `LocalizedTagName` | Display name shown in the Properties pane. **App guideline (mandatory for apps, recommended for scripts):** 30 characters max, sentence-style capitalization (`"Customer name"`, not `"Customer Name"`). |
|
|
125
125
|
| `Tooltip` | Tooltip shown in the Properties pane. **App guideline (mandatory for apps, recommended for scripts):** give every property a tooltip. The only exception is a property that's fully self-explanatory from its name alone with no extra constraints (e.g. "Number of copies" with no min/max) — if there's anything a user would need to know (units, valid range, format, an example value), put it in the tooltip. |
|
|
126
126
|
| `DetailedInfo` | Long-form description for generated docs. Always include the attribute (empty string `""` is fine) — omitting it makes the property non-editable in Switch Designer. |
|
|
@@ -258,7 +258,6 @@ If no OAuth property exists on the script, omit `ExtraProperties` entirely or le
|
|
|
258
258
|
|---|---|
|
|
259
259
|
| `string` | Text |
|
|
260
260
|
| `number` | Integer |
|
|
261
|
-
| `rational` | Decimal |
|
|
262
261
|
| `password` | Masked text |
|
|
263
262
|
| `bool` | `Yes`/`No` |
|
|
264
263
|
| `date`, `datetime`, `time` | `time` is hours-and-minutes |
|
|
@@ -272,11 +271,13 @@ This is the *authoring* vocabulary written into the XML `Type` attribute. It doe
|
|
|
272
271
|
onto the runtime `PropertyType` returned by `getPropertyType()` (see
|
|
273
272
|
[property-editors.md](property-editors.md) and [enums.md](../switch-api/enums.md)) — e.g. XML
|
|
274
273
|
`bool` becomes runtime `boolean`, XML `path` splits into runtime `filepath`/`folderpath`, and several
|
|
275
|
-
XML types (`
|
|
274
|
+
XML types (`stringlist`, `accountlist`, `enum:...`, `datetime`, `time`) have no direct
|
|
276
275
|
`PropertyType` counterpart while several runtime values (`filetype`, `folderpattern`, `regex`,
|
|
277
276
|
`oauthtoken`, `literal`) have no direct XML `Type` counterpart. Don't assume the two vocabularies are
|
|
278
277
|
interchangeable.
|
|
279
278
|
|
|
279
|
+
`rational` (decimal) is not a valid `Type` for Node.js scripts.
|
|
280
|
+
|
|
280
281
|
`Type` is not independently authored on properties with a modal editor chain — it follows from
|
|
281
282
|
which editor(s) you choose, per [property-editors.md](property-editors.md). When combining
|
|
282
283
|
an inline editor with modal editors (e.g. `Editor="inline;sltextwithvar;scriptexp"`), the inline
|