@embedpdf/engine-core 3.0.0-next.13 → 3.0.0-next.14
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/dist/{AbortError-DHqPBnYc.js → AbortError-DwuHPK_I.js} +2 -2
- package/dist/{AbortError-DHqPBnYc.js.map → AbortError-DwuHPK_I.js.map} +1 -1
- package/dist/{AbortError-Cq2igpZ6.cjs → AbortError-P0RU0Mgg.cjs} +4 -4
- package/dist/{AbortError-Cq2igpZ6.cjs.map → AbortError-P0RU0Mgg.cjs.map} +1 -1
- package/dist/{AnnotationListSnapshot-D3mFut1e.d.cts → AnnotationListSnapshot-D9R5n2Kf.d.cts} +237 -7
- package/dist/{AnnotationListSnapshot-D3mFut1e.d.ts → AnnotationListSnapshot-D9R5n2Kf.d.ts} +237 -7
- package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-CIx1MT0T.d.cts} +2 -2
- package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-Ca6EK3-3.d.ts} +2 -2
- package/dist/{Engine-Bx0NOfmd.d.cts → Engine-EWWHhEIi.d.ts} +17 -4
- package/dist/{Engine-DxtpCYcP.d.ts → Engine-FNaAEjfb.d.cts} +17 -4
- package/dist/conformance.cjs +382 -95
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +7 -3
- package/dist/conformance.d.ts +7 -3
- package/dist/conformance.js +302 -16
- package/dist/conformance.js.map +1 -1
- package/dist/derive-BbsDk_Kz.cjs +880 -0
- package/dist/derive-BbsDk_Kz.cjs.map +1 -0
- package/dist/derive-DAFJolWu.js +647 -0
- package/dist/derive-DAFJolWu.js.map +1 -0
- package/dist/{PageInsertBlankInput-cHq9-i-z.js → format-Bbphf4zR.js} +59 -2
- package/dist/format-Bbphf4zR.js.map +1 -0
- package/dist/{PageInsertBlankInput-CqXBmFhN.cjs → format-D_epWlob.cjs} +70 -1
- package/dist/format-D_epWlob.cjs.map +1 -0
- package/dist/index.cjs +127 -107
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/runtime.cjs +137 -117
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +29 -5
- package/dist/runtime.d.ts +29 -5
- package/dist/runtime.js +5 -5
- package/dist/{schemas-BLARNCgx.js → schemas-CFQGvWiu.js} +134 -4
- package/dist/schemas-CFQGvWiu.js.map +1 -0
- package/dist/{schemas-DIqFMmrC.cjs → schemas-D0g6tKa9.cjs} +250 -24
- package/dist/schemas-D0g6tKa9.cjs.map +1 -0
- package/dist/{builders-Bqm8yTpi.cjs → viewport-BWeNHZmb.cjs} +71 -132
- package/dist/viewport-BWeNHZmb.cjs.map +1 -0
- package/dist/{builders-Dqo2X-dt.js → viewport-CvMcadfQ.js} +39 -88
- package/dist/viewport-CvMcadfQ.js.map +1 -0
- package/dist/wire.cjs +25 -2
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +2739 -8
- package/dist/wire.d.ts +2739 -8
- package/dist/wire.js +10 -3
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
- package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
- package/dist/builders-Bqm8yTpi.cjs.map +0 -1
- package/dist/builders-Dqo2X-dt.js.map +0 -1
- package/dist/fold-2V29cxCV.cjs +0 -447
- package/dist/fold-2V29cxCV.cjs.map +0 -1
- package/dist/fold-CdEJTBTn.js +0 -334
- package/dist/fold-CdEJTBTn.js.map +0 -1
- package/dist/schemas-BLARNCgx.js.map +0 -1
- package/dist/schemas-DIqFMmrC.cjs.map +0 -1
package/dist/conformance.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Engine } from "./Engine-
|
|
1
|
+
import { An as HighlightDraft, Bd as PdfPoint, Hd as PdfRect, Ld as InkList, cf as DocumentMetadata, n as AnnotationListSnapshotAllPages, t as AnnotationListPageSnapshot, xl as CharMapAnchor, zd as LinePoints } from "./AnnotationListSnapshot-D9R5n2Kf.cjs";
|
|
2
|
+
import { t as Engine } from "./Engine-FNaAEjfb.cjs";
|
|
3
3
|
//#region src/conformance/runMetadataConformance.d.ts
|
|
4
4
|
interface ConformanceTestRunner {
|
|
5
5
|
describe(name: string, fn: () => void): void;
|
|
@@ -54,6 +54,10 @@ interface ConformanceOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
declare function runMetadataConformance(runner: ConformanceTestRunner, opts: ConformanceOptions): void;
|
|
56
56
|
//#endregion
|
|
57
|
+
//#region src/conformance/runMeasurementConformance.d.ts
|
|
58
|
+
/** Shared numerical, persistence and calibration contract for local and HTTP engines. */
|
|
59
|
+
declare function runMeasurementConformance(runner: ConformanceTestRunner, opts: ConformanceOptions): void;
|
|
60
|
+
//#endregion
|
|
57
61
|
//#region src/conformance/runAnnotationReadConformance.d.ts
|
|
58
62
|
/**
|
|
59
63
|
* Expected per-fixture annotation knowledge. The harness asserts against
|
|
@@ -764,5 +768,5 @@ interface SignatureConformanceOptions {
|
|
|
764
768
|
*/
|
|
765
769
|
declare function runSignatureConformance(runner: ConformanceTestRunner, opts: SignatureConformanceOptions): void;
|
|
766
770
|
//#endregion
|
|
767
|
-
export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageGeometryOrientationFixture, type PageGeometryOrientationOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, type SignatureConformanceFixtures, type SignatureConformanceOptions, TEXT_DIVERGENCE_CASES, type TextDivergenceCase, type TextDivergenceConformanceFixture, type TextDivergenceConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationAppearanceExportConformance, runAnnotationFlattenConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runNamedPagesConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertBlankConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runSignatureConformance, runTextDivergenceConformance };
|
|
771
|
+
export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageGeometryOrientationFixture, type PageGeometryOrientationOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, type SignatureConformanceFixtures, type SignatureConformanceOptions, TEXT_DIVERGENCE_CASES, type TextDivergenceCase, type TextDivergenceConformanceFixture, type TextDivergenceConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationAppearanceExportConformance, runAnnotationFlattenConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMeasurementConformance, runMetadataConformance, runNamedPagesConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertBlankConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runSignatureConformance, runTextDivergenceConformance };
|
|
768
772
|
//# sourceMappingURL=conformance.d.cts.map
|
package/dist/conformance.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Engine } from "./Engine-
|
|
1
|
+
import { An as HighlightDraft, Bd as PdfPoint, Hd as PdfRect, Ld as InkList, cf as DocumentMetadata, n as AnnotationListSnapshotAllPages, t as AnnotationListPageSnapshot, xl as CharMapAnchor, zd as LinePoints } from "./AnnotationListSnapshot-D9R5n2Kf.js";
|
|
2
|
+
import { t as Engine } from "./Engine-EWWHhEIi.js";
|
|
3
3
|
//#region src/conformance/runMetadataConformance.d.ts
|
|
4
4
|
interface ConformanceTestRunner {
|
|
5
5
|
describe(name: string, fn: () => void): void;
|
|
@@ -54,6 +54,10 @@ interface ConformanceOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
declare function runMetadataConformance(runner: ConformanceTestRunner, opts: ConformanceOptions): void;
|
|
56
56
|
//#endregion
|
|
57
|
+
//#region src/conformance/runMeasurementConformance.d.ts
|
|
58
|
+
/** Shared numerical, persistence and calibration contract for local and HTTP engines. */
|
|
59
|
+
declare function runMeasurementConformance(runner: ConformanceTestRunner, opts: ConformanceOptions): void;
|
|
60
|
+
//#endregion
|
|
57
61
|
//#region src/conformance/runAnnotationReadConformance.d.ts
|
|
58
62
|
/**
|
|
59
63
|
* Expected per-fixture annotation knowledge. The harness asserts against
|
|
@@ -764,5 +768,5 @@ interface SignatureConformanceOptions {
|
|
|
764
768
|
*/
|
|
765
769
|
declare function runSignatureConformance(runner: ConformanceTestRunner, opts: SignatureConformanceOptions): void;
|
|
766
770
|
//#endregion
|
|
767
|
-
export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageGeometryOrientationFixture, type PageGeometryOrientationOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, type SignatureConformanceFixtures, type SignatureConformanceOptions, TEXT_DIVERGENCE_CASES, type TextDivergenceCase, type TextDivergenceConformanceFixture, type TextDivergenceConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationAppearanceExportConformance, runAnnotationFlattenConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runNamedPagesConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertBlankConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runSignatureConformance, runTextDivergenceConformance };
|
|
771
|
+
export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageGeometryOrientationFixture, type PageGeometryOrientationOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, type SignatureConformanceFixtures, type SignatureConformanceOptions, TEXT_DIVERGENCE_CASES, type TextDivergenceCase, type TextDivergenceConformanceFixture, type TextDivergenceConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationAppearanceExportConformance, runAnnotationFlattenConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMeasurementConformance, runMetadataConformance, runNamedPagesConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertBlankConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runSignatureConformance, runTextDivergenceConformance };
|
|
768
772
|
//# sourceMappingURL=conformance.d.ts.map
|
package/dist/conformance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as AbortError } from "./AbortError-
|
|
4
|
-
import { B as FormImportResultSchema,
|
|
1
|
+
import { A as isRotatedGeometryRun, C as refKey, M as pdfQuadBounds, i as measurementReadout, u as measureFromKnownLength, w as EngineError, y as foldText } from "./derive-DAFJolWu.js";
|
|
2
|
+
import { c as sliceTextByChars, m as EngineErrorCode } from "./format-Bbphf4zR.js";
|
|
3
|
+
import { t as AbortError } from "./AbortError-DwuHPK_I.js";
|
|
4
|
+
import { B as FormImportResultSchema, Dt as RedactionApplyResultSchema, H as FormSetValueResultSchema, Pt as SearchSliceSchema, V as FormRepairResultSchema, at as PageGeometrySnapshotSchema, bt as PageRotateResultSchema, d as AnnotationListPageSnapshotSchema, f as AnnotationListSnapshotAllPagesSchema, ft as PageMoveResultSchema, hn as AnnotationDTOSchema, it as PageFlattenResultSchema, l as AnnotationFlattenResultSchema, li as DocumentActionsSnapshotSchema, ln as FormSnapshotSchema, m as AnnotationUpdateResultSchema, mt as PageNameResultSchema, o as AnnotationCreateResultSchema, p as AnnotationMoveResultSchema, s as AnnotationDeleteResultSchema, tt as PageDeleteResultSchema, ut as PageListSnapshotSchema, wt as PageTextSnapshotSchema } from "./schemas-CFQGvWiu.js";
|
|
5
5
|
//#region src/conformance/runMetadataConformance.ts
|
|
6
6
|
/**
|
|
7
7
|
* The conformance harness is transport-agnostic. It takes the test runner as
|
|
@@ -122,6 +122,270 @@ async function openFixture$20(engine, opts) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
//#endregion
|
|
125
|
+
//#region src/conformance/runMeasurementConformance.ts
|
|
126
|
+
/** Shared numerical, persistence and calibration contract for local and HTTP engines. */
|
|
127
|
+
function runMeasurementConformance(runner, opts) {
|
|
128
|
+
const { describe, test, beforeAll, afterAll, expect } = runner;
|
|
129
|
+
describe(`measurement conformance: ${opts.label}`, () => {
|
|
130
|
+
let engine;
|
|
131
|
+
beforeAll(async () => {
|
|
132
|
+
engine = await opts.makeEngine();
|
|
133
|
+
});
|
|
134
|
+
afterAll(async () => {
|
|
135
|
+
await engine?.destroy();
|
|
136
|
+
});
|
|
137
|
+
const open = async () => opts.openKind === "bytes" ? engine.open({
|
|
138
|
+
kind: "bytes",
|
|
139
|
+
id: opts.fixture.id,
|
|
140
|
+
bytes: await opts.fixture.bytes()
|
|
141
|
+
}) : engine.open({
|
|
142
|
+
kind: "id",
|
|
143
|
+
id: opts.fixture.cloudId ?? opts.fixture.id
|
|
144
|
+
});
|
|
145
|
+
const scale = measureFromKnownLength(100, {
|
|
146
|
+
value: 3,
|
|
147
|
+
unit: "m"
|
|
148
|
+
});
|
|
149
|
+
const rect = {
|
|
150
|
+
left: 0,
|
|
151
|
+
bottom: 0,
|
|
152
|
+
right: 100,
|
|
153
|
+
top: 100
|
|
154
|
+
};
|
|
155
|
+
const vertices = [
|
|
156
|
+
{
|
|
157
|
+
x: 0,
|
|
158
|
+
y: 0
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
x: 100,
|
|
162
|
+
y: 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
x: 100,
|
|
166
|
+
y: 100
|
|
167
|
+
}
|
|
168
|
+
];
|
|
169
|
+
test("geometry derives contents while caption patches retain placement", async () => {
|
|
170
|
+
const doc = await open();
|
|
171
|
+
try {
|
|
172
|
+
const page = doc.page((await doc.pages.list()).pages[0].pageObjectNumber);
|
|
173
|
+
const created = (await page.annotations.create({
|
|
174
|
+
subtype: "line",
|
|
175
|
+
intent: "LineDimension",
|
|
176
|
+
rect,
|
|
177
|
+
measure: scale,
|
|
178
|
+
linePoints: {
|
|
179
|
+
start: vertices[0],
|
|
180
|
+
end: vertices[1]
|
|
181
|
+
},
|
|
182
|
+
caption: {
|
|
183
|
+
enabled: true,
|
|
184
|
+
offset: {
|
|
185
|
+
along: 10,
|
|
186
|
+
perpendicular: 20
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
})).created;
|
|
190
|
+
const inert = await page.annotations.update(created.ref, {
|
|
191
|
+
subtype: "line",
|
|
192
|
+
contents: "999 m"
|
|
193
|
+
});
|
|
194
|
+
expect(inert.updated.contents).toBe("3 m");
|
|
195
|
+
expect(inert.appearance).toEqual({
|
|
196
|
+
action: "preserved",
|
|
197
|
+
changed: false
|
|
198
|
+
});
|
|
199
|
+
const changed = await page.annotations.update(created.ref, {
|
|
200
|
+
subtype: "line",
|
|
201
|
+
linePoints: {
|
|
202
|
+
start: vertices[0],
|
|
203
|
+
end: {
|
|
204
|
+
x: 200,
|
|
205
|
+
y: 0
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
expect(changed.updated.contents).toBe("6 m");
|
|
210
|
+
expect(changed.appearance.changed).toBe(true);
|
|
211
|
+
const hidden = await page.annotations.update(created.ref, {
|
|
212
|
+
subtype: "line",
|
|
213
|
+
caption: { enabled: false }
|
|
214
|
+
});
|
|
215
|
+
expect(hidden.updated).toMatchObject({
|
|
216
|
+
contents: "6 m",
|
|
217
|
+
caption: {
|
|
218
|
+
enabled: false,
|
|
219
|
+
offset: {
|
|
220
|
+
along: 10,
|
|
221
|
+
perpendicular: 20
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
expect(hidden.appearance.changed).toBe(true);
|
|
226
|
+
const reset = await page.annotations.update(created.ref, {
|
|
227
|
+
subtype: "line",
|
|
228
|
+
caption: {
|
|
229
|
+
enabled: true,
|
|
230
|
+
offset: null
|
|
231
|
+
},
|
|
232
|
+
measure: null
|
|
233
|
+
});
|
|
234
|
+
expect(reset.updated.contents).toBe("6 m");
|
|
235
|
+
expect(reset.updated.subtype === "line" && reset.updated.caption?.offset === void 0).toBe(true);
|
|
236
|
+
expect(measurementReadout(reset.updated)).toEqual({ unavailable: "no-measure" });
|
|
237
|
+
} finally {
|
|
238
|
+
await doc.close();
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
test("all three kinds derive labels, save, reopen and retain captions", async () => {
|
|
242
|
+
let doc = await open();
|
|
243
|
+
try {
|
|
244
|
+
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
245
|
+
const drafts = [
|
|
246
|
+
{
|
|
247
|
+
subtype: "line",
|
|
248
|
+
rect,
|
|
249
|
+
intent: "LineDimension",
|
|
250
|
+
measure: measureFromKnownLength(1, {
|
|
251
|
+
value: 1.00000001,
|
|
252
|
+
unit: "m"
|
|
253
|
+
}),
|
|
254
|
+
contents: "wrong",
|
|
255
|
+
linePoints: {
|
|
256
|
+
start: vertices[0],
|
|
257
|
+
end: {
|
|
258
|
+
x: 3.4450000001,
|
|
259
|
+
y: 0
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
caption: {
|
|
263
|
+
enabled: true,
|
|
264
|
+
offset: {
|
|
265
|
+
along: 10,
|
|
266
|
+
perpendicular: 20
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
subtype: "polyline",
|
|
272
|
+
rect,
|
|
273
|
+
intent: "PolyLineDimension",
|
|
274
|
+
measure: scale,
|
|
275
|
+
contents: "wrong",
|
|
276
|
+
vertices,
|
|
277
|
+
caption: {
|
|
278
|
+
enabled: true,
|
|
279
|
+
center: {
|
|
280
|
+
x: 0,
|
|
281
|
+
y: 0
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
subtype: "polygon",
|
|
287
|
+
rect,
|
|
288
|
+
intent: "PolygonDimension",
|
|
289
|
+
measure: scale,
|
|
290
|
+
contents: "wrong",
|
|
291
|
+
vertices,
|
|
292
|
+
caption: {
|
|
293
|
+
enabled: true,
|
|
294
|
+
center: {
|
|
295
|
+
x: 50,
|
|
296
|
+
y: 30
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
];
|
|
301
|
+
const saved = [];
|
|
302
|
+
for (const draft of drafts) {
|
|
303
|
+
const preview = measurementReadout(draft);
|
|
304
|
+
const a = (await doc.page(pon).annotations.create(draft)).created;
|
|
305
|
+
expect(a.contents).toBe("label" in preview ? preview.label : void 0);
|
|
306
|
+
saved.push(a);
|
|
307
|
+
}
|
|
308
|
+
const bytes = opts.openKind === "bytes" ? await doc.download() : void 0;
|
|
309
|
+
await doc.close();
|
|
310
|
+
doc = bytes ? await engine.open({
|
|
311
|
+
kind: "bytes",
|
|
312
|
+
id: `${opts.fixture.id}-saved`,
|
|
313
|
+
bytes
|
|
314
|
+
}) : await open();
|
|
315
|
+
const page = doc.page((await doc.pages.list()).pages[0].pageObjectNumber);
|
|
316
|
+
const list = (await page.annotations.list()).annotations;
|
|
317
|
+
for (const before of saved) {
|
|
318
|
+
const a = list.find((a) => refKey(a.ref) === refKey(before.ref));
|
|
319
|
+
expect(a.contents).toBe(before.contents);
|
|
320
|
+
if (a.subtype !== "line" && a.subtype !== "polygon" && a.subtype !== "polyline") throw new Error("Missing dimension");
|
|
321
|
+
expect(a.caption).toEqual("caption" in before ? before.caption : void 0);
|
|
322
|
+
const result = await page.annotations.update(a.ref, {
|
|
323
|
+
subtype: a.subtype,
|
|
324
|
+
color: {
|
|
325
|
+
r: 0,
|
|
326
|
+
g: 0,
|
|
327
|
+
b: 255
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
expect(result.updated.contents).toBe(before.contents);
|
|
331
|
+
}
|
|
332
|
+
} finally {
|
|
333
|
+
await doc.close();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
test("calibration updates only viewports and emits one event per write", async () => {
|
|
337
|
+
const doc = await open();
|
|
338
|
+
try {
|
|
339
|
+
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
340
|
+
const page = doc.page(pon);
|
|
341
|
+
if (!page.measure) throw new Error("Measurement service is required");
|
|
342
|
+
const foreign = (await page.measure.viewports()).filter((v) => !v.owned);
|
|
343
|
+
const annotations = (await page.annotations.list()).annotations;
|
|
344
|
+
const events = [];
|
|
345
|
+
const off = doc.events.subscribe((event) => events.push(event));
|
|
346
|
+
try {
|
|
347
|
+
await page.measure.setScale(scale);
|
|
348
|
+
expect((await page.measure.viewports()).filter((v) => v.owned)).toHaveLength(1);
|
|
349
|
+
expect((await page.annotations.list()).annotations).toEqual(annotations);
|
|
350
|
+
await page.measure.setScale(null);
|
|
351
|
+
expect(await page.measure.viewports()).toEqual(foreign);
|
|
352
|
+
const changes = events.filter((e) => e.type === "page.viewportsChanged");
|
|
353
|
+
expect(changes).toHaveLength(2);
|
|
354
|
+
for (const event of changes) expect(event).toMatchObject({
|
|
355
|
+
pageObjectNumber: pon,
|
|
356
|
+
meta: { affectedPages: [] }
|
|
357
|
+
});
|
|
358
|
+
} finally {
|
|
359
|
+
off();
|
|
360
|
+
}
|
|
361
|
+
} finally {
|
|
362
|
+
await doc.close();
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
test("invalid and immediately aborted calibration leaves the previous scale intact", async () => {
|
|
366
|
+
const doc = await open();
|
|
367
|
+
try {
|
|
368
|
+
const page = doc.page((await doc.pages.list()).pages[0].pageObjectNumber);
|
|
369
|
+
await page.measure.setScale(scale);
|
|
370
|
+
const before = await page.measure.viewports();
|
|
371
|
+
await expect(page.measure.setScale({
|
|
372
|
+
...scale,
|
|
373
|
+
x: [{
|
|
374
|
+
unit: "m",
|
|
375
|
+
conversion: 0
|
|
376
|
+
}]
|
|
377
|
+
})).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });
|
|
378
|
+
const pending = page.measure.setScale(null);
|
|
379
|
+
pending.abort("conformance");
|
|
380
|
+
await expect(pending).rejects.toBeInstanceOf(AbortError);
|
|
381
|
+
expect(await page.measure.viewports()).toEqual(before);
|
|
382
|
+
} finally {
|
|
383
|
+
await doc.close();
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
125
389
|
//#region src/conformance/runAnnotationReadConformance.ts
|
|
126
390
|
function runAnnotationReadConformance(runner, opts) {
|
|
127
391
|
const { describe, test, beforeAll, afterAll, expect } = runner;
|
|
@@ -6816,20 +7080,42 @@ function runSearchConformance(runner, opts) {
|
|
|
6816
7080
|
await doc.close();
|
|
6817
7081
|
}
|
|
6818
7082
|
});
|
|
6819
|
-
test("
|
|
7083
|
+
test("ignoreWhitespace keeps every default hit and finds the space-free needle", async () => {
|
|
6820
7084
|
const doc = await openFixture(engine, opts);
|
|
6821
7085
|
try {
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
7086
|
+
const key = (m) => `${m.pageObjectNumber}:${m.charStart}:${m.charCount}`;
|
|
7087
|
+
const plain = await collectAll(doc, { query: { text: fixture.presentLiteral } });
|
|
7088
|
+
const relaxed = await collectAll(doc, { query: {
|
|
7089
|
+
text: fixture.presentLiteral,
|
|
7090
|
+
ignoreWhitespace: true
|
|
7091
|
+
} });
|
|
7092
|
+
const relaxedKeys = new Set(relaxed.matches.map(key));
|
|
7093
|
+
for (const m of plain.matches) expect(relaxedKeys.has(key(m))).toBe(true);
|
|
7094
|
+
const squashed = await collectAll(doc, { query: {
|
|
7095
|
+
text: fixture.presentLiteral.replace(/\s+/g, ""),
|
|
7096
|
+
ignoreWhitespace: true
|
|
7097
|
+
} });
|
|
7098
|
+
expect(squashed.matches.map(key)).toEqual(relaxed.matches.map(key));
|
|
7099
|
+
} finally {
|
|
7100
|
+
await doc.close();
|
|
7101
|
+
}
|
|
7102
|
+
});
|
|
7103
|
+
test("regex + matchDiacritics / ignoreWhitespace are rejected with InvalidArg", async () => {
|
|
7104
|
+
const doc = await openFixture(engine, opts);
|
|
7105
|
+
try {
|
|
7106
|
+
for (const flags of [{ matchDiacritics: true }, { ignoreWhitespace: true }]) {
|
|
7107
|
+
let caught;
|
|
7108
|
+
try {
|
|
7109
|
+
await doc.search.query({ query: {
|
|
7110
|
+
text: fixture.presentRegex,
|
|
7111
|
+
regex: true,
|
|
7112
|
+
...flags
|
|
7113
|
+
} });
|
|
7114
|
+
} catch (err) {
|
|
7115
|
+
caught = err;
|
|
7116
|
+
}
|
|
7117
|
+
expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);
|
|
6831
7118
|
}
|
|
6832
|
-
expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);
|
|
6833
7119
|
} finally {
|
|
6834
7120
|
await doc.close();
|
|
6835
7121
|
}
|
|
@@ -7739,6 +8025,6 @@ async function sha256Hex(bytes) {
|
|
|
7739
8025
|
return toHex(new Uint8Array(digest));
|
|
7740
8026
|
}
|
|
7741
8027
|
//#endregion
|
|
7742
|
-
export { TEXT_DIVERGENCE_CASES, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationAppearanceExportConformance, runAnnotationFlattenConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runNamedPagesConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertBlankConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runSignatureConformance, runTextDivergenceConformance };
|
|
8028
|
+
export { TEXT_DIVERGENCE_CASES, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationAppearanceExportConformance, runAnnotationFlattenConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMeasurementConformance, runMetadataConformance, runNamedPagesConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertBlankConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runSignatureConformance, runTextDivergenceConformance };
|
|
7743
8029
|
|
|
7744
8030
|
//# sourceMappingURL=conformance.js.map
|