@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
@@ -0,0 +1,199 @@
1
+ import { connectorOutputVars } from './bpmn-sdk.js';
2
+ import { transportHttpMethod } from '../config.js';
3
+ import { refuseLookupToken } from '../core/lookups.js';
4
+ export function createConnectorTask(ctx, n) {
5
+ const { m } = ctx;
6
+ if (!ctx.library)
7
+ throw new Error(`connector task "${n.id}" needs the connector library — pass { library } to serialize or use uip maestro bpmn compile --library.`);
8
+ const rc = ctx.library.resolve(n.key, n.action, n.version, n.object);
9
+ const outVars = connectorOutputVars(n);
10
+ const op = (rc.entry.operation ?? {});
11
+ const params = Array.isArray(op.parameters) ? op.parameters : [];
12
+ // ── uipath:context — the connector wiring ──
13
+ // `activity` is the primary-key required field (the selected op identity).
14
+ const ctxInputs = [
15
+ ctxInput(m, 'activity', 'string', op.name ?? op.objectName ?? n.action),
16
+ // `operation` is required by the PRODUCT validator, which reports
17
+ // `EMPTY_REQUIRED_FIELD: The field 'operation' … is required but has no value` without it —
18
+ // so every connector task the SDK emitted was rejected by `uip maestro bpmn validate`,
19
+ // including the one in `example/`. The vendored maestro-sdk + canvas validator this
20
+ // package tests against does not check it, which is why the suite stayed green; the gap
21
+ // only shows against the shipped CLI.
22
+ //
23
+ // It carries the same CRUD op name as `activity` (both are `op.name`, e.g. `Create`)
24
+ // because that is the field the runtime reads for it: the dispatch layer's
25
+ // `authoredOperation` looks at `inputs.operation` first and only falls back to guessing
26
+ // the verb from the HTTP method. So this also makes a live run address the op it was
27
+ // authored for rather than an inferred one.
28
+ ctxInput(m, 'operation', 'string', op.name ?? op.objectName ?? n.action),
29
+ ctxInput(m, 'connectorKey', 'string', rc.connectorKey),
30
+ ];
31
+ const connRef = bindingRef(ctx, n.connection, 'Connection', 'ConnectionId', `${rc.connectorKey} connection`);
32
+ if (connRef) {
33
+ ctxInputs.push(ctxInput(m, 'connection', 'string', `=bindings.${connRef.id}`));
34
+ ctxInputs.push(ctxInput(m, 'resourceKey', 'string', connRef.resourceKey));
35
+ }
36
+ const folderRef = bindingRef(ctx, n.folder, 'Connection', 'folderKey', 'FolderKey');
37
+ if (folderRef)
38
+ ctxInputs.push(ctxInput(m, 'folderKey', 'string', `=bindings.${folderRef.id}`));
39
+ ctxInputs.push(ctxInput(m, 'objectName', 'string', op.objectName ?? n.action), ctxInput(m, 'method', 'string', transportHttpMethod(rc.httpMethod)), ctxInput(m, 'path', 'string', rc.endpoint), jsonInput(m, 'metadata', undefined, connectorMetadata(rc, op)));
40
+ // ── request inputs — split declared params into path/query, rest is body ──
41
+ const pathParameters = {};
42
+ const queryParameters = {};
43
+ // BPMN copies these values into the emitted body verbatim, so an unresolved
44
+ // lookup would ship as `{"__lookup": …}` where the connector wants an id.
45
+ // Only Flow reads connectors-local/resolutions.json today.
46
+ for (const [name, value] of Object.entries(n.inputs ?? {})) {
47
+ refuseLookupToken(value, 'bpmn', name);
48
+ }
49
+ const body = { ...n.inputs };
50
+ for (const p of params) {
51
+ const name = String(p.name ?? '');
52
+ if (!(name in body))
53
+ continue;
54
+ const camel = toCamel(name);
55
+ if (p.type === 'path') {
56
+ pathParameters[camel] = body[name];
57
+ delete body[name];
58
+ }
59
+ else if (p.type === 'query') {
60
+ queryParameters[camel] = body[name];
61
+ delete body[name];
62
+ }
63
+ }
64
+ // ── outputs — response schema + standard Error ──
65
+ const responseSchema = rc.entry.outputSchema
66
+ ? schemaFromFields(rc.entry.outputSchema.fields ?? [])
67
+ : { type: 'object', properties: {} };
68
+ const activity = m.create('uipath:Activity', {
69
+ version: 'v1',
70
+ // Only an activity/event tag can carry this — a mapping has no such
71
+ // attribute, which is why `skipCondition` is a connector-only option.
72
+ skipCondition: n.skipCondition,
73
+ type: m.create('uipath:Type', { value: 'Intsvc.ActivityExecution', version: 'v1' }),
74
+ context: m.create('uipath:Context', { input: ctxInputs }),
75
+ input: [
76
+ jsonInput(m, 'pathParameters', 'pathParameters', pathParameters),
77
+ jsonInput(m, 'queryParameters', 'queryParameters', queryParameters),
78
+ jsonInput(m, 'body', 'body', body),
79
+ ],
80
+ output: [
81
+ m.create('uipath:Output', {
82
+ name: 'response', type: 'jsonSchema', source: '=response', var: outVars.response,
83
+ body: JSON.stringify({ $schema: 'http://json-schema.org/draft-07/schema#', ...responseSchema }),
84
+ }),
85
+ m.create('uipath:Output', {
86
+ name: 'Error', type: 'jsonSchema', source: '=Error', var: outVars.error,
87
+ body: JSON.stringify({
88
+ type: 'object',
89
+ properties: {
90
+ code: { type: 'string' }, message: { type: 'string' }, detail: { type: 'string' },
91
+ category: { type: 'string' }, status: { type: 'number' }, element: { type: 'string' },
92
+ },
93
+ }),
94
+ }),
95
+ ],
96
+ });
97
+ return m.create('bpmn:SendTask', {
98
+ id: n.id,
99
+ name: n.name ?? rc.entry.display?.label ?? n.action,
100
+ extensionElements: m.create('bpmn:ExtensionElements', { values: [activity] }),
101
+ });
102
+ }
103
+ /** A `uipath:context` scalar input row. */
104
+ function ctxInput(m, name, type, value) {
105
+ return m.create('uipath:Input', { name, type, value: String(value ?? '') });
106
+ }
107
+ /** A json `uipath:input` — CDATA body, optionally `target`-tagged (body/path/query). */
108
+ function jsonInput(m, name, target, obj) {
109
+ const props = { name, type: 'json', body: JSON.stringify(obj ?? {}) };
110
+ if (target)
111
+ props.target = target;
112
+ return m.create('uipath:Input', props);
113
+ }
114
+ /**
115
+ * Resolve a symbolic connection/folder to a process-level binding.
116
+ *
117
+ * Exported for the Phase 3d nodes, which need the identical closure: a connector
118
+ * event and an external agent/workflow each reference a connection and a folder
119
+ * the same way a connector activity does, and duplicating this was how the two
120
+ * families drifted apart in `case/serialize.ts`.
121
+ */
122
+ export function connectorBindingRef(ctx, name, resource, propertyAttribute, displayName) {
123
+ return bindingRef(ctx, name, resource, propertyAttribute, displayName);
124
+ }
125
+ /** Resolve a symbolic connection/folder to a process-level binding (collected once),
126
+ * returning its id + resourceKey for the `=bindings.<id>` reference. Mirrors
127
+ * `case/serialize.ts` `bindingRef`. */
128
+ function bindingRef(ctx, name, resource, propertyAttribute, displayName) {
129
+ if (!name)
130
+ return undefined;
131
+ const entry = ctx.bindings?.entry(name);
132
+ const id = entry?.id ?? name;
133
+ const resourceKey = entry?.resourceKey ?? entry?.default ?? name;
134
+ if (!ctx.bindingSink.has(id)) {
135
+ ctx.bindingSink.set(id, {
136
+ id,
137
+ name: entry?.name ?? displayName,
138
+ type: 'string',
139
+ resource,
140
+ resourceKey,
141
+ default: entry?.default ?? resourceKey,
142
+ propertyAttribute,
143
+ });
144
+ }
145
+ return { id, resourceKey };
146
+ }
147
+ /** The functional connector `metadata` blob (essentialConfiguration + activityTypeId);
148
+ * designer cosmetics are omitted (schema-valid without them — design §C/§D). */
149
+ function connectorMetadata(rc, op) {
150
+ const instanceParameters = {
151
+ connectorKey: rc.connectorKey,
152
+ objectName: op.objectName ?? rc.nodeType.split('.').pop(),
153
+ httpMethod: rc.httpMethod,
154
+ activityType: op.activityType ?? 'Curated',
155
+ version: rc.version,
156
+ supportsStreaming: op.supportsStreaming ?? false,
157
+ subType: op.subType ?? 'standard',
158
+ };
159
+ return {
160
+ activityPropertyConfiguration: {
161
+ configuration: `=jsonString:${JSON.stringify({
162
+ essentialConfiguration: {
163
+ instanceParameters,
164
+ objectName: instanceParameters.objectName,
165
+ httpMethod: transportHttpMethod(rc.httpMethod),
166
+ path: rc.endpoint,
167
+ packageVersion: rc.version,
168
+ },
169
+ })}`,
170
+ uiPathActivityTypeId: rc.activityTypeId ?? '',
171
+ errorState: { issues: [] },
172
+ },
173
+ };
174
+ }
175
+ function schemaFromFields(fields) {
176
+ const properties = {};
177
+ for (const f of fields) {
178
+ const name = f?.name;
179
+ if (!name)
180
+ continue;
181
+ properties[name] = { title: f.displayName ?? name, type: jsonType(f.type) };
182
+ }
183
+ return { type: 'object', properties };
184
+ }
185
+ function jsonType(t) {
186
+ switch (String(t ?? '').toLowerCase()) {
187
+ case 'number':
188
+ case 'integer':
189
+ case 'float': return 'number';
190
+ case 'boolean':
191
+ case 'bool': return 'boolean';
192
+ case 'object': return 'object';
193
+ case 'array': return 'array';
194
+ default: return 'string';
195
+ }
196
+ }
197
+ function toCamel(s) {
198
+ return s.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
199
+ }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { type CliExitCode } from '../cli-run.js';
3
+ /**
4
+ * `run(argv)` is the tool contract the family-first `flow-sdk` CLI loads. It must
5
+ * NOT read `process.argv`: under the unified CLI that still holds
6
+ * `bpmn decompile …`, so a positional scan would pick up the family word.
7
+ */
8
+ export declare function run(argv: string[]): Promise<CliExitCode>;
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * decompile-cli — `<Name>.bpmn` → `<Name>.bpmn.ts`
4
+ *
5
+ * Usage:
6
+ * node --experimental-strip-types decompile-cli.js <Name.bpmn> [-o Name.bpmn.ts] [--import <specifier>]
7
+ *
8
+ * The reverse of compile-cli: reads a `.bpmn` and emits builder source whose
9
+ * default export re-serializes to the same XML. `--import` sets the module
10
+ * specifier of the emitted `import { bpmn }` line (default
11
+ * the package's `./bpmn` subpath export) so the emitted file
12
+ * resolves for a package consumer; the library default in `decompile.ts` stays
13
+ * repo-relative for in-tree callers, mirroring the Flow and Case arms.
14
+ *
15
+ * Diagram layout is not read or emitted — the SDK emits semantic-only XML and
16
+ * `tidy` regenerates `bpmndi`. Run `tidy` on the recompiled artifact when a canvas
17
+ * needs one.
18
+ */
19
+ import { readFileSync, writeFileSync } from 'node:fs';
20
+ import { basename } from 'node:path';
21
+ import { runWhenInvokedDirectly } from '../cli-run.js';
22
+ import { decompile } from './decompile.js';
23
+ import { BPMN_IMPORT } from '../package-name.js';
24
+ function opt(argv, name) {
25
+ const i = argv.indexOf(name);
26
+ return i >= 0 ? argv[i + 1] : undefined;
27
+ }
28
+ /**
29
+ * `run(argv)` is the tool contract the family-first `flow-sdk` CLI loads. It must
30
+ * NOT read `process.argv`: under the unified CLI that still holds
31
+ * `bpmn decompile …`, so a positional scan would pick up the family word.
32
+ */
33
+ export async function run(argv) {
34
+ if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
35
+ console.error('usage: decompile <Name.bpmn> [-o Name.bpmn.ts] [--import <specifier>]');
36
+ return 2;
37
+ }
38
+ const flags = new Set(['-o', '--import']);
39
+ const input = argv.find((a, i) => !flags.has(a) && !flags.has(argv[i - 1]));
40
+ if (!input) {
41
+ console.error('decompile: missing <Name.bpmn>');
42
+ return 2;
43
+ }
44
+ const xml = readFileSync(input, 'utf8');
45
+ const source = await decompile(xml, {
46
+ importSpecifier: opt(argv, '--import') ?? BPMN_IMPORT,
47
+ });
48
+ const base = basename(input).replace(/\.bpmn$/, '');
49
+ const out = opt(argv, '-o') ?? `${base}.bpmn.ts`;
50
+ writeFileSync(out, source);
51
+ console.log(`decompile: wrote ${out}`);
52
+ return 0;
53
+ }
54
+ runWhenInvokedDirectly(import.meta.url, 'decompile', run);
@@ -0,0 +1,6 @@
1
+ /** Options for {@link decompile}. */
2
+ export interface BpmnDecompileOptions {
3
+ /** Module specifier for the emitted `import { bpmn }` line. */
4
+ importSpecifier?: string;
5
+ }
6
+ export declare function decompile(xml: string, options?: BpmnDecompileOptions): Promise<string>;