docxodus 12.4.1 → 12.5.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.
Files changed (59) hide show
  1. package/README.md +78 -0
  2. package/dist/core.d.ts +4 -4
  3. package/dist/core.d.ts.map +1 -1
  4. package/dist/core.js +21 -200
  5. package/dist/core.js.map +1 -1
  6. package/dist/docxodus.worker.js +280 -7
  7. package/dist/docxodus.worker.js.map +1 -1
  8. package/dist/editor-reconcile.d.ts +5 -0
  9. package/dist/editor-reconcile.d.ts.map +1 -1
  10. package/dist/editor-reconcile.js.map +1 -1
  11. package/dist/editor.bundle.js +157 -15
  12. package/dist/editor.d.ts +44 -0
  13. package/dist/editor.d.ts.map +1 -1
  14. package/dist/editor.js +209 -22
  15. package/dist/editor.js.map +1 -1
  16. package/dist/embed.bundle.js +560 -217
  17. package/dist/embed.iife.js +560 -217
  18. package/dist/export-assets.json +20 -20
  19. package/dist/export-browser.bundle.js +101 -4
  20. package/dist/external-annotation-wire.d.ts +19 -0
  21. package/dist/external-annotation-wire.d.ts.map +1 -0
  22. package/dist/external-annotation-wire.js +139 -0
  23. package/dist/external-annotation-wire.js.map +1 -0
  24. package/dist/session.bundle.js +258 -7
  25. package/dist/session.d.ts +61 -12
  26. package/dist/session.d.ts.map +1 -1
  27. package/dist/session.js +234 -7
  28. package/dist/session.js.map +1 -1
  29. package/dist/types.d.ts +371 -4
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/types.js.map +1 -1
  32. package/dist/verification-request.d.ts +9 -0
  33. package/dist/verification-request.d.ts.map +1 -0
  34. package/dist/verification-request.js +37 -0
  35. package/dist/verification-request.js.map +1 -0
  36. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  37. package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
  38. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  39. package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
  40. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  41. package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
  42. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
  43. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm.br +0 -0
  44. package/dist/wasm/_framework/System.Security.Cryptography.wasm +0 -0
  45. package/dist/wasm/_framework/System.Security.Cryptography.wasm.br +0 -0
  46. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm +0 -0
  47. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm.br +0 -0
  48. package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
  49. package/dist/wasm/_framework/System.Text.Json.wasm.br +0 -0
  50. package/dist/wasm/_framework/dotnet.boot.js +9 -9
  51. package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
  52. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  53. package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
  54. package/dist/worker-proxy.bundle.js +101 -4
  55. package/dist/worker-proxy.d.ts +21 -3
  56. package/dist/worker-proxy.d.ts.map +1 -1
  57. package/dist/worker-proxy.js +57 -2
  58. package/dist/worker-proxy.js.map +1 -1
  59. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "schema": "https://docxodus.dev/schemas/export/export-assets/v1",
3
3
  "schemaVersion": 1,
4
- "packageVersion": "12.4.1",
4
+ "packageVersion": "12.5.0",
5
5
  "assets": [
6
6
  {
7
7
  "path": "./docxodus.worker.js",
8
8
  "mediaType": "text/javascript",
9
- "byteLength": 24687,
10
- "sha256": "7df9140c9554700f668539b84c61ac700b150404c4d861a346522154d6c787d7"
9
+ "byteLength": 34100,
10
+ "sha256": "d1f99e117dd531896d72c4ed30aa89a32790ff8dfccc3c12edd297506df39282"
11
11
  },
12
12
  {
13
13
  "path": "./export-browser.bundle.js",
14
14
  "mediaType": "text/javascript",
15
- "byteLength": 324788,
16
- "sha256": "8b0e71f4c52137f689d3317560f5614f15e208b250d37d13a51b55f03ee5f3fc"
15
+ "byteLength": 328496,
16
+ "sha256": "1a44e2ded4b32612022e413cd8c9a8e6240e9c8c6ee5376195a9d18f00e07eea"
17
17
  },
18
18
  {
19
19
  "path": "./export-resource-limits-v1.json",
@@ -48,14 +48,14 @@
48
48
  {
49
49
  "path": "./wasm/_framework/Docxodus.wasm",
50
50
  "mediaType": "application/wasm",
51
- "byteLength": 4023577,
52
- "sha256": "e85ac699b38c911241c317a67b03dbaae9ba0d55539d326651ae9cb830c9f270"
51
+ "byteLength": 4619545,
52
+ "sha256": "0d8c5a6064cef2b935eefb041668da7fe7461e14679a44569d1a3616eef34941"
53
53
  },
54
54
  {
55
55
  "path": "./wasm/_framework/DocxodusWasm.wasm",
56
56
  "mediaType": "application/wasm",
57
- "byteLength": 507669,
58
- "sha256": "b2437a7703b107365de3885468269369dd113c0995b352b721b12781d67035da"
57
+ "byteLength": 520981,
58
+ "sha256": "f0bb0fbec335eb27fa9e57673aaf319b71d682911771f579350e8df845c2902a"
59
59
  },
60
60
  {
61
61
  "path": "./wasm/_framework/System.Collections.Concurrent.wasm",
@@ -168,8 +168,8 @@
168
168
  {
169
169
  "path": "./wasm/_framework/System.Private.CoreLib.wasm",
170
170
  "mediaType": "application/wasm",
171
- "byteLength": 1650965,
172
- "sha256": "f98d0419db49bffd890cba0dd115861d13f3b5f9e9563715ff4df3ec131b4c32"
171
+ "byteLength": 1651477,
172
+ "sha256": "f9ee2281c6a4d626bac4607ae3e1b64a2df4cd1dfbc9a285dbc3e019913d4667"
173
173
  },
174
174
  {
175
175
  "path": "./wasm/_framework/System.Private.Uri.wasm",
@@ -180,8 +180,8 @@
180
180
  {
181
181
  "path": "./wasm/_framework/System.Private.Xml.Linq.wasm",
182
182
  "mediaType": "application/wasm",
183
- "byteLength": 66837,
184
- "sha256": "0771724336274e9905ad9efc0ad35ba223dc0727ff7f13ce69af71f7da66b617"
183
+ "byteLength": 67349,
184
+ "sha256": "557d594fa02c46dddf4a8fac43f6880a66b0f271f9f976c7f755e7f18896b49f"
185
185
  },
186
186
  {
187
187
  "path": "./wasm/_framework/System.Private.Xml.wasm",
@@ -205,19 +205,19 @@
205
205
  "path": "./wasm/_framework/System.Security.Cryptography.wasm",
206
206
  "mediaType": "application/wasm",
207
207
  "byteLength": 25365,
208
- "sha256": "869c61facb62ee61cc443065bc89d8bfd0d4fa8affee4dbc2e67a26816071080"
208
+ "sha256": "c0698926d06df7efb0bdba06e1489b23f061ea810f8e9a666efd0d8f9b008a18"
209
209
  },
210
210
  {
211
211
  "path": "./wasm/_framework/System.Text.Encodings.Web.wasm",
212
212
  "mediaType": "application/wasm",
213
213
  "byteLength": 29461,
214
- "sha256": "f2fa89b092fd244cf3424ee3bdc3831ba18978a6dd44c8b9fbef1a0779612b71"
214
+ "sha256": "7fb8c2aaaa4472a075226792ca9a6c653d810b2e28776aeda842013a3db90039"
215
215
  },
216
216
  {
217
217
  "path": "./wasm/_framework/System.Text.Json.wasm",
218
218
  "mediaType": "application/wasm",
219
- "byteLength": 319253,
220
- "sha256": "d674efa55aa85b0dc268e93a3679a6f32863df2c9f3fc4820877d10eaf206b92"
219
+ "byteLength": 321301,
220
+ "sha256": "7448e3de4c4796314a14fa0869b7b81992dfa627b5624c717d30191b5b0812c2"
221
221
  },
222
222
  {
223
223
  "path": "./wasm/_framework/System.Text.RegularExpressions.wasm",
@@ -247,7 +247,7 @@
247
247
  "path": "./wasm/_framework/dotnet.boot.js",
248
248
  "mediaType": "text/javascript",
249
249
  "byteLength": 9374,
250
- "sha256": "3a62eeaec4190246a75dde64ff5966b04a8b01e6a7097f833a10806b284defcb"
250
+ "sha256": "e6a30494914803e35644dc1db56322d051bf3b2ed2d0b5244a0e2ef14c63e11f"
251
251
  },
252
252
  {
253
253
  "path": "./wasm/_framework/dotnet.js",
@@ -264,8 +264,8 @@
264
264
  {
265
265
  "path": "./wasm/_framework/dotnet.native.wasm",
266
266
  "mediaType": "application/wasm",
267
- "byteLength": 8549598,
268
- "sha256": "7e6f541d9d3c089f3275a6aba43b0412749b25d451fb582117df22347173e004"
267
+ "byteLength": 8485433,
268
+ "sha256": "d2960afcfa2fe5f92ea23e29e7bb6af4f24d3f21d3536a0e8af4440165dcfce5"
269
269
  },
270
270
  {
271
271
  "path": "./wasm/_framework/dotnet.runtime.js",
@@ -3177,6 +3177,37 @@ var PaginationEngine = class {
3177
3177
  }
3178
3178
  };
3179
3179
 
3180
+ // src/verification-request.ts
3181
+ function serializeVerificationRequest(request) {
3182
+ if (request === null || typeof request !== "object" || Array.isArray(request)) {
3183
+ throw new RangeError("a verification request must be an object");
3184
+ }
3185
+ const { companionArtifacts, ...rest } = request;
3186
+ const wire = { ...rest };
3187
+ if (companionArtifacts !== void 0) {
3188
+ wire.companionArtifacts = companionArtifacts.map(encodeCompanion);
3189
+ }
3190
+ return JSON.stringify(wire);
3191
+ }
3192
+ function encodeCompanion(artifact) {
3193
+ const { bytes, ...rest } = artifact;
3194
+ const wire = { ...rest };
3195
+ if (bytes !== void 0) wire.bytesB64 = bytesToBase64(bytes);
3196
+ return wire;
3197
+ }
3198
+ function bytesToBase64(bytes) {
3199
+ if (typeof btoa === "function") {
3200
+ let binary = "";
3201
+ const chunkSize = 32768;
3202
+ for (let i = 0; i < bytes.length; i += chunkSize) {
3203
+ const chunk = bytes.subarray(i, i + chunkSize);
3204
+ binary += String.fromCharCode.apply(null, chunk);
3205
+ }
3206
+ return btoa(binary);
3207
+ }
3208
+ return Buffer.from(bytes).toString("base64");
3209
+ }
3210
+
3180
3211
  // src/worker-proxy.ts
3181
3212
  var WorkerOperationError = class extends Error {
3182
3213
  constructor(message, code) {
@@ -3302,7 +3333,7 @@ async function createWorkerDocxodus(options) {
3302
3333
  );
3303
3334
  return response.manifest;
3304
3335
  },
3305
- async verifyDeliverable(document2, baseline) {
3336
+ async verifyDeliverable(document2, baseline, request) {
3306
3337
  const bytes = await toBytes(document2);
3307
3338
  const baselineBytes = baseline === void 0 ? void 0 : await toBytes(baseline);
3308
3339
  const transfer = [bytes.buffer];
@@ -3312,7 +3343,8 @@ async function createWorkerDocxodus(options) {
3312
3343
  id: generateId(),
3313
3344
  type: "verifyDeliverable",
3314
3345
  documentBytes: bytes,
3315
- baselineBytes
3346
+ baselineBytes,
3347
+ requestJson: request === void 0 ? void 0 : serializeVerificationRequest(request)
3316
3348
  },
3317
3349
  transfer
3318
3350
  );
@@ -3355,6 +3387,70 @@ async function createWorkerDocxodus(options) {
3355
3387
  );
3356
3388
  return response.semanticChanges;
3357
3389
  },
3390
+ async createExternalAnnotationSet(document2, documentId) {
3391
+ const bytes = await toBytes(document2);
3392
+ const response = await sendRequest(
3393
+ { id: generateId(), type: "createExternalAnnotationSet", documentBytes: bytes, documentId },
3394
+ [bytes.buffer]
3395
+ );
3396
+ if (!response.success || !response.annotationSet) {
3397
+ throw new Error(response.error ?? "createExternalAnnotationSet failed");
3398
+ }
3399
+ return response.annotationSet;
3400
+ },
3401
+ async validateExternalAnnotations(document2, annotationSet) {
3402
+ const bytes = await toBytes(document2);
3403
+ const response = await sendRequest(
3404
+ { id: generateId(), type: "validateExternalAnnotations", documentBytes: bytes, annotationSet },
3405
+ [bytes.buffer]
3406
+ );
3407
+ if (!response.success || !response.validation) {
3408
+ throw new Error(response.error ?? "validateExternalAnnotations failed");
3409
+ }
3410
+ return response.validation;
3411
+ },
3412
+ async projectAnnotationsOntoHtml(html, annotationSet, projectionOptions) {
3413
+ const response = await sendRequest({
3414
+ id: generateId(),
3415
+ type: "projectAnnotationsOntoHtml",
3416
+ html,
3417
+ annotationSet,
3418
+ projectionOptions
3419
+ });
3420
+ if (!response.success || response.html === void 0) {
3421
+ throw new Error(response.error ?? "projectAnnotationsOntoHtml failed");
3422
+ }
3423
+ return response.html;
3424
+ },
3425
+ async convertDocxToHtmlWithExternalAnnotations(document2, annotationSet, conversionOptions2, projectionOptions) {
3426
+ const bytes = await toBytes(document2);
3427
+ const response = await sendRequest(
3428
+ {
3429
+ id: generateId(),
3430
+ type: "convertDocxToHtmlWithExternalAnnotations",
3431
+ documentBytes: bytes,
3432
+ annotationSet,
3433
+ conversionOptions: conversionOptions2,
3434
+ projectionOptions
3435
+ },
3436
+ [bytes.buffer]
3437
+ );
3438
+ if (!response.success || response.html === void 0) {
3439
+ throw new Error(response.error ?? "convertDocxToHtmlWithExternalAnnotations failed");
3440
+ }
3441
+ return response.html;
3442
+ },
3443
+ async exportToOpenContract(document2) {
3444
+ const bytes = await toBytes(document2);
3445
+ const response = await sendRequest(
3446
+ { id: generateId(), type: "exportToOpenContract", documentBytes: bytes },
3447
+ [bytes.buffer]
3448
+ );
3449
+ if (!response.success || !response.export) {
3450
+ throw new Error(response.error ?? "exportToOpenContract failed");
3451
+ }
3452
+ return response.export;
3453
+ },
3358
3454
  async generatePackageManifestJson(document2, limits) {
3359
3455
  const bytes = await toBytes(document2);
3360
3456
  const response = await sendRequest(
@@ -3518,11 +3614,12 @@ async function createWorkerDocxodus(options) {
3518
3614
  }
3519
3615
  return res.semanticChanges;
3520
3616
  },
3521
- async verifyDeliverable() {
3617
+ async verifyDeliverable(request) {
3522
3618
  const res = await sendRequest({
3523
3619
  id: generateId(),
3524
3620
  type: "sessionVerifyDeliverable",
3525
- handle
3621
+ handle,
3622
+ requestJson: request === void 0 ? void 0 : serializeVerificationRequest(request)
3526
3623
  });
3527
3624
  if (!res.success || !res.verification) {
3528
3625
  throw new Error(res.error ?? "sessionVerifyDeliverable failed");
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Wire-shape readers for the external annotation family.
3
+ *
4
+ * The engine serializes these results with PascalCase property names (and older builds with
5
+ * camelCase), so every consumer has to normalize them once. The main-thread entry points in
6
+ * `core.ts` and the Web Worker (`docxodus.worker.ts`) both read through here, which is what
7
+ * lets the worker hand back the same typed objects the main thread would without a second
8
+ * copy of the mapping.
9
+ */
10
+ import type { ExternalAnnotationSet, ExternalAnnotationValidationResult, OpenContractDocExport } from "./types.js";
11
+ /** Read an OpenContracts document export from the engine's parsed JSON. */
12
+ export declare function readOpenContractExport(parsed: any): OpenContractDocExport;
13
+ /** Read an external annotation set — an OpenContracts export plus identity and label tables. */
14
+ export declare function readExternalAnnotationSet(parsed: any): ExternalAnnotationSet;
15
+ /** Read the result of validating an annotation set against a document. */
16
+ export declare function readExternalAnnotationValidation(parsed: any): ExternalAnnotationValidationResult;
17
+ /** The engine wraps projected HTML in a small JSON envelope; unwrap it. */
18
+ export declare function readProjectedHtml(parsed: any): string;
19
+ //# sourceMappingURL=external-annotation-wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-annotation-wire.d.ts","sourceRoot":"","sources":["../src/external-annotation-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAEV,qBAAqB,EACrB,kCAAkC,EAClC,qBAAqB,EAMtB,MAAM,YAAY,CAAC;AAgGpB,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAWzE;AAED,gGAAgG;AAChG,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,GAAG,qBAAqB,CAW5E;AAED,0EAA0E;AAC1E,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,GAAG,GAAG,kCAAkC,CAYhG;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAErD"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Wire-shape readers for the external annotation family.
3
+ *
4
+ * The engine serializes these results with PascalCase property names (and older builds with
5
+ * camelCase), so every consumer has to normalize them once. The main-thread entry points in
6
+ * `core.ts` and the Web Worker (`docxodus.worker.ts`) both read through here, which is what
7
+ * lets the worker hand back the same typed objects the main thread would without a second
8
+ * copy of the mapping.
9
+ */
10
+ /* eslint-disable @typescript-eslint/no-explicit-any */
11
+ function readPawlsPage(p) {
12
+ return {
13
+ page: {
14
+ width: p.Page?.Width ?? p.page?.width,
15
+ height: p.Page?.Height ?? p.page?.height,
16
+ index: p.Page?.Index ?? p.page?.index,
17
+ },
18
+ tokens: (p.Tokens || p.tokens || []).map((t) => ({
19
+ x: t.X ?? t.x,
20
+ y: t.Y ?? t.y,
21
+ width: t.Width ?? t.width,
22
+ height: t.Height ?? t.height,
23
+ text: t.Text ?? t.text,
24
+ })),
25
+ };
26
+ }
27
+ function readAnnotationJson(json) {
28
+ if (!json)
29
+ return undefined;
30
+ // A text span carries offsets; anything else is a page-keyed dictionary.
31
+ if (json.Start !== undefined || json.start !== undefined) {
32
+ return {
33
+ id: json.Id ?? json.id,
34
+ start: json.Start ?? json.start,
35
+ end: json.End ?? json.end,
36
+ text: json.Text ?? json.text,
37
+ };
38
+ }
39
+ const result = {};
40
+ for (const [key, value] of Object.entries(json)) {
41
+ const v = value;
42
+ result[key] = {
43
+ bounds: {
44
+ top: v.Bounds?.Top ?? v.bounds?.top,
45
+ bottom: v.Bounds?.Bottom ?? v.bounds?.bottom,
46
+ left: v.Bounds?.Left ?? v.bounds?.left,
47
+ right: v.Bounds?.Right ?? v.bounds?.right,
48
+ },
49
+ tokensJsons: (v.TokensJsons || v.tokensJsons || []).map((t) => ({
50
+ pageIndex: t.PageIndex ?? t.pageIndex,
51
+ tokenIndex: t.TokenIndex ?? t.tokenIndex,
52
+ })),
53
+ rawText: v.RawText ?? v.rawText,
54
+ };
55
+ }
56
+ return result;
57
+ }
58
+ function readAnnotation(a) {
59
+ return {
60
+ id: a.Id ?? a.id,
61
+ annotationLabel: a.AnnotationLabel ?? a.annotationLabel,
62
+ rawText: a.RawText ?? a.rawText,
63
+ page: a.Page ?? a.page,
64
+ annotationJson: readAnnotationJson(a.AnnotationJson ?? a.annotationJson),
65
+ parentId: a.ParentId ?? a.parentId,
66
+ annotationType: a.AnnotationType ?? a.annotationType,
67
+ structural: a.Structural ?? a.structural,
68
+ };
69
+ }
70
+ function readRelationship(r) {
71
+ return {
72
+ id: r.Id ?? r.id,
73
+ relationshipLabel: r.RelationshipLabel ?? r.relationshipLabel,
74
+ sourceAnnotationIds: r.SourceAnnotationIds ?? r.sourceAnnotationIds ?? [],
75
+ targetAnnotationIds: r.TargetAnnotationIds ?? r.targetAnnotationIds ?? [],
76
+ structural: r.Structural ?? r.structural,
77
+ };
78
+ }
79
+ function readLabel(l) {
80
+ return {
81
+ id: l.Id ?? l.id,
82
+ color: l.Color ?? l.color,
83
+ description: l.Description ?? l.description ?? "",
84
+ icon: l.Icon ?? l.icon ?? "",
85
+ text: l.Text ?? l.text,
86
+ labelType: l.LabelType ?? l.labelType ?? "text",
87
+ };
88
+ }
89
+ function readLabels(raw) {
90
+ const labels = {};
91
+ for (const [key, value] of Object.entries(raw || {}))
92
+ labels[key] = readLabel(value);
93
+ return labels;
94
+ }
95
+ /** Read an OpenContracts document export from the engine's parsed JSON. */
96
+ export function readOpenContractExport(parsed) {
97
+ return {
98
+ title: parsed.Title ?? parsed.title,
99
+ content: parsed.Content ?? parsed.content,
100
+ description: parsed.Description ?? parsed.description,
101
+ pageCount: parsed.PageCount ?? parsed.pageCount,
102
+ pawlsFileContent: (parsed.PawlsFileContent || parsed.pawlsFileContent || []).map(readPawlsPage),
103
+ docLabels: parsed.DocLabels ?? parsed.docLabels ?? [],
104
+ labelledText: (parsed.LabelledText || parsed.labelledText || []).map(readAnnotation),
105
+ relationships: (parsed.Relationships || parsed.relationships)?.map(readRelationship),
106
+ };
107
+ }
108
+ /** Read an external annotation set — an OpenContracts export plus identity and label tables. */
109
+ export function readExternalAnnotationSet(parsed) {
110
+ return {
111
+ documentId: parsed.DocumentId ?? parsed.documentId,
112
+ documentHash: parsed.DocumentHash ?? parsed.documentHash,
113
+ createdAt: parsed.CreatedAt ?? parsed.createdAt,
114
+ updatedAt: parsed.UpdatedAt ?? parsed.updatedAt,
115
+ version: parsed.Version ?? parsed.version,
116
+ ...readOpenContractExport(parsed),
117
+ textLabels: readLabels(parsed.TextLabels || parsed.textLabels),
118
+ docLabelDefinitions: readLabels(parsed.DocLabelDefinitions || parsed.docLabelDefinitions),
119
+ };
120
+ }
121
+ /** Read the result of validating an annotation set against a document. */
122
+ export function readExternalAnnotationValidation(parsed) {
123
+ return {
124
+ isValid: parsed.IsValid ?? parsed.isValid,
125
+ hashMismatch: parsed.HashMismatch ?? parsed.hashMismatch,
126
+ issues: (parsed.Issues || parsed.issues || []).map((i) => ({
127
+ annotationId: i.AnnotationId ?? i.annotationId,
128
+ issueType: i.IssueType ?? i.issueType,
129
+ description: i.Description ?? i.description,
130
+ expectedText: i.ExpectedText ?? i.expectedText,
131
+ actualText: i.ActualText ?? i.actualText,
132
+ })),
133
+ };
134
+ }
135
+ /** The engine wraps projected HTML in a small JSON envelope; unwrap it. */
136
+ export function readProjectedHtml(parsed) {
137
+ return parsed.Html ?? parsed.html;
138
+ }
139
+ //# sourceMappingURL=external-annotation-wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-annotation-wire.js","sourceRoot":"","sources":["../src/external-annotation-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,uDAAuD;AAEvD,SAAS,aAAa,CAAC,CAAM;IAC3B,OAAO;QACL,IAAI,EAAE;YACJ,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK;YACrC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM;YACxC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK;SACtC;QACD,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;YACpD,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACb,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACb,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,CA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