@uipath/maestro-builder-sdk 5.2.0

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 (238) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +322 -0
  3. package/dist/bindings-v2.d.ts +37 -0
  4. package/dist/bindings-v2.js +155 -0
  5. package/dist/bindings.d.ts +6 -0
  6. package/dist/bindings.js +6 -0
  7. package/dist/bpmn/bpmn-expr-check.d.ts +41 -0
  8. package/dist/bpmn/bpmn-expr-check.js +218 -0
  9. package/dist/bpmn/bpmn-sdk.d.ts +2257 -0
  10. package/dist/bpmn/bpmn-sdk.js +1476 -0
  11. package/dist/bpmn/check-cli.d.ts +3 -0
  12. package/dist/bpmn/check-cli.js +32 -0
  13. package/dist/bpmn/check.d.ts +25 -0
  14. package/dist/bpmn/check.js +430 -0
  15. package/dist/bpmn/compile-cli.d.ts +3 -0
  16. package/dist/bpmn/compile-cli.js +60 -0
  17. package/dist/bpmn/connector.d.ts +56 -0
  18. package/dist/bpmn/connector.js +199 -0
  19. package/dist/bpmn/decompile-cli.d.ts +8 -0
  20. package/dist/bpmn/decompile-cli.js +54 -0
  21. package/dist/bpmn/decompile.d.ts +6 -0
  22. package/dist/bpmn/decompile.js +1108 -0
  23. package/dist/bpmn/format-profile.d.ts +27 -0
  24. package/dist/bpmn/format-profile.js +11 -0
  25. package/dist/bpmn/intsvc.d.ts +77 -0
  26. package/dist/bpmn/intsvc.js +155 -0
  27. package/dist/bpmn/load.d.ts +4 -0
  28. package/dist/bpmn/load.js +22 -0
  29. package/dist/bpmn/merge-cli.d.ts +3 -0
  30. package/dist/bpmn/merge-cli.js +45 -0
  31. package/dist/bpmn/merge.d.ts +19 -0
  32. package/dist/bpmn/merge.js +293 -0
  33. package/dist/bpmn/registry-types.json +1869 -0
  34. package/dist/bpmn/serialize.d.ts +28 -0
  35. package/dist/bpmn/serialize.js +757 -0
  36. package/dist/bpmn/tidy-cli.d.ts +2 -0
  37. package/dist/bpmn/tidy-cli.js +39 -0
  38. package/dist/bpmn/typed-node.d.ts +382 -0
  39. package/dist/bpmn/typed-node.js +551 -0
  40. package/dist/bpmn/uipath-moddle.v1.json +823 -0
  41. package/dist/bpmn/xml-ranges.d.ts +45 -0
  42. package/dist/bpmn/xml-ranges.js +151 -0
  43. package/dist/case/case-expr-check.d.ts +35 -0
  44. package/dist/case/case-expr-check.js +85 -0
  45. package/dist/case/case-sdk.d.ts +1282 -0
  46. package/dist/case/case-sdk.js +923 -0
  47. package/dist/case/check-cli.d.ts +3 -0
  48. package/dist/case/check-cli.js +31 -0
  49. package/dist/case/check.d.ts +18 -0
  50. package/dist/case/check.js +456 -0
  51. package/dist/case/compile-cli.d.ts +3 -0
  52. package/dist/case/compile-cli.js +291 -0
  53. package/dist/case/decompile-cli.d.ts +9 -0
  54. package/dist/case/decompile-cli.js +117 -0
  55. package/dist/case/decompile.d.ts +187 -0
  56. package/dist/case/decompile.js +1170 -0
  57. package/dist/case/entry-points.d.ts +79 -0
  58. package/dist/case/entry-points.js +118 -0
  59. package/dist/case/format-profile.d.ts +60 -0
  60. package/dist/case/format-profile.js +79 -0
  61. package/dist/case/ids.d.ts +24 -0
  62. package/dist/case/ids.js +76 -0
  63. package/dist/case/load.d.ts +12 -0
  64. package/dist/case/load.js +32 -0
  65. package/dist/case/preserve.d.ts +133 -0
  66. package/dist/case/preserve.js +105 -0
  67. package/dist/case/serialize.d.ts +10 -0
  68. package/dist/case/serialize.js +1414 -0
  69. package/dist/check-cli.d.ts +3 -0
  70. package/dist/check-cli.js +118 -0
  71. package/dist/check.d.ts +146 -0
  72. package/dist/check.js +4898 -0
  73. package/dist/cli/commands/bpmn.d.ts +2 -0
  74. package/dist/cli/commands/bpmn.js +73 -0
  75. package/dist/cli/commands/case.d.ts +2 -0
  76. package/dist/cli/commands/case.js +60 -0
  77. package/dist/cli/commands/flow.d.ts +2 -0
  78. package/dist/cli/commands/flow.js +99 -0
  79. package/dist/cli/commands/registry.d.ts +10 -0
  80. package/dist/cli/commands/registry.js +170 -0
  81. package/dist/cli/common.d.ts +30 -0
  82. package/dist/cli/common.js +92 -0
  83. package/dist/cli/index.d.ts +2 -0
  84. package/dist/cli/index.js +18 -0
  85. package/dist/cli-run.d.ts +2 -0
  86. package/dist/cli-run.js +42 -0
  87. package/dist/compile-cli.d.ts +3 -0
  88. package/dist/compile-cli.js +160 -0
  89. package/dist/config.d.ts +47 -0
  90. package/dist/config.js +201 -0
  91. package/dist/core/actions.d.ts +3244 -0
  92. package/dist/core/actions.js +1062 -0
  93. package/dist/core/binding-messages.d.ts +1 -0
  94. package/dist/core/binding-messages.js +16 -0
  95. package/dist/core/bindings.d.ts +12 -0
  96. package/dist/core/bindings.js +67 -0
  97. package/dist/core/ceql.d.ts +73 -0
  98. package/dist/core/ceql.js +272 -0
  99. package/dist/core/cli-spelling.d.ts +39 -0
  100. package/dist/core/cli-spelling.js +62 -0
  101. package/dist/core/connector-raw-node.d.ts +21 -0
  102. package/dist/core/connector-raw-node.js +47 -0
  103. package/dist/core/connectors.d.ts +184 -0
  104. package/dist/core/connectors.js +128 -0
  105. package/dist/core/expr-check.d.ts +93 -0
  106. package/dist/core/expr-check.js +186 -0
  107. package/dist/core/expr.d.ts +323 -0
  108. package/dist/core/expr.js +400 -0
  109. package/dist/core/index.d.ts +10 -0
  110. package/dist/core/index.js +10 -0
  111. package/dist/core/library.d.ts +440 -0
  112. package/dist/core/library.js +1183 -0
  113. package/dist/core/list-envelope.d.ts +45 -0
  114. package/dist/core/list-envelope.js +97 -0
  115. package/dist/core/lookup-store.d.ts +22 -0
  116. package/dist/core/lookup-store.js +85 -0
  117. package/dist/core/lookups.d.ts +227 -0
  118. package/dist/core/lookups.js +231 -0
  119. package/dist/core/node-classes.d.ts +234 -0
  120. package/dist/core/node-classes.js +158 -0
  121. package/dist/core/script-return.d.ts +68 -0
  122. package/dist/core/script-return.js +197 -0
  123. package/dist/core/stable-id.d.ts +28 -0
  124. package/dist/core/stable-id.js +37 -0
  125. package/dist/core-definitions.json +16249 -0
  126. package/dist/decompile-cli.d.ts +3 -0
  127. package/dist/decompile-cli.js +131 -0
  128. package/dist/decompile.d.ts +138 -0
  129. package/dist/decompile.js +2482 -0
  130. package/dist/emit.d.ts +10 -0
  131. package/dist/emit.js +60 -0
  132. package/dist/event-filters.d.ts +130 -0
  133. package/dist/event-filters.js +137 -0
  134. package/dist/flow-expr-check.d.ts +17 -0
  135. package/dist/flow-expr-check.js +193 -0
  136. package/dist/flow-sdk.d.ts +1341 -0
  137. package/dist/flow-sdk.js +1164 -0
  138. package/dist/flow-variables.d.ts +13 -0
  139. package/dist/flow-variables.js +42 -0
  140. package/dist/format-profile.d.ts +72 -0
  141. package/dist/format-profile.js +97 -0
  142. package/dist/generators/_connections.py +287 -0
  143. package/dist/generators/_events.py +355 -0
  144. package/dist/generators/_lookups.py +114 -0
  145. package/dist/generators/_naming.py +185 -0
  146. package/dist/generators/_objects.py +299 -0
  147. package/dist/generators/_resolve.py +273 -0
  148. package/dist/generators/convert_library_to_md.py +1441 -0
  149. package/dist/generators/extract_library.py +125 -0
  150. package/dist/generators/generate_connectors_ts.py +936 -0
  151. package/dist/generators/generate_library_json.py +2527 -0
  152. package/dist/generators/generate_triggers_ts.py +110 -0
  153. package/dist/generators/materialize_registry.py +155 -0
  154. package/dist/generators/prepare_connector.py +1688 -0
  155. package/dist/index.d.ts +35 -0
  156. package/dist/index.js +35 -0
  157. package/dist/ixp-definition.json +1982 -0
  158. package/dist/library.d.ts +6 -0
  159. package/dist/library.js +6 -0
  160. package/dist/load.d.ts +16 -0
  161. package/dist/load.js +95 -0
  162. package/dist/merge-cli.d.ts +3 -0
  163. package/dist/merge-cli.js +47 -0
  164. package/dist/merge.d.ts +125 -0
  165. package/dist/merge.js +0 -0
  166. package/dist/migrate.d.ts +15 -0
  167. package/dist/migrate.js +245 -0
  168. package/dist/node-runtime.d.ts +3 -0
  169. package/dist/node-runtime.js +22 -0
  170. package/dist/package-name.d.ts +17 -0
  171. package/dist/package-name.js +17 -0
  172. package/dist/ref-resolve.d.ts +77 -0
  173. package/dist/ref-resolve.js +170 -0
  174. package/dist/registry/cache.d.ts +55 -0
  175. package/dist/registry/cache.js +134 -0
  176. package/dist/registry/curated-overlay.d.ts +16 -0
  177. package/dist/registry/curated-overlay.js +62 -0
  178. package/dist/registry/extractor.d.ts +22 -0
  179. package/dist/registry/extractor.js +18 -0
  180. package/dist/registry/materialize-bin.d.ts +2 -0
  181. package/dist/registry/materialize-bin.js +7 -0
  182. package/dist/registry/materialize-cli.d.ts +1 -0
  183. package/dist/registry/materialize-cli.js +46 -0
  184. package/dist/registry/materializer.d.ts +23 -0
  185. package/dist/registry/materializer.js +34 -0
  186. package/dist/registry/path-cli.d.ts +1 -0
  187. package/dist/registry/path-cli.js +56 -0
  188. package/dist/registry/prepare-cli.d.ts +62 -0
  189. package/dist/registry/prepare-cli.js +185 -0
  190. package/dist/registry/pull-cli.d.ts +1 -0
  191. package/dist/registry/pull-cli.js +274 -0
  192. package/dist/registry/python.d.ts +26 -0
  193. package/dist/registry/python.js +46 -0
  194. package/dist/registry/search-cli.d.ts +52 -0
  195. package/dist/registry/search-cli.js +159 -0
  196. package/dist/schema-version.d.ts +165 -0
  197. package/dist/schema-version.js +148 -0
  198. package/dist/serialize.d.ts +64 -0
  199. package/dist/serialize.js +6398 -0
  200. package/lib/README.md +112 -0
  201. package/lib/library-json.samples/index.json +158 -0
  202. package/lib/library-json.samples/invariant-collections.json +83 -0
  203. package/lib/library-json.samples/list-envelopes.json +123 -0
  204. package/lib/library-json.samples/uipath-atlassian-jira/create-issue@1.0.0.json +131 -0
  205. package/lib/library-json.samples/uipath-atlassian-jira/create-issue@1.0.0.v1def.json +306 -0
  206. package/lib/library-json.samples/uipath-atlassian-jira/generic/create_issue/create@1.0.0.json +86 -0
  207. package/lib/library-json.samples/uipath-atlassian-jira/generic/create_issue/create@1.0.0.v1def.json +208 -0
  208. package/lib/library-json.samples/uipath-atlassian-jira/get-issue@1.0.0.json +2040 -0
  209. package/lib/library-json.samples/uipath-atlassian-jira/get-issue@1.0.0.v1def.json +195 -0
  210. package/lib/library-json.samples/uipath-google-vertex/execute-google-vertex-agent@1.0.0.json +169 -0
  211. package/lib/library-json.samples/uipath-google-vertex/execute-google-vertex-agent@1.0.0.v1def.json +209 -0
  212. package/lib/library-json.samples/uipath-http-webhook/event-http-webhook@1.0.0.json +63 -0
  213. package/lib/library-json.samples/uipath-http-webhook/event-http-webhook@1.0.0.v1def.json +262 -0
  214. package/lib/library-json.samples/uipath-http-webhook/trigger-http-webhook@1.0.0.json +63 -0
  215. package/lib/library-json.samples/uipath-http-webhook/trigger-http-webhook@1.0.0.v1def.json +213 -0
  216. package/lib/library-json.samples/uipath-microsoft-azureactivedirectory/list-groups@1.0.0.json +227 -0
  217. package/lib/library-json.samples/uipath-microsoft-azureactivedirectory/list-groups@1.0.0.v1def.json +373 -0
  218. package/lib/library-json.samples/uipath-microsoft-onedrive/event-file-created@1.0.0.json +116 -0
  219. package/lib/library-json.samples/uipath-microsoft-onedrive/event-file-created@1.0.0.v1def.json +369 -0
  220. package/lib/library-json.samples/uipath-microsoft-onedrive/event-list-item-added@1.0.0.json +56 -0
  221. package/lib/library-json.samples/uipath-microsoft-onedrive/event-list-item-added@1.0.0.v1def.json +256 -0
  222. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-file-created@1.0.0.json +116 -0
  223. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-file-created@1.0.0.v1def.json +320 -0
  224. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-list-item-added@1.0.0.json +56 -0
  225. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-list-item-added@1.0.0.v1def.json +207 -0
  226. package/lib/library-json.samples/uipath-microsoft-outlook365/event-email-received@1.0.0.json +107 -0
  227. package/lib/library-json.samples/uipath-microsoft-outlook365/event-email-received@1.0.0.v1def.json +264 -0
  228. package/lib/library-json.samples/uipath-microsoft-outlook365/send-email@1.0.0.json +142 -0
  229. package/lib/library-json.samples/uipath-microsoft-outlook365/send-email@1.0.0.v1def.json +306 -0
  230. package/lib/library-json.samples/uipath-microsoft-outlook365/trigger-email-received@1.0.0.json +107 -0
  231. package/lib/library-json.samples/uipath-microsoft-outlook365/trigger-email-received@1.0.0.v1def.json +217 -0
  232. package/lib/library-json.samples/uipath-microsoft-powerautomate/invoke-a-microsoft-power-automate-flow@1.0.0.json +85 -0
  233. package/lib/library-json.samples/uipath-microsoft-powerautomate/invoke-a-microsoft-power-automate-flow@1.0.0.v1def.json +209 -0
  234. package/lib/library-json.samples/uipath-salesforce-slack/send-message-to-user@1.0.0.json +755 -0
  235. package/lib/library-json.samples/uipath-salesforce-slack/send-message-to-user@1.0.0.v1def.json +513 -0
  236. package/lib/library-json.samples/uipath-uipath-dataservice/query-entity-records@1.0.0.json +122 -0
  237. package/lib/library-json.samples/uipath-uipath-dataservice/query-entity-records@1.0.0.v1def.json +227 -0
  238. package/package.json +85 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UiPath, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,322 @@
1
+ # Maestro Builder SDK
2
+
3
+ Build a UiPath Maestro Flow, Case Plan, or BPMN by writing a small, readable TypeScript program.
4
+ You describe the orchestration's shape by calling methods (`.step`, `.branch`, `.loop`); the SDK compiles it to a valid `.flow`/`caseplan.json`/`.bpmn` that UiPath can run and open in the designer.
5
+
6
+ This is a builder, not a program - nothing executes at author time except graph construction.
7
+ Data flows through named variables and expressions — you never write native `if`/`for`.
8
+
9
+ ## Quick start
10
+
11
+ Install the SDK:
12
+
13
+ ```bash
14
+ npm install @uipath/maestro-builder-sdk
15
+ ```
16
+
17
+ ### Author
18
+
19
+ A whole flow is one file. `HelloWorld.flow.ts`:
20
+
21
+ ```ts
22
+ import { flow, script, out, types } from '@uipath/maestro-builder-sdk';
23
+
24
+ export default flow('hello-world')
25
+ .name('HelloWorld')
26
+ .input({ name: types.string })
27
+ .output({ greeting: types.string })
28
+ .step('greet', script({
29
+ code: "return 'Hello, ' + $vars.start.output.name + '!';",
30
+ }))
31
+ .return({ greeting: out('greet') })
32
+ .build();
33
+ ```
34
+
35
+ `.input` and `.output` are the flow's contract. `.step` adds a node — here a
36
+ `script`, whose `code` runs on the platform, not at author time. Steps read each
37
+ other through named variables: `$vars.start.output.name` inside the script,
38
+ `out('greet')` in the builder. There is no `.trigger()` call, so the flow gets a
39
+ manual trigger.
40
+
41
+ ### Check
42
+
43
+ ```bash
44
+ uip maestro flow check HelloWorld.flow.ts --source
45
+ ```
46
+
47
+ ```
48
+ ✓ no issues
49
+ ```
50
+
51
+ `check` reads the source without emitting anything. It is the fast pass: an
52
+ undeclared variable, a step name that does not exist, an empty branch arm.
53
+
54
+ ### Compile
55
+
56
+ ```bash
57
+ uip maestro flow compile HelloWorld
58
+ ```
59
+
60
+ ```
61
+ compile: wrote HelloWorld.flow (3 nodes, 2 edges)
62
+ ```
63
+
64
+ Three nodes: the trigger, the script, and the End that `.return()` created. That
65
+ `.flow` is what UiPath runs and what the designer opens.
66
+
67
+ For a flow that calls nothing outside itself, that is the whole loop —
68
+ **author → check → compile**.
69
+
70
+ ### Prepare
71
+
72
+ The moment a step calls a connector, a fourth verb appears. Add one:
73
+
74
+ ```ts
75
+ import { flow, script, connector, lookup, out, types } from '@uipath/maestro-builder-sdk';
76
+
77
+ const SLACK = { connection: 'slack', folder: 'shared' } as const;
78
+ const SLACK_DM = ['uipath-salesforce-slack', 'send-message-to-user'] as const;
79
+
80
+ export default flow('hello-world')
81
+ .name('HelloWorld')
82
+ .input({ name: types.string })
83
+ .output({ greeting: types.string })
84
+ .step('greet', script({
85
+ code: "return 'Hello, ' + $vars.start.output.name + '!';",
86
+ }))
87
+ .step('announce', connector(...SLACK_DM, {
88
+ channel: lookup(...SLACK_DM, 'channel').by('profile.email', 'ada@example.com'),
89
+ send_as: lookup(...SLACK_DM, 'send_as').by('name', 'bot'),
90
+ messageToSend: out('greet'),
91
+ }, SLACK))
92
+ .return({ greeting: out('greet') })
93
+ .build();
94
+ ```
95
+
96
+ Two things there are deliberately *not* ids. `channel` and `send_as` are lookup
97
+ fields: their real values are opaque ids belonging to one connection, so you
98
+ write what you mean — an email address, the word `bot` — and `lookup()` records
99
+ the question. Now `check` has something to say:
100
+
101
+ ```
102
+ ⚠ [LOOKUP_UNRESOLVED] Connector step "announce": input "channel" is an unresolved
103
+ lookup (profile.email="ada@example.com"). Compile does not make network calls, so
104
+ the value has to be resolved first:
105
+ npx flow-sdk registry prepare uipath-salesforce-slack send-message-to-user \
106
+ --resolve channel:profile.email=ada@example.com
107
+ Compile will fail until this is recorded.
108
+
109
+ ⚠ [LOOKUP_UNRESOLVED] … and the same for "send_as" (name="bot").
110
+ ```
111
+
112
+ Warnings, not errors — the source pass still succeeds. It is `compile` that
113
+ refuses, because resolving a lookup means asking the tenant and compile makes no
114
+ network calls. That is what `prepare` is for: it is the one verb that does talk
115
+ to the tenant. Run what `check` named, both fields at once:
116
+
117
+ ```bash
118
+ npx flow-sdk registry pull # once per machine: the connector library
119
+
120
+ npx flow-sdk registry prepare uipath-salesforce-slack send-message-to-user \
121
+ --resolve channel:profile.email=ada@example.com \
122
+ --resolve send_as:name=bot
123
+ ```
124
+
125
+ `registry pull` is the prerequisite, not part of the loop: `check` and `compile`
126
+ read connector field schemas from that library, and without it a connector step
127
+ reports its lookups as unresolved no matter how many times you prepare.
128
+
129
+ It does three things, all of them on disk:
130
+
131
+ - finds the connection and writes its ids into `bindings.json`, so the symbolic
132
+ `slack` and `shared` names in the code resolve;
133
+ - records each answered lookup in `connectors-local/`, so compiling stays
134
+ offline and repeatable;
135
+ - writes the connection-resolved field schema for that operation, which is how
136
+ a field the static library does not know about becomes compilable at all.
137
+
138
+ Then the same two commands as before:
139
+
140
+ ```bash
141
+ uip maestro flow check HelloWorld.flow.ts --source # ✓ no issues
142
+ uip maestro flow compile HelloWorld # wrote HelloWorld.flow (4 nodes, 3 edges)
143
+ ```
144
+
145
+ **Author → check → prepare → check → compile.** `check` before `prepare` is the
146
+ cheap order: one pass names every resolution the flow owes, so you make one trip
147
+ to the tenant instead of one per field.
148
+
149
+ ### Case plans and BPMN
150
+
151
+ The same builder core, the same four verbs. Import from
152
+ `@uipath/maestro-builder-sdk/case` or `@uipath/maestro-builder-sdk/bpmn`, name the file
153
+ `<Name>.case.ts` or `<Name>.bpmn.ts`, and swap the family in the command:
154
+ `uip maestro case compile` / `uip maestro bpmn compile`. Their builder surfaces
155
+ are `case-api.md` and `bpmn-api.md` in the authoring guides.
156
+
157
+ ## Commands
158
+
159
+ The UiPath CLI is the authoring front door. Beyond the two verbs the quick start
160
+ uses:
161
+
162
+ ```bash
163
+ uip maestro flow check HelloWorld.flow --compiled # deep validation of the ARTIFACT
164
+ uip maestro flow validate HelloWorld.flow # the product validator
165
+ uip maestro flow debug HelloWorld.flow # run it
166
+ ```
167
+
168
+ `build()` itself runs a **first-level check** as it constructs the graph: an
169
+ undeclared `$vars` reference — a mistyped variable or step name in a `` js`…` ``
170
+ expression or script — throws a `FlowBuildError` right there, before anything is
171
+ emitted. `uip maestro flow check --source` runs the authored-source checks without
172
+ emitting. For a COMPILED `.flow`, `uip maestro flow validate` is the authoritative
173
+ product validator, and `uip maestro flow debug` (or `flow-debug`) runs it. Case and BPMN use the same family-first shape:
174
+ `uip maestro case compile|check|decompile` and
175
+ `uip maestro bpmn compile|check|format`.
176
+
177
+ These commands require a prerelease of `@uipath/cli` that exposes the preview
178
+ authoring verbs.
179
+
180
+ ### UiPath CLI delegation contract
181
+
182
+ The UiPath CLI resolves `@uipath/maestro-builder-sdk/package.json` from the caller's current
183
+ directory, checks the installed version, and spawns
184
+ `node <package>/dist/cli/index.js <family> <verb> …` with inherited cwd, environment,
185
+ and stdio. It never imports or bundles the SDK. This preserves the runtime class
186
+ identity shared by the authored TypeScript and serializer.
187
+
188
+ The stable argv grammar is family first: `flow|case|bpmn`, then the SDK verb and
189
+ its documented options. The process exit contract is `0` for success, `1` for
190
+ diagnostics, and `2` for usage errors or a blocked mode. Changes to the spawn path,
191
+ argv grammar, or exit meanings are semver-governed. The package also declares the
192
+ `@uipath/maestro-builder-sdk/cli` export for tooling that needs to verify this surface; normal
193
+ authors should invoke it through `uip maestro`.
194
+
195
+ For `uip maestro flow check --compiled --uip`, the SDK's checker starts a nested
196
+ `uip maestro flow registry get` process to resolve missing schemas. This is
197
+ intentional and does not recurse into `check`. Set `UIP_BIN` to an alternate uip
198
+ executable when the desired binary is not the one on `PATH`.
199
+
200
+ ## What you can express
201
+
202
+ Every node type the platform runs has a builder form. Control flow and data:
203
+
204
+ `core.trigger.manual` · `core.trigger.scheduled` · `core.logic.decision`
205
+ (`.branch`) · `core.logic.switch` · `core.logic.merge` (`.parallel`) ·
206
+ `core.logic.loop` · `core.logic.terminate` · `core.control.end` (`.return`) ·
207
+ `core.subflow` · `core.logic.delay` · `core.logic.mock`
208
+
209
+ Work:
210
+
211
+ `core.action.script` · `core.action.transform` (+ `.map` / `.filter` /
212
+ `.group-by`) · `core.action.http` and `core.action.http.v2` ·
213
+ `core.action.queue.create` and `.create-and-wait` ·
214
+ `uipath.connector.<key>.<action>` · `uipath.connector.trigger.<key>.<event>` and
215
+ `uipath.connector.event.<key>.<event>` · `uipath.human-in-the-loop` (+
216
+ `.quick-form`, `.coded-action-app`) · `uipath.core.rpa-workflow.<key>` ·
217
+ `uipath.core.api-workflow.<key>` · `uipath.core.agentic-process.<key>` ·
218
+ `uipath.core.agent.<key>` · `uipath.agent.autonomous` ·
219
+ `uipath.pattern.deep-rag` (`summarize`) · `uipath.pattern.batch-transform` ·
220
+ `uipath.ixp.*` (`ixpExtract`)
221
+
222
+ An error port (`.onError`, whose handler can rejoin the success path with
223
+ `h.rejoin('step')`), per-arm labels, and switch arms with their own terminal
224
+ outputs are constructs rather than node types.
225
+
226
+ Anything that names a tenant resource — a release key, a published extraction
227
+ model, a queue consumer, a connector connection — needs that id or a `lookup()`
228
+ resolved through `prepare`, as in the quick start. The authoring guides carry a
229
+ worked example per node type.
230
+
231
+ ## The API in two parts
232
+
233
+ - **Control flow & lifecycle** are *fluent methods* on the builder:
234
+ `.name` · `.version` · `.input` · `.output` · `.var` · `.trigger` · `.step` ·
235
+ `.branch` · `.switch` · `.parallel` · `.loop` · `.onError` (whose handler can
236
+ end by rejoining the success path — `h.rejoin('step')`) · `.terminate` ·
237
+ `.return` · `.build`. Inside a `.branch` / `.switch` arm, `.label('…')` names
238
+ that arm — the label round-trips to and from the `.flow`
239
+ (`trueLabel` / `falseLabel` on a decision, the case `label` on a switch).
240
+ - **Actions** are *factory functions* passed to `.step(name, action)`:
241
+ `http` · `script` · `transform` · `hitl` · `delay` · `queueItem` · `connector` ·
242
+ `waitForEvent` · `rpaWorkflow` · `apiWorkflow` · `agenticProcess` · `agent` ·
243
+ `inlineAgent` · `subflow` · `summarize` · `batchTransform` · `ixpExtract` ·
244
+ `mock`.
245
+ - **Expressions**: `lit` · `v` / `input` · `out` · `err` · `ran` · `` js`…` `` ·
246
+ `` tmpl`…` `` · `types.{string,number,boolean,object,array,file,any}`.
247
+
248
+ Every node type, its builder API, ports, and a minimal example are in the Flow
249
+ authoring guide, `SKILL.md` — its router table is the complete reference. See
250
+ [The authoring guides](#the-authoring-guides).
251
+
252
+ ### Signature reference
253
+
254
+ Exact signatures travel with the package, as TSDoc on the declarations in
255
+ `dist/`: parameters, defaults, remarks and worked examples for every exported
256
+ symbol, surfaced by an editor on hover. The authoring guides carry the same
257
+ reference as Markdown.
258
+
259
+ ## Integration Service connectors
260
+
261
+ A flow that calls a connector needs a `bindings.json` alongside it, mapping the
262
+ symbolic `connection` / `folder` names in the code — `slack` and `shared` in the
263
+ quick start — to real ids. `registry prepare` writes it; this is the shape, if
264
+ you would rather fill it from
265
+ `uip is connections list --all-folders --output json`:
266
+
267
+ ```json
268
+ {
269
+ "schemaVersion": "1",
270
+ "bindings": [
271
+ { "id": "slack", "name": "slack", "resource": "Connection",
272
+ "resourceKey": "<connection-id>", "propertyAttribute": "ConnectionId" },
273
+ { "id": "shared", "name": "shared", "resource": "Connection",
274
+ "resourceKey": "<folder-key>", "propertyAttribute": "FolderKey" }
275
+ ]
276
+ }
277
+ ```
278
+
279
+ Keeping the names symbolic is what lets one flow move between connections: the
280
+ code says `slack`, and only `bindings.json` knows which Slack.
281
+
282
+ Discover ops and input shapes from the connector library that
283
+ `npx flow-sdk registry pull` downloads and caches. A field the library does not
284
+ carry is connection-specific — that is the `prepare` case from the quick start.
285
+
286
+ The package also exposes the low-level materializer used by the UiPath CLI to
287
+ derive the Markdown catalog and typed descriptors from canonical JSON:
288
+
289
+ ```bash
290
+ flow-registry-materialize \
291
+ --library-json ./library-json \
292
+ --library-md ./library-md \
293
+ --connectors ./connectors
294
+ ```
295
+
296
+ Most callers want `npx flow-sdk registry pull`, which downloads the published
297
+ archive, verifies its checksum and then runs this transform. The low-level
298
+ command is for SDK development, build pipelines, and troubleshooting: it only
299
+ transforms local files that are already on disk.
300
+
301
+ **Connector event triggers and waits** (`onEvent` / `waitForEvent`) additionally
302
+ need a definition *pair* in the library. Curated pairs are published for
303
+ **Outlook**, **HTTP Webhook**, and **OneDrive**; any other connector's pair is
304
+ generated on demand from live registry evidence. The authoring guides'
305
+ `references/event-trigger.md` has the commands and the evidence bar.
306
+
307
+ ## The authoring guides
308
+
309
+ This package is the **API**: `dist/` and this README.
310
+
311
+ The step-by-step authoring guides — `SKILL.md` for Flow, `SKILL-case.md`,
312
+ `SKILL-bpmn.md`, and the per-node detail under `references/` — ship with the
313
+ UiPath authoring skills catalog rather than here, so a coding agent and a human
314
+ read the same copy. The worked examples named by those guides travel with them.
315
+
316
+ The connector library is not bundled: `npx flow-sdk registry pull` downloads it
317
+ and caches it per machine. The package does carry the curated overlay that pull
318
+ applies on top — corrections and the definitions the raw registry dump omits.
319
+
320
+ ## License
321
+
322
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,37 @@
1
+ /** One declared solution resource. */
2
+ export interface BindingsV2Resource {
3
+ resource: string;
4
+ key: string;
5
+ id: string;
6
+ value: Record<string, unknown>;
7
+ metadata: Record<string, unknown>;
8
+ [k: string]: unknown;
9
+ }
10
+ /** The `bindings_v2.json` document. */
11
+ export interface BindingsV2Document {
12
+ version: string;
13
+ resources: BindingsV2Resource[];
14
+ [k: string]: unknown;
15
+ }
16
+ /**
17
+ * The `connection` resources a compiled flow declares — one per distinct
18
+ * connection, in node order, attributed to the FIRST node that uses it.
19
+ *
20
+ * Both halves of that are pack's behaviour, not a choice made here: a flow with
21
+ * two Outlook steps on one connection yields a single resource whose
22
+ * `ActivityName` is the earlier step's.
23
+ */
24
+ export declare function connectionResources(flow: unknown): BindingsV2Resource[];
25
+ /**
26
+ * Fold freshly derived connection rows into whatever the project already has.
27
+ *
28
+ * Connection rows are replaced wholesale — they are re-derived from the flow that
29
+ * was just compiled, so the compile is the newer truth. Every other row is
30
+ * carried through in its original order, because this module does not derive
31
+ * those kinds and dropping them would silently delete a `TimeTrigger` (or
32
+ * anything a future generator adds) that `node configure` or an earlier `pack`
33
+ * had put there.
34
+ */
35
+ export declare function mergeBindingsV2(existing: unknown, connections: BindingsV2Resource[]): BindingsV2Document;
36
+ /** Read a `bindings_v2.json`, or `undefined` when absent or unparseable. */
37
+ export declare function readBindingsV2(path: string): BindingsV2Document | undefined;
@@ -0,0 +1,155 @@
1
+ /**
2
+ * bindings-v2 — the project's solution-resource sidecar, `bindings_v2.json`.
3
+ *
4
+ * Two files with confusingly similar names, and both are wanted:
5
+ *
6
+ * - `bindings.json` — the AUTHORED, symbolic mapping at the workspace root
7
+ * (`slack`, `shared` → tenant keys). Input to compile; `uip maestro registry
8
+ * prepare` writes it. Not this module.
9
+ * - `bindings_v2.json` — the GENERATED resource declaration inside the Flow
10
+ * project. `uip solution resources refresh` documents it as its own input:
11
+ * "sync resource declarations from their `bindings_v2.json` files". This
12
+ * module.
13
+ *
14
+ * Without the sidecar, `resources refresh` syncs nothing, so
15
+ * `resources/solution_folder/connection/<connector>/<name>.json` is never
16
+ * created and the canvas fails `solution-resource-validation` — every
17
+ * `ConnectionId` binding's `resourceKey` is compared against the solution's
18
+ * declared connection keys and reported as `Resource "…" is not found in the
19
+ * solution`. The UiPath VS Code extension surfaces that as an invalid
20
+ * connection. It is not cosmetic: the same declaration is what a solution deploy
21
+ * provisions the connection from (flow-builder-sdk#689).
22
+ *
23
+ * ## Why compile can write this without racing `pack`
24
+ *
25
+ * `uip maestro flow pack` REGENERATES `bindings_v2.json` from the flow and
26
+ * ignores whatever the project directory holds — verified by packing a project
27
+ * whose sidecar had been replaced with a sentinel, and getting the derived
28
+ * resources back. So the packaged artifact is authoritative and unaffected by
29
+ * this file; the project copy exists purely for `resources refresh` and the
30
+ * extension. A sidecar that lags pack's generator can therefore never ship
31
+ * inside a package.
32
+ *
33
+ * ## What this derives, and what it deliberately leaves alone
34
+ *
35
+ * Only `connection` resources, which is what refresh imports and what #689 is
36
+ * about. Pack derives more from the BPMN projection — a `core.trigger.scheduled`
37
+ * flow also yields a `TimeTrigger` resource whose `CronExpression` comes from
38
+ * translating the trigger's ISO-8601 `timerPreset`. Re-deriving those here would
39
+ * be a second implementation of someone else's generator, free to drift, for no
40
+ * gain in the package. So non-connection resources already in the file are
41
+ * PRESERVED untouched and never invented: {@link mergeBindingsV2} replaces only
42
+ * the connection rows.
43
+ */
44
+ import { existsSync, readFileSync } from 'node:fs';
45
+ /** The document version pack emits. */
46
+ const DOCUMENT_VERSION = '2.0';
47
+ /** The per-resource metadata version pack stamps. */
48
+ const BINDINGS_VERSION = '2.2';
49
+ function isRecord(value) {
50
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
51
+ }
52
+ function str(value) {
53
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
54
+ }
55
+ /** `resource` values are spelled lower-case in a `.flow` and capitalised in the BPMN projection. */
56
+ function isConnection(resource) {
57
+ return typeof resource === 'string' && resource.toLowerCase() === 'connection';
58
+ }
59
+ /**
60
+ * The `connection` resources a compiled flow declares — one per distinct
61
+ * connection, in node order, attributed to the FIRST node that uses it.
62
+ *
63
+ * Both halves of that are pack's behaviour, not a choice made here: a flow with
64
+ * two Outlook steps on one connection yields a single resource whose
65
+ * `ActivityName` is the earlier step's.
66
+ */
67
+ export function connectionResources(flow) {
68
+ if (!isRecord(flow))
69
+ return [];
70
+ const bindings = Array.isArray(flow.bindings) ? flow.bindings.filter(isRecord) : [];
71
+ // Only the ConnectionId binding describes the connection itself. A connector
72
+ // step also emits a sibling `FolderKey` binding against the same resourceKey,
73
+ // and pack does not carry it into the sidecar.
74
+ const byKey = new Map();
75
+ for (const binding of bindings) {
76
+ const key = str(binding.resourceKey);
77
+ if (!key || !isConnection(binding.resource))
78
+ continue;
79
+ if (str(binding.propertyAttribute)?.toLowerCase() !== 'connectionid')
80
+ continue;
81
+ if (!byKey.has(key))
82
+ byKey.set(key, binding);
83
+ }
84
+ if (byKey.size === 0)
85
+ return [];
86
+ const nodes = Array.isArray(flow.nodes) ? flow.nodes.filter(isRecord) : [];
87
+ const resources = [];
88
+ const seen = new Set();
89
+ for (const node of nodes) {
90
+ const detail = isRecord(node.inputs) && isRecord(node.inputs.detail) ? node.inputs.detail : undefined;
91
+ if (!detail)
92
+ continue;
93
+ const key = str(detail.connectionId) ?? str(detail.connectionResourceId);
94
+ if (!key || seen.has(key))
95
+ continue;
96
+ const binding = byKey.get(key);
97
+ if (!binding)
98
+ continue;
99
+ seen.add(key);
100
+ const displayLabel = str(binding.name) ?? key;
101
+ const label = isRecord(node.display) ? str(node.display.label) : undefined;
102
+ resources.push({
103
+ resource: 'connection',
104
+ key,
105
+ // Pack concatenates resource and key with no separator for a connection.
106
+ id: `connection${key}`,
107
+ value: {
108
+ ConnectionId: {
109
+ defaultValue: str(binding.default) ?? key,
110
+ isExpression: false,
111
+ displayName: displayLabel,
112
+ },
113
+ },
114
+ metadata: {
115
+ ActivityName: label ?? str(node.id) ?? key,
116
+ BindingsVersion: BINDINGS_VERSION,
117
+ DisplayLabel: displayLabel,
118
+ UseConnectionService: 'true',
119
+ Connector: str(detail.connector) ?? '',
120
+ },
121
+ });
122
+ }
123
+ return resources;
124
+ }
125
+ /**
126
+ * Fold freshly derived connection rows into whatever the project already has.
127
+ *
128
+ * Connection rows are replaced wholesale — they are re-derived from the flow that
129
+ * was just compiled, so the compile is the newer truth. Every other row is
130
+ * carried through in its original order, because this module does not derive
131
+ * those kinds and dropping them would silently delete a `TimeTrigger` (or
132
+ * anything a future generator adds) that `node configure` or an earlier `pack`
133
+ * had put there.
134
+ */
135
+ export function mergeBindingsV2(existing, connections) {
136
+ const previous = isRecord(existing) && Array.isArray(existing.resources)
137
+ ? existing.resources.filter(isRecord)
138
+ : [];
139
+ const preserved = previous.filter((r) => !isConnection(r.resource));
140
+ const version = (isRecord(existing) && str(existing.version)) || DOCUMENT_VERSION;
141
+ return { version, resources: [...connections, ...preserved] };
142
+ }
143
+ /** Read a `bindings_v2.json`, or `undefined` when absent or unparseable. */
144
+ export function readBindingsV2(path) {
145
+ if (!existsSync(path))
146
+ return undefined;
147
+ try {
148
+ const parsed = JSON.parse(readFileSync(path, 'utf8'));
149
+ return isRecord(parsed) ? parsed : undefined;
150
+ }
151
+ catch {
152
+ // A hand-broken sidecar should not fail the compile; it is regenerated below.
153
+ return undefined;
154
+ }
155
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * bindings — compatibility re-export. The symbolic binding resolver now lives
3
+ * in `core/` (shared across flow/case/bpmn); this shim preserves the historical
4
+ * `./bindings.js` import path.
5
+ */
6
+ export * from './core/bindings.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * bindings — compatibility re-export. The symbolic binding resolver now lives
3
+ * in `core/` (shared across flow/case/bpmn); this shim preserves the historical
4
+ * `./bindings.js` import path.
5
+ */
6
+ export * from './core/bindings.js';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * bpmn-expr-check — the BPMN adapter over the shared `core/expr-check`, run by
3
+ * `BpmnBuilder.build()` before it hands back the model to be serialized.
4
+ *
5
+ * A BPMN `=`-expression reads a declared variable as `=vars.<name>` (a gateway
6
+ * flow `condition`, a script `input`, a multi-instance `collection`/`completion`,
7
+ * a variable assignment). `vars.` is a CLOSED namespace, so a reference to a name
8
+ * nothing declares is a definite mistake — and this is the ONLY thing that
9
+ * catches it early: a `=vars.<typo>` reaches run time and reads `undefined`,
10
+ * silently taking the wrong path. So this flags every undeclared `vars.<root>`,
11
+ * exactly as the flow check flags `$vars`.
12
+ *
13
+ * "Declared" means what it means to the platform, which is wider than
14
+ * `.var()`/`.input()`/`.output()`: a node's output `var` is itself a declaration
15
+ * (the canvas model keys a variable off each output), so a connector's
16
+ * `<id>_response`, a script task's output and a variable task's assignment target
17
+ * are all readable downstream. `nodeDeclaredVars` supplies them; being stricter
18
+ * than the platform here would reject working processes.
19
+ *
20
+ * A loop's item binds `iterator.<itemVar>`, and a script output writes `=result.…`
21
+ * — different namespaces, left alone (only `vars.` is the author's to get wrong).
22
+ * Variables are SCOPED: a sub-process sees the enclosing variables plus its own.
23
+ */
24
+ import { type ExprDiagnostic } from '../core/expr-check.js';
25
+ import { type BuiltBpmn } from './bpmn-sdk.js';
26
+ /** A diagnostic plus the element it was found in. */
27
+ export interface BpmnLocatedDiagnostic extends ExprDiagnostic {
28
+ where: string;
29
+ }
30
+ /** Every first-level expression problem in a built BPMN process, stamped with its location. */
31
+ export declare function checkBpmnExpressions(built: BuiltBpmn): BpmnLocatedDiagnostic[];
32
+ /**
33
+ * Thrown by `BpmnBuilder.build()` when the first-level expression check finds an
34
+ * undeclared `vars.<name>` reference. Same shape/rationale as the flow's
35
+ * `FlowBuildError`: `message` lists every problem; `diagnostics` carries them
36
+ * structured.
37
+ */
38
+ export declare class BpmnBuildError extends Error {
39
+ readonly diagnostics: BpmnLocatedDiagnostic[];
40
+ constructor(built: BuiltBpmn, diagnostics: BpmnLocatedDiagnostic[]);
41
+ }