@uipath/maestro-builder-sdk 6.81.0 → 6.82.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.
- package/dist/api-index.md +85 -84
- package/dist/api-members.md +277 -266
- package/dist/case/case-sdk.d.ts +90 -1
- package/dist/case/case-sdk.js +51 -3
- package/dist/case/check.js +14 -0
- package/dist/case/decompile-document-extraction.d.ts +17 -0
- package/dist/case/decompile-document-extraction.js +76 -0
- package/dist/case/decompile.d.ts +6 -0
- package/dist/case/decompile.js +26 -0
- package/dist/case/document-extraction-output-schema.json +132 -0
- package/dist/case/document-extraction-saved.d.ts +24 -0
- package/dist/case/document-extraction-saved.js +64 -0
- package/dist/case/document-extraction.d.ts +119 -0
- package/dist/case/document-extraction.js +161 -0
- package/dist/case/preserve.d.ts +7 -0
- package/dist/case/preserve.js +6 -0
- package/dist/case/serialize.js +121 -5
- package/dist/core/refusals.d.ts +9 -0
- package/dist/core/refusals.js +17 -0
- package/package.json +2 -2
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* case/document-extraction — the Case `document-extraction` task: a document
|
|
3
|
+
* run through a deployed IXP model, written as the Case Designer saves it.
|
|
4
|
+
*
|
|
5
|
+
* Read from an alpha Designer save (2026-10-16, schema 32.0.4; UiPath/cli
|
|
6
|
+
* `packages/case-tool/tests/fixtures/document-extraction/designer-saved.json`)
|
|
7
|
+
* and the CLI's writer, `sdd convert` (`services/sdd-convert/document-extraction.ts`
|
|
8
|
+
* at UiPath/cli b37f32997c). With ids masked the two agree on every `data`
|
|
9
|
+
* field and on the binding.
|
|
10
|
+
*
|
|
11
|
+
* The task's `data`:
|
|
12
|
+
* - `name` "Document extraction", `serviceType` "IXP.Extraction", `version` "v2";
|
|
13
|
+
* - `context`: the deployment, in the Designer's order. `solutionResourceKey`
|
|
14
|
+
* (the deployment's solution key), `name` (a reference to its `ixpDeployment`
|
|
15
|
+
* name binding), `folderKey`, `folderName`, `modelName` (the deployment's
|
|
16
|
+
* DeploymentName, `<slug>-<hash>-ixp`), `modelDisplayName` (its
|
|
17
|
+
* DeploymentTitle) and `digitizationMode` "fileUpload";
|
|
18
|
+
* - `inputs`: `fileRef` (the document, required) and `pageRange`;
|
|
19
|
+
* - `outputs`: what the model extracts, as `output` (`=result`), and `error`.
|
|
20
|
+
*
|
|
21
|
+
* The keys are tenant values. `uip ixp deployments list <project-name>`, given
|
|
22
|
+
* the IXP project's Name (not its Title, which is `not_found`), gives
|
|
23
|
+
* DeploymentName, DeploymentTitle and FolderKey, and no folder path. `uip
|
|
24
|
+
* solution resources list --kind IxpDeployment --source remote` lists every
|
|
25
|
+
* IXP deployment on the tenant: the row whose `Name` is the DeploymentTitle and
|
|
26
|
+
* whose `FolderKey` matches gives `Key` (the deploymentKey) and `Folder` (the
|
|
27
|
+
* folder path). `sdd resolve` does not resolve them. Without `folderKey` or `modelName` the task packs to a placeholder that
|
|
28
|
+
* never runs, and `validate` says nothing about a missing `folderKey`, so
|
|
29
|
+
* `check` does ({@link documentExtractionLint}). Without `deploymentKey` the
|
|
30
|
+
* binding cannot be written, so compile refuses it ({@link documentExtractionRefusal}).
|
|
31
|
+
*/
|
|
32
|
+
import type { CaseDocumentExtractionSpec, TaskOutputBinding } from './case-sdk.js';
|
|
33
|
+
/**
|
|
34
|
+
* The `output` row's schema, copied byte for byte from UiPath/cli
|
|
35
|
+
* `packages/case-tool/src/services/sdd-convert/document-extraction-output-schema.json`
|
|
36
|
+
* (last changed in 8810e5a8d1, 2026-10-19; read at b37f32997c). The Designer
|
|
37
|
+
* save carries the same schema. `case-document-extraction.test.ts` pins its hash.
|
|
38
|
+
*/
|
|
39
|
+
export declare const DOCUMENT_EXTRACTION_OUTPUT_SCHEMA: Readonly<Record<string, unknown>>;
|
|
40
|
+
export declare const DOCUMENT_EXTRACTION_OUTPUT_SCHEMA_PROVENANCE: {
|
|
41
|
+
readonly repo: "UiPath/cli";
|
|
42
|
+
readonly path: "packages/case-tool/src/services/sdd-convert/document-extraction-output-schema.json";
|
|
43
|
+
readonly commit: "8810e5a8d193ade16b06bf0b5df23af5dc5b9593";
|
|
44
|
+
readonly sha256: "6d1e5b7b65f290bb458b9068f9000c86525557ab25d70a4b86a44a42a1e31358";
|
|
45
|
+
};
|
|
46
|
+
export declare const DOCUMENT_EXTRACTION_SERVICE_TYPE = "IXP.Extraction";
|
|
47
|
+
export declare const DOCUMENT_EXTRACTION_NAME = "Document extraction";
|
|
48
|
+
export declare const DOCUMENT_EXTRACTION_VERSION = "v2";
|
|
49
|
+
export declare const DOCUMENT_EXTRACTION_RESOURCE = "ixpDeployment";
|
|
50
|
+
/** The task's two outputs, in the Designer's order. */
|
|
51
|
+
export declare const DOCUMENT_EXTRACTION_OUTPUTS: readonly [{
|
|
52
|
+
readonly name: "output";
|
|
53
|
+
readonly displayName: "Output";
|
|
54
|
+
readonly source: "=result";
|
|
55
|
+
readonly schema: Readonly<Record<string, unknown>>;
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "error";
|
|
58
|
+
readonly displayName: "Error";
|
|
59
|
+
readonly source: "=Error";
|
|
60
|
+
readonly schema: {
|
|
61
|
+
type: string;
|
|
62
|
+
properties: {
|
|
63
|
+
code: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
message: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
detail: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
category: {
|
|
73
|
+
type: string;
|
|
74
|
+
};
|
|
75
|
+
status: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
element: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}];
|
|
84
|
+
/** The context row names, in the Designer's order: decompile lifts exactly these. */
|
|
85
|
+
export declare const DOCUMENT_EXTRACTION_CONTEXT: readonly string[];
|
|
86
|
+
/** A refusal or finding `check` and `serialize` share. */
|
|
87
|
+
export interface DocumentExtractionFinding {
|
|
88
|
+
code: string;
|
|
89
|
+
message: string;
|
|
90
|
+
suggestion?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* What `check` says about a task compile writes as authored (`lint`): the
|
|
94
|
+
* values without which the task cannot run, which `validate` misses or reports
|
|
95
|
+
* against the wrong thing.
|
|
96
|
+
*/
|
|
97
|
+
export declare function documentExtractionLint(owner: string, spec: CaseDocumentExtractionSpec): DocumentExtractionFinding[];
|
|
98
|
+
/**
|
|
99
|
+
* Why compile cannot write `spec` (`lowering`), or `undefined`: a deployment
|
|
100
|
+
* with no `deploymentKey` would be bound by a binding with no `resourceKey`,
|
|
101
|
+
* which `validate` rejects (as a schema migration failure,
|
|
102
|
+
* CASE_MGMT_FIELD_TYPE_MISMATCH) and decompile cannot read back.
|
|
103
|
+
*/
|
|
104
|
+
export declare function documentExtractionRefusal(owner: string, spec: CaseDocumentExtractionSpec): DocumentExtractionFinding | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Which output an `.outputs()` row writes to a case variable: its `source` is
|
|
107
|
+
* one of the two, once each; or the refusal (`lowering`: no row to write).
|
|
108
|
+
*/
|
|
109
|
+
export declare function documentExtractionOutputMappings(owner: string, outputs: readonly TaskOutputBinding[] | undefined): Map<string, string> | DocumentExtractionFinding;
|
|
110
|
+
/** The context rows, in the Designer's order; `name` is the binding reference, or `""` without a deployment. */
|
|
111
|
+
export declare function documentExtractionContext(spec: CaseDocumentExtractionSpec, nameRef: string): Record<string, unknown>[];
|
|
112
|
+
/** The two inputs, with the `v` ids the caller mints. */
|
|
113
|
+
export declare function documentExtractionInputs(spec: CaseDocumentExtractionSpec, elementId: string, mint: (name: string) => string): Record<string, unknown>[];
|
|
114
|
+
/**
|
|
115
|
+
* The two output rows, each claimed a document-unique id; a mapped output
|
|
116
|
+
* writes the case variable the author named instead, keeping its id as
|
|
117
|
+
* `originalVar`, as the Designer saves an arrow row (`output -> extracted`).
|
|
118
|
+
*/
|
|
119
|
+
export declare function documentExtractionOutputs(elementId: string, claim: (base: string) => string, mappings: ReadonlyMap<string, string>): Record<string, unknown>[];
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import outputSchema from './document-extraction-output-schema.json' with { type: 'json' };
|
|
2
|
+
/**
|
|
3
|
+
* The `output` row's schema, copied byte for byte from UiPath/cli
|
|
4
|
+
* `packages/case-tool/src/services/sdd-convert/document-extraction-output-schema.json`
|
|
5
|
+
* (last changed in 8810e5a8d1, 2026-10-19; read at b37f32997c). The Designer
|
|
6
|
+
* save carries the same schema. `case-document-extraction.test.ts` pins its hash.
|
|
7
|
+
*/
|
|
8
|
+
export const DOCUMENT_EXTRACTION_OUTPUT_SCHEMA = outputSchema;
|
|
9
|
+
export const DOCUMENT_EXTRACTION_OUTPUT_SCHEMA_PROVENANCE = {
|
|
10
|
+
repo: 'UiPath/cli',
|
|
11
|
+
path: 'packages/case-tool/src/services/sdd-convert/document-extraction-output-schema.json',
|
|
12
|
+
commit: '8810e5a8d193ade16b06bf0b5df23af5dc5b9593',
|
|
13
|
+
sha256: '6d1e5b7b65f290bb458b9068f9000c86525557ab25d70a4b86a44a42a1e31358',
|
|
14
|
+
};
|
|
15
|
+
export const DOCUMENT_EXTRACTION_SERVICE_TYPE = 'IXP.Extraction';
|
|
16
|
+
export const DOCUMENT_EXTRACTION_NAME = 'Document extraction';
|
|
17
|
+
export const DOCUMENT_EXTRACTION_VERSION = 'v2';
|
|
18
|
+
export const DOCUMENT_EXTRACTION_RESOURCE = 'ixpDeployment';
|
|
19
|
+
/** The `error` row's schema, as the Designer and the CLI write it. */
|
|
20
|
+
const ERROR_SCHEMA = {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
code: { type: 'string' }, message: { type: 'string' }, detail: { type: 'string' },
|
|
24
|
+
category: { type: 'string' }, status: { type: 'number' }, element: { type: 'string' },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
/** The task's two outputs, in the Designer's order. */
|
|
28
|
+
export const DOCUMENT_EXTRACTION_OUTPUTS = [
|
|
29
|
+
{ name: 'output', displayName: 'Output', source: '=result', schema: DOCUMENT_EXTRACTION_OUTPUT_SCHEMA },
|
|
30
|
+
{ name: 'error', displayName: 'Error', source: '=Error', schema: ERROR_SCHEMA },
|
|
31
|
+
];
|
|
32
|
+
/** The context row names, in the Designer's order: decompile lifts exactly these. */
|
|
33
|
+
export const DOCUMENT_EXTRACTION_CONTEXT = [
|
|
34
|
+
'solutionResourceKey', 'name', 'folderKey', 'folderName', 'modelName', 'modelDisplayName', 'digitizationMode',
|
|
35
|
+
];
|
|
36
|
+
const blank = (value) => value === undefined || value.trim() === '';
|
|
37
|
+
/**
|
|
38
|
+
* What `check` says about a task compile writes as authored (`lint`): the
|
|
39
|
+
* values without which the task cannot run, which `validate` misses or reports
|
|
40
|
+
* against the wrong thing.
|
|
41
|
+
*/
|
|
42
|
+
export function documentExtractionLint(owner, spec) {
|
|
43
|
+
const found = [];
|
|
44
|
+
// The IXP project's Name: a Title is `not_found` (a tenant run, UiPath/skills#4452).
|
|
45
|
+
const LIST = "uip ixp deployments list <IXP project Name, not its Title> --output json";
|
|
46
|
+
if (blank(spec.model))
|
|
47
|
+
found.push({
|
|
48
|
+
code: 'DOCUMENT_EXTRACTION_NO_MODEL',
|
|
49
|
+
message: `${owner} names no model, so it packs to a placeholder that never runs.`,
|
|
50
|
+
suggestion: `Pass model: the deployment's DeploymentName (\`<slug>-<hash>-ixp\`), from '${LIST}'.`,
|
|
51
|
+
});
|
|
52
|
+
if (blank(spec.deployment))
|
|
53
|
+
found.push({
|
|
54
|
+
code: 'DOCUMENT_EXTRACTION_NO_DEPLOYMENT',
|
|
55
|
+
message: `${owner} names no deployment, so compile writes no ixpDeployment binding and nothing binds the model the task runs.`,
|
|
56
|
+
suggestion: `Pass deployment: the deployment's DeploymentTitle, from '${LIST}'.`,
|
|
57
|
+
});
|
|
58
|
+
if (blank(spec.folderKey))
|
|
59
|
+
found.push({
|
|
60
|
+
code: 'DOCUMENT_EXTRACTION_NO_FOLDER_KEY',
|
|
61
|
+
message: `${owner} has no folderKey, so it packs to a placeholder that never runs. \`uip maestro case validate\` does not report this.`,
|
|
62
|
+
suggestion: `Pass folderKey: the deployment's FolderKey, from '${LIST}'.`,
|
|
63
|
+
});
|
|
64
|
+
// `uip maestro case sdd convert` reports a missing Folder Path as unresolved,
|
|
65
|
+
// as it does a missing FolderKey, and writes folderName null.
|
|
66
|
+
if (blank(spec.folder))
|
|
67
|
+
found.push({
|
|
68
|
+
code: 'DOCUMENT_EXTRACTION_NO_FOLDER',
|
|
69
|
+
message: `${owner} names no folder, so context.folderName is written empty: the folder the deployment is deployed to is unnamed. `
|
|
70
|
+
+ "`uip maestro case sdd convert` reports the same gap as unresolved.",
|
|
71
|
+
suggestion: "Pass folder: the deployment's folder path, from the row of 'uip solution resources list --kind IxpDeployment --source remote --output json' whose Name is the deployment and whose FolderKey matches (its Folder).",
|
|
72
|
+
});
|
|
73
|
+
if (blank(spec.file))
|
|
74
|
+
found.push({
|
|
75
|
+
code: 'DOCUMENT_EXTRACTION_NO_FILE',
|
|
76
|
+
message: `${owner} reads no file, so the model has nothing to extract from.`,
|
|
77
|
+
suggestion: "Pass file: the document, usually a file case variable (file: '=vars.invoice').",
|
|
78
|
+
});
|
|
79
|
+
return found;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Why compile cannot write `spec` (`lowering`), or `undefined`: a deployment
|
|
83
|
+
* with no `deploymentKey` would be bound by a binding with no `resourceKey`,
|
|
84
|
+
* which `validate` rejects (as a schema migration failure,
|
|
85
|
+
* CASE_MGMT_FIELD_TYPE_MISMATCH) and decompile cannot read back.
|
|
86
|
+
*/
|
|
87
|
+
export function documentExtractionRefusal(owner, spec) {
|
|
88
|
+
if (spec.deployment.trim() === '' || !blank(spec.deploymentKey))
|
|
89
|
+
return undefined;
|
|
90
|
+
return {
|
|
91
|
+
code: 'DOCUMENT_EXTRACTION_NO_DEPLOYMENT_KEY',
|
|
92
|
+
message: `${owner} has no deploymentKey, so its ixpDeployment binding would have no resourceKey, which the platform rejects and the solution cannot resolve.`,
|
|
93
|
+
suggestion: "Pass deploymentKey: the Key of the row of 'uip solution resources list --kind IxpDeployment --source remote --output json' whose Name is the deployment's title and whose FolderKey matches.",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Which output an `.outputs()` row writes to a case variable: its `source` is
|
|
98
|
+
* one of the two, once each; or the refusal (`lowering`: no row to write).
|
|
99
|
+
*/
|
|
100
|
+
export function documentExtractionOutputMappings(owner, outputs) {
|
|
101
|
+
const bySource = new Map();
|
|
102
|
+
for (const o of outputs ?? []) {
|
|
103
|
+
if (o.custom)
|
|
104
|
+
continue;
|
|
105
|
+
if (!DOCUMENT_EXTRACTION_OUTPUTS.some((row) => row.source === o.source))
|
|
106
|
+
return {
|
|
107
|
+
code: 'DOCUMENT_EXTRACTION_OUTPUT',
|
|
108
|
+
message: `${owner} output "${o.var}" reads ${JSON.stringify(o.source)}; a document extraction has two outputs: `
|
|
109
|
+
+ `${DOCUMENT_EXTRACTION_OUTPUTS.map((row) => row.source).join(' and ')}.`,
|
|
110
|
+
suggestion: "Map the extraction to a case variable, .outputs({ extracted: '=result' }), and read its fields as extracted.<field>.",
|
|
111
|
+
};
|
|
112
|
+
if (bySource.has(o.source))
|
|
113
|
+
return { code: 'DOCUMENT_EXTRACTION_OUTPUT', message: `${owner} writes ${o.source} to two variables, "${bySource.get(o.source)}" and "${o.var}".` };
|
|
114
|
+
bySource.set(o.source, o.var);
|
|
115
|
+
}
|
|
116
|
+
return bySource;
|
|
117
|
+
}
|
|
118
|
+
/** The context rows, in the Designer's order; `name` is the binding reference, or `""` without a deployment. */
|
|
119
|
+
export function documentExtractionContext(spec, nameRef) {
|
|
120
|
+
const row = (name, value) => ({ name, type: 'string', value });
|
|
121
|
+
const or = (value) => (value === undefined ? null : value);
|
|
122
|
+
return [
|
|
123
|
+
row('solutionResourceKey', or(spec.deploymentKey)),
|
|
124
|
+
row('name', nameRef),
|
|
125
|
+
row('folderKey', or(spec.folderKey)),
|
|
126
|
+
row('folderName', or(spec.folder)),
|
|
127
|
+
row('modelName', or(spec.model)),
|
|
128
|
+
row('modelDisplayName', or(spec.deployment)),
|
|
129
|
+
row('digitizationMode', 'fileUpload'),
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
/** The two inputs, with the `v` ids the caller mints. */
|
|
133
|
+
export function documentExtractionInputs(spec, elementId, mint) {
|
|
134
|
+
const file = mint('fileRef');
|
|
135
|
+
const pages = mint('pageRange');
|
|
136
|
+
return [
|
|
137
|
+
{ name: 'fileRef', displayName: 'File', type: 'file', value: spec.file ?? '', required: true, id: file, var: file, elementId },
|
|
138
|
+
{ name: 'pageRange', displayName: 'Page range', type: 'string', value: spec.pageRange ?? '', id: pages, var: pages, elementId },
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The two output rows, each claimed a document-unique id; a mapped output
|
|
143
|
+
* writes the case variable the author named instead, keeping its id as
|
|
144
|
+
* `originalVar`, as the Designer saves an arrow row (`output -> extracted`).
|
|
145
|
+
*/
|
|
146
|
+
export function documentExtractionOutputs(elementId, claim, mappings) {
|
|
147
|
+
return DOCUMENT_EXTRACTION_OUTPUTS.map((row) => {
|
|
148
|
+
const id = claim(row.name);
|
|
149
|
+
const variable = mappings.get(row.source);
|
|
150
|
+
const out = {
|
|
151
|
+
name: row.name, displayName: row.displayName, type: 'jsonSchema', source: row.source,
|
|
152
|
+
_jsonSchema: structuredClone(row.schema), id, var: variable ?? id, value: variable ?? id, elementId,
|
|
153
|
+
};
|
|
154
|
+
if (variable !== undefined) {
|
|
155
|
+
out.target = `=${id}`;
|
|
156
|
+
out.originalVar = id;
|
|
157
|
+
}
|
|
158
|
+
out.body = structuredClone(row.schema);
|
|
159
|
+
return out;
|
|
160
|
+
});
|
|
161
|
+
}
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ReadEventFilter } from '../core/event-filters.js';
|
|
|
3
3
|
import { Bindings } from '../core/bindings.js';
|
|
4
4
|
import type { BindingsView } from '../core/binding-messages.js';
|
|
5
5
|
import { type PreservedResourceWire } from './resource-wire.js';
|
|
6
|
+
import { type PreservedDocumentExtractionData } from './document-extraction-saved.js';
|
|
6
7
|
export type PreservedVariableLane = 'inputs' | 'outputs' | 'inputOutputs';
|
|
7
8
|
/**
|
|
8
9
|
* A preserved `inputs[]` / `outputs[]` slot id copied verbatim from its name is
|
|
@@ -339,6 +340,12 @@ export interface CaseJsonPreservation {
|
|
|
339
340
|
* fields), and the quick form's `inputSchema`. No builder call writes either.
|
|
340
341
|
*/
|
|
341
342
|
actionDataFields?: PreservedActionDataFields[];
|
|
343
|
+
/**
|
|
344
|
+
* Each older, flat document-extraction task's `data`, verbatim
|
|
345
|
+
* (case/document-extraction-saved.ts). Its source is `.savedDocumentExtraction()`,
|
|
346
|
+
* and compile writes this `data` back as saved.
|
|
347
|
+
*/
|
|
348
|
+
documentExtractionData?: PreservedDocumentExtractionData[];
|
|
342
349
|
/**
|
|
343
350
|
* How each subscription with an expression-valued filter spelled it, when not
|
|
344
351
|
* the way compile writes a new one (`CaseFilterSpelling` in
|
package/dist/case/preserve.js
CHANGED
|
@@ -2,6 +2,7 @@ import { stableId } from '../core/stable-id.js';
|
|
|
2
2
|
import { Bindings } from '../core/bindings.js';
|
|
3
3
|
import { bindingIdCandidates, offlineBindingLabel } from './ids.js';
|
|
4
4
|
import { resourceBindingSeed, resourceWireError } from './resource-wire.js';
|
|
5
|
+
import { preservedDocumentExtractionDataError } from './document-extraction-saved.js';
|
|
5
6
|
/**
|
|
6
7
|
* A preserved `inputs[]` / `outputs[]` slot id copied verbatim from its name is
|
|
7
8
|
* the STRICT_FORMAL_ARG_ID defect, not an identity to keep; the minted id stands.
|
|
@@ -320,6 +321,11 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
320
321
|
else if (TASK_KEYS.has(field))
|
|
321
322
|
errors.push(`task "${entry.task}" field "${field}" is owned by the typed Case serializer`);
|
|
322
323
|
}
|
|
324
|
+
for (const entry of payload.documentExtractionData ?? []) {
|
|
325
|
+
const error = preservedDocumentExtractionDataError(entry);
|
|
326
|
+
if (error)
|
|
327
|
+
errors.push(error);
|
|
328
|
+
}
|
|
323
329
|
for (const entry of payload.actionDataFields ?? []) {
|
|
324
330
|
if (!Number.isInteger(entry.lane) || entry.lane < 0)
|
|
325
331
|
errors.push(`preserved action data lane "${entry.lane}" is not a non-negative integer`);
|
package/dist/case/serialize.js
CHANGED
|
@@ -37,8 +37,10 @@ import { ruleShapeProblems } from './rule-options.js';
|
|
|
37
37
|
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
|
+
import { savedDocumentExtractionData } from './document-extraction-saved.js';
|
|
40
41
|
import { taskShapeProblems } from './task-shape.js';
|
|
41
42
|
import { SCRIPT_INPUTS, scriptOutputMappings, scriptOutputs, storedScript } from './script.js';
|
|
43
|
+
import { DOCUMENT_EXTRACTION_NAME, DOCUMENT_EXTRACTION_RESOURCE, DOCUMENT_EXTRACTION_SERVICE_TYPE, DOCUMENT_EXTRACTION_VERSION, documentExtractionContext, documentExtractionInputs, documentExtractionOutputMappings, documentExtractionOutputs, documentExtractionRefusal, } from './document-extraction.js';
|
|
42
44
|
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';
|
|
43
45
|
import { connectorPlaceholderData, isConnectorPlaceholder } from './connector-placeholder.js';
|
|
44
46
|
import { lowerTaskOutputRefs, planTaskOutputs, resolveInPlan, unresolvedTaskOutputRef } from './task-output-ref.js';
|
|
@@ -215,7 +217,9 @@ function serializeCase(built, opts) {
|
|
|
215
217
|
offlineBindingIds: new Map(),
|
|
216
218
|
varCompanions: new Map(),
|
|
217
219
|
ownNameRows: new Map(),
|
|
218
|
-
|
|
220
|
+
// A carried task's saved output rows keep their ids: no other row takes one.
|
|
221
|
+
outputIds: new Set(savedOutputIds(caseJsonPreservation(built)?.documentExtractionData)),
|
|
222
|
+
savedDocumentExtractions: caseJsonPreservation(built)?.documentExtractionData ?? [],
|
|
219
223
|
ownOutputVars: ownOutputVars(built),
|
|
220
224
|
caseVarNames: new Set([...built.vars.map((v) => v.name), ...mappedFixedOutputVars(built)]),
|
|
221
225
|
slaId: new Map(),
|
|
@@ -854,6 +858,7 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
854
858
|
// (preserve.ts `unreadBindings` / `readBindings` / `bindings`): a row the
|
|
855
859
|
// original read nowhere stays, as Studio Web keeps it; any other stays while
|
|
856
860
|
// something in the result still reads it, and goes with its last reader.
|
|
861
|
+
applySavedIxpBindings(result, preservation.readBindings);
|
|
857
862
|
const carried = [...(preservation.unreadBindings ?? []), ...(preservation.readBindings ?? []), ...(preservation.bindings ?? [])];
|
|
858
863
|
if (carried.length) {
|
|
859
864
|
const rows = (result.bindings ??= []);
|
|
@@ -868,6 +873,51 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
868
873
|
}
|
|
869
874
|
return result;
|
|
870
875
|
}
|
|
876
|
+
/**
|
|
877
|
+
* Point each document-extraction task back at the `ixpDeployment` row it was
|
|
878
|
+
* saved with. Compile mints one row per deployment and key (`bIxp<n>`); the
|
|
879
|
+
* source's row for that deployment and key travels in `readBindings`, and it
|
|
880
|
+
* is written back under its own id, `context.name` with it, so a decompile ->
|
|
881
|
+
* compile (and a merge) keeps the Designer's binding. A fresh row no task
|
|
882
|
+
* reads any more is dropped. The carried-row pass below then appends the
|
|
883
|
+
* saved row, which the task now reads.
|
|
884
|
+
*/
|
|
885
|
+
function applySavedIxpBindings(result, carried) {
|
|
886
|
+
const key = (row) => JSON.stringify([row.default, row.resourceKey ?? null]);
|
|
887
|
+
const saved = new Map();
|
|
888
|
+
for (const row of carried ?? [])
|
|
889
|
+
if (row.resource === DOCUMENT_EXTRACTION_RESOURCE && typeof row.id === 'string' && !saved.has(key(row)))
|
|
890
|
+
saved.set(key(row), row.id);
|
|
891
|
+
if (!saved.size)
|
|
892
|
+
return;
|
|
893
|
+
const rows = (result.bindings ?? []);
|
|
894
|
+
const written = new Set(rows.map((row) => row.id));
|
|
895
|
+
const renamed = new Map();
|
|
896
|
+
for (const row of rows) {
|
|
897
|
+
if (row.resource !== DOCUMENT_EXTRACTION_RESOURCE)
|
|
898
|
+
continue;
|
|
899
|
+
const id = saved.get(key(row));
|
|
900
|
+
if (id !== undefined && id !== row.id && !written.has(id))
|
|
901
|
+
renamed.set(row.id, id);
|
|
902
|
+
}
|
|
903
|
+
if (!renamed.size)
|
|
904
|
+
return;
|
|
905
|
+
for (const node of (result.nodes ?? [])) {
|
|
906
|
+
if (!String(node.type ?? '').endsWith('Stage'))
|
|
907
|
+
continue;
|
|
908
|
+
for (const task of (node.data?.tasks ?? []).flat()) {
|
|
909
|
+
if (task.type !== 'document-extraction')
|
|
910
|
+
continue;
|
|
911
|
+
for (const row of (task.data?.context ?? [])) {
|
|
912
|
+
const id = row.name === 'name' ? bindingRefId(row.value) : undefined;
|
|
913
|
+
if (id !== undefined && renamed.has(id))
|
|
914
|
+
row.value = `=bindings.${renamed.get(id)}`;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
const reads = readBindingIds(result);
|
|
919
|
+
result.bindings = rows.filter((row) => !renamed.has(row.id) || reads.has(row.id));
|
|
920
|
+
}
|
|
871
921
|
/**
|
|
872
922
|
* Write each decompiled resource task's saved `=bindings.<id>` pair back over
|
|
873
923
|
* the fresh one compile wrote (resource-wire.ts), while the task still names the
|
|
@@ -1113,6 +1163,7 @@ export function followRenames(result, preservation) {
|
|
|
1113
1163
|
...(preservation.connectorConfigurations ? { connectorConfigurations: preservation.connectorConfigurations.map(ref) } : {}),
|
|
1114
1164
|
...(preservation.httpRequestMetadata ? { httpRequestMetadata: preservation.httpRequestMetadata.map(ref) } : {}),
|
|
1115
1165
|
...(preservation.actionDataFields ? { actionDataFields: preservation.actionDataFields.map(ref) } : {}),
|
|
1166
|
+
...(preservation.documentExtractionData ? { documentExtractionData: preservation.documentExtractionData.map(ref) } : {}),
|
|
1116
1167
|
...(preservation.omitTaskElementIds ? { omitTaskElementIds: preservation.omitTaskElementIds.map(ref) } : {}),
|
|
1117
1168
|
...(preservation.omitStagePositions ? { omitStagePositions: preservation.omitStagePositions.map(stageName) } : {}),
|
|
1118
1169
|
...(preservation.stageDataFields ? { stageDataFields: preservation.stageDataFields.map((entry) => ({ ...entry, stage: stageName(entry.stage) })) } : {}),
|
|
@@ -1934,7 +1985,9 @@ function emitTask(task, stageLabel, taskId, ids, resolver) {
|
|
|
1934
1985
|
/** One task node (see {@link emitTask}). */
|
|
1935
1986
|
function emitTaskNode(task, stageLabel, stageId, taskId, type, ids, resolver) {
|
|
1936
1987
|
const node = { id: taskId, displayName: task.name, [CASE_FORMAT_PROFILE.nodeTypeField]: type };
|
|
1937
|
-
node.data =
|
|
1988
|
+
node.data = task.documentExtractionSaved
|
|
1989
|
+
? savedDocumentExtractionData(`Document extraction task "${task.name}"`, resolver.savedDocumentExtractions, stageLabel, task.name, (task.outputs?.length ?? 0) > 0)
|
|
1990
|
+
: taskData(task, resolver, taskId, stageId, ids);
|
|
1938
1991
|
// Every task carries `elementId: "<stageId>-<taskId>"`, the identity the
|
|
1939
1992
|
// converter matches a task's io rows against:
|
|
1940
1993
|
//
|
|
@@ -2065,6 +2118,9 @@ function taskData(task, resolver, taskId, stageId, ids) {
|
|
|
2065
2118
|
: {};
|
|
2066
2119
|
return withCustomOutputs(data, task, resolver);
|
|
2067
2120
|
}
|
|
2121
|
+
case 'document-extraction':
|
|
2122
|
+
// Only `{ assign }` rows are written beside the two: a mapped row is one of them.
|
|
2123
|
+
return withCustomOutputs(documentExtractionTaskData(task, resolver, `${stageId}-${taskId}`), { ...task, outputs: task.outputs?.filter((o) => o.custom) }, resolver);
|
|
2068
2124
|
case 'script':
|
|
2069
2125
|
// Only `{ assign }` rows are written beside the two: a mapped row is one of them.
|
|
2070
2126
|
return withCustomOutputs(scriptTaskData(task, resolver, `${stageId}-${taskId}`), { ...task, outputs: task.outputs?.filter((o) => o.custom) }, resolver);
|
|
@@ -2737,6 +2793,59 @@ function externalTaskData(kind, spec, resolver, elementId, where) {
|
|
|
2737
2793
|
context.push(io('activityConfigurationVersion', 'string', { value: 'v2' }));
|
|
2738
2794
|
return { ...data, serviceType: externalServiceType(kind, mode) };
|
|
2739
2795
|
}
|
|
2796
|
+
/**
|
|
2797
|
+
* A document-extraction task (`case/document-extraction.ts`): the Designer's
|
|
2798
|
+
* context naming the IXP deployment through one `ixpDeployment` name binding
|
|
2799
|
+
* per deployment and key (as convert writes it), the two inputs, and the two
|
|
2800
|
+
* outputs, claimed like any task output's and kept off the case's variables.
|
|
2801
|
+
*/
|
|
2802
|
+
function documentExtractionTaskData(task, resolver, elementId) {
|
|
2803
|
+
const where = `Document extraction task "${task.name}"`;
|
|
2804
|
+
const spec = task.documentExtraction;
|
|
2805
|
+
if (!spec)
|
|
2806
|
+
throw new Error(`internal SDK error: ${where} has no deployment.`);
|
|
2807
|
+
const refused = documentExtractionRefusal(where, spec);
|
|
2808
|
+
if (refused)
|
|
2809
|
+
throw new CompileRefusal(refused.code, refused.message, refused.suggestion);
|
|
2810
|
+
const mappings = documentExtractionOutputMappings(where, task.outputs);
|
|
2811
|
+
if (!(mappings instanceof Map))
|
|
2812
|
+
throw new CompileRefusal(mappings.code, mappings.message, mappings.suggestion);
|
|
2813
|
+
let nameRef = '';
|
|
2814
|
+
if (spec.deployment.trim() !== '') {
|
|
2815
|
+
const key = spec.deploymentKey;
|
|
2816
|
+
const rows = [...resolver.bindingSink.values()];
|
|
2817
|
+
const found = rows.find((row) => row.resource === DOCUMENT_EXTRACTION_RESOURCE && row.default === spec.deployment
|
|
2818
|
+
&& row.resourceKey === key);
|
|
2819
|
+
let id = found?.id;
|
|
2820
|
+
if (id === undefined) {
|
|
2821
|
+
const ordinal = rows.filter((row) => row.resource === DOCUMENT_EXTRACTION_RESOURCE).length + 1;
|
|
2822
|
+
id = `bIxp${ordinal}`;
|
|
2823
|
+
for (let n = ordinal + 1; resolver.bindingSink.has(id); n++)
|
|
2824
|
+
id = `bIxp${n}`;
|
|
2825
|
+
resolver.bindingSink.set(id, {
|
|
2826
|
+
id, name: 'name', type: 'string', resource: DOCUMENT_EXTRACTION_RESOURCE,
|
|
2827
|
+
resourceKey: key, default: spec.deployment, propertyAttribute: 'name',
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
nameRef = `=bindings.${id}`;
|
|
2831
|
+
}
|
|
2832
|
+
const claim = (base) => {
|
|
2833
|
+
let id = claimOutputId(resolver, base);
|
|
2834
|
+
while (resolver.caseVarNames.has(id))
|
|
2835
|
+
id = claimOutputId(resolver, base);
|
|
2836
|
+
return id;
|
|
2837
|
+
};
|
|
2838
|
+
registerMappedCompanions(resolver, mappings);
|
|
2839
|
+
return {
|
|
2840
|
+
name: DOCUMENT_EXTRACTION_NAME,
|
|
2841
|
+
serviceType: DOCUMENT_EXTRACTION_SERVICE_TYPE,
|
|
2842
|
+
context: documentExtractionContext(spec, nameRef),
|
|
2843
|
+
// The `v` ids follow `ioSlot`, every connector task's.
|
|
2844
|
+
inputs: documentExtractionInputs(spec, elementId, (name) => `v${name}`),
|
|
2845
|
+
outputs: documentExtractionOutputs(elementId, claim, mappings),
|
|
2846
|
+
version: DOCUMENT_EXTRACTION_VERSION,
|
|
2847
|
+
};
|
|
2848
|
+
}
|
|
2740
2849
|
/**
|
|
2741
2850
|
* A script task (`case/script.ts`): the body behind the Designer's leading `=`,
|
|
2742
2851
|
* its two inputs, and its two outputs, each claimed like any task output's and
|
|
@@ -3145,12 +3254,19 @@ function isOwnNameOutput(o) {
|
|
|
3145
3254
|
const field = o.source.replace(/^=/, '').split('.').pop() ?? '';
|
|
3146
3255
|
return keepsOwnName(o.var, field);
|
|
3147
3256
|
}
|
|
3257
|
+
/** The ids of the carried document-extraction tasks' saved output rows. */
|
|
3258
|
+
function savedOutputIds(entries) {
|
|
3259
|
+
return (entries ?? []).flatMap((entry) => (Array.isArray(entry.data.outputs) ? entry.data.outputs : [])
|
|
3260
|
+
.map((row) => row?.id).filter((id) => typeof id === 'string'));
|
|
3261
|
+
}
|
|
3148
3262
|
/**
|
|
3149
3263
|
* The task kinds whose output rows are fixed (the task writes its own rows and
|
|
3150
3264
|
* a `.outputs()` mapping reassigns one to a case variable), so a mapped
|
|
3151
|
-
* variable must be reserved before any row id is claimed.
|
|
3265
|
+
* variable must be reserved before any row id is claimed. A document
|
|
3266
|
+
* extraction carried in the older shape (`.savedDocumentExtraction()`) maps
|
|
3267
|
+
* none: its saved rows are reserved by id instead (`savedOutputIds`).
|
|
3152
3268
|
*/
|
|
3153
|
-
const FIXED_OUTPUT_KINDS = new Set(['http-request', 'script']);
|
|
3269
|
+
const FIXED_OUTPUT_KINDS = new Set(['document-extraction', 'http-request', 'script']);
|
|
3154
3270
|
/**
|
|
3155
3271
|
* The case variables a fixed-output task's `.outputs()` maps, declared or not.
|
|
3156
3272
|
* Collected before any task is emitted, so no task's own output row takes one
|
|
@@ -3163,7 +3279,7 @@ function mappedFixedOutputVars(built) {
|
|
|
3163
3279
|
for (const stage of built.stages)
|
|
3164
3280
|
for (const lane of stage.lanes)
|
|
3165
3281
|
for (const task of lane)
|
|
3166
|
-
if (FIXED_OUTPUT_KINDS.has(task.kind))
|
|
3282
|
+
if (FIXED_OUTPUT_KINDS.has(task.kind) && !task.documentExtractionSaved)
|
|
3167
3283
|
for (const o of task.outputs ?? [])
|
|
3168
3284
|
if (!o.custom)
|
|
3169
3285
|
vars.add(o.var);
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -160,6 +160,15 @@ 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 DOCUMENT_EXTRACTION_NO_MODEL: "lint";
|
|
164
|
+
readonly DOCUMENT_EXTRACTION_NO_DEPLOYMENT: "lint";
|
|
165
|
+
readonly DOCUMENT_EXTRACTION_NO_FOLDER_KEY: "lint";
|
|
166
|
+
readonly DOCUMENT_EXTRACTION_NO_FOLDER: "lint";
|
|
167
|
+
readonly DOCUMENT_EXTRACTION_NO_DEPLOYMENT_KEY: "lowering";
|
|
168
|
+
readonly DOCUMENT_EXTRACTION_NO_FILE: "lint";
|
|
169
|
+
readonly DOCUMENT_EXTRACTION_OUTPUT: "lowering";
|
|
170
|
+
readonly DOCUMENT_EXTRACTION_OLDER_SHAPE: "lint";
|
|
171
|
+
readonly DOCUMENT_EXTRACTION_SAVED_DATA: "lowering";
|
|
163
172
|
readonly SCRIPT_BODY_SYNTAX: "lint";
|
|
164
173
|
readonly SCRIPT_OUTPUT: "lowering";
|
|
165
174
|
readonly HTTP_REQUEST_CONNECTOR: "lowering";
|
package/dist/core/refusals.js
CHANGED
|
@@ -209,6 +209,23 @@ 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 document-extraction task (case/document-extraction.ts). A missing
|
|
213
|
+
// model, folder key or file is written as authored (`lint`). A missing
|
|
214
|
+
// deployment key leaves the binding no resourceKey, which the platform
|
|
215
|
+
// rejects and decompile cannot read back, and an output other than the two
|
|
216
|
+
// has no row (`lowering`).
|
|
217
|
+
DOCUMENT_EXTRACTION_NO_MODEL: 'lint',
|
|
218
|
+
DOCUMENT_EXTRACTION_NO_DEPLOYMENT: 'lint',
|
|
219
|
+
DOCUMENT_EXTRACTION_NO_FOLDER_KEY: 'lint',
|
|
220
|
+
DOCUMENT_EXTRACTION_NO_FOLDER: 'lint',
|
|
221
|
+
DOCUMENT_EXTRACTION_NO_DEPLOYMENT_KEY: 'lowering',
|
|
222
|
+
DOCUMENT_EXTRACTION_NO_FILE: 'lint',
|
|
223
|
+
DOCUMENT_EXTRACTION_OUTPUT: 'lowering',
|
|
224
|
+
// The older, flat shape, carried as saved (case/document-extraction-saved.ts):
|
|
225
|
+
// check warns it is not editable (`lint`); compile refuses a carried task with
|
|
226
|
+
// no saved data, or with outputs it cannot add to the saved rows (`lowering`).
|
|
227
|
+
DOCUMENT_EXTRACTION_OLDER_SHAPE: 'lint',
|
|
228
|
+
DOCUMENT_EXTRACTION_SAVED_DATA: 'lowering',
|
|
212
229
|
// Case script task (case/script.ts). A string body that does not parse is
|
|
213
230
|
// written as authored (`lint`); an output other than the two has no row to
|
|
214
231
|
// write it to (`lowering`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.82.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": "
|
|
106
|
+
"gitref": "5cd8813ad867cef849279dd05ad8b216a618d147"
|
|
107
107
|
}
|