From 3be69fb08f186867cb8dfc7459d0ca35af5414fb Mon Sep 17 00:00:00 2001 From: Victor Lopez Date: Fri, 20 Mar 2026 17:26:32 +0100 Subject: [PATCH 1/2] Fix postinstall script not being included in npm package. Update name in docs. --- README.md | 18 +++++++++--------- docs/MIGRATION_V3_TO_V4.md | 10 +++++----- package-lock.json | 4 ++-- package.json | 1 + 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8a81fcc..84d2487 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ A JavaScript/TypeScript library for parsing, validating, and generating [XARF v4 ## Installation ```bash -npm install xarf +npm install @xarf/xarf ``` ## Quick Start @@ -27,7 +27,7 @@ npm install xarf ### Parsing a Report ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; // Missing first_seen and source_port produce validation errors. const { report, errors, warnings } = parse({ @@ -64,7 +64,7 @@ if (errors.length === 0) { ### Creating a Report ```typescript -import { createReport, createEvidence } from 'xarf'; +import { createReport, createEvidence } from '@xarf/xarf'; // Returns { content_type, payload (base64), hash, size, description } const evidence = createEvidence('message/rfc822', rawEmailContent, { @@ -104,7 +104,7 @@ console.log(JSON.stringify(report, null, 2)); Parse and validate a XARF report from JSON. Supports both v4 and v3 (legacy) formats — v3 reports are automatically converted to v4 with deprecation warnings. ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; const { report, errors, warnings, info } = parse(jsonData, options?); ``` @@ -127,7 +127,7 @@ const { report, errors, warnings, info } = parse(jsonData, options?); Create a validated XARF report with auto-generated metadata. Automatically fills `xarf_version`, `report_id` (UUID), and `timestamp` (ISO 8601) if not provided. ```typescript -import { createReport } from 'xarf'; +import { createReport } from '@xarf/xarf'; const { report, errors, warnings } = createReport(input, options?); ``` @@ -150,7 +150,7 @@ const { report, errors, warnings } = createReport(input, options?); Create an evidence object with automatic base64 encoding, hashing, and size calculation. ```typescript -import { createEvidence } from 'xarf'; +import { createEvidence } from '@xarf/xarf'; const evidence = createEvidence(contentType, payload, options?); ``` @@ -169,7 +169,7 @@ const evidence = createEvidence(contentType, payload, options?); Access schema-derived validation rules and metadata programmatically. ```typescript -import { schemaRegistry } from 'xarf'; +import { schemaRegistry } from '@xarf/xarf'; // Get all valid categories schemaRegistry.getCategories(); @@ -211,7 +211,7 @@ if (info) { The library automatically detects XARF v3 reports (by the `Version` field) and converts them to v4 during parsing. Converted reports include `legacy_version: '3'` and deprecation warnings. ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; const { report, warnings } = parse(v3Report); @@ -224,7 +224,7 @@ console.log(report.legacy_version); // '3' You can also use the low-level utilities directly: ```typescript -import { isXARFv3, convertV3toV4, getV3DeprecationWarning } from 'xarf'; +import { isXARFv3, convertV3toV4, getV3DeprecationWarning } from '@xarf/xarf'; if (isXARFv3(jsonData)) { const warnings: string[] = []; diff --git a/docs/MIGRATION_V3_TO_V4.md b/docs/MIGRATION_V3_TO_V4.md index 8496d1a..4c84dca 100644 --- a/docs/MIGRATION_V3_TO_V4.md +++ b/docs/MIGRATION_V3_TO_V4.md @@ -9,7 +9,7 @@ XARF v4 introduces a category-based architecture that improves upon the v3 forma The library automatically detects and converts v3 reports to v4 format: ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; // v3 report is automatically detected and converted const { report, warnings } = parse(v3JsonData); @@ -104,7 +104,7 @@ const { report, warnings } = parse(v3JsonData); When parsing v3 reports, you'll receive deprecation warnings: ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; const { report, warnings } = parse(v3Report); // warnings includes: @@ -121,7 +121,7 @@ const { report, warnings } = parse(v3Report); Use the library's automatic conversion: ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; function processReport(jsonData: string | Record) { const { report } = parse(jsonData); @@ -140,7 +140,7 @@ function processReport(jsonData: string | Record) { Track v3 report usage to plan deprecation: ```typescript -import { parse } from 'xarf'; +import { parse } from '@xarf/xarf'; function trackLegacyUsage(jsonData: string | Record) { const { report } = parse(jsonData); @@ -157,7 +157,7 @@ function trackLegacyUsage(jsonData: string | Record) { Update your report generators to produce v4 format: ```typescript -import { createReport } from 'xarf'; +import { createReport } from '@xarf/xarf'; const { report } = createReport({ category: 'messaging', diff --git a/package-lock.json b/package-lock.json index 8c86301..8fd4d4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "xarf", + "name": "@xarf/xarf", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "xarf", + "name": "@xarf/xarf", "version": "1.0.0", "hasInstallScript": true, "license": "MIT", diff --git a/package.json b/package.json index a003e8a..77b8fd5 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "typescript": "^5.3.3" }, "files": [ + "scripts", "dist", "README.md", "LICENSE" From 50d1f8a53f8552dc07841807f93e3b31b32c8d06 Mon Sep 17 00:00:00 2001 From: Victor Lopez Date: Fri, 20 Mar 2026 17:33:58 +0100 Subject: [PATCH 2/2] Move tar from devDependencies to dependencies --- package-lock.json | 10 ++-------- package.json | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8fd4d4e..75fe31d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "license": "MIT", "dependencies": { "ajv": "^8.17.1", - "ajv-formats": "^3.0.1" + "ajv-formats": "^3.0.1", + "tar": "^7.5.2" }, "devDependencies": { "@types/jest": "^29.5.11", @@ -28,7 +29,6 @@ "jest": "^29.7.0", "lint-staged": "^16.2.7", "prettier": "^3.7.4", - "tar": "^7.5.2", "ts-jest": "^29.4.6", "ts-prune": "^0.10.3", "typescript": "^5.3.3" @@ -780,7 +780,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", - "dev": true, "license": "ISC", "dependencies": { "minipass": "^7.0.4" @@ -2224,7 +2223,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", - "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": ">=18" @@ -4960,7 +4958,6 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" @@ -4970,7 +4967,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", - "dev": true, "license": "MIT", "dependencies": { "minipass": "^7.1.2" @@ -6063,7 +6059,6 @@ "version": "7.5.11", "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.11.tgz", "integrity": "sha512-ChjMH33/KetonMTAtpYdgUFr0tbz69Fp2v7zWxQfYZX4g5ZN2nOBXm1R2xyA+lMIKrLKIoKAwFj93jE/avX9cQ==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/fs-minipass": "^4.0.0", @@ -6080,7 +6075,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", - "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": ">=18" diff --git a/package.json b/package.json index 77b8fd5..8ab98d9 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "jest": "^29.7.0", "lint-staged": "^16.2.7", "prettier": "^3.7.4", - "tar": "^7.5.2", "ts-jest": "^29.4.6", "ts-prune": "^0.10.3", "typescript": "^5.3.3" @@ -92,6 +91,7 @@ }, "dependencies": { "ajv": "^8.17.1", - "ajv-formats": "^3.0.1" + "ajv-formats": "^3.0.1", + "tar": "^7.5.2" } }