@flowrunner/cli 0.1.19-dev.2 → 0.1.19-dev.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.
- package/ai-docs/instructions/service-code-format/02-zod-types.md +6 -5
- package/ai-docs/instructions/service-code-format/17-client-certificates.md +4 -5
- package/bin/banner.js +36 -0
- package/bin/flowrunner.js +24 -1
- package/dist/cli.js +260 -206
- package/dist/cli.js.map +4 -4
- package/dist/index.js +111 -91
- package/dist/index.js.map +3 -3
- package/dist/types/packages/cli/src/constants/testing.d.ts +13 -6
- package/dist/types/shared/src/constants/error-codes.d.ts +14 -0
- package/dist/types/shared/src/constants/flow-catalog.d.ts +54 -0
- package/dist/types/shared/src/constants/index.d.ts +1 -0
- package/dist/types/shared/src/errors/flow-catalog.d.ts +37 -0
- package/dist/types/shared/src/errors/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/flow-catalog/analysis.d.ts +190 -0
- package/dist/types/shared/src/scheme/flow-catalog/index.d.ts +6 -0
- package/dist/types/shared/src/scheme/flow-catalog/pack.d.ts +144 -0
- package/dist/types/shared/src/scheme/flow-catalog/requests.d.ts +664 -0
- package/dist/types/shared/src/scheme/flow-catalog/summary.d.ts +69 -0
- package/dist/types/shared/src/scheme/flow-catalog/version.d.ts +132 -0
- package/dist/types/shared/src/scheme/flowrunner/java.dto.d.ts +76 -0
- package/dist/types/shared/src/scheme/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/knowledge-base/dto.d.ts +12 -12
- package/dist/types/shared/src/scheme/properties/index.d.ts +1 -0
- package/dist/types/shared/src/scheme/properties/secret.d.ts +12 -0
- package/dist/types/shared/src/scheme/remote-mcp-server/dto.d.ts +0 -11
- package/dist/types/shared/src/scheme/shared-extensions/config.d.ts +20 -2
- package/dist/types/shared/src/scheme/shared-extensions/rest.d.ts +1 -0
- package/dist/types/shared/src/scheme/shared-extensions/usage-stats.d.ts +6 -6
- package/package.json +1 -4
- package/project-files/sandbox/nock-mock.js +61 -5
|
@@ -19,7 +19,7 @@ and behaviors.
|
|
|
19
19
|
| `z.union([...])` | the **first** branch's widget — see below | | | | |
|
|
20
20
|
| `z.filesUploadOptions([...])`, `z.filesListOptions([...])`, `z.filesGetOptions([...])`, `z.filesDeleteOptions([...])` | nested form — the platform's own file-storage options, one group per Files call (see [03-parameters.md](03-parameters.md)) | | | | |
|
|
21
21
|
| | | | `.required()` | `z.unknown()` / `z.any()` field | required, any value — the open types are the only ones optional by default (see [Any value, but required](#any-value-but-required)) |
|
|
22
|
-
| | | | `.secret()` | `z.string()` config field | Masks the input, with a reveal toggle
|
|
22
|
+
| | | | `.secret()` | `z.string()` config field | Masks the input, with a reveal toggle; once saved the value is write-only in the console — see below |
|
|
23
23
|
| | | | `.dynamicProps({ dependsOn, execute })` | top-level **action** param: `z.looseObject()` or `z.array(z.looseObject())` | the object's inner fields are loaded at design time from other params (see [03-parameters.md](03-parameters.md)) |
|
|
24
24
|
|
|
25
25
|
Notes:
|
|
@@ -37,10 +37,11 @@ Notes:
|
|
|
37
37
|
installed as a *custom* extension has no shared tier at all — the customer fills in every item in one
|
|
38
38
|
dialog. See `configItems` in [01-service-structure.md](01-service-structure.md) and the output mapping in
|
|
39
39
|
[11-output-model.md](11-output-model.md).
|
|
40
|
-
- `.secret()` marks a **`z.string()` config field** as sensitive: the console renders it masked
|
|
41
|
-
toggle to reveal it.
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
- `.secret()` marks a **`z.string()` config field** as sensitive: the console renders it masked while it is
|
|
41
|
+
typed, with a toggle to reveal it. Once saved, the value is **write-only** in the console: it shows a hint
|
|
42
|
+
(the last characters) with **Replace** and **Clear** buttons and is never shown again, and the platform may
|
|
43
|
+
store it encrypted. Your handler still receives the plain value in `config`, validated exactly as it would
|
|
44
|
+
be without `.secret()`. It has no effect anywhere else: not on `z.text()`, which has no password mode, and not on an action or
|
|
44
45
|
trigger param, whose value lives in the flow definition and is readable through the API — masking that
|
|
45
46
|
input would suggest a protection that is not there. Put credentials in a `z.string()` config item.
|
|
46
47
|
- `.dictionary(ref)` binds a param to a dictionary for dynamic options and auto-derives its `dependsOn` — the
|
|
@@ -62,8 +62,8 @@ See [01-service-structure.md](01-service-structure.md) for `configItems` and `in
|
|
|
62
62
|
|
|
63
63
|
**`z.text()`, because a PEM block is multi-line** — it draws a textarea, where `z.string()` would put a
|
|
64
64
|
27-line certificate through a one-line box. The cost is that the key is on screen in clear text:
|
|
65
|
-
`.secret()`
|
|
66
|
-
([02-zod-types.md](02-zod-types.md)). If that matters more than the textarea, ship the key as a file in the
|
|
65
|
+
`.secret()` (masked input, write-only once saved) applies to a `z.string()` config field only and is a no-op on
|
|
66
|
+
`z.text()` ([02-zod-types.md](02-zod-types.md)). If that matters more than the textarea, ship the key as a file in the
|
|
67
67
|
service folder instead — the whole folder is deployed, so `require('fs').readFileSync(path.join(__dirname,
|
|
68
68
|
'../certs/client.key'))` reads it in the pod.
|
|
69
69
|
|
|
@@ -74,9 +74,8 @@ service folder instead — the whole folder is deployed, so `require('fs').readF
|
|
|
74
74
|
- **`ca` replaces the default trust store** for that request, the way `curl --cacert` does. Pass the whole
|
|
75
75
|
chain needed to verify the server, not just the leaf.
|
|
76
76
|
- **The private key is credential material.** Never inline it in the source and never put it in a URL —
|
|
77
|
-
declare it as a config field or read it from a file in the service folder. Whichever way,
|
|
78
|
-
stored and transmitted in clear text
|
|
79
|
-
it does not protect it. The client keeps the key out of verbose output and off the request's enumerable
|
|
77
|
+
declare it as a config field or read it from a file in the service folder. Whichever way, a value that is not a `.secret()` config field is
|
|
78
|
+
stored and transmitted in clear text, and a `z.text()` field cannot be `.secret()`. The client keeps the key out of verbose output and off the request's enumerable
|
|
80
79
|
properties, so `console.log(request)` and `JSON.stringify(request)` will not leak it — but your own logging
|
|
81
80
|
still can, so redact there too ([04-http-requests.md](04-http-requests.md)).
|
|
82
81
|
|
package/bin/banner.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// The line every run opens with: which CLI is running, and from where.
|
|
4
|
+
//
|
|
5
|
+
// Plain CommonJS for the same reason as ./resolve-local.js: `bin/flowrunner.js` prints it before any build
|
|
6
|
+
// step or loader exists. `src/cli/version-banner.ts` uses the same function, so the two cannot drift.
|
|
7
|
+
//
|
|
8
|
+
// The version alone is not enough. The launcher hands over to a project's own copy when there is one, so
|
|
9
|
+
// `npx @flowrunner/cli@x` run inside a project runs the project's version, not `x`. The location tells an
|
|
10
|
+
// npx cache, a global install and a project's `node_modules` apart, and a hand-over also names the copy that
|
|
11
|
+
// launched it.
|
|
12
|
+
|
|
13
|
+
const os = require('os')
|
|
14
|
+
const path = require('path')
|
|
15
|
+
|
|
16
|
+
/** `~/…` for anything under the home directory, which is where npx caches and most projects live. */
|
|
17
|
+
function shortPath(target, home) {
|
|
18
|
+
return target === home || target.startsWith(home + path.sep) ? '~' + target.slice(home.length) : target
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {{ version: string, root: string, launcher?: { version: string, root: string } }} cli
|
|
23
|
+
* @param {string} [home]
|
|
24
|
+
* @returns {string[]}
|
|
25
|
+
*/
|
|
26
|
+
function versionBanner(cli, home = os.homedir()) {
|
|
27
|
+
const lines = [`FlowRunner CLI ${ cli.version } — ${ shortPath(cli.root, home) }`]
|
|
28
|
+
|
|
29
|
+
if (cli.launcher) {
|
|
30
|
+
lines.push(` this project's copy, started by ${ cli.launcher.version } — ${ shortPath(cli.launcher.root, home) }`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return lines
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { versionBanner }
|
package/bin/flowrunner.js
CHANGED
|
@@ -6,6 +6,15 @@ const fs = require('fs')
|
|
|
6
6
|
const { resolveLocalCli } = require('./resolve-local')
|
|
7
7
|
|
|
8
8
|
const cliRoot = path.resolve(__dirname, '..')
|
|
9
|
+
|
|
10
|
+
/** A package's version, or `unknown`: an unreadable manifest makes a less informative banner, never a failed run. */
|
|
11
|
+
function readVersion(manifest) {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(fs.readFileSync(manifest, 'utf-8')).version || 'unknown'
|
|
14
|
+
} catch {
|
|
15
|
+
return 'unknown'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
9
18
|
const srcEntry = path.resolve(cliRoot, 'src', 'cli', 'index.ts')
|
|
10
19
|
|
|
11
20
|
// ─── Hand over to the project's own copy, if there is one ────────────────────
|
|
@@ -29,9 +38,23 @@ if (!process.env.FLOWRUNNER_DELEGATED) {
|
|
|
29
38
|
if (resolution.kind === 'delegate') {
|
|
30
39
|
const { spawnSync } = require('child_process')
|
|
31
40
|
|
|
41
|
+
// Printed here, not by the copy that runs: only the launcher knows both copies, and the project's copy
|
|
42
|
+
// may predate the banner — which is exactly when `npx @flowrunner/cli@x` most needs to say that `x` is
|
|
43
|
+
// not what runs. On stderr, so piped output is unchanged.
|
|
44
|
+
const { versionBanner } = require('./banner')
|
|
45
|
+
const versionOf = directory => readVersion(path.join(directory, 'package.json'))
|
|
46
|
+
|
|
47
|
+
for (const line of versionBanner({
|
|
48
|
+
version : versionOf(resolution.packageDirectory),
|
|
49
|
+
root : resolution.packageDirectory,
|
|
50
|
+
launcher: { version: versionOf(cliRoot), root: cliRoot },
|
|
51
|
+
})) {
|
|
52
|
+
console.error(line)
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
const result = spawnSync(process.execPath, [resolution.bin, ...process.argv.slice(2)], {
|
|
33
56
|
stdio: 'inherit',
|
|
34
|
-
env: { ...process.env, FLOWRUNNER_DELEGATED: '1' },
|
|
57
|
+
env: { ...process.env, FLOWRUNNER_DELEGATED: '1', FLOWRUNNER_BANNER_SHOWN: '1' },
|
|
35
58
|
})
|
|
36
59
|
|
|
37
60
|
if (result.error) {
|