@adeu/core 1.6.2 → 1.6.4

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/package.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "name": "@adeu/core",
3
- "version": "1.6.2",
4
- "description": "",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.cjs"
12
- }
13
- },
14
- "scripts": {
15
- "build": "tsup",
16
- "test": "vitest run"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "https://github.com/dealfluence/adeu.git",
21
- "directory": "node/packages/core"
22
- },
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
- "author": "Mikko Korpela <mikko@adeu.ai>",
27
- "license": "MIT",
28
- "type": "module",
29
- "dependencies": {
30
- "@xmldom/xmldom": "^0.9.10",
31
- "diff-match-patch": "^1.0.5",
32
- "jszip": "^3.10.1",
33
- "xpath": "^0.0.34"
34
- },
35
- "devDependencies": {
36
- "@types/diff-match-patch": "^1.0.36"
37
- }
38
- }
1
+ {
2
+ "name": "@adeu/core",
3
+ "version": "1.6.4",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "test": "vitest run"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/dealfluence/adeu.git",
21
+ "directory": "node/packages/core"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "author": "Mikko Korpela <mikko@adeu.ai>",
27
+ "license": "MIT",
28
+ "type": "module",
29
+ "dependencies": {
30
+ "@xmldom/xmldom": "^0.9.10",
31
+ "diff-match-patch": "^1.0.5",
32
+ "jszip": "^3.10.1",
33
+ "xpath": "^0.0.34"
34
+ },
35
+ "devDependencies": {
36
+ "@types/diff-match-patch": "^1.0.36"
37
+ }
38
+ }
@@ -1,38 +1,38 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { readFileSync } from 'node:fs';
3
- import { resolve, dirname } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- import { DocumentObject } from './docx/bridge.js';
6
- import { CommentsManager, extract_comments_data } from './comments.js';
7
-
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
-
11
- describe('CommentsManager & DOM Serialization', () => {
12
- it('should safely add a comment and serialize to buffer', async () => {
13
- // 1. Load the golden DOCX from shared fixtures
14
- const fixturePath = resolve(__dirname, '../../../../shared/fixtures/golden.docx');
15
- const buf = readFileSync(fixturePath);
16
- const doc = await DocumentObject.load(buf);
17
-
18
- // 2. Perform a mutation via the TS implementation of CommentsManager
19
- const mgr = new CommentsManager(doc);
20
- const cid = mgr.addComment('Adeu AI (TS)', 'This is a test comment injected by Node.js');
21
-
22
- expect(cid).toBeDefined();
23
-
24
- // 3. Serialize the mutated DOM back to a zipped DOCX buffer
25
- const savedBuf = await doc.save();
26
- expect(savedBuf.length).toBeGreaterThan(0);
27
-
28
- // 4. Ensure we can load the serialized buffer back (verifying [Content_Types] and .rels integrity)
29
- const doc2 = await DocumentObject.load(savedBuf);
30
- expect(doc2.pkg.parts.length).toBeGreaterThan(0);
31
-
32
- // Assert the comment survived the roundtrip
33
- const data = extract_comments_data(doc2.pkg);
34
- // golden.docx has 3 comments initially, plus our 1 new one = 4
35
- expect(Object.keys(data).length).toBe(4);
36
- expect(data[cid].author).toBe('Adeu AI (TS)');
37
- });
1
+ import { describe, it, expect } from 'vitest';
2
+ import { readFileSync } from 'node:fs';
3
+ import { resolve, dirname } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { DocumentObject } from './docx/bridge.js';
6
+ import { CommentsManager, extract_comments_data } from './comments.js';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+
11
+ describe('CommentsManager & DOM Serialization', () => {
12
+ it('should safely add a comment and serialize to buffer', async () => {
13
+ // 1. Load the golden DOCX from shared fixtures
14
+ const fixturePath = resolve(__dirname, '../../../../shared/fixtures/golden.docx');
15
+ const buf = readFileSync(fixturePath);
16
+ const doc = await DocumentObject.load(buf);
17
+
18
+ // 2. Perform a mutation via the TS implementation of CommentsManager
19
+ const mgr = new CommentsManager(doc);
20
+ const cid = mgr.addComment('Adeu AI (TS)', 'This is a test comment injected by Node.js');
21
+
22
+ expect(cid).toBeDefined();
23
+
24
+ // 3. Serialize the mutated DOM back to a zipped DOCX buffer
25
+ const savedBuf = await doc.save();
26
+ expect(savedBuf.length).toBeGreaterThan(0);
27
+
28
+ // 4. Ensure we can load the serialized buffer back (verifying [Content_Types] and .rels integrity)
29
+ const doc2 = await DocumentObject.load(savedBuf);
30
+ expect(doc2.pkg.parts.length).toBeGreaterThan(0);
31
+
32
+ // Assert the comment survived the roundtrip
33
+ const data = extract_comments_data(doc2.pkg);
34
+ // golden.docx has 3 comments initially, plus our 1 new one = 4
35
+ expect(Object.keys(data).length).toBe(4);
36
+ expect(data[cid].author).toBe('Adeu AI (TS)');
37
+ });
38
38
  });