@codemation/core-nodes-ocr 0.2.6 → 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.
Files changed (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{analyzeInvoiceNode-BqZsN8iL.js → analyzeInvoiceNode-BQzww-XC.js} +1 -9
  3. package/dist/analyzeInvoiceNode-BQzww-XC.js.map +1 -0
  4. package/dist/{analyzeInvoiceNode-CmMsifbw.cjs → analyzeInvoiceNode-CW_SXNQf.cjs} +1 -9
  5. package/dist/analyzeInvoiceNode-CW_SXNQf.cjs.map +1 -0
  6. package/dist/codemation.plugin.cjs +1204 -14695
  7. package/dist/codemation.plugin.cjs.map +1 -1
  8. package/dist/codemation.plugin.d.cts +1 -73
  9. package/dist/codemation.plugin.d.ts +1 -58
  10. package/dist/codemation.plugin.js +1248 -14738
  11. package/dist/codemation.plugin.js.map +1 -1
  12. package/dist/dist-BDgdLisG.js +5378 -0
  13. package/dist/dist-BDgdLisG.js.map +1 -0
  14. package/dist/dist-BYInIjS8.js +2246 -0
  15. package/dist/dist-BYInIjS8.js.map +1 -0
  16. package/dist/dist-BlD4pqf2.cjs +4358 -0
  17. package/dist/dist-BlD4pqf2.cjs.map +1 -0
  18. package/dist/dist-CUcwHflE.cjs +14870 -0
  19. package/dist/dist-CUcwHflE.cjs.map +1 -0
  20. package/dist/dist-DB2xMXXm.cjs +5380 -0
  21. package/dist/dist-DB2xMXXm.cjs.map +1 -0
  22. package/dist/dist-DBYFkhSG.js +14739 -0
  23. package/dist/dist-DBYFkhSG.js.map +1 -0
  24. package/dist/dist-DZfaPW8T.js +4356 -0
  25. package/dist/dist-DZfaPW8T.js.map +1 -0
  26. package/dist/dist-Zdvm5pqX.cjs +2464 -0
  27. package/dist/dist-Zdvm5pqX.cjs.map +1 -0
  28. package/dist/{index-DF2ht42F.d.ts → index-DdjAAXvy.d.ts} +18 -274
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +15 -35
  31. package/dist/index.d.ts +7 -29
  32. package/dist/index.js +1 -1
  33. package/dist/metadata.json +1 -1
  34. package/dist/{runtimeTypes-WCvsnJMY.d.cts → runtimeTypes-D_9j5Pat.d.cts} +10 -253
  35. package/dist/{token-CgF09kyP.cjs → token-Cbd8b88n.cjs} +2 -2
  36. package/dist/{token-CgF09kyP.cjs.map → token-Cbd8b88n.cjs.map} +1 -1
  37. package/dist/{token-CIu4PqRI.js → token-P-r3QR1d.js} +2 -2
  38. package/dist/{token-CIu4PqRI.js.map → token-P-r3QR1d.js.map} +1 -1
  39. package/dist/{token-util-B2kSJtEV.cjs → token-util-B2Ofk2zk.cjs} +77 -77
  40. package/dist/token-util-B2Ofk2zk.cjs.map +1 -0
  41. package/dist/{token-util-Lr5foG4r.cjs → token-util-CT85hbGe.cjs} +1 -1
  42. package/dist/{token-util-EUxa8JtH.js → token-util-CfNdwRXi.js} +77 -77
  43. package/dist/token-util-CfNdwRXi.js.map +1 -0
  44. package/dist/token-util-rTxWuZPt.js +5 -0
  45. package/package.json +2 -2
  46. package/src/lib/analyzeWithAzure.ts +0 -9
  47. package/src/nodes/analyzeDocumentNode.ts +0 -9
  48. package/src/nodes/analyzeImageNode.ts +0 -9
  49. package/src/nodes/analyzeInvoiceNode.ts +0 -4
  50. package/dist/analyzeInvoiceNode-BqZsN8iL.js.map +0 -1
  51. package/dist/analyzeInvoiceNode-CmMsifbw.cjs.map +0 -1
  52. package/dist/token-util-B2kSJtEV.cjs.map +0 -1
  53. package/dist/token-util-BsR6OYHz.js +0 -5
  54. package/dist/token-util-EUxa8JtH.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,9 +1,8 @@
1
- import { _ as CredentialSessionFactory, a as RunId, b as WorkflowId, d as CredentialAdvancedSectionPresentation, f as CredentialAuthDefinition, g as CredentialMaterialSourceKind, h as CredentialJsonRecord, i as RunDataSnapshot, l as TypeToken, m as CredentialHealthTester, n as Items, o as RunnableNodeConfig, p as CredentialFieldSchema, r as NodeActivationId, t as Item, u as AnyCredentialType, v as CredentialTypeId, y as NodeId } from "./runtimeTypes-WCvsnJMY.cjs";
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
 
5
5
  //#region ../core/src/contracts/itemExpr.d.ts
6
- declare const ITEM_EXPR_BRAND: unique symbol;
7
6
  type ItemExprResolvedContext = Readonly<{
8
7
  runId: RunId;
9
8
  workflowId: WorkflowId;
@@ -11,9 +10,6 @@ type ItemExprResolvedContext = Readonly<{
11
10
  activationId: NodeActivationId;
12
11
  data: RunDataSnapshot;
13
12
  }>;
14
- /**
15
- * Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
16
- */
17
13
  type ItemExprContext = ItemExprResolvedContext;
18
14
  type ItemExprArgs<TItemJson = unknown> = Readonly<{
19
15
  item: Item<TItemJson>;
@@ -23,7 +19,7 @@ type ItemExprArgs<TItemJson = unknown> = Readonly<{
23
19
  }>;
24
20
  type ItemExprCallback<T, TItemJson = unknown> = (args: ItemExprArgs<TItemJson>) => T | Promise<T>;
25
21
  type ItemExpr<T, TItemJson = unknown> = Readonly<{
26
- readonly [ITEM_EXPR_BRAND]: true;
22
+ readonly __codemationItemExpr: "codemation.itemExpr";
27
23
  readonly fn: ItemExprCallback<T, TItemJson>;
28
24
  }>;
29
25
  //#endregion
@@ -31,6 +27,12 @@ type ItemExpr<T, TItemJson = unknown> = Readonly<{
31
27
  type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
32
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);
33
29
  //#endregion
30
+ //#region ../core/src/authoring/nodeBaseOptions.types.d.ts
31
+ interface NodeBaseOptions {
32
+ readonly id?: string;
33
+ readonly description?: string;
34
+ }
35
+ //#endregion
34
36
  //#region ../core/src/authoring/defineNode.types.d.ts
35
37
  type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
36
38
  type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
@@ -47,7 +49,7 @@ interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecor
47
49
  readonly key: TKey$1;
48
50
  readonly title: string;
49
51
  readonly description?: string;
50
- create<TConfigItemJson = TInputJson>(config: DefinedNodeConfigInput<TConfig, TConfigItemJson>, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson>;
52
+ create<TConfigItemJson = TInputJson>(config: DefinedNodeConfigInput<TConfig, TConfigItemJson>, name?: string, idOrOptions?: string | NodeBaseOptions): RunnableNodeConfig<TInputJson, TOutputJson>;
51
53
  register(context: {
52
54
  registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
53
55
  }): void;
@@ -77,6 +79,12 @@ declare const azureContentUnderstandingCredentialType: Readonly<{
77
79
  endpoint: string;
78
80
  apiKey: string;
79
81
  }>>;
82
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<{
83
+ endpoint: unknown;
84
+ }, Readonly<{
85
+ endpoint: string;
86
+ apiKey: string;
87
+ }>> | undefined;
80
88
  test: CredentialHealthTester<{
81
89
  endpoint: unknown;
82
90
  }, {
@@ -87,41 +95,24 @@ declare const azureContentUnderstandingCredentialType: Readonly<{
87
95
  };
88
96
  //#endregion
89
97
  //#region src/lib/analyzeWithAzure.d.ts
90
- /** Structured analyzer fields: scalars at leaves; nested objects and arrays preserved. */
91
98
  type OcrStructuredFields = Readonly<Record<string, unknown>>;
92
- /** The output shape returned by all OCR analyzer nodes. */
93
99
  type OcrAnalysisOutput = Readonly<{
94
- /** Markdown representation of the document content. */
95
100
  content: string;
96
- /** Structured fields extracted by the prebuilt analyzer. */
97
101
  fields: OcrStructuredFields;
98
102
  }>;
99
- /**
100
- * Analyzes a binary document using an Azure Content Understanding prebuilt analyzer.
101
- * Retries on transient failures are handled by the engine via the node's `retryPolicy`.
102
- */
103
103
  declare function analyzeWithAzure(args: Readonly<{
104
104
  session: AzureContentUnderstandingSession;
105
105
  analyzerId: string;
106
106
  body: Uint8Array;
107
107
  contentType: string;
108
108
  }>): Promise<OcrAnalysisOutput>;
109
- /** @internal Exported for testing — maps a raw AnalysisResult to the node output shape. */
110
109
  declare function mapAnalysisResult(result: AnalysisResult): OcrAnalysisOutput;
111
110
  //#endregion
112
111
  //#region src/nodes/analyzeDocumentNode.d.ts
113
112
  type AnalyzeDocumentConfig = Readonly<{
114
- /** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
115
113
  binaryField?: string;
116
- /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
117
114
  contentType?: string;
118
- /**
119
- * Azure Content Understanding analyzer ID to use.
120
- * Defaults to `"prebuilt-document"`. Set this to a custom analyzer ID when you have
121
- * a trained model or need a different prebuilt variant.
122
- */
123
115
  analyzerId?: string;
124
- /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
125
116
  maxBytes?: number;
126
117
  }>;
127
118
  declare const analyzeDocumentNode: DefinedNode<"azure-ocr.analyze-document", {
@@ -142,17 +133,9 @@ declare const analyzeDocumentNode: DefinedNode<"azure-ocr.analyze-document", {
142
133
  //#endregion
143
134
  //#region src/nodes/analyzeImageNode.d.ts
144
135
  type AnalyzeImageConfig = Readonly<{
145
- /** Key on `item.binary` that holds the image bytes. Default: `"data"`. */
146
136
  binaryField?: string;
147
- /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
148
137
  contentType?: string;
149
- /**
150
- * Azure Content Understanding analyzer ID to use.
151
- * Defaults to `"prebuilt-imageAnalyzer"`. Set this to a custom analyzer ID when you have
152
- * a trained model or need a different prebuilt variant.
153
- */
154
138
  analyzerId?: string;
155
- /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
156
139
  maxBytes?: number;
157
140
  }>;
158
141
  declare const analyzeImageNode: DefinedNode<"azure-ocr.analyze-image", {
@@ -173,11 +156,8 @@ declare const analyzeImageNode: DefinedNode<"azure-ocr.analyze-image", {
173
156
  //#endregion
174
157
  //#region src/nodes/analyzeInvoiceNode.d.ts
175
158
  type AnalyzeInvoiceConfig = Readonly<{
176
- /** Key on `item.binary` that holds the document bytes. Default: `"data"`. */
177
159
  binaryField?: string;
178
- /** MIME type override sent to the analyzer. Falls back to attachment `mimeType` when not set. */
179
160
  contentType?: string;
180
- /** Max bytes the attachment may have before reading. Defaults to 50 MiB. */
181
161
  maxBytes?: number;
182
162
  }>;
183
163
  declare const analyzeInvoiceNode: DefinedNode<"azure-ocr.analyze-invoice", {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as CredentialAuthDefinition, f as CredentialFieldSchema, g as CredentialTypeId, h as CredentialSessionFactory, l as AnyCredentialType, m as CredentialMaterialSourceKind, p as CredentialHealthTester, s as DefinedNode, u as CredentialAdvancedSectionPresentation } from "./index-DF2ht42F.js";
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-BqZsN8iL.js";
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 };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "packageName": "@codemation/core-nodes-ocr",
4
- "packageVersion": "0.2.6",
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": [