@attentionform/ooxml-validator 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,206 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Attentionform, the publisher of ASTra, operated by the
11
+ holder of the GitHub account github.com/Userfrom1995
12
+ and also identified by the GitHub organization
13
+ github.com/Attentionform and the domain
14
+ attentionform.com, together with its successors and
15
+ assigns.
16
+
17
+ Licensed Work: ASTra: the engine, command-line tool, MCP server and
18
+ OOXML validator in this repository, in each version
19
+ that the Licensor makes publicly available, beginning
20
+ with the first public release. Each version carries
21
+ its own Change Date, below.
22
+ The Licensed Work is (c) 2026 Attentionform.
23
+ This License applies to all files in this repository and
24
+ to the packages published from it, UNLESS another license
25
+ file is present in a sub-directory, in which case that
26
+ license applies to the files in that sub-directory.
27
+
28
+ Additional Use Grant: You may make production use of the Licensed Work, free of
29
+ charge, if Your use is Individual Use, Educational and
30
+ Research Use, Non-Profit Use, Public-Sector Use or Small
31
+ Business Use, each as defined below. Any other production
32
+ use requires a commercial license from the Licensor.
33
+
34
+ "Individual Use" means use by a natural person on his or
35
+ her own account, including as a freelancer or consultant,
36
+ either personally or through a business entity that has
37
+ no employees. Contractors engaged for a specific project
38
+ are not employees. Individual Use does not include use
39
+ for the internal operations of an employer or of a client
40
+ (for example, running the Licensed Work on a client's
41
+ systems for the client's own continuing use). Using the
42
+ Licensed Work to prepare documents or other deliverables
43
+ for clients is Individual Use.
44
+
45
+ "Educational and Research Use" means use by an accredited
46
+ school, college or university, or by its students and
47
+ staff, for teaching, learning or non-commercial academic
48
+ research.
49
+
50
+ "Non-Profit Use" means use by a Qualifying Non-Profit in
51
+ furtherance of its exempt purposes, and not in connection
52
+ with the sale of products or services (other than fees
53
+ that only recover the cost of its charitable activities).
54
+ A "Qualifying Non-Profit" is an organization that is
55
+ organized and operated exclusively for charitable,
56
+ educational, religious, scientific or similar
57
+ public-benefit purposes, whose net earnings do not
58
+ benefit any private person, and that is recognized as a
59
+ charity or as exempt from income tax on that basis under
60
+ the law of its jurisdiction (for example, under Section
61
+ 501(c)(3) of the U.S. Internal Revenue Code, or as a
62
+ charity registered in the United Kingdom).
63
+
64
+ "Public-Sector Use" means use by a government department,
65
+ agency, municipality or other public authority for its
66
+ governmental functions. It does not include use by a
67
+ state-owned or government-controlled enterprise, or by
68
+ any body that sells products or services on a commercial
69
+ basis. Fees charged only to recover the cost of statutory
70
+ services are not a commercial basis.
71
+
72
+ Any organization that is not described in Individual Use,
73
+ Educational and Research Use, Non-Profit Use or
74
+ Public-Sector Use, including a company, partnership or
75
+ other business with employees and any state-owned or
76
+ government-controlled enterprise, is a "For-Profit
77
+ Organization". Production use by or for a For-Profit
78
+ Organization requires a commercial license unless it is
79
+ Small Business Use.
80
+
81
+ "Small Business Use" means use by a For-Profit
82
+ Organization that, together with its affiliates, had
83
+ total gross revenue below USD 1,000,000 and fewer than 10
84
+ people working for it in its last completed fiscal year,
85
+ or that has not yet completed a fiscal year and
86
+ reasonably expects to meet both limits in its first one.
87
+ The people working for it are its employees and the
88
+ individuals who work for it on a regular basis as
89
+ contractors, counted as individuals and not as
90
+ companies. An "affiliate" is any entity that controls,
91
+ is controlled by, or is under common control with
92
+ another entity.
93
+
94
+ Individual Use and Small Business Use include using the
95
+ Licensed Work as a component of a product or service of
96
+ Your own that has substantial functionality beyond that
97
+ of the Licensed Work, and Your customers and users may
98
+ use the Licensed Work only as part of that product or
99
+ service. A product or service includes software that You
100
+ make available free of charge. No category above
101
+ includes a Competing Offering, which always requires a
102
+ commercial license. A "Competing Offering" is a product
103
+ or service offered to third parties whose value consists
104
+ mainly of the functionality of the Licensed Work, for
105
+ example hosting the Licensed Work as a service for others
106
+ or reselling it.
107
+
108
+ If You stop qualifying for a category above, You may
109
+ continue Your existing use for 90 days (for Small
110
+ Business Use, until the end of Your next fiscal year),
111
+ and must then obtain a commercial license or stop.
112
+ "Production use" means any use of the Licensed Work
113
+ other than non-production use, including making it part
114
+ of a product or service that You provide to others.
115
+ Non-production use (including evaluation, development,
116
+ testing and demonstration) is permitted by this License
117
+ without any category. Documents and other output that You
118
+ create with the Licensed Work belong to You, and this
119
+ License places no restriction on them.
120
+
121
+ Change Date: Four years after the date on which a specific version of
122
+ the Licensed Work is first made publicly available.
123
+
124
+ Change License: Apache License, Version 2.0
125
+
126
+ For information about commercial licenses for the Licensed Work, contact:
127
+ astra@attentionform.com
128
+
129
+ -----------------------------------------------------------------------------
130
+
131
+ Terms
132
+
133
+ The Licensor hereby grants you the right to copy, modify, create derivative
134
+ works, redistribute, and make non-production use of the Licensed Work. The
135
+ Licensor may make an Additional Use Grant, above, permitting limited
136
+ production use.
137
+
138
+ Effective on the Change Date, or the fourth anniversary of the first publicly
139
+ available distribution of a specific version of the Licensed Work under this
140
+ License, whichever comes first, the Licensor hereby grants you rights under
141
+ the terms of the Change License, and the rights granted in the paragraph
142
+ above terminate.
143
+
144
+ If your use of the Licensed Work does not comply with the requirements
145
+ currently in effect as described in this License, you must purchase a
146
+ commercial license from the Licensor, its affiliated entities, or authorized
147
+ resellers, or you must refrain from using the Licensed Work.
148
+
149
+ All copies of the original and modified Licensed Work, and derivative works
150
+ of the Licensed Work, are subject to this License. This License applies
151
+ separately for each version of the Licensed Work and the Change Date may vary
152
+ for each version of the Licensed Work released by Licensor.
153
+
154
+ You must conspicuously display this License on each original or modified copy
155
+ of the Licensed Work. If you receive the Licensed Work in original or
156
+ modified form from a third party, the terms and conditions set forth in this
157
+ License apply to your use of that work.
158
+
159
+ Any use of the Licensed Work in violation of this License will automatically
160
+ terminate your rights under this License for the current and all other
161
+ versions of the Licensed Work.
162
+
163
+ This License does not grant you any right in any trademark or logo of
164
+ Licensor or its affiliates (provided that you may use a trademark or logo of
165
+ Licensor as expressly required by this License).
166
+
167
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
168
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
169
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
170
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
171
+ TITLE.
172
+
173
+ MariaDB hereby grants you permission to use this License’s text to license
174
+ your works, and to refer to it using the trademark "Business Source License",
175
+ as long as you comply with the Covenants of Licensor below.
176
+
177
+ -----------------------------------------------------------------------------
178
+
179
+ Covenants of Licensor
180
+
181
+ In consideration of the right to use this License’s text and the "Business
182
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
183
+ other recipients of the licensed work to be provided by Licensor:
184
+
185
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
186
+ or a license that is compatible with GPL Version 2.0 or a later version,
187
+ where "compatible" means that software provided under the Change License can
188
+ be included in a program with software provided under GPL Version 2.0 or a
189
+ later version. Licensor may specify additional Change Licenses without
190
+ limitation.
191
+
192
+ 2. To either: (a) specify an additional grant of rights to use that does not
193
+ impose any additional restriction on the right granted in this License, as
194
+ the Additional Use Grant; or (b) insert the text "None".
195
+
196
+ 3. To specify a Change Date.
197
+
198
+ 4. Not to modify this License in any other way.
199
+
200
+ -----------------------------------------------------------------------------
201
+
202
+ Notice
203
+
204
+ The Business Source License (this document, or the "License") is not an Open
205
+ Source license. However, the Licensed Work will eventually be made available
206
+ under an Open Source License, as stated in this License.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ ASTra
2
+ Copyright 2026 Attentionform (https://attentionform.com)
3
+
4
+ This product includes software developed by Attentionform and its contributors.
5
+
6
+ ASTra is licensed under the Business Source License 1.1 (source-available, not open source).
7
+ See the LICENSE file for the terms, including who may use it for free. Each version
8
+ converts to the Apache License, Version 2.0 four years after it is first made
9
+ publicly available. For a commercial license, write to astra@attentionform.com.
10
+
11
+ Third-party software included in or used by ASTra, with its own licenses and
12
+ copyright notices, is listed in THIRD_PARTY_NOTICES.md.
package/README.md CHANGED
@@ -1,3 +1,106 @@
1
- # Temporary Holding Version
1
+ # @attentionform/ooxml-validator
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Cross-platform OOXML (ECMA-376 / ISO-29500) document schema validator powered by .NET 10 OpenXmlValidator.
4
+
5
+ Portions of the code are adapted from `xarsh/ooxml-validator` (MIT). See `THIRD_PARTY_NOTICES.md`.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @attentionform/ooxml-validator
11
+ ```
12
+
13
+ The package automatically uses the matching prebuilt native platform binary from optional dependencies:
14
+ - `@attentionform/ooxml-validator-linux-x64`
15
+ - `@attentionform/ooxml-validator-linux-arm64`
16
+ - `@attentionform/ooxml-validator-darwin-x64`
17
+ - `@attentionform/ooxml-validator-darwin-arm64`
18
+ - `@attentionform/ooxml-validator-win32-x64`
19
+ - `@attentionform/ooxml-validator-win32-arm64`
20
+
21
+ ## API
22
+
23
+ ### `validateFile(filePath, options?): Promise<ValidationResult>`
24
+ Validates an OOXML document from disk. Defaults to `Microsoft365` office version when unspecified.
25
+
26
+ ```typescript
27
+ import { validateFile } from '@attentionform/ooxml-validator';
28
+
29
+ const result = await validateFile('path/to/doc.docx', { officeVersion: 'Office2019' });
30
+ console.log(result.ok, result.errors);
31
+ ```
32
+
33
+ ### `isValid(filePath, options?): Promise<boolean>`
34
+ Convenience helper returning `true` when the file validates without schema errors.
35
+
36
+ ```typescript
37
+ import { isValid } from '@attentionform/ooxml-validator';
38
+
39
+ if (!await isValid('contract.docx')) {
40
+ throw new Error('Invalid document');
41
+ }
42
+ ```
43
+
44
+ ### `validateBuffer(bytes, options?): Promise<ValidationResult>`
45
+ Validates an in-memory document buffer directly without creating temporary disk files. Uses a resident worker process via streaming stdin/stdout IPC. Defaults to `Office2019`.
46
+
47
+ ```typescript
48
+ import { validateBuffer } from '@attentionform/ooxml-validator';
49
+ import fs from 'node:fs';
50
+
51
+ const bytes = fs.readFileSync('document.docx');
52
+ const result = await validateBuffer(bytes, { officeVersion: 'Office2019', maxErrors: 100 });
53
+ ```
54
+
55
+ ### `createValidator(options?): ValidatorInstance`
56
+ Creates an isolated validator worker client with configurable recycling, limits, and timeouts.
57
+
58
+ ```typescript
59
+ import { createValidator } from '@attentionform/ooxml-validator';
60
+
61
+ const validator = createValidator({
62
+ timeoutMs: 20000,
63
+ recycleAfter: 500,
64
+ maxDocBytes: 64 * 1024 * 1024,
65
+ });
66
+
67
+ const result = await validator.validate(buffer);
68
+ await validator.close();
69
+ ```
70
+
71
+ ### `selfTest(): Promise<{ ok: boolean; details: string }>`
72
+ Validates internal known-good and known-bad embedded test documents to verify runtime health.
73
+
74
+ ### `backendInfo(): BackendInfo`
75
+ Returns diagnostic metadata regarding the active binary, platform package, SDK version, and SHA-256 hash.
76
+
77
+ ## Environment Variables
78
+
79
+ - `OOXML_VALIDATOR_CLI`: Explicit path to a native `ooxml-validator` binary. Overrides platform package resolution and local fallback.
80
+
81
+ ## Supported Platforms
82
+
83
+ - Linux (x64, arm64) - glibc 2.31+ (Linux musl / Alpine is currently not supported)
84
+ - macOS (Apple Silicon arm64, Intel x64) - macOS 13+
85
+ - Windows (x64, arm64) - Windows 10+ / Windows Server 2019+
86
+
87
+ ## Local Development & Building Native Binaries
88
+
89
+ Building the native executable requires the .NET 10 SDK, version 10.0.100 or newer (the minimum in `native/global.json`). CI builds with the exact version set as `dotnet-version` in `.github/workflows/`; all three workflows must carry the same version (a test checks this). To bump it, change the version in all three workflows, then regenerate the lock file with that SDK (`dotnet restore native/ooxml-validator.csproj --force-evaluate`): the lock records runtime-tied packages, so a locked restore fails on a different SDK until it is regenerated. The restore also audits the dependencies and fails on a known high or critical advisory.
90
+
91
+ ```bash
92
+ # Build the native binary for the current host architecture:
93
+ npm run build:native
94
+
95
+ # Compile the TypeScript wrapper:
96
+ npm run build
97
+
98
+ # Run unit tests:
99
+ npm test
100
+ ```
101
+
102
+ ## License
103
+
104
+ This package is licensed under BUSL-1.1. It incorporates and adapts code from `xarsh/ooxml-validator` (Copyright (c) 2025 Takao Naito, MIT License) and uses Microsoft's DocumentFormat.OpenXml SDK (MIT License). See `THIRD_PARTY_NOTICES.md` for full attribution and license texts.
105
+
106
+ The six platform packages (`@attentionform/ooxml-validator-<platform>`) are not listed in this package's `package.json` in the repository: they are built from the native binaries at release time, and listing packages that are not on npm yet would make `npm ci` fail. The published wrapper lists them as optional dependencies at the range of native binaries it accepts, which is declared in the repository manifest as `validatorBinary.range` (for example `>=0.1.0 <0.2.0`). The platform packages carry that binary version, which changes only when the native validator changes and is separate from the wrapper's own version. So a platform whose newest binary could not be published keeps the last one inside the range, and the wrapper is not released while any platform has no binary in the range. See [Releasing](../../docs/releasing.md).
@@ -0,0 +1,98 @@
1
+ # Third-Party Software Notices and Information
2
+
3
+ ASTra includes third-party software. The notices below are provided as required by their licenses.
4
+
5
+ ---
6
+
7
+ ## 1. xarsh/ooxml-validator
8
+
9
+ - **Component:** OOXML validator wrapper (runner, binary resolution, one-shot native program)
10
+ - **Upstream Project:** ooxml-validator
11
+ - **Version:** 0.4.0
12
+ - **Upstream Commit:** `11e3e8c5430d054c8d9102e3e5f5e15c6697c7b2`
13
+ - **Source URL:** https://github.com/xarsh/ooxml-validator
14
+ - **Copyright:** Copyright (c) 2025 Takao Naito
15
+ - **License:** MIT
16
+ - **Where it appears in ASTra:**
17
+ - `packages/ooxml-validator/src/**`
18
+ - `packages/ooxml-validator/native/**`
19
+ - `@attentionform/ooxml-validator-<platform>` packages
20
+ - **Modifications:** Modified by Attention Form for use in ASTra.
21
+
22
+ ---
23
+
24
+ ## 2. Open XML SDK (DocumentFormat.OpenXml)
25
+
26
+ - **Component:** OOXML schema validation
27
+ - **Source URL:** https://github.com/dotnet/Open-XML-SDK
28
+ - **Version:** 3.5.1
29
+ - **Copyright:** Copyright (c) .NET Foundation and Contributors
30
+ - **License:** MIT
31
+ - **Where it appears:** linked into each platform binary.
32
+
33
+ ---
34
+
35
+ ## 3. .NET runtime
36
+
37
+ - **Component:** self-contained runtime bundled in each platform binary
38
+ - **Source URL:** https://github.com/dotnet/runtime
39
+ - **Copyright:** Copyright (c) .NET Foundation and Contributors
40
+ - **License:** MIT
41
+ - **Where it appears:** bundled in each platform binary. The runtime's licence (`DOTNET-LICENSE.TXT`) and its own third-party notices (`THIRD-PARTY-NOTICES.TXT`) ship in every platform package, next to the binary.
42
+
43
+ ---
44
+
45
+ # License Texts
46
+
47
+ ## MIT License (xarsh/ooxml-validator)
48
+
49
+ MIT License
50
+
51
+ Copyright (c) 2025 Takao Naito
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining a copy
54
+ of this software and associated documentation files (the "Software"), to deal
55
+ in the Software without restriction, including without limitation the rights
56
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
57
+ copies of the Software, and to permit persons to whom the Software is
58
+ furnished to do so, subject to the following conditions:
59
+
60
+ The above copyright notice and this permission notice shall be included in all
61
+ copies or substantial portions of the Software.
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
69
+ SOFTWARE.
70
+
71
+ ---
72
+
73
+ ## MIT License (Open XML SDK and .NET runtime)
74
+
75
+ The MIT License (MIT)
76
+
77
+ Copyright (c) .NET Foundation and Contributors
78
+
79
+ All rights reserved.
80
+
81
+ Permission is hereby granted, free of charge, to any person obtaining a copy
82
+ of this software and associated documentation files (the "Software"), to deal
83
+ in the Software without restriction, including without limitation the rights
84
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
85
+ copies of the Software, and to permit persons to whom the Software is
86
+ furnished to do so, subject to the following conditions:
87
+
88
+ The above copyright notice and this permission notice shall be included in all
89
+ copies or substantial portions of the Software.
90
+
91
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97
+ SOFTWARE.
98
+
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ // Adapted from xarsh/ooxml-validator (MIT). See LICENSE-MIT-xarsh.
3
+ import { parseArgs } from 'node:util';
4
+ import { OFFICE_VERSIONS, validateFile } from './index.js';
5
+ const USAGE = `Usage: ooxml-validator <file> [--officeVersion <version>]
6
+
7
+ Validates one Office Open XML file and prints a single JSON object to stdout.
8
+
9
+ Options:
10
+ --officeVersion <version> ${OFFICE_VERSIONS.join(', ')} (default: Microsoft365)
11
+ --help Print this message
12
+
13
+ Exit codes:
14
+ 0 file is valid
15
+ 1 file is invalid, or could not be opened (see errors[].errorType)
16
+ 2 usage error, or the validator could not be run`;
17
+ function parseCliArgs() {
18
+ return parseArgs({
19
+ options: {
20
+ officeVersion: { type: 'string' },
21
+ help: { type: 'boolean' },
22
+ },
23
+ allowPositionals: true,
24
+ });
25
+ }
26
+ async function main() {
27
+ let values;
28
+ let positionals;
29
+ try {
30
+ ({ values, positionals } = parseCliArgs());
31
+ }
32
+ catch (err) {
33
+ console.error(err instanceof Error ? err.message : String(err));
34
+ console.error(USAGE);
35
+ return 2;
36
+ }
37
+ if (values.help) {
38
+ console.log(USAGE);
39
+ return 0;
40
+ }
41
+ if (positionals.length === 0) {
42
+ console.error('Missing <file>.');
43
+ console.error(USAGE);
44
+ return 2;
45
+ }
46
+ if (positionals.length > 1) {
47
+ console.error(`Expected exactly one file, got ${positionals.length}: ${positionals.join(', ')}`);
48
+ console.error(USAGE);
49
+ return 2;
50
+ }
51
+ const officeVersion = values.officeVersion ?? 'Microsoft365';
52
+ if (!OFFICE_VERSIONS.includes(officeVersion)) {
53
+ console.error(`Invalid --officeVersion "${officeVersion}". Expected one of: ${OFFICE_VERSIONS.join(', ')}`);
54
+ return 2;
55
+ }
56
+ try {
57
+ const res = await validateFile(positionals[0], { officeVersion: officeVersion });
58
+ console.log(JSON.stringify(res, null, 2));
59
+ return res.ok ? 0 : 1;
60
+ }
61
+ catch (err) {
62
+ console.error('[ooxml-validator] Failed to validate:', err instanceof Error ? err.message : String(err));
63
+ return 2;
64
+ }
65
+ }
66
+ process.stdout.on('error', (err) => {
67
+ if (err.code !== 'EPIPE')
68
+ throw err;
69
+ });
70
+ process.exitCode = await main();
71
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,mEAAmE;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,WAA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edBinary, resolveBinaryDetails } from './resolve-binary.js';
2
+ import { OFFICE_VERSIONS, type OfficeVersion, type ValidateOptions, type ValidationError, type ValidationResult, type ValidatorPoolOptions, type BackendInfo, type ValidatorInstance, type ErrorNode, type ValidationErrorClass } from './types.js';
3
+ export { OFFICE_VERSIONS };
4
+ export type { OfficeVersion, ValidateOptions, ValidationError, ValidationResult, ValidatorPoolOptions, BackendInfo, ValidatorInstance, ErrorNode, ValidationErrorClass, };
5
+ /**
6
+ * Validates a single OOXML file from disk.
7
+ * Defaults to 'Microsoft365' to match standard ECMA-376 / ISO-29500 behavior.
8
+ */
9
+ export declare function validateFile(filePath: string, options?: ValidateOptions): Promise<ValidationResult>;
10
+ /**
11
+ * Convenience helper returning a boolean indicating if the document is valid.
12
+ */
13
+ export declare function isValid(filePath: string, options?: ValidateOptions): Promise<boolean>;
14
+ /**
15
+ * Validates an in-memory DOCX buffer without creating temporary files.
16
+ * Defaults to 'Office2019' matching the ASTra engine's standard validation target.
17
+ */
18
+ export declare function validateBuffer(bytes: Buffer | Uint8Array, options?: ValidateOptions): Promise<ValidationResult>;
19
+ /**
20
+ * Creates an isolated validator worker client instance.
21
+ */
22
+ export declare function createValidator(opts?: ValidatorPoolOptions): ValidatorInstance;
23
+ /**
24
+ * Returns diagnostic metadata about the resolved binary and platform package.
25
+ */
26
+ export declare function backendInfo(): Promise<BackendInfo>;
27
+ /**
28
+ * Runs a self-diagnostic validating an embedded known-good and known-bad document.
29
+ */
30
+ export declare function selfTest(): Promise<{
31
+ ok: boolean;
32
+ details: string;
33
+ }>;
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,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