@uipath/ui-widgets-validation-station 1.2.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 +272 -214
- package/dist/ValidationStation.d.ts +5 -2
- package/dist/ValidationStation.d.ts.map +1 -1
- package/dist/ValidationStation.js +8 -4
- package/dist/ValidationStation.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/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/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 +42 -16
- 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 +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactElement } from "react";
|
|
2
2
|
import type { WcRefCallback } from "../bindWcEvents.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ValidationStationArtifacts } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Renders a standalone DU custom element by tag name with the given (typed)
|
|
6
6
|
* JSX props and ref callback.
|
|
@@ -24,12 +24,12 @@ export declare function wcStyle(style?: CSSProperties): Record<string, string |
|
|
|
24
24
|
* discriminated result so the caller narrows `artifacts` to non-null without a
|
|
25
25
|
* `!` assertion: render `fallback` when not ready, otherwise use `artifacts`.
|
|
26
26
|
*/
|
|
27
|
-
export type ArtifactsGate = {
|
|
27
|
+
export type ArtifactsGate<A extends ValidationStationArtifacts = ValidationStationArtifacts> = {
|
|
28
28
|
ready: true;
|
|
29
|
-
artifacts:
|
|
29
|
+
artifacts: A;
|
|
30
30
|
} | {
|
|
31
31
|
ready: false;
|
|
32
32
|
fallback: ReactElement;
|
|
33
33
|
};
|
|
34
|
-
export declare function resolveArtifacts(error: string | null, wcReady: boolean, artifacts:
|
|
34
|
+
export declare function resolveArtifacts<A extends ValidationStationArtifacts>(error: string | null, wcReady: boolean, artifacts: A | null): ArtifactsGate<A>;
|
|
35
35
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/subcomponents/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/subcomponents/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,SAAS,MAAM,EAClD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,aAAa,GACjB,YAAY,CAEd;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,KAAK,CAAC,EAAE,aAAa,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAE7C;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,0BAA0B,GAAG,0BAA0B,IAC/D;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AAE7E,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,0BAA0B,EACnE,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,GAAG,IAAI,GAClB,aAAa,CAAC,CAAC,CAAC,CAelB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/subcomponents/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyC,MAAM,OAAO,CAAC;AAI7E;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,KAAY,EACZ,GAAkB;IAElB,OAAO,aAAa,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CACrB,KAAqB;IAErB,OAAO,KAA+D,CAAC;AACzE,CAAC;AAWD,MAAM,UAAU,gBAAgB,CAC9B,KAAoB,EACpB,OAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/subcomponents/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyC,MAAM,OAAO,CAAC;AAI7E;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,KAAY,EACZ,GAAkB;IAElB,OAAO,aAAa,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CACrB,KAAqB;IAErB,OAAO,KAA+D,CAAC;AACzE,CAAC;AAWD,MAAM,UAAU,gBAAgB,CAC9B,KAAoB,EACpB,OAAgB,EAChB,SAAmB;IAEnB,IAAI,KAAK,EAAE,CAAC;QACV,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,aAAa,CACrB,KAAK,EACL,IAAI,EACJ,sCAAsC,KAAK,EAAE,CAC9C;SACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
2
|
import { type ResolvedArtifacts, type DuArtifactsSource } from "../useResolvedArtifacts.js";
|
|
3
|
-
import { ValidationStationLanguage, type DuTheme } from "../types.js";
|
|
3
|
+
import { ValidationStationLanguage, type DuDocumentArtifacts, type DuTheme } from "../types.js";
|
|
4
4
|
/** Presentation + linking props common to every subcomponent wrapper. */
|
|
5
5
|
export interface WcElementCommon {
|
|
6
6
|
instanceId?: string;
|
|
@@ -21,7 +21,7 @@ interface WcCommonProps {
|
|
|
21
21
|
language: ValidationStationLanguage;
|
|
22
22
|
isReadonly: boolean;
|
|
23
23
|
}
|
|
24
|
-
export interface WcElementState extends ResolvedArtifacts {
|
|
24
|
+
export interface WcElementState extends ResolvedArtifacts<DuDocumentArtifacts> {
|
|
25
25
|
wcReady: boolean;
|
|
26
26
|
/** Tag actually rendered — the base tag, or its persistent variant. */
|
|
27
27
|
tag: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWcElement.d.ts","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"useWcElement.d.ts","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAIrB,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,qEAAqE;AACrE,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,yBAAyB,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB,CAAC,mBAAmB,CAAC;IAC5E,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,EAAE,eAAe,CAAC;CACzB,GAAG,cAAc,CA2BjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { convertToPersistentTag } from "../loadValidationStationWc.js";
|
|
2
2
|
import { useResolvedArtifacts, } from "../useResolvedArtifacts.js";
|
|
3
|
-
import { ValidationStationLanguage } from "../types.js";
|
|
3
|
+
import { ValidationStationLanguage, } from "../types.js";
|
|
4
4
|
import { useWcReady } from "../useWcReady.js";
|
|
5
5
|
import { wcStyle } from "./shared.js";
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWcElement.js","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,oBAAoB,GAGrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"useWcElement.js","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,oBAAoB,GAGrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,GAG1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA+BtC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAI5B;IACC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,KAAK,CAAC;IAC9C,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAEnE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC1E,8DAA8D;IAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAEhC,MAAM,WAAW,GAAkB;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5B,aAAa,EAAE,MAAM,CAAC,UAAU;QAChC,UAAU;QACV,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,OAAO;QAC9B,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,yBAAyB,CAAC,OAAO;QAC9D,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK;KACvC,CAAC;IAEF,OAAO;QACL,SAAS;QACT,KAAK;QACL,UAAU;QACV,OAAO;QACP,GAAG;QACH,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DocumentViewerOptions, EvaluatedBusinessRulesForFieldValueDto, FieldFilterOptions, ICustomizationInfoDTO, IFeatureCustomization, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsIndicatorOverlayContext, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, IVsWcMessage, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult } from "@uipath/du-validation-station-wc";
|
|
1
|
+
import type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DocumentViewerOptions, EvaluatedBusinessRulesForFieldValueDto, FieldFilterOptions, ICustomizationInfoDTO, IFeatureCustomization, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsIndicatorOverlayContext, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, IVsWcMessage, IXPExtraction, IXPTaxonomy, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult } from "@uipath/du-validation-station-wc";
|
|
2
2
|
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
3
3
|
import type { SaveValidatedDataResult } from "./saveValidatedDataUtil.js";
|
|
4
|
-
import type {
|
|
5
|
-
export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DocumentViewerOptions, EvaluatedBusinessRulesForFieldValueDto, FieldFilterOptions, ICustomizationInfoDTO, IFeatureCustomization, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsIndicatorOverlayContext, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, IVsWcMessage, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult, };
|
|
4
|
+
import type { ValidationStationArtifactsSource } from "./useResolvedArtifacts.js";
|
|
5
|
+
export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DocumentViewerOptions, EvaluatedBusinessRulesForFieldValueDto, FieldFilterOptions, ICustomizationInfoDTO, IFeatureCustomization, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsIndicatorOverlayContext, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, IVsWcMessage, IXPExtraction, IXPTaxonomy, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult, };
|
|
6
6
|
export declare enum TelemetryEvent {
|
|
7
7
|
Load = "ValidationStation.Load",
|
|
8
8
|
/**
|
|
@@ -76,6 +76,22 @@ export interface DuDocumentArtifacts {
|
|
|
76
76
|
customizationInfo: unknown;
|
|
77
77
|
original: string | undefined;
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* {@link DuDocumentArtifacts} with the taxonomy and the extraction result in
|
|
81
|
+
* the IXP (JSON Schema) representation. Only `ValidationStation` takes it; the
|
|
82
|
+
* subcomponents take the Document Understanding representation.
|
|
83
|
+
*
|
|
84
|
+
* `fetchProcessedDocumentArtifacts` produces one of these from a Flow
|
|
85
|
+
* `ProcessedDocument`.
|
|
86
|
+
*/
|
|
87
|
+
export interface IxpDocumentArtifacts extends Omit<DuDocumentArtifacts, "taxonomy" | "extractionResult" | "predictedExtractionResult"> {
|
|
88
|
+
taxonomy: IXPTaxonomy;
|
|
89
|
+
extractionResult: IXPExtraction;
|
|
90
|
+
/** None: the web component takes a prediction in the Document Understanding representation only. */
|
|
91
|
+
predictedExtractionResult?: never;
|
|
92
|
+
}
|
|
93
|
+
/** The artifacts `ValidationStation` takes: either representation. */
|
|
94
|
+
export type ValidationStationArtifacts = DuDocumentArtifacts | IxpDocumentArtifacts;
|
|
79
95
|
/**
|
|
80
96
|
* The save flows every save-capable widget reports — `ValidationStation` and
|
|
81
97
|
* `CompactFieldsForm`. Both implement them identically, so a host swapping one
|
|
@@ -87,24 +103,33 @@ export interface DuSaveCallbacks {
|
|
|
87
103
|
* carries the request the web component produced.
|
|
88
104
|
*
|
|
89
105
|
* `result` is present only when the widget persisted the data itself, i.e.
|
|
90
|
-
* when it has `sdk` + `data` naming a folder
|
|
91
|
-
*
|
|
92
|
-
*
|
|
106
|
+
* when it has `sdk` + `data` naming a folder, or (`ValidationStation` only)
|
|
107
|
+
* `sdk` + `processedDocument`.
|
|
108
|
+
* Otherwise the write-back is yours — the exported `submitValidatedData`
|
|
109
|
+
* (bucket-backed document) and `submitProcessedDocument` (Flow document) do
|
|
110
|
+
* what the widget would have done.
|
|
111
|
+
*
|
|
112
|
+
* For a `processedDocument`, `request.validatedData` is an `IXPExtraction`:
|
|
113
|
+
* complete the task with it whatever `result` says.
|
|
93
114
|
*/
|
|
94
115
|
onSubmit?: (request: IVsSaveValidatedDataRequest, result?: SaveValidatedDataResult) => void;
|
|
95
116
|
/**
|
|
96
117
|
* The user saved a draft (`save={{ validate: false }}`). Same contract as
|
|
97
|
-
* {@link DuSaveCallbacks.onSubmit}; the host-side
|
|
98
|
-
* `saveValidatedDataAsDraft`.
|
|
118
|
+
* {@link DuSaveCallbacks.onSubmit}; the host-side equivalents are
|
|
119
|
+
* `saveValidatedDataAsDraft` and `saveProcessedDocumentAsDraft`.
|
|
99
120
|
*/
|
|
100
121
|
onSaveAsDraft?: (request: IVsSaveValidatedDataAsDraftRequest, result?: SaveValidatedDataResult) => void;
|
|
101
122
|
/**
|
|
102
|
-
* The user reported the document as an exception. The
|
|
103
|
-
* this in either mode, so there is no `result` — the host owns it, typically
|
|
104
|
-
* via `OrchestratorDuModule.submitExceptionReport(...)`. The reason lives at
|
|
123
|
+
* The user reported the document as an exception. The reason lives at
|
|
105
124
|
* `request.exceptionReport.Reason`.
|
|
125
|
+
*
|
|
126
|
+
* Given `sdk` + `processedDocument` (`ValidationStation` only), the widget
|
|
127
|
+
* records the rejection and
|
|
128
|
+
* passes the outcome as `result` (host-side: `reportProcessedDocumentException`).
|
|
129
|
+
* Otherwise there is no `result` and the host owns it, typically via
|
|
130
|
+
* `OrchestratorDuModule.submitExceptionReport(...)`.
|
|
106
131
|
*/
|
|
107
|
-
onReportException?: (request: IVsSaveExceptionReportRequest) => void;
|
|
132
|
+
onReportException?: (request: IVsSaveExceptionReportRequest, result?: SaveValidatedDataResult) => void;
|
|
108
133
|
}
|
|
109
134
|
/**
|
|
110
135
|
* Callbacks for the edit/state events reported by the four widgets that share
|
|
@@ -187,11 +212,12 @@ export interface ValidationStationEventProps extends VsStateEventProps, VsSaveRe
|
|
|
187
212
|
/**
|
|
188
213
|
* Props for the monolithic `ValidationStation`.
|
|
189
214
|
*
|
|
190
|
-
* The document data comes from a {@link
|
|
191
|
-
* pre-fetched `artifacts` handed in directly,
|
|
192
|
-
*
|
|
215
|
+
* The document data comes from a {@link ValidationStationArtifactsSource}:
|
|
216
|
+
* pre-fetched `artifacts` handed in directly, `sdk` + `data` for the widget to
|
|
217
|
+
* fetch from the bucket paths on `ContentValidationData`, or `sdk` +
|
|
218
|
+
* `processedDocument` for it to fetch a Flow document through its run.
|
|
193
219
|
*/
|
|
194
|
-
export interface ValidationStationProps extends
|
|
220
|
+
export interface ValidationStationProps extends ValidationStationArtifactsSource, DuCommonProps, DuSaveCallbacks, ValidationStationEventProps {
|
|
195
221
|
options?: IValidationStationOptions;
|
|
196
222
|
save?: {
|
|
197
223
|
validate: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,sCAAsC,EACtC,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC3B,YAAY,EACZ,8BAA8B,EAC9B,oCAAoC,EACpC,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA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;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,mCAAmC;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C;AAED;;;;GAIG;AACH,MAAM,WAAW,2BACf,SAAQ,iBAAiB,EAAE,sBAAsB;IACjD;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,mEAAmE;IACnE,yBAAyB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,uEAAuE;IACvE,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CAC7D;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBACf,SACE,gCAAgC,EAChC,aAAa,EACb,eAAe,EACf,2BAA2B;IAC7B,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7B,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,8BAA8B,CAAC,EAAE,8BAA8B,CAAC;IAChE,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2DA,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,iDAA+B,CAAA;IAC/B;;;OAGG;IACH,qDAAmC,CAAA;IACnC,yEAAuD,CAAA;AACzD,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,wDAAqC,CAAA;IACrC,oDAAiC,CAAA;AACnC,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,MAAM,CAAN,IAAY,yBAeX;AAfD,WAAY,yBAAyB;IACnC,0CAAa,CAAA;IACb,2CAAc,CAAA;IACd,2CAAc,CAAA;IACd,oDAAuB,CAAA;IACvB,0CAAa,CAAA;IACb,4CAAe,CAAA;IACf,0CAAa,CAAA;IACb,8CAAiB,CAAA;IACjB,uDAA0B,CAAA;IAC1B,4CAAe,CAAA;IACf,2CAAc,CAAA;IACd,2CAAc,CAAA;IACd,wDAA2B,CAAA;IAC3B,yDAA4B,CAAA;AAC9B,CAAC,EAfW,yBAAyB,KAAzB,yBAAyB,QAepC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
2
2
|
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
3
|
-
import {
|
|
3
|
+
import type { ProcessedDocument } from "./processedDocument/types.js";
|
|
4
|
+
import { type DuDocumentArtifacts, type ValidationStationArtifacts } from "./types.js";
|
|
4
5
|
/**
|
|
5
|
-
* Data source
|
|
6
|
-
* mutually-exclusive modes:
|
|
6
|
+
* Data source of every subcomponent wrapper. Two mutually-exclusive modes:
|
|
7
7
|
*
|
|
8
8
|
* 1. **Pre-fetched** — pass `artifacts` (and usually `documentId`). No HTTP
|
|
9
9
|
* call is made. This is the composition mode: a parent fetches once and
|
|
@@ -27,15 +27,34 @@ export interface DuArtifactsSource {
|
|
|
27
27
|
/** Document id. Falls back to `data.DocumentId`. */
|
|
28
28
|
documentId?: string;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* `ValidationStation`'s data source: {@link DuArtifactsSource}, whose
|
|
32
|
+
* `artifacts` may also be in the IXP representation, plus a third mode:
|
|
33
|
+
*
|
|
34
|
+
* 3. **Self-fetching, IXP** — pass `sdk` + `processedDocument`. The hook
|
|
35
|
+
* fetches the document's artifacts through its producing run, as
|
|
36
|
+
* `fetchProcessedDocumentArtifacts` does.
|
|
37
|
+
*
|
|
38
|
+
* `data` wins when both it and `processedDocument` are set.
|
|
39
|
+
*/
|
|
40
|
+
export interface ValidationStationArtifactsSource extends Omit<DuArtifactsSource, "artifacts" | "documentId"> {
|
|
41
|
+
/** Pre-fetched artifacts. When supplied, no fetch is performed. */
|
|
42
|
+
artifacts?: ValidationStationArtifacts;
|
|
43
|
+
/** A Flow IDP node's output — self-fetching through its producing run. */
|
|
44
|
+
processedDocument?: ProcessedDocument;
|
|
45
|
+
/** Document id. Falls back to `data.DocumentId`, else the `processedDocument`'s trace id. */
|
|
46
|
+
documentId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ResolvedArtifacts<A extends ValidationStationArtifacts = ValidationStationArtifacts> {
|
|
49
|
+
artifacts: A | null;
|
|
32
50
|
error: string | null;
|
|
33
51
|
documentId: string | undefined;
|
|
34
52
|
}
|
|
35
53
|
/**
|
|
36
54
|
* Resolves the artifacts a widget needs — `ValidationStation` and every
|
|
37
55
|
* subcomponent alike — transparently handling both the pre-fetched and
|
|
38
|
-
* self-fetching modes described on {@link
|
|
56
|
+
* self-fetching modes described on {@link ValidationStationArtifactsSource}.
|
|
39
57
|
*/
|
|
40
|
-
export declare function useResolvedArtifacts(
|
|
58
|
+
export declare function useResolvedArtifacts(source: DuArtifactsSource): ResolvedArtifacts<DuDocumentArtifacts>;
|
|
59
|
+
export declare function useResolvedArtifacts(source: ValidationStationArtifactsSource): ResolvedArtifacts;
|
|
41
60
|
//# sourceMappingURL=useResolvedArtifacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolvedArtifacts.d.ts","sourceRoot":"","sources":["../src/useResolvedArtifacts.ts"],"names":[],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AgB,oBAAoB,CAClC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAC1C,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gCAAgC,GACvC,iBAAiB,CAAC"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { BucketService } from "@uipath/uipath-typescript/buckets";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { fetchBucketArtifacts } from "./bucketArtifactsUtil.js";
|
|
4
|
+
import { selectPayload } from "./payloadSource.js";
|
|
5
|
+
import { fetchProcessedDocumentArtifacts } from "./processedDocument/artifacts.js";
|
|
4
6
|
import { TelemetryEvent, TelemetryStatus, } from "./types.js";
|
|
5
7
|
import { trackTelemetry } from "./utils/telemetryUtils.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export function useResolvedArtifacts(source) {
|
|
9
|
+
const { sdk, artifacts: provided, documentId } = source;
|
|
10
|
+
const { data, processedDocument } = selectPayload(source.data, source.processedDocument);
|
|
11
|
+
const resolvedDocumentId = documentId ?? data?.DocumentId ?? processedDocument?.metadata?.traceId;
|
|
12
|
+
// The outcome is tagged with the document it belongs to, so another
|
|
13
|
+
// document shows the loading state instead of the previous one while its
|
|
14
|
+
// fetch is in flight. By content rather than payload identity: a caller
|
|
15
|
+
// passing an inline payload would otherwise never see its own fetch land.
|
|
16
|
+
// A Flow run's documents share a trace id, so theirs adds the span id.
|
|
17
|
+
const outcomeKey = processedDocument
|
|
18
|
+
? `${resolvedDocumentId}|${processedDocument.metadata?.spanId}`
|
|
19
|
+
: resolvedDocumentId;
|
|
20
|
+
const [outcome, setOutcome] = useState(null);
|
|
15
21
|
const hasFolder = !!(data?.FolderKey || data?.FolderId);
|
|
16
22
|
// Fetch only when the caller did not supply artifacts and a full context is
|
|
17
23
|
// present (the missing-folder case is surfaced at render).
|
|
18
|
-
const shouldFetch = !provided && !!sdk &&
|
|
24
|
+
const shouldFetch = !provided && !!sdk && (data ? hasFolder : !!processedDocument);
|
|
19
25
|
// Keep the latest sdk reachable so each fetch uses the current instance (token
|
|
20
26
|
// refresh / tenant switch) without making sdk identity a fetch trigger.
|
|
21
27
|
const sdkRef = useRef(sdk);
|
|
@@ -26,22 +32,28 @@ export function useResolvedArtifacts({ sdk, data, artifacts: provided, documentI
|
|
|
26
32
|
if (!shouldFetch)
|
|
27
33
|
return;
|
|
28
34
|
let cancelled = false;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.then((
|
|
35
|
+
const pending = data
|
|
36
|
+
? fetchBucketArtifacts(new BucketService(sdkRef.current), data)
|
|
37
|
+
: fetchProcessedDocumentArtifacts(sdkRef.current, processedDocument);
|
|
38
|
+
pending
|
|
39
|
+
.then((artifacts) => {
|
|
34
40
|
if (!cancelled) {
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
setOutcome({
|
|
42
|
+
key: outcomeKey,
|
|
43
|
+
artifacts,
|
|
44
|
+
error: null,
|
|
45
|
+
});
|
|
37
46
|
trackTelemetry(TelemetryEvent.Load, TelemetryStatus.Success);
|
|
38
47
|
}
|
|
39
48
|
})
|
|
40
49
|
.catch((er) => {
|
|
41
50
|
if (!cancelled) {
|
|
42
51
|
const message = er instanceof Error ? er.message : String(er);
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
setOutcome({
|
|
53
|
+
key: outcomeKey,
|
|
54
|
+
artifacts: null,
|
|
55
|
+
error: message,
|
|
56
|
+
});
|
|
45
57
|
trackTelemetry(TelemetryEvent.Load, TelemetryStatus.Error, {
|
|
46
58
|
error: message,
|
|
47
59
|
});
|
|
@@ -50,11 +62,11 @@ export function useResolvedArtifacts({ sdk, data, artifacts: provided, documentI
|
|
|
50
62
|
return () => {
|
|
51
63
|
cancelled = true;
|
|
52
64
|
};
|
|
53
|
-
// Keyed on
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// (React state) so this does not refetch on unrelated re-renders.
|
|
57
|
-
}, [shouldFetch, data]);
|
|
65
|
+
// Keyed on payload identity: the fetch reads the bucket PATH fields off
|
|
66
|
+
// `data` (the trace ids off `processedDocument`), not just the document id,
|
|
67
|
+
// so a new payload with the same id must refetch. Callers pass a stable
|
|
68
|
+
// reference (React state) so this does not refetch on unrelated re-renders.
|
|
69
|
+
}, [shouldFetch, data, processedDocument, outcomeKey]);
|
|
58
70
|
if (provided) {
|
|
59
71
|
return {
|
|
60
72
|
artifacts: provided,
|
|
@@ -62,23 +74,24 @@ export function useResolvedArtifacts({ sdk, data, artifacts: provided, documentI
|
|
|
62
74
|
documentId: resolvedDocumentId,
|
|
63
75
|
};
|
|
64
76
|
}
|
|
65
|
-
if (!sdk || !data) {
|
|
77
|
+
if (!sdk || !(data || processedDocument)) {
|
|
66
78
|
return {
|
|
67
79
|
artifacts: null,
|
|
68
|
-
error: "No data source provided. Pass `artifacts` (pre-fetched) or `sdk` + `data` (to fetch).",
|
|
80
|
+
error: "No data source provided. Pass `artifacts` (pre-fetched), or `sdk` + `data` or `sdk` + `processedDocument` (to fetch).",
|
|
69
81
|
documentId: resolvedDocumentId,
|
|
70
82
|
};
|
|
71
83
|
}
|
|
72
|
-
if (!hasFolder) {
|
|
84
|
+
if (data && !hasFolder) {
|
|
73
85
|
return {
|
|
74
86
|
artifacts: null,
|
|
75
87
|
error: "ContentValidationData must carry FolderId or FolderKey (the storage bucket's folder).",
|
|
76
88
|
documentId: resolvedDocumentId,
|
|
77
89
|
};
|
|
78
90
|
}
|
|
91
|
+
const current = outcome?.key === outcomeKey ? outcome : null;
|
|
79
92
|
return {
|
|
80
|
-
artifacts:
|
|
81
|
-
error,
|
|
93
|
+
artifacts: current?.artifacts ?? null,
|
|
94
|
+
error: current?.error ?? null,
|
|
82
95
|
documentId: resolvedDocumentId,
|
|
83
96
|
};
|
|
84
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolvedArtifacts.js","sourceRoot":"","sources":["../src/useResolvedArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAEL,cAAc,EACd,eAAe,
|
|
1
|
+
{"version":3,"file":"useResolvedArtifacts.js","sourceRoot":"","sources":["../src/useResolvedArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAEL,cAAc,EACd,eAAe,GAEhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAqE3D,MAAM,UAAU,oBAAoB,CAClC,MAAwC;IAExC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACxD,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,aAAa,CAC/C,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,iBAAiB,CACzB,CAAC;IACF,MAAM,kBAAkB,GACtB,UAAU,IAAI,IAAI,EAAE,UAAU,IAAI,iBAAiB,EAAE,QAAQ,EAAE,OAAO,CAAC;IACzE,oEAAoE;IACpE,yEAAyE;IACzE,wEAAwE;IACxE,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,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,MAAM,OAAO,GAAG,OAAO,EAAE,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,OAAO;QACL,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,IAAI;QACrC,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI;QAC7B,UAAU,EAAE,kBAAkB;KAC/B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/ui-widgets-validation-station",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-rc.0",
|
|
4
4
|
"description": "A React component for UiPath Document Understanding Validation Station.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"vitest": "^4.0.18"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@uipath/du-utils": "1.0.0-rc.
|
|
70
|
-
"@uipath/du-validation-station-wc": "1.0.0-rc.
|
|
69
|
+
"@uipath/du-utils": "1.0.0-rc.3",
|
|
70
|
+
"@uipath/du-validation-station-wc": "1.0.0-rc.4",
|
|
71
71
|
"fflate": "^0.8.2"
|
|
72
72
|
}
|
|
73
73
|
}
|