@uipath/maestro-builder-sdk 6.80.0 → 6.81.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.
@@ -38,6 +38,7 @@ import { CompileRefusal } from '../core/compile-refusal.js';
38
38
  import { implicitInArgBuiltTrigger, unboundInArgMessage } from './in-arg-binding.js';
39
39
  import { jsonClone } from '../core/json-clone.js';
40
40
  import { taskShapeProblems } from './task-shape.js';
41
+ import { SCRIPT_INPUTS, scriptOutputMappings, scriptOutputs, storedScript } from './script.js';
41
42
  import { HTTP_REQUEST_CONNECTION_NAME, HTTP_REQUEST_IMPLICIT_BINDING_ID, HTTP_REQUEST_IMPLICIT_CONNECTION, HTTP_REQUEST_SERVICE_TYPE, httpRequestBody, httpRequestContext, httpRequestInputs, httpRequestOutputMappings, httpRequestOutputs, httpRequestRefusal, writeHttpRequestMetadata, } from './http-request.js';
42
43
  import { connectorPlaceholderData, isConnectorPlaceholder } from './connector-placeholder.js';
43
44
  import { lowerTaskOutputRefs, planTaskOutputs, resolveInPlan, unresolvedTaskOutputRef } from './task-output-ref.js';
@@ -2064,6 +2065,9 @@ function taskData(task, resolver, taskId, stageId, ids) {
2064
2065
  : {};
2065
2066
  return withCustomOutputs(data, task, resolver);
2066
2067
  }
2068
+ case 'script':
2069
+ // Only `{ assign }` rows are written beside the two: a mapped row is one of them.
2070
+ return withCustomOutputs(scriptTaskData(task, resolver, `${stageId}-${taskId}`), { ...task, outputs: task.outputs?.filter((o) => o.custom) }, resolver);
2067
2071
  case 'http-request':
2068
2072
  // Only `{ assign }` rows are written beside the four: a mapped row is one of them.
2069
2073
  return withCustomOutputs(httpRequestTaskData(task, resolver, `${stageId}-${taskId}`), { ...task, outputs: task.outputs?.filter((o) => o.custom) }, resolver);
@@ -2733,6 +2737,42 @@ function externalTaskData(kind, spec, resolver, elementId, where) {
2733
2737
  context.push(io('activityConfigurationVersion', 'string', { value: 'v2' }));
2734
2738
  return { ...data, serviceType: externalServiceType(kind, mode) };
2735
2739
  }
2740
+ /**
2741
+ * A script task (`case/script.ts`): the body behind the Designer's leading `=`,
2742
+ * its two inputs, and its two outputs, each claimed like any task output's and
2743
+ * kept off the case's own variable names (an output's `var` is its id).
2744
+ */
2745
+ function scriptTaskData(task, resolver, elementId) {
2746
+ const where = `Script task "${task.name}"`;
2747
+ const spec = task.script;
2748
+ if (!spec)
2749
+ throw new Error(`internal SDK error: ${where} has no body.`);
2750
+ const mappings = scriptOutputMappings(where, task.outputs);
2751
+ if (!(mappings instanceof Map))
2752
+ throw new CompileRefusal(mappings.code, mappings.message, mappings.suggestion);
2753
+ const claim = (base) => {
2754
+ let id = claimOutputId(resolver, base);
2755
+ while (resolver.caseVarNames.has(id))
2756
+ id = claimOutputId(resolver, base);
2757
+ return id;
2758
+ };
2759
+ registerMappedCompanions(resolver, mappings);
2760
+ return {
2761
+ script: storedScript(spec.body),
2762
+ inputs: SCRIPT_INPUTS.map((row) => ({ ...row })),
2763
+ outputs: scriptOutputs(elementId, claim, mappings, spec),
2764
+ };
2765
+ }
2766
+ /**
2767
+ * A mapped output writes a case variable the source may not declare. Its row
2768
+ * is reassigned (`var` is not its id), so like a connector extract's it needs a
2769
+ * root entry for `=vars.<name>` to read; a declared `.var()` wins the name.
2770
+ */
2771
+ function registerMappedCompanions(resolver, mappings) {
2772
+ for (const variable of mappings.values())
2773
+ if (!resolver.varCompanions.has(variable))
2774
+ resolver.varCompanions.set(variable, { id: variable, name: variable, type: 'object', elementId: 'root', custom: true });
2775
+ }
2736
2776
  /**
2737
2777
  * An HTTP request task (`case/http-request.ts`): the generic HTTP connector's
2738
2778
  * activity, with the request in the `body` input. A manual request names the
@@ -2752,12 +2792,7 @@ function httpRequestTaskData(task, resolver, elementId) {
2752
2792
  const mappings = httpRequestOutputMappings(where, task.outputs);
2753
2793
  if (!(mappings instanceof Map))
2754
2794
  throw new CompileRefusal(mappings.code, mappings.message, mappings.suggestion);
2755
- // A mapped output writes a case variable the source may not declare. Its row
2756
- // is reassigned (`var` is not its id), so like a connector extract's it needs
2757
- // a root entry for `=vars.<name>` to read; a declared `.var()` wins the name.
2758
- for (const variable of mappings.values())
2759
- if (!resolver.varCompanions.has(variable))
2760
- resolver.varCompanions.set(variable, { id: variable, name: variable, type: 'object', elementId: 'root', custom: true });
2795
+ registerMappedCompanions(resolver, mappings);
2761
2796
  let connection;
2762
2797
  let resourceKey = null;
2763
2798
  let folderKey = null;
@@ -3111,28 +3146,34 @@ function isOwnNameOutput(o) {
3111
3146
  return keepsOwnName(o.var, field);
3112
3147
  }
3113
3148
  /**
3114
- * Every variable a task in the plan writes under its own name: own-name task
3115
- * outputs and action form outputs (whose row id is the variable). Collected
3116
- * before any row is emitted, so `claimOutputId` can keep suffixes off them.
3149
+ * The task kinds whose output rows are fixed (the task writes its own rows and
3150
+ * a `.outputs()` mapping reassigns one to a case variable), so a mapped
3151
+ * variable must be reserved before any row id is claimed.
3117
3152
  */
3153
+ const FIXED_OUTPUT_KINDS = new Set(['http-request', 'script']);
3118
3154
  /**
3119
- * The case variables a fixed-output task's `.outputs()` maps (an HTTP
3120
- * request's), declared or not. Collected before any task is emitted, so no
3121
- * task's own output row takes one of them as its id, whatever the task order:
3122
- * an undeclared one gets a root companion, and a row id equal to it would make
3123
- * two writers of one variable, or read back as unmapped.
3155
+ * The case variables a fixed-output task's `.outputs()` maps, declared or not.
3156
+ * Collected before any task is emitted, so no task's own output row takes one
3157
+ * of them as its id, whatever the task order: an undeclared one gets a root
3158
+ * companion, and a row id equal to it would make two writers of one variable,
3159
+ * or read back as unmapped.
3124
3160
  */
3125
3161
  function mappedFixedOutputVars(built) {
3126
3162
  const vars = new Set();
3127
3163
  for (const stage of built.stages)
3128
3164
  for (const lane of stage.lanes)
3129
3165
  for (const task of lane)
3130
- if (task.kind === 'http-request')
3166
+ if (FIXED_OUTPUT_KINDS.has(task.kind))
3131
3167
  for (const o of task.outputs ?? [])
3132
3168
  if (!o.custom)
3133
3169
  vars.add(o.var);
3134
3170
  return vars;
3135
3171
  }
3172
+ /**
3173
+ * Every variable a task in the plan writes under its own name: own-name task
3174
+ * outputs and action form outputs (whose row id is the variable). Collected
3175
+ * before any row is emitted, so `claimOutputId` can keep suffixes off them.
3176
+ */
3136
3177
  function ownOutputVars(built) {
3137
3178
  const vars = new Set();
3138
3179
  for (const stage of built.stages)
@@ -160,6 +160,8 @@ export declare const REFUSALS: {
160
160
  readonly CASE_IN_ARG_UNBOUND: "lowering";
161
161
  readonly CASE_LAYOUT_NODE_MATCH: "lowering";
162
162
  readonly CASE_LAYOUT_UNKNOWN_FIELD: "lowering";
163
+ readonly SCRIPT_BODY_SYNTAX: "lint";
164
+ readonly SCRIPT_OUTPUT: "lowering";
163
165
  readonly HTTP_REQUEST_CONNECTOR: "lowering";
164
166
  readonly HTTP_REQUEST_TARGET: "lowering";
165
167
  readonly HTTP_REQUEST_FIELD: "lowering";
@@ -209,6 +209,11 @@ export const REFUSALS = {
209
209
  CASE_IN_ARG_UNBOUND: 'lowering',
210
210
  CASE_LAYOUT_NODE_MATCH: 'lowering',
211
211
  CASE_LAYOUT_UNKNOWN_FIELD: 'lowering',
212
+ // Case script task (case/script.ts). A string body that does not parse is
213
+ // written as authored (`lint`); an output other than the two has no row to
214
+ // write it to (`lowering`).
215
+ SCRIPT_BODY_SYNTAX: 'lint',
216
+ SCRIPT_OUTPUT: 'lowering',
212
217
  // Case http-request task (case/http-request.ts). `lowering`: compile would
213
218
  // drop or rewrite what the source says. `lint`: compile writes it as
214
219
  // authored, and only `check` reports it.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * core/script-engine — what the engine gives a script body, whichever family
3
+ * wrote the task: a Flow script node and a Case script task both run on
4
+ * UiPath/PO.BpmnEngine's script service, Jint 4.4.0
5
+ * (`ScriptTaskService.InvokeScriptAsync`,
6
+ * `src/BpmnEngine/UiPath.PO.Worker/Services/ElementExecution/Script/ScriptTaskService.cs`).
7
+ * Each family's `ScriptRuntime` (`core/script-function.ts`) names its own scope
8
+ * globals and takes these facts from here, so the two lists cannot drift.
9
+ * Moved from `nodes/script/flow/runtime.ts`, where the measurements are
10
+ * described; change them when the engine does.
11
+ */
12
+ /**
13
+ * The names the engine's preludes declare with `const` before the script runs
14
+ * (`ScriptTaskService.cs`, `WithBuiltInFunctions` and `WithConsole`). At the
15
+ * body's top level, a `const`, `let`, `var`, `function` or `class` of one fails
16
+ * with "Identifier '…' has already been declared", and an assignment to one with
17
+ * "Assignment to constant variable." (both measured on Jint 4.4.0). Inside a
18
+ * nested block or function the name is the author's own and is fine.
19
+ */
20
+ export declare const SCRIPT_ENGINE_CONST_GLOBALS: ReadonlySet<string>;
21
+ /**
22
+ * The members the engine's own objects have; any other member reads
23
+ * `undefined`, so calling it throws "Property '…' of object is not a function"
24
+ * (measured on Jint 4.4.0). `crypto` holds only `randomUUID`
25
+ * (`JavaScriptEvaluator.cs`), and `console` only the five no-ops `WithConsole`
26
+ * declares (`ScriptTaskService.cs`).
27
+ */
28
+ export declare const SCRIPT_ENGINE_GLOBAL_MEMBERS: ReadonlyMap<string, ReadonlySet<string>>;
29
+ /**
30
+ * Every global a script body can read besides its family's scope globals: the
31
+ * language's ES2020 built-ins, the globals the engine registers (`btoa`,
32
+ * `atob`, `randomUUID`, `crypto`), and `console`.
33
+ */
34
+ export declare const SCRIPT_ENGINE_GLOBALS: ReadonlySet<string>;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * core/script-engine — what the engine gives a script body, whichever family
3
+ * wrote the task: a Flow script node and a Case script task both run on
4
+ * UiPath/PO.BpmnEngine's script service, Jint 4.4.0
5
+ * (`ScriptTaskService.InvokeScriptAsync`,
6
+ * `src/BpmnEngine/UiPath.PO.Worker/Services/ElementExecution/Script/ScriptTaskService.cs`).
7
+ * Each family's `ScriptRuntime` (`core/script-function.ts`) names its own scope
8
+ * globals and takes these facts from here, so the two lists cannot drift.
9
+ * Moved from `nodes/script/flow/runtime.ts`, where the measurements are
10
+ * described; change them when the engine does.
11
+ */
12
+ /**
13
+ * The names the engine's preludes declare with `const` before the script runs
14
+ * (`ScriptTaskService.cs`, `WithBuiltInFunctions` and `WithConsole`). At the
15
+ * body's top level, a `const`, `let`, `var`, `function` or `class` of one fails
16
+ * with "Identifier '…' has already been declared", and an assignment to one with
17
+ * "Assignment to constant variable." (both measured on Jint 4.4.0). Inside a
18
+ * nested block or function the name is the author's own and is fine.
19
+ */
20
+ export const SCRIPT_ENGINE_CONST_GLOBALS = new Set(['console', 'uipath', 'aggregate', '_aggregate', '_pipe']);
21
+ /**
22
+ * The members the engine's own objects have; any other member reads
23
+ * `undefined`, so calling it throws "Property '…' of object is not a function"
24
+ * (measured on Jint 4.4.0). `crypto` holds only `randomUUID`
25
+ * (`JavaScriptEvaluator.cs`), and `console` only the five no-ops `WithConsole`
26
+ * declares (`ScriptTaskService.cs`).
27
+ */
28
+ export const SCRIPT_ENGINE_GLOBAL_MEMBERS = new Map([
29
+ ['crypto', new Set(['randomUUID'])],
30
+ ['console', new Set(['debug', 'error', 'info', 'log', 'warn'])],
31
+ ]);
32
+ /**
33
+ * Every global a script body can read besides its family's scope globals: the
34
+ * language's ES2020 built-ins, the globals the engine registers (`btoa`,
35
+ * `atob`, `randomUUID`, `crypto`), and `console`.
36
+ */
37
+ export const SCRIPT_ENGINE_GLOBALS = new Set([
38
+ 'undefined', 'NaN', 'Infinity', 'globalThis', 'console',
39
+ 'btoa', 'atob', 'randomUUID', 'crypto',
40
+ 'Object', 'Function', 'Array', 'Number', 'Boolean', 'String', 'Symbol', 'BigInt', 'Date', 'RegExp', 'Math', 'JSON',
41
+ 'Promise', 'Proxy', 'Reflect', 'Map', 'Set', 'WeakMap', 'WeakSet',
42
+ 'Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
43
+ 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Atomics',
44
+ 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array',
45
+ 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array',
46
+ 'parseInt', 'parseFloat', 'isNaN', 'isFinite',
47
+ 'encodeURI', 'encodeURIComponent', 'decodeURI', 'decodeURIComponent', 'eval',
48
+ ]);
@@ -20,7 +20,7 @@ import type { ScriptRuntime } from '../../../core/script-function.js';
20
20
  * the body goes to `Engine.Evaluate` as a script, after `btoa`/`atob` (UTF-8),
21
21
  * `randomUUID` and `crypto` (holding only `randomUUID`) are set
22
22
  * (`src/BpmnEngine/UiPath.PO.BpmnEngine/Expressions/JavaScriptEvaluator.cs`) and
23
- * two preludes declare {@link FLOW_SCRIPT_CONST_GLOBALS} with `const`. `Intl`,
23
+ * two preludes declare {@link SCRIPT_ENGINE_CONST_GLOBALS} with `const`. `Intl`,
24
24
  * `URL`, `TextEncoder`, `Buffer`, `fetch`, `require` and `structuredClone` read
25
25
  * `undefined` there, so they are absent here. Change this when the engine does.
26
26
  *
@@ -1,23 +1,4 @@
1
- /**
2
- * The names the engine's preludes declare with `const` before the script runs
3
- * (`ScriptTaskService.cs`, `WithBuiltInFunctions` and `WithConsole`). At the
4
- * body's top level, a `const`, `let`, `var`, `function` or `class` of one fails
5
- * with "Identifier '…' has already been declared", and an assignment to one with
6
- * "Assignment to constant variable." (both measured on Jint 4.4.0). Inside a
7
- * nested block or function the name is the author's own and is fine.
8
- */
9
- const FLOW_SCRIPT_CONST_GLOBALS = new Set(['console', 'uipath', 'aggregate', '_aggregate', '_pipe']);
10
- /**
11
- * The members the engine's own objects have; any other member reads
12
- * `undefined`, so calling it throws "Property '…' of object is not a function"
13
- * (measured on Jint 4.4.0). `crypto` holds only `randomUUID`
14
- * (`JavaScriptEvaluator.cs`), and `console` only the five no-ops `WithConsole`
15
- * declares (`ScriptTaskService.cs`).
16
- */
17
- const FLOW_SCRIPT_GLOBAL_MEMBERS = new Map([
18
- ['crypto', new Set(['randomUUID'])],
19
- ['console', new Set(['debug', 'error', 'info', 'log', 'warn'])],
20
- ]);
1
+ import { SCRIPT_ENGINE_CONST_GLOBALS, SCRIPT_ENGINE_GLOBAL_MEMBERS, SCRIPT_ENGINE_GLOBALS } from '../../../core/script-engine.js';
21
2
  /**
22
3
  * What a Flow script body can read: the language's ES2020 built-ins, the
23
4
  * globals the engine registers, `console`, and the runtime's `$vars` and
@@ -35,7 +16,7 @@ const FLOW_SCRIPT_GLOBAL_MEMBERS = new Map([
35
16
  * the body goes to `Engine.Evaluate` as a script, after `btoa`/`atob` (UTF-8),
36
17
  * `randomUUID` and `crypto` (holding only `randomUUID`) are set
37
18
  * (`src/BpmnEngine/UiPath.PO.BpmnEngine/Expressions/JavaScriptEvaluator.cs`) and
38
- * two preludes declare {@link FLOW_SCRIPT_CONST_GLOBALS} with `const`. `Intl`,
19
+ * two preludes declare {@link SCRIPT_ENGINE_CONST_GLOBALS} with `const`. `Intl`,
39
20
  * `URL`, `TextEncoder`, `Buffer`, `fetch`, `require` and `structuredClone` read
40
21
  * `undefined` there, so they are absent here. Change this when the engine does.
41
22
  *
@@ -63,18 +44,7 @@ export const FLOW_SCRIPT_RUNTIME = {
63
44
  },
64
45
  ],
65
46
  name: 'the Flow script runtime',
66
- constGlobals: FLOW_SCRIPT_CONST_GLOBALS,
67
- globalMembers: FLOW_SCRIPT_GLOBAL_MEMBERS,
68
- globals: new Set([
69
- 'undefined', 'NaN', 'Infinity', 'globalThis', 'console',
70
- 'btoa', 'atob', 'randomUUID', 'crypto',
71
- 'Object', 'Function', 'Array', 'Number', 'Boolean', 'String', 'Symbol', 'BigInt', 'Date', 'RegExp', 'Math', 'JSON',
72
- 'Promise', 'Proxy', 'Reflect', 'Map', 'Set', 'WeakMap', 'WeakSet',
73
- 'Error', 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
74
- 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Atomics',
75
- 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array',
76
- 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array',
77
- 'parseInt', 'parseFloat', 'isNaN', 'isFinite',
78
- 'encodeURI', 'encodeURIComponent', 'decodeURI', 'decodeURIComponent', 'eval',
79
- ]),
47
+ constGlobals: SCRIPT_ENGINE_CONST_GLOBALS,
48
+ globalMembers: SCRIPT_ENGINE_GLOBAL_MEMBERS,
49
+ globals: SCRIPT_ENGINE_GLOBALS,
80
50
  };
@@ -1,5 +1,7 @@
1
1
  import { relative } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
2
3
  import { typescript } from './core/typescript-module.js';
4
+ import { isSdkSpecifier } from './sdk-resolve-hook.js';
3
5
  import { isReference } from './core/script-function.js';
4
6
  /**
5
7
  * Every name a `script(fn)` function in `file` (or a file it imports) reads from
@@ -18,7 +20,7 @@ export function scriptFunctionScope(file) {
18
20
  noLib: true, types: [], noEmit: true, skipLibCheck: true, allowImportingTsExtensions: true,
19
21
  target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.NodeNext, moduleResolution: ts.ModuleResolutionKind.NodeNext,
20
22
  };
21
- const program = ts.createProgram([file], options);
23
+ const program = ts.createProgram([file], options, sdkResolvingHost(ts, options));
22
24
  const checker = program.getTypeChecker();
23
25
  const cwd = process.cwd();
24
26
  const where = (n) => {
@@ -61,6 +63,25 @@ export function scriptFunctionScope(file) {
61
63
  }
62
64
  return { captures: out, unfollowed, untyped, followed: seen.size, followedTexts };
63
65
  }
66
+ /**
67
+ * A compiler host that resolves the SDK's own specifiers (the package name and
68
+ * its subpaths) from inside this package, as `sdk-resolve-hook.ts` does at run
69
+ * time. The author's folder may have no `node_modules` (a global install): a
70
+ * plain NodeNext program then cannot find the SDK's declarations, a Case
71
+ * task's `t` is `any`, and `.script(fn)` is not recognised. Package
72
+ * self-reference maps the name to the declarations beside this file. Any other
73
+ * specifier resolves as before.
74
+ */
75
+ function sdkResolvingHost(ts, options) {
76
+ const host = ts.createCompilerHost(options);
77
+ const self = fileURLToPath(import.meta.url);
78
+ host.resolveModuleNameLiterals = (literals, containingFile, redirected, opts, containing) => literals.map((literal) => {
79
+ const from = isSdkSpecifier(literal.text) ? self : containingFile;
80
+ const mode = ts.getModeForUsageLocation(containing, literal, opts);
81
+ return ts.resolveModuleName(literal.text, from, opts, host, undefined, redirected, mode);
82
+ });
83
+ return host;
84
+ }
64
85
  /** A whitespace-free key for comparing function texts. */
65
86
  export function functionTextKey(text) {
66
87
  return text.replace(/\s+/g, '');
@@ -136,8 +157,11 @@ export function scriptFunctionCaptureMessage(captures) {
136
157
  + 'Move the helper\'s code inside the function, or give it a name the runtime does not have.';
137
158
  }
138
159
  /**
139
- * Whether a call is `script(…)` from an import: the callee is an identifier
140
- * imported under the name `script`, or `<namespace import>.script`.
160
+ * Whether a call is a script call: Flow's `script(…)` from an import (the
161
+ * callee is an identifier imported under the name `script`, or
162
+ * `<namespace import>.script`), or a Case task's `.script(…)`, a method the
163
+ * checker resolves to the SDK's own `TaskBuilder.script` (`case/case-sdk.ts`),
164
+ * so another library's `script` method is not one.
141
165
  */
142
166
  function isScriptCall(ts, checker, call) {
143
167
  const callee = call.expression;
@@ -145,12 +169,26 @@ function isScriptCall(ts, checker, call) {
145
169
  const decl = checker.getSymbolAtLocation(callee)?.declarations?.[0];
146
170
  return decl !== undefined && ts.isImportSpecifier(decl) && (decl.propertyName ?? decl.name).text === 'script';
147
171
  }
148
- if (ts.isPropertyAccessExpression(callee) && callee.name.text === 'script' && ts.isIdentifier(callee.expression)) {
149
- const decl = checker.getSymbolAtLocation(callee.expression)?.declarations?.[0];
150
- return decl !== undefined && ts.isNamespaceImport(decl);
172
+ if (ts.isPropertyAccessExpression(callee) && callee.name.text === 'script') {
173
+ if (ts.isIdentifier(callee.expression)) {
174
+ const decl = checker.getSymbolAtLocation(callee.expression)?.declarations?.[0];
175
+ if (decl !== undefined && ts.isNamespaceImport(decl))
176
+ return true;
177
+ }
178
+ return isCaseTaskScript(ts, checker, callee);
151
179
  }
152
180
  return false;
153
181
  }
182
+ /** Whether `callee` is the Case `TaskBuilder.script` method, declared in the SDK's `case-sdk` module. */
183
+ function isCaseTaskScript(ts, checker, callee) {
184
+ const decl = checker.getSymbolAtLocation(callee.name)?.declarations?.[0];
185
+ if (!decl || !ts.isMethodDeclaration(decl))
186
+ return false;
187
+ const owner = decl.parent;
188
+ if (!ts.isClassDeclaration(owner) || owner.name?.text !== 'TaskBuilder')
189
+ return false;
190
+ return /(?:^|[\\/])case-sdk\.(?:d\.)?ts$/.test(decl.getSourceFile().fileName);
191
+ }
154
192
  /** The function an argument is, or names: inline, a declaration, or a `const` bound to one, through imports. */
155
193
  function functionOf(ts, checker, arg) {
156
194
  const fnLike = (n) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.80.0",
3
+ "version": "6.81.0",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -103,5 +103,5 @@
103
103
  "@types/node": "^22.7.0",
104
104
  "esbuild": "^0.28.1"
105
105
  },
106
- "gitref": "42acd5e20650a9c9102e87297a3754b766b0c4ca"
106
+ "gitref": "f1f3a61ac051ab0738028776a78b2e564a15987f"
107
107
  }