@uipath/ui-widgets-validation-station 1.1.0 → 1.3.0-rc.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/README.md +361 -202
- package/dist/ValidationStation.d.ts +5 -2
- package/dist/ValidationStation.d.ts.map +1 -1
- package/dist/ValidationStation.js +10 -4
- package/dist/ValidationStation.js.map +1 -1
- package/dist/ValidationStation.stories.d.ts.map +1 -1
- package/dist/ValidationStation.stories.js +3 -2
- package/dist/ValidationStation.stories.js.map +1 -1
- package/dist/bucketArtifactsUtil.d.ts.map +1 -1
- package/dist/bucketArtifactsUtil.js +28 -12
- package/dist/bucketArtifactsUtil.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/ixpUtil.d.ts +6 -0
- package/dist/ixpUtil.d.ts.map +1 -0
- package/dist/ixpUtil.js +9 -0
- package/dist/ixpUtil.js.map +1 -0
- package/dist/loadValidationStationWc.d.ts +3 -1
- package/dist/loadValidationStationWc.d.ts.map +1 -1
- package/dist/loadValidationStationWc.js +1 -15
- package/dist/loadValidationStationWc.js.map +1 -1
- package/dist/payloadSource.d.ts +19 -0
- package/dist/payloadSource.d.ts.map +1 -0
- package/dist/payloadSource.js +12 -0
- package/dist/payloadSource.js.map +1 -0
- package/dist/processedDocument/artifacts.d.ts +15 -0
- package/dist/processedDocument/artifacts.d.ts.map +1 -0
- package/dist/processedDocument/artifacts.js +86 -0
- package/dist/processedDocument/artifacts.js.map +1 -0
- package/dist/processedDocument/dom.d.ts +7 -0
- package/dist/processedDocument/dom.d.ts.map +1 -0
- package/dist/processedDocument/dom.js +43 -0
- package/dist/processedDocument/dom.js.map +1 -0
- package/dist/processedDocument/errors.d.ts +20 -0
- package/dist/processedDocument/errors.d.ts.map +1 -0
- package/dist/processedDocument/errors.js +27 -0
- package/dist/processedDocument/errors.js.map +1 -0
- package/dist/processedDocument/payload.d.ts +14 -0
- package/dist/processedDocument/payload.d.ts.map +1 -0
- package/dist/processedDocument/payload.js +34 -0
- package/dist/processedDocument/payload.js.map +1 -0
- package/dist/processedDocument/platformClient.d.ts +22 -0
- package/dist/processedDocument/platformClient.d.ts.map +1 -0
- package/dist/processedDocument/platformClient.js +131 -0
- package/dist/processedDocument/platformClient.js.map +1 -0
- package/dist/processedDocument/review.d.ts +20 -0
- package/dist/processedDocument/review.d.ts.map +1 -0
- package/dist/processedDocument/review.js +28 -0
- package/dist/processedDocument/review.js.map +1 -0
- package/dist/processedDocument/save.d.ts +22 -0
- package/dist/processedDocument/save.d.ts.map +1 -0
- package/dist/processedDocument/save.js +73 -0
- package/dist/processedDocument/save.js.map +1 -0
- package/dist/processedDocument/spans.d.ts +4 -0
- package/dist/processedDocument/spans.d.ts.map +1 -0
- package/dist/processedDocument/spans.js +65 -0
- package/dist/processedDocument/spans.js.map +1 -0
- package/dist/processedDocument/types.d.ts +45 -0
- package/dist/processedDocument/types.d.ts.map +1 -0
- package/dist/processedDocument/types.js +2 -0
- package/dist/processedDocument/types.js.map +1 -0
- package/dist/saveHandlers.d.ts +3 -1
- package/dist/saveHandlers.d.ts.map +1 -1
- package/dist/saveHandlers.js +40 -11
- package/dist/saveHandlers.js.map +1 -1
- package/dist/saveValidatedDataUtil.d.ts.map +1 -1
- package/dist/saveValidatedDataUtil.js +9 -0
- package/dist/saveValidatedDataUtil.js.map +1 -1
- package/dist/subcomponents/CompactBusinessRules.d.ts.map +1 -1
- package/dist/subcomponents/CompactBusinessRules.js +2 -1
- package/dist/subcomponents/CompactBusinessRules.js.map +1 -1
- package/dist/subcomponents/CompactFieldsForm.d.ts.map +1 -1
- package/dist/subcomponents/CompactFieldsForm.js +4 -2
- package/dist/subcomponents/CompactFieldsForm.js.map +1 -1
- package/dist/subcomponents/CompactTableEditor.d.ts.map +1 -1
- package/dist/subcomponents/CompactTableEditor.js +4 -2
- package/dist/subcomponents/CompactTableEditor.js.map +1 -1
- package/dist/subcomponents/shared.d.ts +4 -4
- package/dist/subcomponents/shared.d.ts.map +1 -1
- package/dist/subcomponents/shared.js.map +1 -1
- package/dist/subcomponents/useWcElement.d.ts +2 -2
- package/dist/subcomponents/useWcElement.d.ts.map +1 -1
- package/dist/subcomponents/useWcElement.js +1 -1
- package/dist/subcomponents/useWcElement.js.map +1 -1
- package/dist/types.d.ts +62 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/useResolvedArtifacts.d.ts +26 -7
- package/dist/useResolvedArtifacts.d.ts.map +1 -1
- package/dist/useResolvedArtifacts.js +42 -29
- package/dist/useResolvedArtifacts.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A direct platform call that failed. The message is fixed text — the
|
|
3
|
+
* operation and the status — because a failed load's message is sent to
|
|
4
|
+
* telemetry: no URL (trace, span and folder ids, document paths) and none of
|
|
5
|
+
* the service's response. That stays on `detail`, bounded, for the host.
|
|
6
|
+
*/
|
|
7
|
+
export class PlatformCallError extends Error {
|
|
8
|
+
constructor(operation, status,
|
|
9
|
+
/** The start of the service's response; never sent to telemetry. */
|
|
10
|
+
detail) {
|
|
11
|
+
super(`${operation} failed with status ${status}`);
|
|
12
|
+
this.status = status;
|
|
13
|
+
this.detail = detail;
|
|
14
|
+
this.name = "PlatformCallError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The error as a host-facing result reports it: the message, plus the
|
|
19
|
+
* service's detail when there is one. Not for telemetry.
|
|
20
|
+
*/
|
|
21
|
+
export function describeForHost(error) {
|
|
22
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
23
|
+
return error instanceof PlatformCallError && error.detail
|
|
24
|
+
? `${message}: ${error.detail}`
|
|
25
|
+
: message;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/processedDocument/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YACE,SAAiB,EACR,MAAc;IACvB,oEAAoE;IAC3D,MAAc;QAEvB,KAAK,CAAC,GAAG,SAAS,uBAAuB,MAAM,EAAE,CAAC,CAAC;QAJ1C,WAAM,GAAN,MAAM,CAAQ;QAEd,WAAM,GAAN,MAAM,CAAQ;QAGvB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,KAAK,YAAY,iBAAiB,IAAI,KAAK,CAAC,MAAM;QACvD,CAAC,CAAC,GAAG,OAAO,KAAK,KAAK,CAAC,MAAM,EAAE;QAC/B,CAAC,CAAC,OAAO,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IXPExtraction, IXPTaxonomy } from "@uipath/du-validation-station-wc";
|
|
2
|
+
import type { FeedbackAnchor, ProcessedDocument } from "./types.js";
|
|
3
|
+
export declare function refuse(reason: string): never;
|
|
4
|
+
export interface ValidatedProcessedDocument {
|
|
5
|
+
taxonomy: IXPTaxonomy;
|
|
6
|
+
extraction: IXPExtraction;
|
|
7
|
+
anchor: FeedbackAnchor;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Refuses a payload it cannot render: the artifacts are unreachable without
|
|
11
|
+
* `traceId` and `folderKey`, and a review cannot be recorded without `spanId`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateProcessedDocument(processedDocument: ProcessedDocument): ValidatedProcessedDocument;
|
|
14
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/processedDocument/payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAE5C;AAKD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,iBAAiB,EAAE,iBAAiB,GACnC,0BAA0B,CAqB5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isIXPExtraction, isIXPTaxonomy } from "../ixpUtil.js";
|
|
2
|
+
export function refuse(reason) {
|
|
3
|
+
throw new Error(`Cannot validate this ProcessedDocument: ${reason}.`);
|
|
4
|
+
}
|
|
5
|
+
const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
6
|
+
/**
|
|
7
|
+
* Refuses a payload it cannot render: the artifacts are unreachable without
|
|
8
|
+
* `traceId` and `folderKey`, and a review cannot be recorded without `spanId`.
|
|
9
|
+
*/
|
|
10
|
+
export function validateProcessedDocument(processedDocument) {
|
|
11
|
+
const { type, taxonomy, result, metadata } = processedDocument;
|
|
12
|
+
if (type !== "Extraction") {
|
|
13
|
+
refuse("type is not Extraction");
|
|
14
|
+
}
|
|
15
|
+
if (!isIXPTaxonomy(taxonomy)) {
|
|
16
|
+
refuse("taxonomy declares neither properties nor $defs");
|
|
17
|
+
}
|
|
18
|
+
if (!isIXPExtraction(result)) {
|
|
19
|
+
refuse("result declares neither output nor attribution");
|
|
20
|
+
}
|
|
21
|
+
const { traceId, spanId, folderKey } = metadata ?? {};
|
|
22
|
+
if (!isNonEmptyString(traceId))
|
|
23
|
+
refuse("metadata.traceId is empty");
|
|
24
|
+
if (!isNonEmptyString(spanId))
|
|
25
|
+
refuse("metadata.spanId is empty");
|
|
26
|
+
if (!isNonEmptyString(folderKey))
|
|
27
|
+
refuse("metadata.folderKey is empty");
|
|
28
|
+
return {
|
|
29
|
+
taxonomy,
|
|
30
|
+
extraction: result,
|
|
31
|
+
anchor: { traceId, spanId, folderKey },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../src/processedDocument/payload.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG/D,MAAM,UAAU,MAAM,CAAC,MAAc;IACnC,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,GAAG,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAmB,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAQhD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,iBAAoC;IAEpC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAC;IAC/D,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC1B,MAAM,CAAC,wBAAwB,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,gDAAgD,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,gDAAgD,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAC;IACtD,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;QAAE,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACpE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAAE,MAAM,CAAC,0BAA0B,CAAC,CAAC;IAClE,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC;QAAE,MAAM,CAAC,6BAA6B,CAAC,CAAC;IAExE,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
2
|
+
import type { ArtifactRef, FeedbackAnchor, FeedbackRecord, FeedbackWrite, TraceSpan } from "./types.js";
|
|
3
|
+
/** The trace a call is about, and the folder it is authorized in. */
|
|
4
|
+
type CallScope = Pick<FeedbackAnchor, "traceId" | "folderKey">;
|
|
5
|
+
export type PlatformClient = ReturnType<typeof createPlatformClient>;
|
|
6
|
+
/**
|
|
7
|
+
* The Traces, ECS and Feedback calls a `ProcessedDocument` needs, all on public
|
|
8
|
+
* routes, so they work with an external-app token (e.g. a coded action app's).
|
|
9
|
+
* Spans come through the SDK's Traces service. The ECS and Feedback calls are
|
|
10
|
+
* made directly with the SDK's token: the SDK has no ECS bucket service, and
|
|
11
|
+
* its Feedback service cannot set the `feedbackType` a review needs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createPlatformClient(sdk: UiPath): {
|
|
14
|
+
getSpans: (traceId: string) => Promise<TraceSpan[]>;
|
|
15
|
+
getEcsReadUri: (ref: ArtifactRef, scope: CallScope) => Promise<string>;
|
|
16
|
+
readBytes: (uri: string) => Promise<ArrayBuffer>;
|
|
17
|
+
findFeedback: (anchor: FeedbackAnchor) => Promise<FeedbackRecord | null>;
|
|
18
|
+
createFeedback: (anchor: FeedbackAnchor, write: FeedbackWrite) => Promise<string>;
|
|
19
|
+
editFeedback: (anchor: FeedbackAnchor, id: string, write: FeedbackWrite) => Promise<string>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=platformClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platformClient.d.ts","sourceRoot":"","sources":["../../src/processedDocument/platformClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAI7D,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACV,MAAM,YAAY,CAAC;AAOpB,qEAAqE;AACrE,KAAK,SAAS,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;AAmC/D,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM;wBAsElB,MAAM,KAAG,OAAO,CAAC,SAAS,EAAE,CAAC;yBAWhD,WAAW,SACT,SAAS,KACf,OAAO,CAAC,MAAM,CAAC;qBAeK,MAAM,KAAG,OAAO,CAAC,WAAW,CAAC;2BAW1C,cAAc,KACrB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;6BAmBvB,cAAc,SACf,aAAa,KACnB,OAAO,CAAC,MAAM,CAAC;2BAeR,cAAc,MAClB,MAAM,SACH,aAAa,KACnB,OAAO,CAAC,MAAM,CAAC;EAarB"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Traces } from "@uipath/uipath-typescript/traces";
|
|
2
|
+
import { joinDeploymentUrl } from "../urlUtil.js";
|
|
3
|
+
import { PlatformCallError } from "./errors.js";
|
|
4
|
+
const FOLDER_KEY_HEADER = "x-uipath-folderkey";
|
|
5
|
+
const LLM_OPS_SERVICE = "llmopstenant_";
|
|
6
|
+
const ECS_SERVICE = "ecs_";
|
|
7
|
+
const IDP_EXTRACTION_FEEDBACK_TYPE = "idpExtraction";
|
|
8
|
+
// Newest by timestamp rather than by position: the list's order is not part of the contract.
|
|
9
|
+
const newest = (records) => records.reduce((latest, record) => !latest || Date.parse(record.createdAt) > Date.parse(latest.createdAt)
|
|
10
|
+
? record
|
|
11
|
+
: latest, undefined);
|
|
12
|
+
// Ids from service responses go into URL paths, where encoding alone would
|
|
13
|
+
// still let a bare `..` segment through.
|
|
14
|
+
const pathSegment = (value, what) => {
|
|
15
|
+
if (!/^[A-Za-z0-9_-]+$/.test(value)) {
|
|
16
|
+
// Not the value itself: a failed load's message goes to telemetry.
|
|
17
|
+
throw new Error(`Refusing an unexpected ${what}`);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
const feedbackBody = (write) => ({
|
|
22
|
+
feedbackType: IDP_EXTRACTION_FEEDBACK_TYPE,
|
|
23
|
+
isPositive: write.isPositive,
|
|
24
|
+
metadata: write.metadata ?? null,
|
|
25
|
+
comment: write.comment ?? null,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* The Traces, ECS and Feedback calls a `ProcessedDocument` needs, all on public
|
|
29
|
+
* routes, so they work with an external-app token (e.g. a coded action app's).
|
|
30
|
+
* Spans come through the SDK's Traces service. The ECS and Feedback calls are
|
|
31
|
+
* made directly with the SDK's token: the SDK has no ECS bucket service, and
|
|
32
|
+
* its Feedback service cannot set the `feedbackType` a review needs.
|
|
33
|
+
*/
|
|
34
|
+
export function createPlatformClient(sdk) {
|
|
35
|
+
const serviceUrl = (service, endpoint) => {
|
|
36
|
+
const { baseUrl, orgName, tenantName } = sdk.config;
|
|
37
|
+
return [orgName, tenantName, service, endpoint].reduce(joinDeploymentUrl, baseUrl);
|
|
38
|
+
};
|
|
39
|
+
// A host-delegated token (e.g. Action Center's) is only fetched, and
|
|
40
|
+
// refreshed, by the SDK's own service calls: `getToken()` is undefined before
|
|
41
|
+
// the first one and again once the token expires. A one-span read of the
|
|
42
|
+
// trace is the cheapest such call the Flow path is already scoped for.
|
|
43
|
+
// Replace with an async token getter if the SDK exposes one.
|
|
44
|
+
const ensureToken = async (traceId) => {
|
|
45
|
+
const loaded = sdk.getToken();
|
|
46
|
+
if (loaded)
|
|
47
|
+
return loaded;
|
|
48
|
+
await new Traces(sdk).getById(traceId, { pageSize: 1 });
|
|
49
|
+
const fetched = sdk.getToken();
|
|
50
|
+
if (!fetched) {
|
|
51
|
+
throw new Error("The SDK is not authenticated.");
|
|
52
|
+
}
|
|
53
|
+
return fetched;
|
|
54
|
+
};
|
|
55
|
+
const send = async (operation, url, scope, init = {}) => {
|
|
56
|
+
const token = await ensureToken(scope.traceId);
|
|
57
|
+
const method = init.method ?? "GET";
|
|
58
|
+
const response = await fetch(url, {
|
|
59
|
+
method,
|
|
60
|
+
headers: {
|
|
61
|
+
Authorization: `Bearer ${token}`,
|
|
62
|
+
[FOLDER_KEY_HEADER]: scope.folderKey,
|
|
63
|
+
...(init.body === undefined
|
|
64
|
+
? {}
|
|
65
|
+
: { "Content-Type": "application/json" }),
|
|
66
|
+
},
|
|
67
|
+
body: init.body === undefined ? undefined : JSON.stringify(init.body),
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
// The service's message tells a rejected payload apart from a missing
|
|
71
|
+
// permission; it travels on `detail`, short, and never in the message.
|
|
72
|
+
const detail = (await response.text().catch(() => "")).slice(0, 300);
|
|
73
|
+
throw new PlatformCallError(operation, response.status, detail);
|
|
74
|
+
}
|
|
75
|
+
return response;
|
|
76
|
+
};
|
|
77
|
+
const getJson = async (operation, url, scope) => (await send(operation, url, scope)).json();
|
|
78
|
+
const postJson = async (operation, url, scope, body) => (await send(operation, url, scope, { method: "POST", body })).json();
|
|
79
|
+
return {
|
|
80
|
+
getSpans: async (traceId) => (await new Traces(sdk).getById(traceId)).map((span) => ({
|
|
81
|
+
id: span.id,
|
|
82
|
+
spanType: span.spanType,
|
|
83
|
+
attributes: span.attributes,
|
|
84
|
+
attachments: span.attachments?.map((a) => ({ id: a.id, fileName: a.fileName })) ??
|
|
85
|
+
null,
|
|
86
|
+
})),
|
|
87
|
+
getEcsReadUri: async (ref, scope) => {
|
|
88
|
+
// An OData string literal: `'` doubles, then the path's own slashes are
|
|
89
|
+
// encoded so they do not read as further route segments.
|
|
90
|
+
const path = encodeURIComponent(ref.fileName.replace(/'/g, "''"));
|
|
91
|
+
const bucketId = pathSegment(ref.bucketId, "bucket id");
|
|
92
|
+
const endpoint = `v2.0/Buckets/${bucketId}/GetReadUri(path='${path}')`;
|
|
93
|
+
const { uri } = await getJson("Reading an artifact's link", serviceUrl(ECS_SERVICE, endpoint), scope);
|
|
94
|
+
return uri;
|
|
95
|
+
},
|
|
96
|
+
// Pre-signed: no token goes to the storage host.
|
|
97
|
+
readBytes: async (uri) => {
|
|
98
|
+
const response = await fetch(uri);
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
throw new Error(`Reading an artifact failed with status ${response.status}`);
|
|
101
|
+
}
|
|
102
|
+
return response.arrayBuffer();
|
|
103
|
+
},
|
|
104
|
+
findFeedback: async (anchor) => {
|
|
105
|
+
const params = new URLSearchParams({
|
|
106
|
+
traceId: anchor.traceId,
|
|
107
|
+
spanId: anchor.spanId,
|
|
108
|
+
folderKey: anchor.folderKey,
|
|
109
|
+
feedbackType: IDP_EXTRACTION_FEEDBACK_TYPE,
|
|
110
|
+
});
|
|
111
|
+
const records = await getJson("Looking up the saved review", `${serviceUrl(LLM_OPS_SERVICE, "api/Feedback")}?${params}`, anchor);
|
|
112
|
+
const record = newest(records);
|
|
113
|
+
return record
|
|
114
|
+
? { id: record.id, metadata: record.metadata ?? undefined }
|
|
115
|
+
: null;
|
|
116
|
+
},
|
|
117
|
+
createFeedback: async (anchor, write) => {
|
|
118
|
+
const { id } = await postJson("Creating the review", serviceUrl(LLM_OPS_SERVICE, "api/Feedback"), anchor, {
|
|
119
|
+
traceId: anchor.traceId,
|
|
120
|
+
spanId: anchor.spanId,
|
|
121
|
+
...feedbackBody(write),
|
|
122
|
+
});
|
|
123
|
+
return id;
|
|
124
|
+
},
|
|
125
|
+
editFeedback: async (anchor, id, write) => {
|
|
126
|
+
const response = await postJson("Editing the review", serviceUrl(LLM_OPS_SERVICE, `api/Feedback/${pathSegment(id, "feedback id")}`), anchor, feedbackBody(write));
|
|
127
|
+
return response.id;
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=platformClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platformClient.js","sourceRoot":"","sources":["../../src/processedDocument/platformClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAShD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,MAAM,eAAe,GAAG,eAAe,CAAC;AACxC,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAWrD,6FAA6F;AAC7F,MAAM,MAAM,GAAG,CAAC,OAA2B,EAAgC,EAAE,CAC3E,OAAO,CAAC,MAAM,CACZ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CACjB,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IACpE,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,MAAM,EACZ,SAAS,CACV,CAAC;AAEJ,2EAA2E;AAC3E,yCAAyC;AACzC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,IAAY,EAAU,EAAE;IAC1D,IAAI,CAAC,kBAA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AAC,EAC3C,MAAM,EACN;gBACE,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,GAAG,YAAY,CAAC,KAAK,CAAC;aACvB,CACF,CAAC;YACF,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,YAAY,EAAE,KAAK,EACjB,MAAsB,EACtB,EAAU,EACV,KAAoB,EACH,EAAE;YACnB,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAC7B,oBAAoB,EACpB,UAAU,CACR,eAAe,EACf,gBAAgB,WAAW,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,CACjD,EACD,MAAM,EACN,YAAY,CAAC,KAAK,CAAC,CACpB,CAAC;YACF,OAAO,QAAQ,CAAC,EAAE,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IXPExtraction } from "@uipath/du-validation-station-wc";
|
|
2
|
+
/**
|
|
3
|
+
* What a review's Feedback record holds as `metadata`, serialized — the shape
|
|
4
|
+
* the Angular Validation Station writes (`ValidatedFlowExtraction`), so either
|
|
5
|
+
* reopens a review the other saved. `draft` tells a saved draft from a
|
|
6
|
+
* submitted result; both reopen on `extraction`.
|
|
7
|
+
*/
|
|
8
|
+
export interface RecordedReview {
|
|
9
|
+
draft: boolean;
|
|
10
|
+
extraction: IXPExtraction;
|
|
11
|
+
}
|
|
12
|
+
/** Serializes a review of `validatedData`, which must be an IXP extraction. */
|
|
13
|
+
export declare function serializeReview(validatedData: unknown, draft: boolean): string;
|
|
14
|
+
/**
|
|
15
|
+
* The extraction a review's record holds, draft or submitted, or `null` when
|
|
16
|
+
* the metadata is not a {@link RecordedReview} — the document then opens on the
|
|
17
|
+
* payload's result, as the Angular Validation Station does.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseReview(metadata: string): IXPExtraction | null;
|
|
20
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/processedDocument/review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGtE;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,aAAa,CAAC;CAC3B;AAQD,+EAA+E;AAC/E,wBAAgB,eAAe,CAC7B,aAAa,EAAE,OAAO,EACtB,KAAK,EAAE,OAAO,GACb,MAAM,CAQR;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAOlE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isIXPExtraction } from "../ixpUtil.js";
|
|
2
|
+
const isRecordedReview = (value) => !!value &&
|
|
3
|
+
typeof value === "object" &&
|
|
4
|
+
typeof value.draft === "boolean" &&
|
|
5
|
+
isIXPExtraction(value.extraction);
|
|
6
|
+
/** Serializes a review of `validatedData`, which must be an IXP extraction. */
|
|
7
|
+
export function serializeReview(validatedData, draft) {
|
|
8
|
+
if (!isIXPExtraction(validatedData)) {
|
|
9
|
+
throw new Error("validatedData is not an IXP extraction, so it cannot be recorded against a ProcessedDocument.");
|
|
10
|
+
}
|
|
11
|
+
const review = { draft, extraction: validatedData };
|
|
12
|
+
return JSON.stringify(review);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The extraction a review's record holds, draft or submitted, or `null` when
|
|
16
|
+
* the metadata is not a {@link RecordedReview} — the document then opens on the
|
|
17
|
+
* payload's result, as the Angular Validation Station does.
|
|
18
|
+
*/
|
|
19
|
+
export function parseReview(metadata) {
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(metadata);
|
|
22
|
+
return isRecordedReview(parsed) ? parsed.extraction : null;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/processedDocument/review.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAahD,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAA2B,EAAE,CACnE,CAAC,CAAC,KAAK;IACP,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAQ,KAA6B,CAAC,KAAK,KAAK,SAAS;IACzD,eAAe,CAAE,KAAkC,CAAC,UAAU,CAAC,CAAC;AAElE,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAC7B,aAAsB,EACtB,KAAc;IAEd,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,+FAA+F,CAChG,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAmB,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;IACpE,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest } from "@uipath/du-validation-station-wc";
|
|
2
|
+
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
3
|
+
import type { SaveValidatedDataResult } from "../saveValidatedDataUtil.js";
|
|
4
|
+
import type { ProcessedDocument } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Records a submitted {@link ProcessedDocument} review. The downstream Flow
|
|
7
|
+
* node reads the result from the task completion, so complete the task with
|
|
8
|
+
* `request.validatedData` whatever the outcome.
|
|
9
|
+
*/
|
|
10
|
+
export declare function submitProcessedDocument(sdk: UiPath, processedDocument: ProcessedDocument, request: IVsSaveValidatedDataRequest): Promise<SaveValidatedDataResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Saves a draft of a {@link ProcessedDocument} review; the next load opens on
|
|
13
|
+
* it. Writes the same record as a submit, flagged `draft` — what makes a
|
|
14
|
+
* submit final is the host completing the task.
|
|
15
|
+
*/
|
|
16
|
+
export declare function saveProcessedDocumentAsDraft(sdk: UiPath, processedDocument: ProcessedDocument, request: IVsSaveValidatedDataAsDraftRequest): Promise<SaveValidatedDataResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Records a {@link ProcessedDocument} rejected as an exception, replacing any
|
|
19
|
+
* saved draft. As with a submit, completing the task is yours.
|
|
20
|
+
*/
|
|
21
|
+
export declare function reportProcessedDocumentException(sdk: UiPath, processedDocument: ProcessedDocument, request: IVsSaveExceptionReportRequest): Promise<SaveValidatedDataResult>;
|
|
22
|
+
//# sourceMappingURL=save.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../src/processedDocument/save.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAK3E,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAyCnE;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC,CAKlC;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,uBAAuB,CAAC,CAKlC;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,uBAAuB,CAAC,CAQlC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describeForHost } from "./errors.js";
|
|
2
|
+
import { validateProcessedDocument } from "./payload.js";
|
|
3
|
+
import { createPlatformClient } from "./platformClient.js";
|
|
4
|
+
import { serializeReview } from "./review.js";
|
|
5
|
+
// Saves for one span run one at a time: find-then-create is not atomic, so two
|
|
6
|
+
// quick saves would otherwise both find no record and both create one.
|
|
7
|
+
const savesBySpan = new Map();
|
|
8
|
+
function oneAtATime(key, task) {
|
|
9
|
+
const next = (savesBySpan.get(key) ?? Promise.resolve()).then(task, task);
|
|
10
|
+
savesBySpan.set(key, next);
|
|
11
|
+
const release = () => {
|
|
12
|
+
if (savesBySpan.get(key) === next)
|
|
13
|
+
savesBySpan.delete(key);
|
|
14
|
+
};
|
|
15
|
+
next.then(release, release);
|
|
16
|
+
return next;
|
|
17
|
+
}
|
|
18
|
+
// Edits the span's newest record, or creates one, so the widget and a host
|
|
19
|
+
// saving outside it always land on the record the next load reopens.
|
|
20
|
+
async function recordReview(sdk, processedDocument, write) {
|
|
21
|
+
try {
|
|
22
|
+
const { anchor } = validateProcessedDocument(processedDocument);
|
|
23
|
+
const body = write();
|
|
24
|
+
const client = createPlatformClient(sdk);
|
|
25
|
+
await oneAtATime(`${anchor.traceId}/${anchor.spanId}`, async () => {
|
|
26
|
+
const existing = await client.findFeedback(anchor);
|
|
27
|
+
await (existing
|
|
28
|
+
? client.editFeedback(anchor, existing.id, body)
|
|
29
|
+
: client.createFeedback(anchor, body));
|
|
30
|
+
});
|
|
31
|
+
return { success: true };
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
// The result goes to the host's callbacks, not telemetry, so it may carry
|
|
35
|
+
// the service's detail.
|
|
36
|
+
return { success: false, error: describeForHost(error) };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Records a submitted {@link ProcessedDocument} review. The downstream Flow
|
|
41
|
+
* node reads the result from the task completion, so complete the task with
|
|
42
|
+
* `request.validatedData` whatever the outcome.
|
|
43
|
+
*/
|
|
44
|
+
export function submitProcessedDocument(sdk, processedDocument, request) {
|
|
45
|
+
return recordReview(sdk, processedDocument, () => ({
|
|
46
|
+
isPositive: true,
|
|
47
|
+
metadata: serializeReview(request.validatedData, false),
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Saves a draft of a {@link ProcessedDocument} review; the next load opens on
|
|
52
|
+
* it. Writes the same record as a submit, flagged `draft` — what makes a
|
|
53
|
+
* submit final is the host completing the task.
|
|
54
|
+
*/
|
|
55
|
+
export function saveProcessedDocumentAsDraft(sdk, processedDocument, request) {
|
|
56
|
+
return recordReview(sdk, processedDocument, () => ({
|
|
57
|
+
isPositive: true,
|
|
58
|
+
metadata: serializeReview(request.validatedData, true),
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Records a {@link ProcessedDocument} rejected as an exception, replacing any
|
|
63
|
+
* saved draft. As with a submit, completing the task is yours.
|
|
64
|
+
*/
|
|
65
|
+
export function reportProcessedDocumentException(sdk, processedDocument, request) {
|
|
66
|
+
const reason = request.exceptionReport?.Reason ??
|
|
67
|
+
"";
|
|
68
|
+
return recordReview(sdk, processedDocument, () => ({
|
|
69
|
+
isPositive: false,
|
|
70
|
+
comment: reason,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save.js","sourceRoot":"","sources":["../../src/processedDocument/save.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,+EAA+E;AAC/E,uEAAuE;AACvE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;AAExD,SAAS,UAAU,CAAI,GAAW,EAAE,IAAsB;IACxD,MAAM,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1E,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI;YAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2EAA2E;AAC3E,qEAAqE;AACrE,KAAK,UAAU,YAAY,CACzB,GAAW,EACX,iBAAoC,EACpC,KAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC;QACrB,MAAM,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AAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,GAAW,EACX,iBAAoC,EACpC,OAAsC;IAEtC,MAAM,MAAM,GACT,OAAO,CAAC,eAAqD,EAAE,MAAM;QACtE,EAAE,CAAC;IACL,OAAO,YAAY,CAAC,GAAG,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC;QACjD,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DocumentArtifactRefs, TraceSpan } from "./types.js";
|
|
2
|
+
/** The document and its DOM are required to render; the OCR text is not. */
|
|
3
|
+
export declare function resolveDocumentArtifacts(spans: TraceSpan[]): DocumentArtifactRefs;
|
|
4
|
+
//# sourceMappingURL=spans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../../src/processedDocument/spans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,oBAAoB,EACpB,SAAS,EAEV,MAAM,YAAY,CAAC;AAsCpB,4EAA4E;AAC5E,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,SAAS,EAAE,GACjB,oBAAoB,CAiDtB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { refuse } from "./payload.js";
|
|
2
|
+
const DIGITIZATION_SPAN_TYPE = "idpDigitization";
|
|
3
|
+
// The service sends attributes as a JSON string; take an object as it is too.
|
|
4
|
+
const parseAttributes = (attributes) => {
|
|
5
|
+
let parsed = attributes;
|
|
6
|
+
if (typeof attributes === "string") {
|
|
7
|
+
try {
|
|
8
|
+
parsed = JSON.parse(attributes);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return parsed && typeof parsed === "object"
|
|
15
|
+
? parsed
|
|
16
|
+
: null;
|
|
17
|
+
};
|
|
18
|
+
// The ids on `digitizationArtifacts` are bucket *paths*; the bucket holding
|
|
19
|
+
// each one is only on the span's attachment list, matched by that path.
|
|
20
|
+
const toArtifactRef = (attachments, fileName) => {
|
|
21
|
+
if (!fileName)
|
|
22
|
+
return null;
|
|
23
|
+
const attachment = attachments.find((a) => a.fileName === fileName);
|
|
24
|
+
return attachment ? { bucketId: attachment.id, fileName } : null;
|
|
25
|
+
};
|
|
26
|
+
/** The document and its DOM are required to render; the OCR text is not. */
|
|
27
|
+
export function resolveDocumentArtifacts(spans) {
|
|
28
|
+
// Nothing on a span ties it to the extraction it fed, so with more than one
|
|
29
|
+
// the document could belong to another extraction: refuse rather than guess.
|
|
30
|
+
const digitizations = spans.filter((s) => s.spanType === DIGITIZATION_SPAN_TYPE);
|
|
31
|
+
if (digitizations.length > 1) {
|
|
32
|
+
refuse(`the trace carries ${digitizations.length} ${DIGITIZATION_SPAN_TYPE} spans, so the document cannot be matched to this extraction`);
|
|
33
|
+
}
|
|
34
|
+
const span = digitizations[0];
|
|
35
|
+
if (!span) {
|
|
36
|
+
refuse(`the trace carries no ${DIGITIZATION_SPAN_TYPE} span`);
|
|
37
|
+
}
|
|
38
|
+
const attributes = parseAttributes(span.attributes);
|
|
39
|
+
if (!attributes) {
|
|
40
|
+
refuse(`the ${DIGITIZATION_SPAN_TYPE} span carries no readable attributes`);
|
|
41
|
+
}
|
|
42
|
+
const artifacts = attributes["digitizationArtifacts"];
|
|
43
|
+
if (!Array.isArray(artifacts) || artifacts.length === 0) {
|
|
44
|
+
refuse(`the ${DIGITIZATION_SPAN_TYPE} span declares no digitizationArtifacts`);
|
|
45
|
+
}
|
|
46
|
+
if (artifacts.length > 1) {
|
|
47
|
+
refuse(`the run digitized ${artifacts.length} documents, and only one can be validated`);
|
|
48
|
+
}
|
|
49
|
+
const artifact = artifacts[0];
|
|
50
|
+
const attachments = span.attachments ?? [];
|
|
51
|
+
const document = toArtifactRef(attachments, artifact?.normalizedPdfAttachmentId);
|
|
52
|
+
const dom = toArtifactRef(attachments, artifact?.domAttachmentId);
|
|
53
|
+
if (!document) {
|
|
54
|
+
refuse("the run produced no document artifact");
|
|
55
|
+
}
|
|
56
|
+
if (!dom) {
|
|
57
|
+
refuse("the run produced no dom artifact");
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
document,
|
|
61
|
+
dom,
|
|
62
|
+
text: toArtifactRef(attachments, artifact?.textAttachmentId),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=spans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spans.js","sourceRoot":"","sources":["../../src/processedDocument/spans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAQtC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAQjD,8EAA8E;AAC9E,MAAM,eAAe,GAAG,CACtB,UAAmB,EACa,EAAE;IAClC,IAAI,MAAM,GAAG,UAAU,CAAC;IACxB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QACzC,CAAC,CAAE,MAAkC;QACrC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,4EAA4E;AAC5E,wEAAwE;AACxE,MAAM,aAAa,GAAG,CACpB,WAAkC,EAClC,QAA4B,EACR,EAAE;IACtB,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACpE,OAAO,UAAU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AG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAC5B,WAAW,EACX,QAAQ,EAAE,yBAAyB,CACpC,CAAC;IACF,MAAM,GAAG,GAAG,aAAa,CAAC,WAAW,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,CAAC,uCAAuC,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,CAAC,kCAAkC,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,QAAQ;QACR,GAAG;QACH,IAAI,EAAE,aAAa,CAAC,WAAW,EAAE,QAAQ,EAAE,gBAAgB,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type { ProcessedDocument, ProcessedDocumentMetadata, ProcessedDocumentTaxonomy, ProcessedDocumentType, } from "@uipath/du-utils";
|
|
2
|
+
/** What a review is recorded against, and the folder every call is made in. */
|
|
3
|
+
export interface FeedbackAnchor {
|
|
4
|
+
traceId: string;
|
|
5
|
+
spanId: string;
|
|
6
|
+
folderKey: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TraceSpanAttachment {
|
|
9
|
+
/** The storage bucket holding the file. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** The path inside the bucket. */
|
|
12
|
+
fileName: string;
|
|
13
|
+
}
|
|
14
|
+
/** The fields of a trace span the artifact resolver reads. */
|
|
15
|
+
export interface TraceSpan {
|
|
16
|
+
id: string;
|
|
17
|
+
spanType: string | null;
|
|
18
|
+
/** Typed as an object by the SDK, but the service sends a JSON string. */
|
|
19
|
+
attributes: unknown;
|
|
20
|
+
attachments: TraceSpanAttachment[] | null;
|
|
21
|
+
}
|
|
22
|
+
export interface ArtifactRef {
|
|
23
|
+
bucketId: string;
|
|
24
|
+
fileName: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DocumentArtifactRefs {
|
|
27
|
+
/** The normalized PDF. */
|
|
28
|
+
document: ArtifactRef;
|
|
29
|
+
/** Gzipped. */
|
|
30
|
+
dom: ArtifactRef;
|
|
31
|
+
/** Gzipped. */
|
|
32
|
+
text: ArtifactRef | null;
|
|
33
|
+
}
|
|
34
|
+
/** An edit replaces the whole record, so an absent field is sent as `null`. */
|
|
35
|
+
export interface FeedbackWrite {
|
|
36
|
+
isPositive: boolean;
|
|
37
|
+
/** A serialized {@link RecordedReview}. */
|
|
38
|
+
metadata?: string;
|
|
39
|
+
comment?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface FeedbackRecord {
|
|
42
|
+
id: string;
|
|
43
|
+
metadata?: string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/processedDocument/types.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAI1B,+EAA+E;AAC/E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,8DAA8D;AAC9D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,0EAA0E;IAC1E,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,QAAQ,EAAE,WAAW,CAAC;IACtB,eAAe;IACf,GAAG,EAAE,WAAW,CAAC;IACjB,eAAe;IACf,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CAC1B;AAED,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/processedDocument/types.ts"],"names":[],"mappings":""}
|
package/dist/saveHandlers.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest } from "@uipath/du-validation-station-wc";
|
|
2
2
|
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
3
3
|
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
4
|
+
import type { ProcessedDocument } from "./processedDocument/types.js";
|
|
4
5
|
import { type DuSaveCallbacks } from "./types.js";
|
|
5
6
|
/**
|
|
6
7
|
* Builds the save/draft/exception listeners shared by the two save-capable
|
|
@@ -8,9 +9,10 @@ import { type DuSaveCallbacks } from "./types.js";
|
|
|
8
9
|
* cannot drift: each persists when it can, tracks the flow once, and emits the
|
|
9
10
|
* request with the outcome attached only when it was the one that saved.
|
|
10
11
|
*/
|
|
11
|
-
export declare function createSaveHandlers({ sdk, data }: {
|
|
12
|
+
export declare function createSaveHandlers({ sdk, data, processedDocument, }: {
|
|
12
13
|
sdk?: UiPath;
|
|
13
14
|
data?: DuFramework.ContentValidationData;
|
|
15
|
+
processedDocument?: ProcessedDocument;
|
|
14
16
|
}, { onSubmit, onSaveAsDraft, onReportException }: DuSaveCallbacks): {
|
|
15
17
|
handleSubmit: (request: IVsSaveValidatedDataRequest) => void;
|
|
16
18
|
handleSaveAsDraft: (request: IVsSaveValidatedDataAsDraftRequest) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveHandlers.d.ts","sourceRoot":"","sources":["../src/saveHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"saveHandlers.d.ts","sourceRoot":"","sources":["../src/saveHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAOpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAMtE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,YAAY,CAAC;AAgDpB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,EACE,GAAG,EACH,IAAI,EACJ,iBAAiB,GAClB,EAAE;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,WAAW,CAAC,qBAAqB,CAAC;IACzC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC,EACD,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,eAAe;4BAKrC,2BAA2B;iCAgBtB,kCAAkC;+BAUpC,6BAA6B;EAkB3D"}
|