@codemation/core-nodes-ocr 0.2.7 → 0.2.8
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/CHANGELOG.md +9 -0
- package/dist/{analyzeInvoiceNode-BqZsN8iL.js → analyzeInvoiceNode-BQzww-XC.js} +1 -9
- package/dist/analyzeInvoiceNode-BQzww-XC.js.map +1 -0
- package/dist/{analyzeInvoiceNode-CmMsifbw.cjs → analyzeInvoiceNode-CW_SXNQf.cjs} +1 -9
- package/dist/analyzeInvoiceNode-CW_SXNQf.cjs.map +1 -0
- package/dist/codemation.plugin.cjs +178 -346
- package/dist/codemation.plugin.cjs.map +1 -1
- package/dist/codemation.plugin.d.cts +1 -73
- package/dist/codemation.plugin.d.ts +1 -58
- package/dist/codemation.plugin.js +179 -347
- package/dist/codemation.plugin.js.map +1 -1
- package/dist/{index-RNoZqCPr.d.ts → index-DdjAAXvy.d.ts} +9 -291
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -46
- package/dist/index.d.ts +7 -29
- package/dist/index.js +1 -1
- package/dist/metadata.json +1 -1
- package/dist/{runtimeTypes-B6RO-Yki.d.cts → runtimeTypes-D_9j5Pat.d.cts} +9 -259
- package/package.json +2 -2
- package/src/lib/analyzeWithAzure.ts +0 -9
- package/src/nodes/analyzeDocumentNode.ts +0 -9
- package/src/nodes/analyzeImageNode.ts +0 -9
- package/src/nodes/analyzeInvoiceNode.ts +0 -4
- package/dist/analyzeInvoiceNode-BqZsN8iL.js.map +0 -1
- package/dist/analyzeInvoiceNode-CmMsifbw.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as CredentialMaterialSourceKind, a as RunId, b as NodeId, d as CredentialAccessTokenSessionFactory, f as CredentialAdvancedSectionPresentation, g as CredentialJsonRecord, h as CredentialHealthTester, i as RunDataSnapshot, l as TypeToken, m as CredentialFieldSchema, n as Items, o as RunnableNodeConfig, p as CredentialAuthDefinition, r as NodeActivationId, t as Item, u as AnyCredentialType, v as CredentialSessionFactory, x as WorkflowId, y as CredentialTypeId } from "./runtimeTypes-D_9j5Pat.cjs";
|
|
2
2
|
import { ZodType } from "zod";
|
|
3
3
|
import { AnalysisResult } from "@azure/ai-content-understanding";
|
|
4
4
|
|
|
@@ -10,9 +10,6 @@ type ItemExprResolvedContext = Readonly<{
|
|
|
10
10
|
activationId: NodeActivationId;
|
|
11
11
|
data: RunDataSnapshot;
|
|
12
12
|
}>;
|
|
13
|
-
/**
|
|
14
|
-
* Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
|
|
15
|
-
*/
|
|
16
13
|
type ItemExprContext = ItemExprResolvedContext;
|
|
17
14
|
type ItemExprArgs<TItemJson = unknown> = Readonly<{
|
|
18
15
|
item: Item<TItemJson>;
|
|
@@ -31,20 +28,6 @@ type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
|
|
|
31
28
|
type ParamDeep<T, TItemJson = unknown> = Expr<T, TItemJson> | (T extends readonly (infer U)[] ? ReadonlyArray<ParamDeep<U, TItemJson>> : never) | (T extends object ? { [K in keyof T]: ParamDeep<T[K], TItemJson> } : T);
|
|
32
29
|
//#endregion
|
|
33
30
|
//#region ../core/src/authoring/nodeBaseOptions.types.d.ts
|
|
34
|
-
/**
|
|
35
|
-
* Core-local copy of the per-instance authoring options every `define*` factory's `create(...)`
|
|
36
|
-
* accepts in its trailing argument: a stable `id` plus a plain-language `description` (the
|
|
37
|
-
* non-technical "what does this step do" line surfaced in the node sidebar).
|
|
38
|
-
*
|
|
39
|
-
* `description` is a first-class option — passed inline exactly like `id` — and is threaded onto
|
|
40
|
-
* the config instance as an OWN ENUMERABLE field so it flows into the persisted workflow snapshot
|
|
41
|
-
* (`WorkflowSnapshotCodec` serializes via `JSON.parse(JSON.stringify(config))`, which only captures
|
|
42
|
-
* own enumerable properties — never a getter).
|
|
43
|
-
*
|
|
44
|
-
* `@codemation/core-nodes` declares an identical `NodeBaseOptions` for its bare-id built-in nodes;
|
|
45
|
-
* core keeps its own copy because core must not depend on `@codemation/core-nodes` (dependency
|
|
46
|
-
* direction). The two types are structurally identical by design.
|
|
47
|
-
*/
|
|
48
31
|
interface NodeBaseOptions {
|
|
49
32
|
readonly id?: string;
|
|
50
33
|
readonly description?: string;
|
|
@@ -96,6 +79,12 @@ declare const azureContentUnderstandingCredentialType: Readonly<{
|
|
|
96
79
|
endpoint: string;
|
|
97
80
|
apiKey: string;
|
|
98
81
|
}>>;
|
|
82
|
+
createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<{
|
|
83
|
+
endpoint: unknown;
|
|
84
|
+
}, Readonly<{
|
|
85
|
+
endpoint: string;
|
|
86
|
+
apiKey: string;
|
|
87
|
+
}>> | undefined;
|
|
99
88
|
test: CredentialHealthTester<{
|
|
100
89
|
endpoint: unknown;
|
|
101
90
|
}, {
|
|
@@ -106,41 +95,24 @@ declare const azureContentUnderstandingCredentialType: Readonly<{
|
|
|
106
95
|
};
|
|
107
96
|
//#endregion
|
|
108
97
|
//#region src/lib/analyzeWithAzure.d.ts
|
|
109
|
-
/** Structured analyzer fields: scalars at leaves; nested objects and arrays preserved. */
|
|
110
98
|
type OcrStructuredFields = Readonly<Record<string, unknown>>;
|
|
111
|
-
/** The output shape returned by all OCR analyzer nodes. */
|
|
112
99
|
type OcrAnalysisOutput = Readonly<{
|
|
113
|
-
/** Markdown representation of the document content. */
|
|
114
100
|
content: string;
|
|
115
|
-
/** Structured fields extracted by the prebuilt analyzer. */
|
|
116
101
|
fields: OcrStructuredFields;
|
|
117
102
|
}>;
|
|
118
|
-
/**
|
|
119
|
-
* Analyzes a binary document using an Azure Content Understanding prebuilt analyzer.
|
|
120
|
-
* Retries on transient failures are handled by the engine via the node's `retryPolicy`.
|
|
121
|
-
*/
|
|
122
103
|
declare function analyzeWithAzure(args: Readonly<{
|
|
123
104
|
session: AzureContentUnderstandingSession;
|
|
124
105
|
analyzerId: string;
|
|
125
106
|
body: Uint8Array;
|
|
126
107
|
contentType: string;
|
|
127
108
|
}>): Promise<OcrAnalysisOutput>;
|
|
128
|
-
/** @internal Exported for testing — maps a raw AnalysisResult to the node output shape. */
|
|
129
109
|
declare function mapAnalysisResult(result: AnalysisResult): OcrAnalysisOutput;
|
|
130
110
|
//#endregion
|
|
131
111
|
//#region src/nodes/analyzeDocumentNode.d.ts
|
|
132
112
|
type AnalyzeDocumentConfig = Readonly<{
|
|
133
|
-
/** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
|
|
134
113
|
binaryField?: string;
|
|
135
|
-
/** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
|
|
136
114
|
contentType?: string;
|
|
137
|
-
/**
|
|
138
|
-
* Azure Content Understanding analyzer ID to use.
|
|
139
|
-
* Defaults to `"prebuilt-document"`. Set this to a custom analyzer ID when you have
|
|
140
|
-
* a trained model or need a different prebuilt variant.
|
|
141
|
-
*/
|
|
142
115
|
analyzerId?: string;
|
|
143
|
-
/** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
|
|
144
116
|
maxBytes?: number;
|
|
145
117
|
}>;
|
|
146
118
|
declare const analyzeDocumentNode: DefinedNode<"azure-ocr.analyze-document", {
|
|
@@ -161,17 +133,9 @@ declare const analyzeDocumentNode: DefinedNode<"azure-ocr.analyze-document", {
|
|
|
161
133
|
//#endregion
|
|
162
134
|
//#region src/nodes/analyzeImageNode.d.ts
|
|
163
135
|
type AnalyzeImageConfig = Readonly<{
|
|
164
|
-
/** Key on `item.binary` that holds the image bytes. Default: `"data"`. */
|
|
165
136
|
binaryField?: string;
|
|
166
|
-
/** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
|
|
167
137
|
contentType?: string;
|
|
168
|
-
/**
|
|
169
|
-
* Azure Content Understanding analyzer ID to use.
|
|
170
|
-
* Defaults to `"prebuilt-imageAnalyzer"`. Set this to a custom analyzer ID when you have
|
|
171
|
-
* a trained model or need a different prebuilt variant.
|
|
172
|
-
*/
|
|
173
138
|
analyzerId?: string;
|
|
174
|
-
/** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
|
|
175
139
|
maxBytes?: number;
|
|
176
140
|
}>;
|
|
177
141
|
declare const analyzeImageNode: DefinedNode<"azure-ocr.analyze-image", {
|
|
@@ -192,11 +156,8 @@ declare const analyzeImageNode: DefinedNode<"azure-ocr.analyze-image", {
|
|
|
192
156
|
//#endregion
|
|
193
157
|
//#region src/nodes/analyzeInvoiceNode.d.ts
|
|
194
158
|
type AnalyzeInvoiceConfig = Readonly<{
|
|
195
|
-
/** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
|
|
196
159
|
binaryField?: string;
|
|
197
|
-
/** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
|
|
198
160
|
contentType?: string;
|
|
199
|
-
/** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
|
|
200
161
|
maxBytes?: number;
|
|
201
162
|
}>;
|
|
202
163
|
declare const analyzeInvoiceNode: DefinedNode<"azure-ocr.analyze-invoice", {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as
|
|
1
|
+
import { _ as CredentialTypeId, d as CredentialAdvancedSectionPresentation, f as CredentialAuthDefinition, g as CredentialSessionFactory, h as CredentialMaterialSourceKind, l as AnyCredentialType, m as CredentialHealthTester, p as CredentialFieldSchema, s as DefinedNode, u as CredentialAccessTokenSessionFactory } from "./index-DdjAAXvy.js";
|
|
2
2
|
import { AnalysisResult } from "@azure/ai-content-understanding";
|
|
3
3
|
|
|
4
4
|
//#region src/credentials/azureContentUnderstandingCredential.d.ts
|
|
@@ -25,6 +25,12 @@ declare const azureContentUnderstandingCredentialType: Readonly<{
|
|
|
25
25
|
endpoint: string;
|
|
26
26
|
apiKey: string;
|
|
27
27
|
}>>;
|
|
28
|
+
createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<{
|
|
29
|
+
endpoint: unknown;
|
|
30
|
+
}, Readonly<{
|
|
31
|
+
endpoint: string;
|
|
32
|
+
apiKey: string;
|
|
33
|
+
}>> | undefined;
|
|
28
34
|
test: CredentialHealthTester<{
|
|
29
35
|
endpoint: unknown;
|
|
30
36
|
}, {
|
|
@@ -35,41 +41,24 @@ declare const azureContentUnderstandingCredentialType: Readonly<{
|
|
|
35
41
|
};
|
|
36
42
|
//#endregion
|
|
37
43
|
//#region src/lib/analyzeWithAzure.d.ts
|
|
38
|
-
/** Structured analyzer fields: scalars at leaves; nested objects and arrays preserved. */
|
|
39
44
|
type OcrStructuredFields = Readonly<Record<string, unknown>>;
|
|
40
|
-
/** The output shape returned by all OCR analyzer nodes. */
|
|
41
45
|
type OcrAnalysisOutput = Readonly<{
|
|
42
|
-
/** Markdown representation of the document content. */
|
|
43
46
|
content: string;
|
|
44
|
-
/** Structured fields extracted by the prebuilt analyzer. */
|
|
45
47
|
fields: OcrStructuredFields;
|
|
46
48
|
}>;
|
|
47
|
-
/**
|
|
48
|
-
* Analyzes a binary document using an Azure Content Understanding prebuilt analyzer.
|
|
49
|
-
* Retries on transient failures are handled by the engine via the node's `retryPolicy`.
|
|
50
|
-
*/
|
|
51
49
|
declare function analyzeWithAzure(args: Readonly<{
|
|
52
50
|
session: AzureContentUnderstandingSession;
|
|
53
51
|
analyzerId: string;
|
|
54
52
|
body: Uint8Array;
|
|
55
53
|
contentType: string;
|
|
56
54
|
}>): Promise<OcrAnalysisOutput>;
|
|
57
|
-
/** @internal Exported for testing — maps a raw AnalysisResult to the node output shape. */
|
|
58
55
|
declare function mapAnalysisResult(result: AnalysisResult): OcrAnalysisOutput;
|
|
59
56
|
//#endregion
|
|
60
57
|
//#region src/nodes/analyzeDocumentNode.d.ts
|
|
61
58
|
type AnalyzeDocumentConfig = Readonly<{
|
|
62
|
-
/** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
|
|
63
59
|
binaryField?: string;
|
|
64
|
-
/** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
|
|
65
60
|
contentType?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Azure Content Understanding analyzer ID to use.
|
|
68
|
-
* Defaults to `"prebuilt-document"`. Set this to a custom analyzer ID when you have
|
|
69
|
-
* a trained model or need a different prebuilt variant.
|
|
70
|
-
*/
|
|
71
61
|
analyzerId?: string;
|
|
72
|
-
/** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
|
|
73
62
|
maxBytes?: number;
|
|
74
63
|
}>;
|
|
75
64
|
declare const analyzeDocumentNode: DefinedNode<"azure-ocr.analyze-document", {
|
|
@@ -90,17 +79,9 @@ declare const analyzeDocumentNode: DefinedNode<"azure-ocr.analyze-document", {
|
|
|
90
79
|
//#endregion
|
|
91
80
|
//#region src/nodes/analyzeImageNode.d.ts
|
|
92
81
|
type AnalyzeImageConfig = Readonly<{
|
|
93
|
-
/** Key on `item.binary` that holds the image bytes. Default: `"data"`. */
|
|
94
82
|
binaryField?: string;
|
|
95
|
-
/** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
|
|
96
83
|
contentType?: string;
|
|
97
|
-
/**
|
|
98
|
-
* Azure Content Understanding analyzer ID to use.
|
|
99
|
-
* Defaults to `"prebuilt-imageAnalyzer"`. Set this to a custom analyzer ID when you have
|
|
100
|
-
* a trained model or need a different prebuilt variant.
|
|
101
|
-
*/
|
|
102
84
|
analyzerId?: string;
|
|
103
|
-
/** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
|
|
104
85
|
maxBytes?: number;
|
|
105
86
|
}>;
|
|
106
87
|
declare const analyzeImageNode: DefinedNode<"azure-ocr.analyze-image", {
|
|
@@ -121,11 +102,8 @@ declare const analyzeImageNode: DefinedNode<"azure-ocr.analyze-image", {
|
|
|
121
102
|
//#endregion
|
|
122
103
|
//#region src/nodes/analyzeInvoiceNode.d.ts
|
|
123
104
|
type AnalyzeInvoiceConfig = Readonly<{
|
|
124
|
-
/** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
|
|
125
105
|
binaryField?: string;
|
|
126
|
-
/** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
|
|
127
106
|
contentType?: string;
|
|
128
|
-
/** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
|
|
129
107
|
maxBytes?: number;
|
|
130
108
|
}>;
|
|
131
109
|
declare const analyzeInvoiceNode: DefinedNode<"azure-ocr.analyze-invoice", {
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as mapAnalysisResult, i as analyzeWithAzure, n as analyzeImageNode, o as azureContentUnderstandingCredentialType, r as analyzeDocumentNode, t as analyzeInvoiceNode } from "./analyzeInvoiceNode-
|
|
1
|
+
import { a as mapAnalysisResult, i as analyzeWithAzure, n as analyzeImageNode, o as azureContentUnderstandingCredentialType, r as analyzeDocumentNode, t as analyzeInvoiceNode } from "./analyzeInvoiceNode-BQzww-XC.js";
|
|
2
2
|
|
|
3
3
|
export { analyzeDocumentNode, analyzeImageNode, analyzeInvoiceNode, analyzeWithAzure, azureContentUnderstandingCredentialType, mapAnalysisResult };
|
package/dist/metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "@codemation/core-nodes-ocr",
|
|
4
|
-
"packageVersion": "0.2.
|
|
4
|
+
"packageVersion": "0.2.8",
|
|
5
5
|
"description": "Azure AI Content Understanding (OCR) plugin for Codemation — prebuilt document, invoice, and image analyzers.",
|
|
6
6
|
"kind": "nodes",
|
|
7
7
|
"nodes": [
|