@uipath/maestro-builder-sdk 6.122.7 → 6.122.9
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/dist/api-index.md +78 -77
- package/dist/api-members.md +357 -354
- package/dist/bpmn/bpmn-sdk.d.ts +48 -4
- package/dist/bpmn/bpmn-sdk.js +43 -5
- package/dist/bpmn/decompile.js +96 -2
- package/dist/bpmn/serialize.js +37 -2
- package/dist/bpmn/task-elements.d.ts +2 -0
- package/dist/bpmn/task-elements.js +4 -0
- package/dist/bpmn/typed-node.d.ts +2 -0
- package/dist/bpmn/typed-node.js +2 -1
- package/dist/bpmn-api.md +23 -7
- package/dist/check-cli.js +13 -3
- package/dist/check.d.ts +9 -0
- package/dist/check.js +18 -0
- package/dist/core/current-manifest-handles.d.ts +57 -0
- package/dist/core/current-manifest-handles.js +215 -0
- package/dist/core/node-catalog.d.ts +12 -0
- package/dist/core/node-catalog.js +35 -0
- package/dist/core/refusals.d.ts +2 -0
- package/dist/core/refusals.js +4 -0
- package/dist/node-catalog-files.d.ts +35 -1
- package/dist/node-catalog-files.js +77 -23
- package/package.json +2 -2
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
* read on the first lookup, not when the catalog is opened: a flow with no
|
|
12
12
|
* manifest-less `rawNode` never reads it.
|
|
13
13
|
*/
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
14
15
|
import { readFileSync } from 'node:fs';
|
|
15
16
|
import { homedir } from 'node:os';
|
|
16
|
-
import { join } from 'node:path';
|
|
17
|
+
import { dirname, join } from 'node:path';
|
|
18
|
+
import { nodeCatalogOf } from './core/node-catalog.js';
|
|
17
19
|
import { isRecord } from './core/node-envelope.js';
|
|
18
20
|
/** The cache `uip maestro flow registry pull` writes. */
|
|
19
21
|
export function defaultNodeCatalogFile() {
|
|
@@ -25,28 +27,80 @@ export function defaultNodeCatalogFile() {
|
|
|
25
27
|
* reports the miss and names `registry pull`.
|
|
26
28
|
*/
|
|
27
29
|
export function readNodeCatalog(file = defaultNodeCatalogFile()) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
// Read on the first lookup, not here: a flow with no lookup never pays for the ~20 MB file.
|
|
31
|
+
return nodeCatalogOf(() => cachedNodes(file), file.startsWith(homedir()) ? `~${file.slice(homedir().length)}` : file);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The environment variable `uip maestro flow check` sets to the node-cache
|
|
35
|
+
* scope of the tenant it is logged in to (`<base URL>|<org id>|<tenant id>`,
|
|
36
|
+
* lower-cased, as `index.meta.json` records it).
|
|
37
|
+
*/
|
|
38
|
+
export const NODE_CACHE_SCOPE_ENV = 'FLOW_SDK_NODE_CACHE_SCOPE';
|
|
39
|
+
/** How long a node cache counts as current: the TTL `uip maestro flow registry get/search` use. */
|
|
40
|
+
export const CURRENT_NODE_CACHE_TTL_MS = 30 * 60 * 1000;
|
|
41
|
+
/**
|
|
42
|
+
* The node catalog in `file` when it provably holds the current tenant's
|
|
43
|
+
* manifests, or why not. It has to:
|
|
44
|
+
*
|
|
45
|
+
* - be named: `scope` is the logged-in tenant's scope, which only `uip` knows;
|
|
46
|
+
* - be that tenant's: the sibling `index.meta.json` records the same scope,
|
|
47
|
+
* so a cache pulled on another tenant or environment is never "current";
|
|
48
|
+
* - be complete: the metadata's `hash` is the sha256 of `index.json`, so an
|
|
49
|
+
* index another login replaced after the metadata was read does not pass;
|
|
50
|
+
* - be fresh: pulled within {@link CURRENT_NODE_CACHE_TTL_MS}, so an old
|
|
51
|
+
* snapshot cannot reject a handle the tenant serves today. Nothing here
|
|
52
|
+
* refetches; the next `registry pull` makes it current again.
|
|
53
|
+
*
|
|
54
|
+
* `HANDLE_NOT_IN_CURRENT_MANIFEST` runs only on such a catalog. A `rawNode`
|
|
55
|
+
* still resolves from {@link readNodeCatalog}, which needs no tenant.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* currentNodeCatalog(undefined); // { skipped: 'uip named no logged-in tenant …' }
|
|
59
|
+
*/
|
|
60
|
+
export function currentNodeCatalog(scope, file = defaultNodeCatalogFile(), now = Date.now()) {
|
|
61
|
+
if (scope === undefined || scope.trim() === '') {
|
|
62
|
+
return { skipped: 'uip named no logged-in tenant (run it through `uip maestro flow check` while logged in)' };
|
|
63
|
+
}
|
|
64
|
+
let meta;
|
|
65
|
+
let content;
|
|
66
|
+
try {
|
|
67
|
+
meta = JSON.parse(readFileSync(join(dirname(file), 'index.meta.json'), 'utf8'));
|
|
68
|
+
content = readFileSync(file, 'utf8');
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return { skipped: 'there is no node cache (run `uip maestro flow registry pull`)' };
|
|
72
|
+
}
|
|
73
|
+
if (!isRecord(meta) || typeof meta.scope !== 'string' || typeof meta.hash !== 'string') {
|
|
74
|
+
return { skipped: 'the node cache has no tenant metadata (run `uip maestro flow registry pull`)' };
|
|
75
|
+
}
|
|
76
|
+
if (meta.scope.toLowerCase() !== scope.trim().toLowerCase()) {
|
|
77
|
+
return { skipped: 'the node cache was pulled for another tenant (run `uip maestro flow registry pull`)' };
|
|
78
|
+
}
|
|
79
|
+
// The age must be known: a finite time, not in the future (a clock moved back), under the TTL.
|
|
80
|
+
const age = typeof meta.lastSync === 'number' && Number.isFinite(meta.lastSync) ? now - meta.lastSync : Number.NaN;
|
|
81
|
+
if (!Number.isFinite(age) || age < 0) {
|
|
82
|
+
return { skipped: "the node cache's pull time is missing, invalid or in the future (run `uip maestro flow registry pull --force`)" };
|
|
83
|
+
}
|
|
84
|
+
if (age >= CURRENT_NODE_CACHE_TTL_MS) {
|
|
85
|
+
return { skipped: 'the node cache is more than 30 minutes old (run `uip maestro flow registry pull`)' };
|
|
86
|
+
}
|
|
87
|
+
if (createHash('sha256').update(content).digest('hex') !== meta.hash) {
|
|
88
|
+
return { skipped: 'the node cache does not match its metadata (a pull may be in progress: run check again; if it persists, run `uip maestro flow registry pull --force`)' };
|
|
89
|
+
}
|
|
90
|
+
let parsed;
|
|
91
|
+
try {
|
|
92
|
+
parsed = JSON.parse(content);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return { skipped: 'the node cache is not valid JSON (run `uip maestro flow registry pull --force`)' };
|
|
96
|
+
}
|
|
97
|
+
const nodes = Array.isArray(parsed) ? parsed : isRecord(parsed) && Array.isArray(parsed.nodes) ? parsed.nodes : [];
|
|
98
|
+
return { catalog: nodeCatalogOf(nodes, file.startsWith(homedir()) ? `~${file.slice(homedir().length)}` : file) };
|
|
99
|
+
}
|
|
100
|
+
/** {@link currentNodeCatalog}'s catalog, or `undefined` when it was skipped. */
|
|
101
|
+
export function readCurrentNodeCatalog(scope, file = defaultNodeCatalogFile(), now = Date.now()) {
|
|
102
|
+
const current = currentNodeCatalog(scope, file, now);
|
|
103
|
+
return 'catalog' in current ? current.catalog : undefined;
|
|
50
104
|
}
|
|
51
105
|
/** The manifests in the cache file: an array, or `{ nodes: [...] }`; nothing when absent or unparseable. */
|
|
52
106
|
function cachedNodes(file) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.122.
|
|
3
|
+
"version": "6.122.9",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"@types/node": "^22.7.0",
|
|
127
127
|
"esbuild": "^0.28.1"
|
|
128
128
|
},
|
|
129
|
-
"gitref": "
|
|
129
|
+
"gitref": "76511fd23b518ce60d8bfeb9c76573a12c33a3f3"
|
|
130
130
|
}
|