@xeplr/actions 1.3.1 → 1.4.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/README.md CHANGED
@@ -64,7 +64,7 @@ var moved = await actions.runAction(actions.builtins.dbMove, {
64
64
  |---|---|
65
65
  | `register(def)` / `register(name, def)` | Add an action. Throws without `name` or `execute`, or with a `requires` module that is not installed (`ActionMissingDependencyError`). Re-registering a name replaces it. |
66
66
  | `get(name)` / `has(name)` | Look one up. |
67
- | `list()` | `[{ name, description, inputSchema, outputSchema, requires }]` — serializable, for an actions endpoint. |
67
+ | `list()` | `[{ name, description, inputSchema, outputSchema, requires, event }]` — serializable, for an actions endpoint. `event` is `null` for an ordinary action. |
68
68
  | `clear()` | Empty the registry. |
69
69
  | `runAction({ name, input, system?, timeoutMs? })` | Run a registered action. Never throws. |
70
70
  | `runAction(nameOrDef, input, { system, timeoutMs, metaStore }?)` | Same, by name or with an action module directly. |
@@ -91,6 +91,7 @@ var moved = await actions.runAction(actions.builtins.dbMove, {
91
91
  | `outputSchema` | Optional documentation of the return value. |
92
92
  | `requires` | Module names checked with `require.resolve` at `register()`. |
93
93
  | `execute({ input, system, metaStore })` | Returns (or resolves to) the output. |
94
+ | `event` | Optional. Makes this a **screen function** rather than a step: the event it is written for — `beforeLoad`, `beforeSave`, `afterSave`, `beforeDelete`, `onError` (run by `@xeplr/factory` around a screen's records) or `decide` (run by `@xeplr/workflow-engine` to choose a flow's next step). A screen names one per event and pickers offer only the functions for that event. It is called with the event's context — `execute(ctx)`, not `{ input, system }` — and never as a workflow step. |
94
95
 
95
96
  ### `runAction` result
96
97
 
@@ -469,6 +470,10 @@ await driver.query(pool, userSql, params) // reads only
469
470
  | The system mail sender refuses `text`, `bcc`, `from`, `replyTo` rather than dropping them. | A silently lost bcc is a compliance problem found a year later. |
470
471
  | `email-send` returns both `accepted` and `rejected`. | SMTP accepts per recipient; a "success" can drop half of them. |
471
472
 
473
+ ## Dev-only overrides
474
+
475
+ `package.json` overrides `@azure/msal-node` to `^7.1.0` for this repo's own install. `mssql` (a dev dependency here, for the SQL Server driver tests) pulls it in through `tedious` → `@azure/identity`, which still asks for `^6` — and every 6.x has GHSA-xcx6-jx8p-x3h5 (high). Overrides apply only to this repo's own install; an app using `@xeplr/actions` resolves its own `mssql` and should add the same override until `@azure/identity` moves to msal-node 7. Remove it once it does.
476
+
472
477
  ## Tests
473
478
 
474
479
  There is no `npm test` script. The tests use `node:test`; run a file directly:
package/lib/registry.js CHANGED
@@ -9,8 +9,17 @@
9
9
  // outputSchema : array? — optional; documents what the action returns
10
10
  // requires : string[]? — peer-dep module names checked at register time
11
11
  // execute : function — async ({ input, system }) => output
12
+ // event : string? — a SCREEN FUNCTION, not a step: the event it
13
+ // is written for ('beforeSave', 'decide', …).
14
+ // Called with that event's own context instead
15
+ // of { input, system } — see the README.
12
16
  // }
13
17
  //
18
+ // One registry for both, because one app registers both and the two readers
19
+ // (a screen's events, a workflow's arrows and steps) live in one process. What
20
+ // an `event` means is the reader's business: this package only keeps it, and
21
+ // lists it, so a picker can offer each event only the functions written for it.
22
+ //
14
23
  // Two call forms:
15
24
  // register(name, def) → traditional
16
25
  // register(def) → module-export style: `def.name` is used
@@ -33,6 +42,9 @@ function register(nameOrDef, def) {
33
42
  if (typeof action.execute !== 'function') {
34
43
  throw new Error('register: action "' + action.name + '" must have an `execute` function');
35
44
  }
45
+ if (action.event !== undefined && (typeof action.event !== 'string' || !action.event.trim())) {
46
+ throw new Error('register: action "' + action.name + '" has an `event` that is not a name — e.g. "beforeSave"');
47
+ }
36
48
 
37
49
  // Sanity-check peer deps.
38
50
  if (Array.isArray(action.requires)) {
@@ -48,6 +60,7 @@ function register(nameOrDef, def) {
48
60
  inputSchema: Array.isArray(action.inputSchema) ? action.inputSchema : [],
49
61
  outputSchema: action.outputSchema || null,
50
62
  requires: Array.isArray(action.requires) ? action.requires.slice() : [],
63
+ event: action.event || null,
51
64
  execute: action.execute
52
65
  });
53
66
  }
@@ -64,7 +77,8 @@ function list() {
64
77
  description: def.description,
65
78
  inputSchema: def.inputSchema,
66
79
  outputSchema: def.outputSchema,
67
- requires: def.requires
80
+ requires: def.requires,
81
+ event: def.event
68
82
  });
69
83
  });
70
84
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeplr/actions",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "description": "Named-action registry with typed inputs and safe invocation — plus built-in actions for HTTP, DB, files, email, spawn",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -130,5 +130,8 @@
130
130
  "pg": "^8.0.0",
131
131
  "saxes": "^6.0.0",
132
132
  "unzipper": "^0.12.0"
133
+ },
134
+ "overrides": {
135
+ "@azure/msal-node": "^7.1.0"
133
136
  }
134
137
  }