@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
|
@@ -3,8 +3,11 @@ import { type ValidationStationProps } from "./types.js";
|
|
|
3
3
|
* The all-in-one Document Understanding Validation Station: document viewer,
|
|
4
4
|
* fields form, table editor, business rules and save actions in one element.
|
|
5
5
|
*
|
|
6
|
-
* Takes its document
|
|
7
|
-
*
|
|
6
|
+
* Takes its document pre-fetched (`artifacts`), self-fetched from the bucket
|
|
7
|
+
* paths on `data` (`sdk` + `data`), or self-fetched through a Flow run
|
|
8
|
+
* (`sdk` + `processedDocument`) — see {@link DuArtifactsSource}. The document
|
|
9
|
+
* may be a Document Understanding document (`DocumentTaxonomy` +
|
|
10
|
+
* `ExtractionResult`) or an IXP document (`IXPTaxonomy` + `IXPExtraction`).
|
|
8
11
|
*
|
|
9
12
|
* Reports every event in the element's public
|
|
10
13
|
* `IValidationStationStandaloneWcEventMap`: the save flows through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationStation.d.ts","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAIpB
|
|
1
|
+
{"version":3,"file":"ValidationStation.d.ts","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwG9D,CAAC"}
|
|
@@ -9,19 +9,23 @@ import { useWcReady } from "./useWcReady.js";
|
|
|
9
9
|
* The all-in-one Document Understanding Validation Station: document viewer,
|
|
10
10
|
* fields form, table editor, business rules and save actions in one element.
|
|
11
11
|
*
|
|
12
|
-
* Takes its document
|
|
13
|
-
*
|
|
12
|
+
* Takes its document pre-fetched (`artifacts`), self-fetched from the bucket
|
|
13
|
+
* paths on `data` (`sdk` + `data`), or self-fetched through a Flow run
|
|
14
|
+
* (`sdk` + `processedDocument`) — see {@link DuArtifactsSource}. The document
|
|
15
|
+
* may be a Document Understanding document (`DocumentTaxonomy` +
|
|
16
|
+
* `ExtractionResult`) or an IXP document (`IXPTaxonomy` + `IXPExtraction`).
|
|
14
17
|
*
|
|
15
18
|
* Reports every event in the element's public
|
|
16
19
|
* `IValidationStationStandaloneWcEventMap`: the save flows through
|
|
17
20
|
* {@link DuSaveCallbacks}, and the edit, validity, command-outcome and panel
|
|
18
21
|
* events through {@link ValidationStationEventProps}.
|
|
19
22
|
*/
|
|
20
|
-
export const ValidationStation = ({ sdk, data, artifacts: providedArtifacts, documentId: documentIdProp, theme = "light", language = ValidationStationLanguage.English, isReadonly = false, persistent = false, options, save, discardChanges, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, onSubmit, onSaveAsDraft, onReportException, onLoaded, onDirtyChange, onIsValidChange, onDocumentTypeChanged, onExtractionResultChanged, onFieldValueSelected, onFieldValueChanged, onBusinessRulesEvaluated, onSaveResult, onSetFieldValueByPathResult, onSelectAndFocusFieldValueByPathResult, onDeleteFieldValueByPathResult, onFieldsPanelWidthChanged, onFieldsPanelSideChanged, onWcMessage, }) => {
|
|
23
|
+
export const ValidationStation = ({ sdk, data, artifacts: providedArtifacts, processedDocument, documentId: documentIdProp, theme = "light", language = ValidationStationLanguage.English, isReadonly = false, persistent = false, options, save, discardChanges, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, onSubmit, onSaveAsDraft, onReportException, onLoaded, onDirtyChange, onIsValidChange, onDocumentTypeChanged, onExtractionResultChanged, onFieldValueSelected, onFieldValueChanged, onBusinessRulesEvaluated, onSaveResult, onSetFieldValueByPathResult, onSelectAndFocusFieldValueByPathResult, onDeleteFieldValueByPathResult, onFieldsPanelWidthChanged, onFieldsPanelSideChanged, onWcMessage, }) => {
|
|
21
24
|
const { artifacts, error, documentId } = useResolvedArtifacts({
|
|
22
25
|
sdk,
|
|
23
26
|
data,
|
|
24
27
|
artifacts: providedArtifacts,
|
|
28
|
+
processedDocument,
|
|
25
29
|
documentId: documentIdProp,
|
|
26
30
|
});
|
|
27
31
|
const tag = persistent
|
|
@@ -29,7 +33,7 @@ export const ValidationStation = ({ sdk, data, artifacts: providedArtifacts, doc
|
|
|
29
33
|
: VALIDATION_STATION_TAG;
|
|
30
34
|
// Gate on the tag actually rendered, not always the base one.
|
|
31
35
|
const wcReady = useWcReady(tag);
|
|
32
|
-
const { handleSubmit, handleSaveAsDraft, handleException } = createSaveHandlers({ sdk, data }, { onSubmit, onSaveAsDraft, onReportException });
|
|
36
|
+
const { handleSubmit, handleSaveAsDraft, handleException } = createSaveHandlers({ sdk, data, processedDocument }, { onSubmit, onSaveAsDraft, onReportException });
|
|
33
37
|
const ref = useWcRef({
|
|
34
38
|
loaded: onLoaded,
|
|
35
39
|
dirty: onDirtyChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationStation.js","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EACL,yBAAyB,GAE1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"ValidationStation.js","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EACL,yBAAyB,GAE1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAA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QAC9B,sBAAsB;KACvB,CAAC;IAEF,OAAO,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export { ValidationStationLanguage } from "./types.js";
|
|
2
|
-
export type { DuArtifactsSource } from "./useResolvedArtifacts.js";
|
|
3
|
-
export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DuCommonProps,
|
|
2
|
+
export type { DuArtifactsSource, ValidationStationArtifactsSource, } from "./useResolvedArtifacts.js";
|
|
3
|
+
export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DuCommonProps, DocumentViewerOptions, DuDocumentArtifacts, DuSaveCallbacks, DuTheme, EvaluatedBusinessRulesForFieldValueDto, FieldFilterOptions, ICustomizationInfoDTO, IFeatureCustomization, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsIndicatorOverlayContext, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, IVsWcMessage, IxpDocumentArtifacts, IXPExtraction, IXPTaxonomy, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult, ValidationStationEventProps, ValidationStationArtifacts, ValidationStationProps, VsSaveResultEventProps, VsStateEventProps, } from "./types.js";
|
|
4
4
|
export { ValidationStation } from "./ValidationStation.js";
|
|
5
5
|
export { useDuDocumentArtifacts } from "./useDuDocumentArtifacts.js";
|
|
6
6
|
export { fetchDuDocumentArtifacts } from "./bucketArtifactsUtil.js";
|
|
7
7
|
export { saveValidatedDataAsDraft, submitValidatedData, } from "./saveValidatedDataUtil.js";
|
|
8
|
+
export { fetchProcessedDocumentArtifacts } from "./processedDocument/artifacts.js";
|
|
9
|
+
export { reportProcessedDocumentException, saveProcessedDocumentAsDraft, submitProcessedDocument, } from "./processedDocument/save.js";
|
|
10
|
+
export type { ProcessedDocument, ProcessedDocumentMetadata, ProcessedDocumentTaxonomy, ProcessedDocumentType, } from "./processedDocument/types.js";
|
|
8
11
|
export { configureValidationStationWc, DU_WC_TAGS, VALIDATION_STATION_TAG, } from "./loadValidationStationWc.js";
|
|
9
12
|
export type { ValidationStationWcConfig } from "./loadValidationStationWc.js";
|
|
10
13
|
export { joinDeploymentUrl } from "./urlUtil.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,gCAAgC,GACjC,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,sCAAsC,EACtC,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,uBAAuB,EACvB,8BAA8B,EAC9B,oCAAoC,EACpC,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,4BAA4B,EAC5B,UAAU,EACV,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,9 @@ export { useDuDocumentArtifacts } from "./useDuDocumentArtifacts.js";
|
|
|
4
4
|
// ─── Host-driven fetch & persistence ──────────────────────────────────────────
|
|
5
5
|
export { fetchDuDocumentArtifacts } from "./bucketArtifactsUtil.js";
|
|
6
6
|
export { saveValidatedDataAsDraft, submitValidatedData, } from "./saveValidatedDataUtil.js";
|
|
7
|
+
// ─── IXP documents (ProcessedDocument) ────────────────────────────────────────
|
|
8
|
+
export { fetchProcessedDocumentArtifacts } from "./processedDocument/artifacts.js";
|
|
9
|
+
export { reportProcessedDocumentException, saveProcessedDocumentAsDraft, submitProcessedDocument, } from "./processedDocument/save.js";
|
|
7
10
|
// ─── Web component loading ────────────────────────────────────────────────────
|
|
8
11
|
export { configureValidationStationWc, DU_WC_TAGS, VALIDATION_STATION_TAG, } from "./loadValidationStationWc.js";
|
|
9
12
|
export { joinDeploymentUrl } from "./urlUtil.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAuCvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,iFAAiF;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,iFAAiF;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,6BAA6B,CAAC;AAQrC,iFAAiF;AACjF,OAAO,EACL,4BAA4B,EAC5B,UAAU,EACV,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,iFAAiF;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IXPExtraction, IXPTaxonomy } from "@uipath/du-validation-station-wc";
|
|
2
|
+
/** A UiPath `DocumentTaxonomy` is PascalCase, so it never has `properties` or `$defs`. */
|
|
3
|
+
export declare const isIXPTaxonomy: (value: unknown) => value is IXPTaxonomy;
|
|
4
|
+
/** A UiPath `ExtractionResult` is PascalCase, so it never has `output` or `attribution`. */
|
|
5
|
+
export declare const isIXPExtraction: (value: unknown) => value is IXPExtraction;
|
|
6
|
+
//# sourceMappingURL=ixpUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ixpUtil.d.ts","sourceRoot":"","sources":["../src/ixpUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAE1C,0FAA0F;AAC1F,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAGX,CAAC;AAE9C,4FAA4F;AAC5F,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,aAGX,CAAC"}
|
package/dist/ixpUtil.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A UiPath `DocumentTaxonomy` is PascalCase, so it never has `properties` or `$defs`. */
|
|
2
|
+
export const isIXPTaxonomy = (value) => typeof value === "object" &&
|
|
3
|
+
value !== null &&
|
|
4
|
+
("properties" in value || "$defs" in value);
|
|
5
|
+
/** A UiPath `ExtractionResult` is PascalCase, so it never has `output` or `attribution`. */
|
|
6
|
+
export const isIXPExtraction = (value) => typeof value === "object" &&
|
|
7
|
+
value !== null &&
|
|
8
|
+
("output" in value || "attribution" in value);
|
|
9
|
+
//# sourceMappingURL=ixpUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ixpUtil.js","sourceRoot":"","sources":["../src/ixpUtil.ts"],"names":[],"mappings":"AAKA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,CAAC,YAAY,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,CAAC;AAE9C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAA0B,EAAE,CACxE,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,CAAC,QAAQ,IAAI,KAAK,IAAI,aAAa,IAAI,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
2
|
+
import type { ProcessedDocument } from "./processedDocument/types.js";
|
|
3
|
+
/** The one payload a widget loads from and saves to. */
|
|
4
|
+
export type SelectedPayload = {
|
|
5
|
+
data: DuFramework.ContentValidationData;
|
|
6
|
+
processedDocument?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
data?: undefined;
|
|
9
|
+
processedDocument: ProcessedDocument;
|
|
10
|
+
} | {
|
|
11
|
+
data?: undefined;
|
|
12
|
+
processedDocument?: undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* `data` wins when both payloads are set, matching the web component. Loading
|
|
16
|
+
* and saving both resolve through here so they cannot disagree on the source.
|
|
17
|
+
*/
|
|
18
|
+
export declare function selectPayload(data: DuFramework.ContentValidationData | undefined, processedDocument: ProcessedDocument | undefined): SelectedPayload;
|
|
19
|
+
//# sourceMappingURL=payloadSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payloadSource.d.ts","sourceRoot":"","sources":["../src/payloadSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,wDAAwD;AACxD,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAC,qBAAqB,CAAC;IAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAAE,GAC1E;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,GAC1D;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAExD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,WAAW,CAAC,qBAAqB,GAAG,SAAS,EACnD,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,GAC/C,eAAe,CAIjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `data` wins when both payloads are set, matching the web component. Loading
|
|
3
|
+
* and saving both resolve through here so they cannot disagree on the source.
|
|
4
|
+
*/
|
|
5
|
+
export function selectPayload(data, processedDocument) {
|
|
6
|
+
if (data)
|
|
7
|
+
return { data };
|
|
8
|
+
if (processedDocument)
|
|
9
|
+
return { processedDocument };
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=payloadSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payloadSource.js","sourceRoot":"","sources":["../src/payloadSource.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAmD,EACnD,iBAAgD;IAEhD,IAAI,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAI,iBAAiB;QAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IACpD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
2
|
+
import type { IxpDocumentArtifacts } from "../types.js";
|
|
3
|
+
import type { ProcessedDocument } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Fetches a {@link ProcessedDocument}'s artifacts, ready to pass as the
|
|
6
|
+
* `artifacts` prop — the same fetch the widgets run when given `sdk` +
|
|
7
|
+
* `processedDocument`. Opens on the draft last saved against the producing
|
|
8
|
+
* span, else on the payload's result. A call while the same `sdk` is already
|
|
9
|
+
* loading the same `processedDocument` shares that load.
|
|
10
|
+
*
|
|
11
|
+
* @throws if the payload is not a renderable extraction, or its run's trace
|
|
12
|
+
* does not describe exactly one digitized document.
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchProcessedDocumentArtifacts(sdk: UiPath, processedDocument: ProcessedDocument): Promise<IxpDocumentArtifacts>;
|
|
15
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/processedDocument/artifacts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMxD,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAgDpB;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,iBAAiB,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAgB/B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { gunzipSync, strFromU8 } from "fflate";
|
|
2
|
+
import { parseDigitizedDocument } from "./dom.js";
|
|
3
|
+
import { validateProcessedDocument } from "./payload.js";
|
|
4
|
+
import { createPlatformClient } from "./platformClient.js";
|
|
5
|
+
import { parseReview } from "./review.js";
|
|
6
|
+
import { resolveDocumentArtifacts } from "./spans.js";
|
|
7
|
+
// The viewer takes a data URI, which the `ContentValidationData` artifact
|
|
8
|
+
// already is; this one is bare bytes.
|
|
9
|
+
const PDF_DATA_URI_PREFIX = "data:application/pdf;base64,";
|
|
10
|
+
// Chunked because `String.fromCharCode` takes one argument per byte: spreading
|
|
11
|
+
// a whole PDF throws a RangeError.
|
|
12
|
+
const CHUNK_SIZE = 8192;
|
|
13
|
+
const toBase64 = (data) => {
|
|
14
|
+
const bytes = new Uint8Array(data);
|
|
15
|
+
let binary = "";
|
|
16
|
+
for (let offset = 0; offset < bytes.length; offset += CHUNK_SIZE) {
|
|
17
|
+
binary += String.fromCharCode(...bytes.subarray(offset, offset + CHUNK_SIZE));
|
|
18
|
+
}
|
|
19
|
+
return btoa(binary);
|
|
20
|
+
};
|
|
21
|
+
// The pipeline's DOM and OCR text are raw gzip streams, not ZIP archives like
|
|
22
|
+
// the `ContentValidationData` artifacts.
|
|
23
|
+
const gunzipToText = (data) => strFromU8(gunzipSync(new Uint8Array(data)));
|
|
24
|
+
// A failed lookup fails the load: opening on the payload's result instead
|
|
25
|
+
// would let the next save overwrite the reviewer's draft with it.
|
|
26
|
+
async function resultToOpenOn(client, anchor, payloadResult) {
|
|
27
|
+
const record = await client.findFeedback(anchor);
|
|
28
|
+
const recorded = record?.metadata ? parseReview(record.metadata) : null;
|
|
29
|
+
return recorded ?? payloadResult;
|
|
30
|
+
}
|
|
31
|
+
// Loads under way, by SDK and payload. React's StrictMode runs effects twice in
|
|
32
|
+
// development, and a host may remount quickly; both would otherwise send every
|
|
33
|
+
// request again. Keyed by the payload object, not its trace, so two payloads
|
|
34
|
+
// never share a result, and dropped once settled: a later load fetches afresh,
|
|
35
|
+
// and a failed one is never reused.
|
|
36
|
+
const loadsInFlight = new WeakMap();
|
|
37
|
+
/**
|
|
38
|
+
* Fetches a {@link ProcessedDocument}'s artifacts, ready to pass as the
|
|
39
|
+
* `artifacts` prop — the same fetch the widgets run when given `sdk` +
|
|
40
|
+
* `processedDocument`. Opens on the draft last saved against the producing
|
|
41
|
+
* span, else on the payload's result. A call while the same `sdk` is already
|
|
42
|
+
* loading the same `processedDocument` shares that load.
|
|
43
|
+
*
|
|
44
|
+
* @throws if the payload is not a renderable extraction, or its run's trace
|
|
45
|
+
* does not describe exactly one digitized document.
|
|
46
|
+
*/
|
|
47
|
+
export function fetchProcessedDocumentArtifacts(sdk, processedDocument) {
|
|
48
|
+
let bySdk = loadsInFlight.get(sdk);
|
|
49
|
+
if (!bySdk) {
|
|
50
|
+
bySdk = new WeakMap();
|
|
51
|
+
loadsInFlight.set(sdk, bySdk);
|
|
52
|
+
}
|
|
53
|
+
const inFlight = bySdk.get(processedDocument);
|
|
54
|
+
if (inFlight)
|
|
55
|
+
return inFlight;
|
|
56
|
+
const load = loadArtifacts(sdk, processedDocument);
|
|
57
|
+
bySdk.set(processedDocument, load);
|
|
58
|
+
const settle = () => {
|
|
59
|
+
if (bySdk.get(processedDocument) === load)
|
|
60
|
+
bySdk.delete(processedDocument);
|
|
61
|
+
};
|
|
62
|
+
load.then(settle, settle);
|
|
63
|
+
return load;
|
|
64
|
+
}
|
|
65
|
+
async function loadArtifacts(sdk, processedDocument) {
|
|
66
|
+
const { taxonomy, extraction, anchor } = validateProcessedDocument(processedDocument);
|
|
67
|
+
const client = createPlatformClient(sdk);
|
|
68
|
+
const refs = resolveDocumentArtifacts(await client.getSpans(anchor.traceId));
|
|
69
|
+
const read = async (ref) => client.readBytes(await client.getEcsReadUri(ref, anchor));
|
|
70
|
+
const [original, dom, text, extractionResult] = await Promise.all([
|
|
71
|
+
read(refs.document).then((bytes) => PDF_DATA_URI_PREFIX + toBase64(bytes)),
|
|
72
|
+
read(refs.dom).then((bytes) => parseDigitizedDocument(gunzipToText(bytes))),
|
|
73
|
+
// Optional, so an unreadable one opens the document without it.
|
|
74
|
+
refs.text ? read(refs.text).then(gunzipToText, () => "") : "",
|
|
75
|
+
resultToOpenOn(client, anchor, extraction),
|
|
76
|
+
]);
|
|
77
|
+
return {
|
|
78
|
+
taxonomy,
|
|
79
|
+
extractionResult,
|
|
80
|
+
dom,
|
|
81
|
+
text,
|
|
82
|
+
customizationInfo: {},
|
|
83
|
+
original,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/processedDocument/artifacts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAuB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAOtD,0EAA0E;AAC1E,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAE3D,+EAA+E;AAC/E,mCAAmC;AACnC,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAU,EAAE;IAC7C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,CAAC;QACjE,MAAM,IAAI,MAAM,CAAC,YAAY,CAC3B,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAC/C,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,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,CAAC,CAAC,CAAC,CAAC,EAAE;QAC7D,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;KAC3C,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ;QACR,gBAAgB;QAChB,GAAG;QACH,IAAI;QACJ,iBAAiB,EAAE,EAAE;QACrB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
2
|
+
/**
|
|
3
|
+
* The pipeline serializes the DOM with camelCase keys; the DU contracts are
|
|
4
|
+
* PascalCase. An artifact that already arrives PascalCase passes through.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseDigitizedDocument(json: string): DuFramework.DocumentEntity;
|
|
7
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/processedDocument/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AA4CpF;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GACX,WAAW,CAAC,cAAc,CAW5B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { refuse } from "./payload.js";
|
|
2
|
+
const toPascalCase = (key) => key.charAt(0).toUpperCase() + key.slice(1);
|
|
3
|
+
// Safe to rename every key: nothing in a DOM is a keyed map (its metadata
|
|
4
|
+
// travels as `{ Key, Value }` pairs), so no key is data.
|
|
5
|
+
const withPascalCaseKeys = (value) => {
|
|
6
|
+
if (Array.isArray(value))
|
|
7
|
+
return value.map(withPascalCaseKeys);
|
|
8
|
+
if (value == null || typeof value !== "object")
|
|
9
|
+
return value;
|
|
10
|
+
return Object.fromEntries(Object.entries(value).map(([key, nested]) => [
|
|
11
|
+
toPascalCase(key),
|
|
12
|
+
withPascalCaseKeys(nested),
|
|
13
|
+
]));
|
|
14
|
+
};
|
|
15
|
+
// Refused rather than passed on: the web component walks every level unguarded,
|
|
16
|
+
// so a partial model would surface as a TypeError.
|
|
17
|
+
const isDigitizedDocument = (dom) => {
|
|
18
|
+
const pages = dom?.Pages;
|
|
19
|
+
return (Array.isArray(pages) &&
|
|
20
|
+
pages.every((page) => Array.isArray(page?.Size) &&
|
|
21
|
+
Array.isArray(page?.Sections) &&
|
|
22
|
+
page.Sections.every((section) => Array.isArray(section?.WordGroups) &&
|
|
23
|
+
section.WordGroups.every((group) => Array.isArray(group?.Words) &&
|
|
24
|
+
group.Words.every((word) => Array.isArray(word?.Box))))));
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The pipeline serializes the DOM with camelCase keys; the DU contracts are
|
|
28
|
+
* PascalCase. An artifact that already arrives PascalCase passes through.
|
|
29
|
+
*/
|
|
30
|
+
export function parseDigitizedDocument(json) {
|
|
31
|
+
let parsed;
|
|
32
|
+
try {
|
|
33
|
+
parsed = withPascalCaseKeys(JSON.parse(json));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
refuse("the resolved document object model could not be read");
|
|
37
|
+
}
|
|
38
|
+
if (!isDigitizedDocument(parsed)) {
|
|
39
|
+
refuse("the resolved document object model is not a digitized document");
|
|
40
|
+
}
|
|
41
|
+
return parsed;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/processedDocument/dom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE,CAC3C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE7C,0EAA0E;AAC1E,yDAAyD;AACzD,MAAM,kBAA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,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAY;IAEZ,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,sDAAsD,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,gEAAgE,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,MAAoC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 declare class PlatformCallError extends Error {
|
|
8
|
+
readonly status: number;
|
|
9
|
+
/** The start of the service's response; never sent to telemetry. */
|
|
10
|
+
readonly detail: string;
|
|
11
|
+
constructor(operation: string, status: number,
|
|
12
|
+
/** The start of the service's response; never sent to telemetry. */
|
|
13
|
+
detail: string);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The error as a host-facing result reports it: the message, plus the
|
|
17
|
+
* service's detail when there is one. Not for telemetry.
|
|
18
|
+
*/
|
|
19
|
+
export declare function describeForHost(error: unknown): string;
|
|
20
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/processedDocument/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAGxC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAHvB,SAAS,EAAE,MAAM,EACR,MAAM,EAAE,MAAM;IACvB,oEAAoE;IAC3D,MAAM,EAAE,MAAM;CAK1B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKtD"}
|
|
@@ -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"}
|