@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,79 @@
1
+ /**
2
+ * case/entry-points — project a case's In/Out args into the sibling
3
+ * `entry-points.json` `input`/`output` JSON-Schemas.
4
+ *
5
+ * The runtime discovers a case's start points (triggers) from `entry-points.json`,
6
+ * and Studio Web reads each entry's `input`/`output` schema to render the run
7
+ * form. `compile-cli` keeps that file in step with the caseplan. This module is
8
+ * the pure projection: caseplan `variables` (+ a trigger id) → `{ input, output }`.
9
+ *
10
+ * The type→format mapping mirrors the platform's `getTypeAndFormatForType`
11
+ * (PackagingUtil), ported from the `uipath-maestro-case` skill's
12
+ * `entry-points-sync.md`:
13
+ *
14
+ * string → { type: 'string' }
15
+ * integer → { type: 'integer' }
16
+ * boolean → { type: 'boolean' }
17
+ * float → { type: 'number', format: 'float' }
18
+ * double → { type: 'number', format: 'double' }
19
+ * date → { type: 'string', format: 'date' }
20
+ * datetime → { type: 'string', format: 'date-time' }
21
+ * file → { $ref: '#/definitions/job-attachment' } (+ a `definitions` block)
22
+ * jsonSchema → the variable's `body` (minus `$schema`)
23
+ *
24
+ * Scalars/date/datetime/float/double carry `title` = the var name, and `default`
25
+ * only when truthy (verbatim string, never coerced). `file`/`jsonSchema` carry
26
+ * neither. An entry's `input` is scoped to the In-args bound to THAT trigger (by
27
+ * `elementId`); its `output` projects every Out-arg (default from the Out-arg's
28
+ * `inputOutputs` companion).
29
+ */
30
+ /** The fixed JobAttachment definition a `file` property `$ref`s into. */
31
+ export declare const JOB_ATTACHMENT_DEFINITION: {
32
+ readonly type: "object";
33
+ readonly properties: {
34
+ readonly ID: {
35
+ readonly type: "string";
36
+ readonly description: "Orchestrator attachment key";
37
+ };
38
+ readonly FullName: {
39
+ readonly type: "string";
40
+ readonly description: "File name";
41
+ };
42
+ readonly MimeType: {
43
+ readonly type: "string";
44
+ readonly description: "The MIME type of the content, such as \"application/json\" or \"image/png";
45
+ };
46
+ readonly Metadata: {
47
+ readonly type: "object";
48
+ readonly description: "Dictionary<string, string> of metadata";
49
+ readonly additionalProperties: {
50
+ readonly type: "string";
51
+ };
52
+ };
53
+ };
54
+ readonly required: readonly ["ID"];
55
+ readonly 'x-uipath-resource-kind': "JobAttachment";
56
+ };
57
+ interface Var {
58
+ name?: string;
59
+ type?: string;
60
+ default?: unknown;
61
+ elementId?: string;
62
+ required?: boolean;
63
+ body?: unknown;
64
+ }
65
+ interface CaseVariables {
66
+ inputs?: Var[];
67
+ outputs?: Var[];
68
+ inputOutputs?: Var[];
69
+ }
70
+ /**
71
+ * Project a case's variables into one trigger's `{ input, output }`. `input` holds
72
+ * the In-args bound to `triggerId`; `output` holds every Out-arg (with its default
73
+ * pulled from the root `inputOutputs` companion).
74
+ */
75
+ export declare function entryPointIO(variables: CaseVariables | undefined, triggerId: string): {
76
+ input: Record<string, unknown>;
77
+ output: Record<string, unknown>;
78
+ };
79
+ export {};
@@ -0,0 +1,118 @@
1
+ /**
2
+ * case/entry-points — project a case's In/Out args into the sibling
3
+ * `entry-points.json` `input`/`output` JSON-Schemas.
4
+ *
5
+ * The runtime discovers a case's start points (triggers) from `entry-points.json`,
6
+ * and Studio Web reads each entry's `input`/`output` schema to render the run
7
+ * form. `compile-cli` keeps that file in step with the caseplan. This module is
8
+ * the pure projection: caseplan `variables` (+ a trigger id) → `{ input, output }`.
9
+ *
10
+ * The type→format mapping mirrors the platform's `getTypeAndFormatForType`
11
+ * (PackagingUtil), ported from the `uipath-maestro-case` skill's
12
+ * `entry-points-sync.md`:
13
+ *
14
+ * string → { type: 'string' }
15
+ * integer → { type: 'integer' }
16
+ * boolean → { type: 'boolean' }
17
+ * float → { type: 'number', format: 'float' }
18
+ * double → { type: 'number', format: 'double' }
19
+ * date → { type: 'string', format: 'date' }
20
+ * datetime → { type: 'string', format: 'date-time' }
21
+ * file → { $ref: '#/definitions/job-attachment' } (+ a `definitions` block)
22
+ * jsonSchema → the variable's `body` (minus `$schema`)
23
+ *
24
+ * Scalars/date/datetime/float/double carry `title` = the var name, and `default`
25
+ * only when truthy (verbatim string, never coerced). `file`/`jsonSchema` carry
26
+ * neither. An entry's `input` is scoped to the In-args bound to THAT trigger (by
27
+ * `elementId`); its `output` projects every Out-arg (default from the Out-arg's
28
+ * `inputOutputs` companion).
29
+ */
30
+ /** The fixed JobAttachment definition a `file` property `$ref`s into. */
31
+ export const JOB_ATTACHMENT_DEFINITION = {
32
+ type: 'object',
33
+ properties: {
34
+ ID: { type: 'string', description: 'Orchestrator attachment key' },
35
+ FullName: { type: 'string', description: 'File name' },
36
+ MimeType: { type: 'string', description: 'The MIME type of the content, such as "application/json" or "image/png' },
37
+ Metadata: { type: 'object', description: 'Dictionary<string, string> of metadata', additionalProperties: { type: 'string' } },
38
+ },
39
+ required: ['ID'],
40
+ 'x-uipath-resource-kind': 'JobAttachment',
41
+ };
42
+ const JOB_ATTACHMENT_REF = '#/definitions/job-attachment';
43
+ /** The JSON-Schema property for one variable. `file` → `$ref`; others get title + default. */
44
+ function propertyForVar(v) {
45
+ const type = normalizeType(v.type);
46
+ if (type === 'file')
47
+ return { $ref: JOB_ATTACHMENT_REF };
48
+ if (type === 'jsonSchema') {
49
+ const body = (v.body && typeof v.body === 'object' ? { ...v.body } : {});
50
+ delete body.$schema;
51
+ return body;
52
+ }
53
+ // Build in the platform's key order: type, format, title, default.
54
+ const out = {};
55
+ const tf = TYPE_FORMAT[type];
56
+ if (tf) {
57
+ out.type = tf.type;
58
+ if (tf.format)
59
+ out.format = tf.format;
60
+ }
61
+ else {
62
+ out.type = type; // string / integer / boolean / number / unknown → bare type
63
+ }
64
+ out.title = v.name;
65
+ if (v.default)
66
+ out.default = v.default; // only when truthy; verbatim
67
+ return out;
68
+ }
69
+ const TYPE_FORMAT = {
70
+ string: { type: 'string' },
71
+ integer: { type: 'integer' },
72
+ boolean: { type: 'boolean' },
73
+ number: { type: 'number' },
74
+ float: { type: 'number', format: 'float' },
75
+ double: { type: 'number', format: 'double' },
76
+ date: { type: 'string', format: 'date' },
77
+ datetime: { type: 'string', format: 'date-time' },
78
+ };
79
+ function normalizeType(t) {
80
+ return t === 'octet-stream' ? 'file' : t ?? 'string';
81
+ }
82
+ /** Build one `{ type:'object', properties, required, definitions? }` schema from a var list. */
83
+ function objectSchema(vars) {
84
+ const properties = {};
85
+ const required = [];
86
+ let hasFile = false;
87
+ for (const v of vars) {
88
+ if (!v.name)
89
+ continue;
90
+ properties[v.name] = propertyForVar(v);
91
+ if (normalizeType(v.type) === 'file')
92
+ hasFile = true;
93
+ if (v.required)
94
+ required.push(v.name);
95
+ }
96
+ const schema = { type: 'object', properties, required };
97
+ if (hasFile)
98
+ schema.definitions = { 'job-attachment': JOB_ATTACHMENT_DEFINITION };
99
+ return schema;
100
+ }
101
+ /**
102
+ * Project a case's variables into one trigger's `{ input, output }`. `input` holds
103
+ * the In-args bound to `triggerId`; `output` holds every Out-arg (with its default
104
+ * pulled from the root `inputOutputs` companion).
105
+ */
106
+ export function entryPointIO(variables, triggerId) {
107
+ const vars = variables ?? {};
108
+ const inArgs = (vars.inputs ?? []).filter((v) => v.elementId === triggerId);
109
+ const companionDefault = new Map();
110
+ for (const c of vars.inputOutputs ?? [])
111
+ if (c.name && c.elementId === 'root' && c.default !== undefined)
112
+ companionDefault.set(c.name, c.default);
113
+ const outArgs = (vars.outputs ?? []).map((o) => ({
114
+ ...o,
115
+ default: o.default ?? (o.name ? companionDefault.get(o.name) : undefined),
116
+ }));
117
+ return { input: objectSchema(inArgs), output: objectSchema(outArgs) };
118
+ }
@@ -0,0 +1,60 @@
1
+ import type { SchemaVersionPolicy } from '../schema-version.js';
2
+ /** The serializer-owned Case JSON grammar contract. */
3
+ export interface CaseFormatProfile {
4
+ writeVersion: string;
5
+ publishVersion: number;
6
+ nodeTypeField: 'type';
7
+ triggerNodeType: string;
8
+ triggerBagField: 'uipath' | 'inputs';
9
+ triggerLabelField: 'label' | 'display';
10
+ triggerTypeVersion?: string;
11
+ timerServiceType: 'Intsvc.TimerTrigger' | 'timer';
12
+ eventServiceType: 'Intsvc.EventTrigger';
13
+ waitConnectorServiceType: 'Intsvc.WaitForEvent';
14
+ connectorActivityServiceType: 'Intsvc.ActivityExecution';
15
+ externalAgentSyncServiceType: 'Intsvc.SyncAgentExecution';
16
+ externalAgentAsyncServiceType: 'Intsvc.AsyncAgentExecution';
17
+ externalWorkflowSyncServiceType: 'Intsvc.SyncWorkflowExecution';
18
+ externalWorkflowAsyncServiceType: 'Intsvc.AsyncWorkflowExecution';
19
+ stageNodeType: string;
20
+ stageLabelField: 'label';
21
+ exceptionStageField: 'type' | 'data.stageType';
22
+ exceptionStageValue: string;
23
+ connectorActivityNodeType: string;
24
+ selectedStageField: 'selectedStageId' | 'selectedStageIds';
25
+ selectedStageCardinality: 'singular' | 'array';
26
+ waitConnectorRuleBagField: 'uipath';
27
+ layoutPolicy: 'inline' | 'sidecar';
28
+ requireSlaDisplayNames: boolean;
29
+ migrationDependencies: readonly {
30
+ featureFlag: string;
31
+ fromVersion: string;
32
+ }[];
33
+ validationCeiling: {
34
+ caseSchemaVersion: string;
35
+ formatVersion: string;
36
+ };
37
+ }
38
+ export declare const CASE_FORMAT_PROFILE: Readonly<CaseFormatProfile>;
39
+ /**
40
+ * Which Case JSON schema versions `.schemaVersion()` may declare.
41
+ *
42
+ * ONE, and that is the honest answer rather than a placeholder. Case is a
43
+ * closed, whole-document schema: `@uipath/case-schema` ships a chain of 31
44
+ * grammars (`case-schema-census.json`'s `versionChain`), each with its own
45
+ * forward migration, and a version is a claim that the entire document matches
46
+ * that grammar. This SDK emits the V30 grammar natively — the V30 rule schemas
47
+ * `z.never` the singular `selectedStageId` that a V20 document would carry, so
48
+ * the older shapes are not something the current emitter can reach by writing a
49
+ * different number on the same bytes. `.schemaVersion('30.0.0')` is therefore
50
+ * an explicit restatement of what gets written, which is what makes a decompile
51
+ * able to PRESERVE it, and an older version is refused with the reason instead
52
+ * of being stamped onto V30 bytes.
53
+ *
54
+ * A second row lands here the day the emitter can write a second grammar — the
55
+ * `migrationDependencies` above are the same shape of statement one version
56
+ * further in (a feature that only exists from a given version onward).
57
+ */
58
+ export declare const CASE_SCHEMA_VERSIONS: SchemaVersionPolicy;
59
+ export declare function recordAuthoredCaseVersion(built: object, version: string): void;
60
+ export declare function authoredCaseVersion(built: object): string | undefined;
@@ -0,0 +1,79 @@
1
+ export const CASE_FORMAT_PROFILE = {
2
+ writeVersion: '30.0.0',
3
+ publishVersion: 2,
4
+ nodeTypeField: 'type',
5
+ triggerNodeType: 'uipath.case.trigger',
6
+ triggerBagField: 'inputs',
7
+ triggerLabelField: 'display',
8
+ triggerTypeVersion: '1.0.0',
9
+ timerServiceType: 'timer',
10
+ eventServiceType: 'Intsvc.EventTrigger',
11
+ waitConnectorServiceType: 'Intsvc.WaitForEvent',
12
+ connectorActivityServiceType: 'Intsvc.ActivityExecution',
13
+ externalAgentSyncServiceType: 'Intsvc.SyncAgentExecution',
14
+ externalAgentAsyncServiceType: 'Intsvc.AsyncAgentExecution',
15
+ externalWorkflowSyncServiceType: 'Intsvc.SyncWorkflowExecution',
16
+ externalWorkflowAsyncServiceType: 'Intsvc.AsyncWorkflowExecution',
17
+ stageNodeType: 'case-management:Stage',
18
+ stageLabelField: 'label',
19
+ exceptionStageField: 'data.stageType',
20
+ exceptionStageValue: 'secondary',
21
+ connectorActivityNodeType: 'execute-connector-activity',
22
+ selectedStageField: 'selectedStageIds',
23
+ selectedStageCardinality: 'array',
24
+ waitConnectorRuleBagField: 'uipath',
25
+ layoutPolicy: 'sidecar',
26
+ requireSlaDisplayNames: true,
27
+ migrationDependencies: [
28
+ { featureFlag: 'canvas-useExplicitEntryExitConditions', fromVersion: '12.0.0' },
29
+ { featureFlag: 'canvas-caseUnifiedSchema', fromVersion: '20.0.0' },
30
+ ],
31
+ validationCeiling: {
32
+ caseSchemaVersion: '0.1016.2',
33
+ formatVersion: '30.0.0',
34
+ },
35
+ };
36
+ /**
37
+ * Which Case JSON schema versions `.schemaVersion()` may declare.
38
+ *
39
+ * ONE, and that is the honest answer rather than a placeholder. Case is a
40
+ * closed, whole-document schema: `@uipath/case-schema` ships a chain of 31
41
+ * grammars (`case-schema-census.json`'s `versionChain`), each with its own
42
+ * forward migration, and a version is a claim that the entire document matches
43
+ * that grammar. This SDK emits the V30 grammar natively — the V30 rule schemas
44
+ * `z.never` the singular `selectedStageId` that a V20 document would carry, so
45
+ * the older shapes are not something the current emitter can reach by writing a
46
+ * different number on the same bytes. `.schemaVersion('30.0.0')` is therefore
47
+ * an explicit restatement of what gets written, which is what makes a decompile
48
+ * able to PRESERVE it, and an older version is refused with the reason instead
49
+ * of being stamped onto V30 bytes.
50
+ *
51
+ * A second row lands here the day the emitter can write a second grammar — the
52
+ * `migrationDependencies` above are the same shape of statement one version
53
+ * further in (a feature that only exists from a given version onward).
54
+ */
55
+ export const CASE_SCHEMA_VERSIONS = {
56
+ family: 'case',
57
+ mode: 'enumerated',
58
+ method: '.schemaVersion',
59
+ default: CASE_FORMAT_PROFILE.writeVersion,
60
+ latestKnown: CASE_FORMAT_PROFILE.validationCeiling.formatVersion,
61
+ migration: 'Case documents migrate FORWARD on read, through the platform\'s feature-flag-gated chain; there is no '
62
+ + '`uip maestro case migrate`, and no path that writes an older grammar.',
63
+ writable: [
64
+ {
65
+ version: CASE_FORMAT_PROFILE.writeVersion,
66
+ evidence: 'The grammar this serializer emits natively, asserted construct by construct by '
67
+ + 'scripts/audit-case-coverage.mjs against case-schema-census.json for the pinned write version.',
68
+ },
69
+ ],
70
+ };
71
+ // Preserve deprecated-method provenance for check() without adding an emitted
72
+ // or publicly documented field to BuiltCase.
73
+ const authoredVersions = new WeakMap();
74
+ export function recordAuthoredCaseVersion(built, version) {
75
+ authoredVersions.set(built, version);
76
+ }
77
+ export function authoredCaseVersion(built) {
78
+ return authoredVersions.get(built);
79
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * case/ids — deterministic ID generation for caseplan.json (schema V30).
3
+ *
4
+ * The Case schema (see @uipath/case-schema) uses `prefixedId`-style IDs: a fixed
5
+ * prefix followed by N characters from the base-62 alphabet. The frontend and
6
+ * validator only depend on the *format* (e.g. the case id must match
7
+ * `/^case-[A-Za-z0-9]{10}$/`); the suffix need only be unique within the file.
8
+ *
9
+ * A builder should emit *stable, diffable* output, so instead of random
10
+ * suffixes we derive them deterministically from a seed string (the entity's
11
+ * logical path). Same input → same caseplan.json every compile. A uniqueness
12
+ * guard salts-and-rehashes on the (astronomically unlikely) collision.
13
+ */
14
+ /** Per-file ID allocator: prefix + deterministic base-62 suffix, unique within the file. */
15
+ export declare class IdGen {
16
+ private readonly used;
17
+ /** Allocate an id `<prefix><suffix>` where suffix is `len` base-62 chars derived from `seed`. */
18
+ make(prefix: string, len: number, seed: string): string;
19
+ caseId(seed: string): string;
20
+ stageId(seed: string): string;
21
+ taskId(seed: string): string;
22
+ conditionId(seed: string): string;
23
+ ruleId(seed: string): string;
24
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * case/ids — deterministic ID generation for caseplan.json (schema V30).
3
+ *
4
+ * The Case schema (see @uipath/case-schema) uses `prefixedId`-style IDs: a fixed
5
+ * prefix followed by N characters from the base-62 alphabet. The frontend and
6
+ * validator only depend on the *format* (e.g. the case id must match
7
+ * `/^case-[A-Za-z0-9]{10}$/`); the suffix need only be unique within the file.
8
+ *
9
+ * A builder should emit *stable, diffable* output, so instead of random
10
+ * suffixes we derive them deterministically from a seed string (the entity's
11
+ * logical path). Same input → same caseplan.json every compile. A uniqueness
12
+ * guard salts-and-rehashes on the (astronomically unlikely) collision.
13
+ */
14
+ const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; // 62
15
+ /** FNV-1a 64-bit hash of a string → bigint. Deterministic, well-distributed. */
16
+ function fnv1a64(s) {
17
+ let h = 0xcbf29ce484222325n;
18
+ const mask = 0xffffffffffffffffn;
19
+ for (let i = 0; i < s.length; i++) {
20
+ h ^= BigInt(s.charCodeAt(i));
21
+ h = (h * 0x100000001b3n) & mask;
22
+ }
23
+ return h;
24
+ }
25
+ /** Encode a hash into `len` base-62 characters. */
26
+ function base62(seed, len) {
27
+ let x = fnv1a64(seed);
28
+ // Mix in the length so different-length requests for the same seed diverge.
29
+ x ^= BigInt(len) * 0x9e3779b97f4a7c15n;
30
+ x &= 0xffffffffffffffffn;
31
+ const base = BigInt(ALPHABET.length);
32
+ let out = '';
33
+ for (let i = 0; i < len; i++) {
34
+ out += ALPHABET[Number(x % base)];
35
+ x = x / base;
36
+ if (x === 0n)
37
+ x = fnv1a64(seed + '#' + i); // re-seed if exhausted (long ids)
38
+ }
39
+ return out;
40
+ }
41
+ /** Per-file ID allocator: prefix + deterministic base-62 suffix, unique within the file. */
42
+ export class IdGen {
43
+ used = new Set();
44
+ /** Allocate an id `<prefix><suffix>` where suffix is `len` base-62 chars derived from `seed`. */
45
+ make(prefix, len, seed) {
46
+ for (let salt = 0;; salt++) {
47
+ const id = prefix + base62(salt === 0 ? seed : `${seed}~${salt}`, len);
48
+ if (!this.used.has(id)) {
49
+ this.used.add(id);
50
+ return id;
51
+ }
52
+ }
53
+ }
54
+ caseId(seed) {
55
+ // Decompile feeds an already-emitted root id back through casePlan(). The
56
+ // wire form is unambiguous and may be reserved verbatim; authored logical
57
+ // ids still take the deterministic hash path below.
58
+ if (/^case-[A-Za-z0-9]{10}$/.test(seed)) {
59
+ this.used.add(seed);
60
+ return seed;
61
+ }
62
+ return this.make('case-', 10, seed);
63
+ }
64
+ stageId(seed) {
65
+ return this.make('Stage_', 6, seed);
66
+ }
67
+ taskId(seed) {
68
+ return this.make('t', 8, seed);
69
+ }
70
+ conditionId(seed) {
71
+ return this.make('Condition_', 6, seed);
72
+ }
73
+ ruleId(seed) {
74
+ return this.make('Rule_', 6, seed);
75
+ }
76
+ }
@@ -0,0 +1,12 @@
1
+ import type { BuiltCase } from './case-sdk.js';
2
+ /**
3
+ * Resolve a user argument (a `.ts` path or a BaseName) to a case source file.
4
+ *
5
+ * Candidates must be FILES: the authoring workspace always has a directory named
6
+ * `<Name>` beside `<Name>.case.ts` (created by `uip solution init <Name>`), and
7
+ * the family-first check/compile commands pass the bare basename. A plain `existsSync()` is true for
8
+ * that directory, so the bare name resolved to it and Node failed with
9
+ * "Directory import ... is not supported".
10
+ */
11
+ export declare function resolveCaseFile(arg: string): string;
12
+ export declare function loadBuiltCase(file: string): Promise<BuiltCase>;
@@ -0,0 +1,32 @@
1
+ /** Shared: dynamic-import an authored case module and return its BuiltCase. */
2
+ import { pathToFileURL } from 'node:url';
3
+ import { resolve } from 'node:path';
4
+ import { existsSync, statSync } from 'node:fs';
5
+ /**
6
+ * Resolve a user argument (a `.ts` path or a BaseName) to a case source file.
7
+ *
8
+ * Candidates must be FILES: the authoring workspace always has a directory named
9
+ * `<Name>` beside `<Name>.case.ts` (created by `uip solution init <Name>`), and
10
+ * the family-first check/compile commands pass the bare basename. A plain `existsSync()` is true for
11
+ * that directory, so the bare name resolved to it and Node failed with
12
+ * "Directory import ... is not supported".
13
+ */
14
+ export function resolveCaseFile(arg) {
15
+ const candidates = [arg, `${arg}.case.ts`, `${arg}.ts`];
16
+ for (const c of candidates) {
17
+ const resolved = resolve(c);
18
+ if (existsSync(resolved) && statSync(resolved).isFile())
19
+ return resolved;
20
+ }
21
+ throw new Error(`case source not found: tried ${candidates.join(', ')}`);
22
+ }
23
+ export async function loadBuiltCase(file) {
24
+ const mod = await import(pathToFileURL(file).href);
25
+ const exp = mod.default ?? mod.casePlan ?? mod.case;
26
+ if (!exp)
27
+ throw new Error(`${file} has no default export. Add: export default casePlan('id')...build();`);
28
+ const built = typeof exp.build === 'function' ? exp.build() : exp;
29
+ if (!built || !Array.isArray(built.stages))
30
+ throw new Error(`${file} default export is not a built case. Did you call .build()?`);
31
+ return built;
32
+ }
@@ -0,0 +1,133 @@
1
+ import type { BuiltCase } from './case-sdk.js';
2
+ export type PreservedVariableLane = 'inputs' | 'outputs' | 'inputOutputs';
3
+ /** One platform-owned node retained at its original position in `nodes[]`. */
4
+ export interface PreservedCaseNode {
5
+ /** Original zero-based position in the top-level `nodes[]` array. */
6
+ index: number;
7
+ /** Opaque annotation node. */
8
+ node: Record<string, unknown>;
9
+ }
10
+ /** Platform-owned task identity fields keyed by stage label, lane, and task name. */
11
+ /** Locates one rebuilt task, the way `taskFields` entries do. */
12
+ export interface PreservedTaskRef {
13
+ /** Stage label used to find the rebuilt task. */
14
+ stage: string;
15
+ /** Zero-based task lane. */
16
+ lane: number;
17
+ /** Task display name used to find the rebuilt task. */
18
+ task: string;
19
+ }
20
+ export interface PreservedTaskFields extends PreservedTaskRef {
21
+ /** Wire-only fields; the preservation contract permits `elementId` only. */
22
+ fields: Record<string, unknown>;
23
+ }
24
+ interface ConditionIdentity {
25
+ id?: string;
26
+ rules?: Array<Array<{
27
+ id?: string;
28
+ }>>;
29
+ }
30
+ interface SlaIdentity {
31
+ id?: string;
32
+ escalations?: Array<{
33
+ id?: string;
34
+ }>;
35
+ }
36
+ interface StageIdentity {
37
+ label: string;
38
+ id?: string;
39
+ tasks?: Array<Array<{
40
+ name: string;
41
+ id?: string;
42
+ entryConditions?: ConditionIdentity[];
43
+ inputs?: Array<{
44
+ name: string;
45
+ id?: string;
46
+ }>;
47
+ outputs?: Array<{
48
+ name: string;
49
+ id?: string;
50
+ }>;
51
+ }>>;
52
+ entryConditions?: ConditionIdentity[];
53
+ exitConditions?: ConditionIdentity[];
54
+ slaRules?: SlaIdentity[];
55
+ }
56
+ interface CaseIdentityPreservation {
57
+ id?: string;
58
+ triggers?: Array<{
59
+ id?: string;
60
+ }>;
61
+ stages?: StageIdentity[];
62
+ caseExitRules?: ConditionIdentity[];
63
+ slaRules?: SlaIdentity[];
64
+ variables?: Partial<Record<PreservedVariableLane, Array<{
65
+ name: string;
66
+ id?: string;
67
+ }>>>;
68
+ }
69
+ /**
70
+ * Non-authoring Case JSON lanes retained by decompile/recompile.
71
+ *
72
+ * This intentionally cannot carry stages, tasks, known metadata, or known
73
+ * variable fields. Those constructs must use the typed builder or fail with a
74
+ * named refusal.
75
+ */
76
+ export interface CaseJsonPreservation {
77
+ /** Unknown document-root fields. */
78
+ topLevel?: Record<string, unknown>;
79
+ /** Unknown metadata fields, including Case Manager configuration. */
80
+ metadata?: Record<string, unknown>;
81
+ /** Platform-owned fields nested inside an otherwise typed Case App config. */
82
+ caseAppConfigFields?: {
83
+ fields?: Record<string, unknown>;
84
+ sections?: Array<{
85
+ id: string;
86
+ fields: Record<string, unknown>;
87
+ }>;
88
+ };
89
+ /** Platform-owned annotation nodes. */
90
+ nodes?: PreservedCaseNode[];
91
+ /** Original ordering of typed and preserved top-level nodes. */
92
+ nodeOrder?: string[];
93
+ /** Opaque diagram edges. */
94
+ edges?: unknown[];
95
+ /** Opaque V30 layout side-car. */
96
+ layout?: unknown;
97
+ /** Preserve the absence of a layout side-car on a foreign document. */
98
+ omitLayout?: boolean;
99
+ /** Designer-internal variable fields keyed by lane and variable name. */
100
+ variableFields?: Partial<Record<PreservedVariableLane, Record<string, Record<string, unknown>>>>;
101
+ /**
102
+ * Legacy non-string defaults retained by decompile/recompile. Each value must
103
+ * JSON-encode to the serializer-owned string default for the same variable.
104
+ */
105
+ legacyVariableDefaults?: Partial<Record<PreservedVariableLane, Record<string, unknown>>>;
106
+ /** Original variable row order for each lane. */
107
+ variableOrder?: Partial<Record<PreservedVariableLane, string[]>>;
108
+ /** Wire-only task identity fields aligned without authoring them. */
109
+ taskFields?: PreservedTaskFields[];
110
+ /** Platform-owned trigger data fields aligned by trigger order. */
111
+ triggerDataFields?: Array<Record<string, unknown>>;
112
+ /** Stage labels whose source JSON intentionally omitted inline positions. */
113
+ omitStagePositions?: string[];
114
+ /**
115
+ * Tasks whose source JSON carried no `elementId`. The serializer stamps one on
116
+ * every task, so a document predating the field (the V20-era corpus) would
117
+ * otherwise gain one on round-trip — and gaining one is not cosmetic: the
118
+ * converter matches a task's io rows against it, so adding it can newly wire
119
+ * outputs that were dead in the original. Recording the omission keeps
120
+ * `decompile` → `compile` converter-equivalent, which is the brownfield
121
+ * contract; greenfield authoring still always gets one.
122
+ */
123
+ omitTaskElementIds?: PreservedTaskRef[];
124
+ /** Opaque wire identities aligned to typed constructs by name and position. */
125
+ identities?: CaseIdentityPreservation;
126
+ }
127
+ /** Attach decompiler-owned, non-authoring wire data to a built case. */
128
+ export declare function preserveCaseJson(built: BuiltCase, payload: CaseJsonPreservation): BuiltCase;
129
+ /** @internal Read the preservation payload attached by `preserveCaseJson`. */
130
+ export declare function caseJsonPreservation(built: BuiltCase): CaseJsonPreservation | undefined;
131
+ /** @internal Validate that preservation cannot impersonate typed authoring. */
132
+ export declare function caseJsonPreservationErrors(payload: CaseJsonPreservation | undefined): string[];
133
+ export {};