@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
|
@@ -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,EAA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CAAC;QACzC,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EACH,uHAAuH;YACzH,UAAU,EAAE,kBAAkB;SAC/B,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACvB,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EACH,uFAAuF;YACzF,UAAU,EAAE,kBAAkB;SAC/B,CAAC;IACJ,CAAC;IAED,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",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"registry": "https://npm.pkg.github.com"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@uipath/uipath-typescript": "^1.
|
|
45
|
+
"@uipath/uipath-typescript": "^1.5.1",
|
|
46
46
|
"react": "^19.2.0",
|
|
47
47
|
"react-dom": "^19.2.0"
|
|
48
48
|
},
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"vitest": "^4.0.18"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@uipath/du-utils": "
|
|
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
|
}
|