@fulmenhq/tsfulmen 0.2.0 → 0.2.2
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/CHANGELOG.md +42 -0
- package/README.md +60 -7
- package/config/crucible-ts/agentic/roles/README.md +3 -3
- package/config/crucible-ts/library/fulencode/fixtures/README.md +18 -0
- package/config/crucible-ts/library/fulencode/fixtures/bom/bom.yaml +14 -0
- package/config/crucible-ts/library/fulencode/fixtures/detection/detection.yaml +12 -0
- package/config/crucible-ts/library/fulencode/fixtures/invalid-encodings/base64.yaml +10 -0
- package/config/crucible-ts/library/fulencode/fixtures/normalization/text-safe.yaml +10 -0
- package/config/crucible-ts/library/fulencode/fixtures/telemetry/telemetry-test-cases.yaml +24 -0
- package/config/crucible-ts/library/fulencode/fixtures/valid-encodings/base64.yaml +11 -0
- package/config/crucible-ts/taxonomy/library/platform-modules/v1.0.0/modules.yaml +2 -2
- package/config/crucible-ts/taxonomy/metrics.yaml +79 -1
- package/dist/appidentity/index.d.ts +1 -1
- package/dist/appidentity/index.js +122 -56
- package/dist/appidentity/index.js.map +1 -1
- package/dist/config/index.js +122 -56
- package/dist/config/index.js.map +1 -1
- package/dist/crucible/index.js +122 -56
- package/dist/crucible/index.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +122 -56
- package/dist/errors/index.js.map +1 -1
- package/dist/foundry/index.js +122 -56
- package/dist/foundry/index.js.map +1 -1
- package/dist/fulencode/index.d.ts +102 -0
- package/dist/fulencode/index.js +806 -0
- package/dist/fulencode/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +123 -57
- package/dist/index.js.map +1 -1
- package/dist/pathfinder/index.d.ts +1 -1
- package/dist/pathfinder/index.js +122 -56
- package/dist/pathfinder/index.js.map +1 -1
- package/dist/reports/license-inventory.csv +7 -6
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +122 -56
- package/dist/schema/index.js.map +1 -1
- package/dist/signals/index.js +122 -56
- package/dist/signals/index.js.map +1 -1
- package/dist/telemetry/http/index.js +122 -56
- package/dist/telemetry/http/index.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +122 -56
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/prometheus/index.d.ts +1 -1
- package/dist/telemetry/prometheus/index.js +122 -56
- package/dist/telemetry/prometheus/index.js.map +1 -1
- package/dist/{types-BJswWpQC.d.ts → types-DdoeE7F5.d.ts} +1 -1
- package/package.json +7 -2
- package/schemas/crucible-ts/library/fulencode/v1.0.0/README.md +37 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/bom-result.schema.json +48 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/decode-options.schema.json +60 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/decoding-result.schema.json +70 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/detect-options.schema.json +25 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/detection-result.schema.json +57 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/encode-options.schema.json +71 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/encoding-result.schema.json +57 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/fulencode-config.schema.json +8 -4
- package/schemas/crucible-ts/library/fulencode/v1.0.0/fulencode-error.schema.json +66 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/normalization-result.schema.json +73 -0
- package/schemas/crucible-ts/library/fulencode/v1.0.0/normalize-options.schema.json +44 -0
- package/schemas/crucible-ts/meta/README.md +38 -2
- package/schemas/crucible-ts/meta/draft-04/schema.json +222 -0
- package/schemas/crucible-ts/meta/draft-06/schema.json +218 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/applicator.json +93 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/content.json +21 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/core.json +58 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/format.json +15 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/meta-data.json +35 -0
- package/schemas/crucible-ts/meta/draft-2019-09/meta/validation.json +119 -0
- package/schemas/crucible-ts/meta/draft-2019-09/offline.schema.json +148 -0
- package/schemas/crucible-ts/meta/draft-2019-09/schema.json +62 -0
- package/schemas/crucible-ts/meta/fixtures/draft-04-sample.json +16 -0
- package/schemas/crucible-ts/meta/fixtures/draft-06-sample.json +16 -0
- package/schemas/crucible-ts/meta/fixtures/draft-07-sample.json +34 -0
- package/schemas/crucible-ts/meta/fixtures/draft-2019-09-sample.json +21 -0
- package/schemas/crucible-ts/meta/fixtures/draft-2020-12-sample.json +21 -0
- package/schemas/crucible-ts/taxonomy/library/fulencode/normalization-profiles/v1.0.0/profiles.yaml +16 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/PROVENANCE.md +64 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/access-tier.dimension.json +103 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/retention-lifecycle.dimension.json +103 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/schema-stability.dimension.json +100 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/sensitivity.dimension.json +130 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/velocity-mode.dimension.json +79 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/volatility.dimension.json +72 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/config/classifiers/dimensions/volume-tier.dimension.json +66 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/catalog/classifiers/README.md +29 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/access-tier-classification.md +163 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/classifiers-framework.md +157 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/data-sensitivity-classification.md +259 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/retention-lifecycle-classification.md +200 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/schema-stability-classification.md +205 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/velocity-mode-classification.md +222 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/volatility-classification.md +209 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/volume-tier-classification.md +200 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/ailink/v0/README.md +48 -0
- package/schemas/crucible-ts/upstream/3leaps/{ailink → crucible/schemas/ailink}/v0/prompt.schema.json +4 -18
- package/schemas/crucible-ts/upstream/3leaps/{ailink → crucible/schemas/ailink}/v0/search-response.schema.json +7 -37
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/classifiers/v0/dimension-definition.schema.json +247 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/classifiers/v0/sensitivity-level.schema.json +67 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/error-response.schema.json +59 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/lifecycle-phases.data.json +102 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/lifecycle-phases.schema.json +101 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/release-phase.schema.json +18 -0
- package/schemas/crucible-ts/upstream/3leaps/crucible/schemas/foundation/v0/types.schema.json +177 -0
- package/schemas/crucible-ts/upstream/3leaps/PROVENANCE.md +0 -43
- /package/schemas/crucible-ts/upstream/3leaps/{agentic → crucible/schemas/agentic}/v0/role-prompt.schema.json +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/crucible/fulhash/types.ts","../../src/fulhash/algorithms/crc32.ts","../../src/fulhash/algorithms/crc32c.ts","../../src/fulhash/algorithms/sha256.ts","../../src/fulhash/errors.ts","../../src/fulhash/algorithms/xxh3.ts","../../src/fulhash/digest.ts","../../src/fulhash/hash.ts","../../src/fulencode/errors.ts","../../src/fulencode/types.ts","../../src/fulencode/fulencode.ts","../../src/fulencode/base32.ts","../../src/fulencode/index.ts"],"names":["Algorithm","hex","hexToBytes","hashBytes","crc32","hashString","hash"],"mappings":";;;;;;;;;;;;;;AAAA,IAQY,SAAA;AARZ,IAAA,UAAA,GAAA,KAAA,CAAA;AAAA,EAAA,+BAAA,GAAA;AAQO,IAAK,SAAA,qBAAAA,UAAAA,KAAL;AAKL,MAAAA,WAAA,UAAA,CAAA,GAAW,UAAA;AAMX,MAAAA,WAAA,QAAA,CAAA,GAAS,QAAA;AAMT,MAAAA,WAAA,OAAA,CAAA,GAAQ,OAAA;AAMR,MAAAA,WAAA,QAAA,CAAA,GAAS,QAAA;AAvBC,MAAA,OAAAA,UAAAA;AAAA,IAAA,CAAA,EAAA,SAAA,IAAA,EAAA,CAAA;AAAA,EAAA;AAAA,CAAA,CAAA;ACcZ,SAAS,WAAW,GAAA,EAAyB;AAC3C,EAAA,MAAM,KAAA,GAAQ,IAAI,UAAA,CAAW,CAAC,CAAA;AAC9B,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,KAAA,CAAM,CAAC,CAAA,GAAI,MAAA,CAAO,QAAA,CAAS,GAAA,CAAI,OAAO,CAAA,GAAI,CAAA,EAAG,CAAC,CAAA,EAAG,EAAE,CAAA;AAAA,EACrD;AACA,EAAA,OAAO,KAAA;AACT;AAEA,eAAsB,UAAU,IAAA,EAAuC;AACrE,EAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,IAAI,CAAA;AAC5B,EAAA,OAAO,WAAW,GAAG,CAAA;AACvB;AAEA,eAAsB,UAAA,CACpB,GAAA,EACA,QAAA,GAA2B,MAAA,EACN;AACrB,EAAA,IAAI,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A,SAAA,EAAW,OAAO,KAAA,KAAU,QAAA,GAAW,OAAO,UAAA,CAAW,KAAA,EAAO,MAAM,CAAA,GAAI,KAAA,CAAM,MAAA;AAAA,IAChF,YAAY,OAAA,CAAQ,MAAA;AAAA,IACpB,QAAA;AAAA,IACA,kBAAA;AAAA,IACA,GAAG;AAAA,GACL;AACF;;;AE3aO,IAAM,OAAA,GAAU;AAQhB,IAAM,SAAA,GAAY;AAAA,EACvB,MAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["/**\n * FulHash Types\n * Code generated by scripts/codegen/generate-fulhash-types.ts; DO NOT EDIT.\n */\n\n/**\n * Supported hashing algorithms for FulHash\n */\nexport enum Algorithm {\n /**\n * XXH3 (128-bit)\n * Fast non-cryptographic hash (default). Excellent collision resistance, extremely high throughput (50GB/s+).\n */\n XXH3_128 = \"xxh3-128\",\n\n /**\n * SHA-256\n * Cryptographic security standard. Resistant to intentional collisions. Use for security verification.\n */\n SHA256 = \"sha256\",\n\n /**\n * CRC-32 (IEEE)\n * 32-bit Cyclic Redundancy Check. Standard for GZIP/ZIP/PNG legacy format interoperability.\n */\n CRC32 = \"crc32\",\n\n /**\n * CRC-32C (Castagnoli)\n * 32-bit CRC (Castagnoli). HW accelerated (SSE4.2/ARMv8). Use for cloud storage (GCS, AWS) and networking.\n */\n CRC32C = \"crc32c\",\n}\n\n/**\n * Standard digest payload returned by FulHash helpers\n */\nexport interface Digest {\n /**\n * Hash algorithm identifier\n */\n algorithm: \"xxh3-128\" | \"crc32\" | \"crc32c\" | \"sha256\";\n\n /**\n * Lowercase hexadecimal representation of the digest\n */\n hex: string;\n\n /**\n * Canonical string representation '<algorithm>:<hex>'\n */\n formatted: string;\n\n /**\n * Raw digest bytes (optional)\n */\n bytes?: number[];\n}\n","import type { IHasher } from \"hash-wasm\";\nimport { crc32, createCRC32 } from \"hash-wasm\";\n\n// Local definition to avoid importing from hash-wasm/dist/lib/util which is not a public export\ntype IDataType =\n | string\n | Uint8Array\n | Uint16Array\n | Uint32Array\n | Int8Array\n | Int16Array\n | Int32Array\n | Float32Array\n | Float64Array\n | DataView\n | ArrayBuffer\n | SharedArrayBuffer;\n\n/**\n * Convert hex string to Uint8Array\n * @internal\n */\nfunction hexToBytes(hex: string): Uint8Array {\n const bytes = new Uint8Array(4);\n for (let i = 0; i < 4; i++) {\n bytes[i] = Number.parseInt(hex.substr(i * 2, 2), 16);\n }\n return bytes;\n}\n\nexport async function hashBytes(data: Uint8Array): Promise<Uint8Array> {\n const hex = await crc32(data);\n return hexToBytes(hex);\n}\n\nexport async function hashString(\n str: string,\n encoding: BufferEncoding = \"utf8\",\n): Promise<Uint8Array> {\n if (encoding !== \"utf8\") {\n // hash-wasm only supports string input as UTF-8\n // For other encodings, convert to Buffer first\n const buf = Buffer.from(str, encoding);\n const hex = await crc32(buf);\n return hexToBytes(hex);\n }\n const hex = await crc32(str);\n return hexToBytes(hex);\n}\n\n// Ensure the hasher we return respects the IHasher interface correctly\ninterface CRC32Hasher extends IHasher {\n update(data: IDataType): IHasher;\n}\n\nexport async function createHasher(): Promise<CRC32Hasher> {\n const hasher = await createCRC32();\n return hasher as unknown as CRC32Hasher;\n}\n","import type { IHasher } from \"hash-wasm\";\nimport { crc32, createCRC32 } from \"hash-wasm\";\n\n// Local definition to avoid importing from hash-wasm/dist/lib/util\ntype IDataType =\n | string\n | Uint8Array\n | Uint16Array\n | Uint32Array\n | Int8Array\n | Int16Array\n | Int32Array\n | Float32Array\n | Float64Array\n | DataView\n | ArrayBuffer\n | SharedArrayBuffer;\n\nconst CRC32C_POLYNOMIAL = 0x82f63b78;\n\n/**\n * Convert hex string to Uint8Array\n * @internal\n */\nfunction hexToBytes(hex: string): Uint8Array {\n const bytes = new Uint8Array(4);\n for (let i = 0; i < 4; i++) {\n bytes[i] = Number.parseInt(hex.substr(i * 2, 2), 16);\n }\n return bytes;\n}\n\nexport async function hashBytes(data: Uint8Array): Promise<Uint8Array> {\n const hex = await crc32(data, CRC32C_POLYNOMIAL);\n return hexToBytes(hex);\n}\n\nexport async function hashString(\n str: string,\n encoding: BufferEncoding = \"utf8\",\n): Promise<Uint8Array> {\n if (encoding !== \"utf8\") {\n const buf = Buffer.from(str, encoding);\n const hex = await crc32(buf, CRC32C_POLYNOMIAL);\n return hexToBytes(hex);\n }\n const hex = await crc32(str, CRC32C_POLYNOMIAL);\n return hexToBytes(hex);\n}\n\ninterface CRC32Hasher extends IHasher {\n update(data: IDataType): IHasher;\n}\n\nexport async function createHasher(): Promise<CRC32Hasher> {\n const hasher = await createCRC32(CRC32C_POLYNOMIAL);\n return hasher as unknown as CRC32Hasher;\n}\n","/**\n * SHA-256 algorithm adapter using Node.js crypto module\n */\n\nimport { createHash } from \"node:crypto\";\n\nexport function hashBytes(data: Uint8Array): Uint8Array {\n const hash = createHash(\"sha256\");\n hash.update(data);\n return new Uint8Array(hash.digest());\n}\n\nexport function hashString(str: string, encoding: BufferEncoding = \"utf8\"): Uint8Array {\n const hash = createHash(\"sha256\");\n hash.update(str, encoding);\n return new Uint8Array(hash.digest());\n}\n","/**\n * Error classes for FulHash module\n */\n\nexport class FulHashError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"FulHashError\";\n Object.setPrototypeOf(this, FulHashError.prototype);\n }\n}\n\nexport class UnsupportedAlgorithmError extends FulHashError {\n constructor(algorithm: string, supportedAlgorithms: string[]) {\n super(\n `Unsupported algorithm \"${algorithm}\". Supported algorithms: ${supportedAlgorithms.join(\", \")}`,\n );\n this.name = \"UnsupportedAlgorithmError\";\n Object.setPrototypeOf(this, UnsupportedAlgorithmError.prototype);\n }\n}\n\nexport class InvalidChecksumError extends FulHashError {\n constructor(checksum: string, reason: string) {\n super(`Invalid checksum \"${checksum}\": ${reason}. Expected format: algorithm:hex`);\n this.name = \"InvalidChecksumError\";\n Object.setPrototypeOf(this, InvalidChecksumError.prototype);\n }\n}\n\nexport class InvalidChecksumFormatError extends InvalidChecksumError {\n constructor(checksum: string, reason: string) {\n super(checksum, reason);\n this.name = \"InvalidChecksumFormatError\";\n Object.setPrototypeOf(this, InvalidChecksumFormatError.prototype);\n }\n}\n\nexport class DigestStateError extends FulHashError {\n constructor(operation: string) {\n super(`Cannot ${operation}: digest already finalized. Call reset() to reuse hasher.`);\n this.name = \"DigestStateError\";\n Object.setPrototypeOf(this, DigestStateError.prototype);\n }\n}\n","import { xxhash128 } from \"hash-wasm\";\nimport { FulHashError } from \"../errors.js\";\n\n/**\n * Convert hex string to Uint8Array\n * @internal\n */\nfunction hexToBytes(hex: string): Uint8Array {\n const bytes = new Uint8Array(16);\n for (let i = 0; i < 16; i++) {\n bytes[i] = Number.parseInt(hex.substr(i * 2, 2), 16);\n }\n return bytes;\n}\n\n/**\n * Hash bytes using XXH3-128 algorithm\n *\n * Uses the cached hash-wasm xxhash128() helper for optimal performance.\n * The WASM module is initialized once and reused across all calls.\n *\n * @param data - Input data as Uint8Array\n * @returns Hash digest as Uint8Array (16 bytes)\n */\nexport async function hashBytes(data: Uint8Array): Promise<Uint8Array> {\n // Use cached xxhash128 helper - returns hex string\n const hex = await xxhash128(data);\n return hexToBytes(hex);\n}\n\n/**\n * Hash string using XXH3-128 algorithm\n *\n * Uses the cached hash-wasm xxhash128() helper for optimal performance.\n * The WASM module is initialized once and reused across all calls.\n *\n * @param str - Input string\n * @param encoding - Character encoding (only 'utf8' supported)\n * @returns Hash digest as Uint8Array (16 bytes)\n */\nexport async function hashString(\n str: string,\n encoding: \"utf8\" | \"utf16le\" = \"utf8\",\n): Promise<Uint8Array> {\n if (encoding !== \"utf8\") {\n throw new FulHashError(\n \"XXH3-128 only supports UTF-8 encoding. Use utf8 encoding or convert data to Uint8Array.\",\n );\n }\n\n // Use cached xxhash128 helper directly on string\n const hex = await xxhash128(str);\n return hexToBytes(hex);\n}\n","/**\n * Digest implementation - immutable hash result container\n */\n\nimport { Algorithm, type Digest as DigestInterface } from \"../crucible/fulhash/types.js\";\nimport {\n InvalidChecksumError,\n InvalidChecksumFormatError,\n UnsupportedAlgorithmError,\n} from \"./errors.js\";\n\nexport class Digest implements DigestInterface {\n readonly algorithm: Algorithm;\n private readonly _bytes: Uint8Array;\n readonly hex: string;\n readonly formatted: string;\n\n constructor(algorithm: Algorithm, bytes: Uint8Array) {\n this.algorithm = algorithm;\n this._bytes = new Uint8Array(bytes);\n this.hex = Array.from(this._bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n this.formatted = `${this.algorithm}:${this.hex}`;\n Object.freeze(this);\n }\n\n get bytes(): number[] {\n return Array.from(this._bytes);\n }\n\n toJSON(): object {\n return {\n algorithm: this.algorithm,\n hex: this.hex,\n formatted: this.formatted,\n };\n }\n\n toString(): string {\n return this.formatted;\n }\n\n static parse(formatted: string): Digest {\n if (!formatted.includes(\":\")) {\n throw new InvalidChecksumFormatError(formatted, \"missing separator\");\n }\n\n const [algorithmStr, hex] = formatted.split(\":\", 2);\n\n if (!algorithmStr || !hex) {\n throw new InvalidChecksumFormatError(formatted, \"invalid format\");\n }\n\n const algorithm = algorithmStr as Algorithm;\n if (!Object.values(Algorithm).includes(algorithm)) {\n throw new UnsupportedAlgorithmError(algorithm, Object.values(Algorithm));\n }\n\n if (!/^[0-9a-f]+$/.test(hex)) {\n throw new InvalidChecksumError(\n formatted,\n \"hex must contain only lowercase hexadecimal characters\",\n );\n }\n\n let expectedLength: number;\n switch (algorithm) {\n case Algorithm.XXH3_128:\n expectedLength = 32;\n break;\n case Algorithm.SHA256:\n expectedLength = 64;\n break;\n case Algorithm.CRC32:\n case Algorithm.CRC32C:\n expectedLength = 8;\n break;\n default:\n // Should have been caught by Object.values check, but TS safety\n throw new UnsupportedAlgorithmError(algorithm, Object.values(Algorithm));\n }\n\n if (hex.length !== expectedLength) {\n throw new InvalidChecksumError(\n formatted,\n `invalid hex length for ${algorithm}: expected ${expectedLength}, got ${hex.length}`,\n );\n }\n\n const bytes = new Uint8Array(hex.length / 2);\n for (let i = 0; i < hex.length; i += 2) {\n bytes[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);\n }\n\n return new Digest(algorithm, bytes);\n }\n\n equals(other: Digest): boolean {\n if (this.algorithm !== other.algorithm) {\n return false;\n }\n if (this.hex !== other.hex) {\n return false;\n }\n return true;\n }\n\n static async verify(data: string | Uint8Array, checksum: string): Promise<boolean> {\n const expected = Digest.parse(checksum);\n const { hash } = await import(\"./hash.js\");\n const actual = await hash(data, { algorithm: expected.algorithm });\n return actual.equals(expected);\n }\n}\n","/**\n * Block hashing helpers for one-shot hashing operations\n */\n\nimport { Algorithm } from \"../crucible/fulhash/types.js\";\nimport * as crc32 from \"./algorithms/crc32.js\";\nimport * as crc32c from \"./algorithms/crc32c.js\";\nimport * as sha256 from \"./algorithms/sha256.js\";\nimport * as xxh3 from \"./algorithms/xxh3.js\";\nimport type { HashOptions } from \"./definitions.js\";\nimport { Digest } from \"./digest.js\";\nimport { UnsupportedAlgorithmError } from \"./errors.js\";\n\nexport async function hash(input: string | Uint8Array, options?: HashOptions): Promise<Digest> {\n const algorithm = options?.algorithm ?? Algorithm.XXH3_128;\n const encoding = options?.encoding ?? \"utf8\";\n\n let bytes: Uint8Array;\n\n switch (algorithm) {\n case Algorithm.SHA256:\n if (typeof input === \"string\") {\n bytes = sha256.hashString(input, encoding);\n } else {\n bytes = sha256.hashBytes(input);\n }\n break;\n case Algorithm.XXH3_128:\n if (typeof input === \"string\") {\n if (encoding !== \"utf8\") {\n // Fallback via buffer if non-utf8 is requested, as xxh3-wasm is utf8 only\n bytes = await xxh3.hashBytes(Buffer.from(input, encoding));\n } else {\n bytes = await xxh3.hashString(input, \"utf8\");\n }\n } else {\n bytes = await xxh3.hashBytes(input);\n }\n break;\n case Algorithm.CRC32:\n if (typeof input === \"string\") {\n bytes = await crc32.hashString(input, encoding);\n } else {\n bytes = await crc32.hashBytes(input);\n }\n break;\n case Algorithm.CRC32C:\n if (typeof input === \"string\") {\n bytes = await crc32c.hashString(input, encoding);\n } else {\n bytes = await crc32c.hashBytes(input);\n }\n break;\n default:\n throw new UnsupportedAlgorithmError(algorithm, Object.values(Algorithm));\n }\n\n return new Digest(algorithm, bytes);\n}\n\nexport async function hashString(str: string, options?: HashOptions): Promise<Digest> {\n return hash(str, options);\n}\n\nexport async function hashBytes(data: Uint8Array, options?: HashOptions): Promise<Digest> {\n return hash(data, options);\n}\n","import type { EncodingFormat } from \"./types.js\";\n\nexport type FulencodeOperation = \"encode\" | \"decode\" | \"detect\" | \"normalize\" | \"bom\";\n\nexport interface FulencodeErrorDetails {\n byteOffset?: number;\n codepointOffset?: number;\n detectedEncoding?: string;\n confidence?: number;\n invalidBytes?: number[];\n expected?: string;\n actual?: string;\n [key: string]: unknown;\n}\n\nexport class FulencodeError extends Error {\n public readonly code: string;\n public readonly operation: FulencodeOperation;\n public readonly inputFormat?: EncodingFormat;\n public readonly outputFormat?: EncodingFormat;\n public readonly details?: FulencodeErrorDetails;\n\n public constructor(args: {\n code: string;\n message: string;\n operation: FulencodeOperation;\n inputFormat?: EncodingFormat;\n outputFormat?: EncodingFormat;\n details?: FulencodeErrorDetails;\n cause?: unknown;\n }) {\n super(args.message);\n this.name = \"FulencodeError\";\n this.code = args.code;\n this.operation = args.operation;\n this.inputFormat = args.inputFormat;\n this.outputFormat = args.outputFormat;\n this.details = args.details;\n if (args.cause !== undefined) {\n (this as unknown as { cause: unknown }).cause = args.cause;\n }\n }\n}\n","/**\n * Fulencode types - canonical encoding/decoding interfaces.\n */\n\nexport const EncodingFormat = {\n BASE64: \"base64\",\n BASE64URL: \"base64url\",\n BASE64_RAW: \"base64_raw\",\n BASE32: \"base32\",\n BASE32HEX: \"base32hex\",\n HEX: \"hex\",\n UTF8: \"utf-8\",\n UTF16LE: \"utf-16le\",\n UTF16BE: \"utf-16be\",\n ISO_8859_1: \"iso-8859-1\",\n CP1252: \"cp1252\",\n ASCII: \"ascii\",\n} as const;\n\nexport type EncodingFormat = (typeof EncodingFormat)[keyof typeof EncodingFormat];\n\nexport type OnErrorMode = \"strict\" | \"replace\" | \"ignore\";\nexport type DecodeOnErrorMode = OnErrorMode | \"fallback\";\n\nexport interface EncodeOptions {\n padding?: boolean;\n hexCase?: \"upper\" | \"lower\";\n lineLength?: number | null;\n lineEnding?: \"\\n\" | \"\\r\\n\";\n maxEncodedSize?: number;\n\n computeChecksum?: string;\n embedChecksum?: boolean;\n\n onError?: OnErrorMode;\n}\n\nexport interface EncodingResult {\n data: string;\n format: EncodingFormat;\n inputSize: number;\n outputSize: number;\n checksum?: string;\n checksumAlgorithm?: string;\n warnings: string[];\n}\n\nexport interface DecodeOptions {\n verifyChecksum?: boolean;\n computeChecksum?: string;\n maxDecodedSize?: number;\n\n onError?: DecodeOnErrorMode;\n fallbackFormats?: EncodingFormat[];\n\n ignoreWhitespace?: boolean;\n validatePadding?: boolean;\n}\n\nexport interface DecodingResult {\n data: Uint8Array;\n format: EncodingFormat;\n inputSize: number;\n outputSize: number;\n checksum?: string;\n checksumVerified?: boolean;\n checksumAlgorithm?: string;\n warnings: string[];\n correctionsApplied: number;\n}\n","import { Algorithm } from \"../crucible/fulhash/types.js\";\nimport { hashBytes } from \"../fulhash/hash.js\";\nimport { decodeBase32, encodeBase32 } from \"./base32.js\";\nimport { FulencodeError } from \"./errors.js\";\nimport type {\n DecodeOptions,\n DecodingResult,\n EncodeOptions,\n EncodingFormat,\n EncodingResult,\n} from \"./types.js\";\n\nfunction wrapLines(data: string, lineLength: number, lineEnding: \"\\n\" | \"\\r\\n\"): string {\n if (lineLength <= 0) return data;\n let out = \"\";\n for (let i = 0; i < data.length; i += lineLength) {\n out += data.slice(i, i + lineLength);\n if (i + lineLength < data.length) out += lineEnding;\n }\n return out;\n}\n\nfunction requireBytes(input: Uint8Array | string, format: EncodingFormat): Uint8Array {\n if (typeof input === \"string\") {\n throw new FulencodeError({\n code: \"INVALID_INPUT_TYPE\",\n message: `Format '${format}' requires binary input (Uint8Array)`,\n operation: \"encode\",\n outputFormat: format,\n details: { expected: \"Uint8Array\", actual: \"string\" },\n });\n }\n return input;\n}\n\nfunction normalizeWhitespace(input: string, ignoreWhitespace: boolean): string {\n if (!ignoreWhitespace) return input;\n return input.replace(/[\\n\\r\\t\\s]/g, \"\");\n}\n\nfunction base64FromBytes(data: Uint8Array): string {\n return Buffer.from(data).toString(\"base64\");\n}\n\nfunction base64UrlFromBytes(data: Uint8Array): string {\n // Derive from base64 for consistent padding control.\n return base64FromBytes(data).replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n}\n\nfunction applyBase64Padding(s: string, padding: boolean): string {\n return padding ? s.padEnd(Math.ceil(s.length / 4) * 4, \"=\") : s.replace(/=+$/g, \"\");\n}\n\nfunction decodeBase64Strict(\n input: string,\n variant: \"base64\" | \"base64url\",\n validatePadding: boolean,\n): Uint8Array {\n const allowed = variant === \"base64\" ? /^[A-Za-z0-9+/]*={0,2}$/ : /^[A-Za-z0-9\\-_]*={0,2}$/;\n if (!allowed.test(input)) {\n throw new Error(\"Invalid base64 characters\");\n }\n\n if (validatePadding) {\n if (input.length % 4 !== 0) {\n throw new Error(\"Invalid base64 length\");\n }\n const firstPad = input.indexOf(\"=\");\n if (firstPad !== -1) {\n for (let i = firstPad; i < input.length; i++) {\n if (input[i] !== \"=\") throw new Error(\"Invalid base64 padding\");\n }\n }\n }\n\n const s = variant === \"base64url\" ? input.replace(/-/g, \"+\").replace(/_/g, \"/\") : input;\n return Uint8Array.from(Buffer.from(s, \"base64\"));\n}\n\nasync function computeChecksumIfRequested(\n data: Uint8Array,\n algorithm?: string,\n): Promise<{ checksum?: string; checksumAlgorithm?: string }> {\n if (!algorithm) return {};\n\n if (algorithm !== \"sha256\" && algorithm !== \"xxh3-128\") {\n throw new FulencodeError({\n code: \"UNSUPPORTED_CHECKSUM\",\n message: `Unsupported checksum algorithm: ${algorithm}`,\n operation: \"encode\",\n details: { algorithm },\n });\n }\n\n const digest = await hashBytes(data, {\n algorithm: algorithm === \"sha256\" ? Algorithm.SHA256 : Algorithm.XXH3_128,\n });\n\n return { checksum: digest.toString(), checksumAlgorithm: algorithm };\n}\n\nexport async function encode(\n input: Uint8Array | string,\n format: EncodingFormat,\n options: EncodeOptions = {},\n): Promise<EncodingResult> {\n const warnings: string[] = [];\n if (options.embedChecksum) {\n throw new FulencodeError({\n code: \"UNSUPPORTED_FEATURE\",\n message: \"embedChecksum is not implemented in tsfulmen yet\",\n operation: \"encode\",\n outputFormat: format,\n });\n }\n\n const padding = options.padding ?? true;\n const lineLength = options.lineLength ?? null;\n const lineEnding = options.lineEnding ?? \"\\n\";\n const maxEncodedSize = options.maxEncodedSize ?? 500 * 1024 * 1024;\n const onError = options.onError ?? \"strict\";\n\n let data: string;\n let inputBytes: Uint8Array;\n\n try {\n switch (format) {\n case \"base64\": {\n inputBytes = requireBytes(input, format);\n data = applyBase64Padding(base64FromBytes(inputBytes), padding);\n break;\n }\n case \"base64url\": {\n inputBytes = requireBytes(input, format);\n data = applyBase64Padding(base64UrlFromBytes(inputBytes), padding);\n break;\n }\n case \"base64_raw\": {\n inputBytes = requireBytes(input, format);\n data = applyBase64Padding(base64FromBytes(inputBytes), false);\n break;\n }\n case \"hex\": {\n inputBytes = requireBytes(input, format);\n const hex = Buffer.from(inputBytes).toString(\"hex\");\n data = (options.hexCase ?? \"lower\") === \"upper\" ? hex.toUpperCase() : hex;\n break;\n }\n case \"base32\":\n case \"base32hex\": {\n inputBytes = requireBytes(input, format);\n data = encodeBase32(inputBytes, format, { padding });\n break;\n }\n case \"utf-8\": {\n if (typeof input === \"string\") {\n // Pass-through for already-decoded text; decode() is the canonical text->bytes operation.\n data = input;\n inputBytes = new TextEncoder().encode(input);\n warnings.push(\"string_input_passthrough\");\n } else {\n inputBytes = input;\n if (onError === \"strict\") {\n data = new TextDecoder(\"utf-8\", { fatal: true }).decode(inputBytes);\n } else {\n data = new TextDecoder(\"utf-8\", { fatal: false }).decode(inputBytes);\n }\n }\n break;\n }\n case \"utf-16le\": {\n if (typeof input === \"string\") {\n data = input;\n inputBytes = Uint8Array.from(Buffer.from(input, \"utf16le\"));\n warnings.push(\"string_input_passthrough\");\n } else {\n inputBytes = input;\n data = Buffer.from(inputBytes).toString(\"utf16le\");\n }\n break;\n }\n case \"utf-16be\": {\n if (typeof input === \"string\") {\n data = input;\n const le = Buffer.from(input, \"utf16le\");\n for (let i = 0; i + 1 < le.length; i += 2) {\n const a = le[i];\n le[i] = le[i + 1];\n le[i + 1] = a;\n }\n inputBytes = Uint8Array.from(le);\n warnings.push(\"string_input_passthrough\");\n } else {\n inputBytes = input;\n const swapped = Buffer.from(inputBytes);\n for (let i = 0; i + 1 < swapped.length; i += 2) {\n const a = swapped[i];\n swapped[i] = swapped[i + 1];\n swapped[i + 1] = a;\n }\n data = swapped.toString(\"utf16le\");\n }\n break;\n }\n case \"iso-8859-1\": {\n if (typeof input === \"string\") {\n data = input;\n inputBytes = Uint8Array.from(Buffer.from(input, \"latin1\"));\n warnings.push(\"string_input_passthrough\");\n } else {\n inputBytes = input;\n data = Buffer.from(inputBytes).toString(\"latin1\");\n }\n break;\n }\n case \"ascii\": {\n if (typeof input === \"string\") {\n data = input;\n inputBytes = Uint8Array.from(Buffer.from(input, \"ascii\"));\n warnings.push(\"string_input_passthrough\");\n } else {\n inputBytes = input;\n data = Buffer.from(inputBytes).toString(\"ascii\");\n }\n break;\n }\n case \"cp1252\": {\n throw new FulencodeError({\n code: \"UNSUPPORTED_FORMAT\",\n message: \"cp1252 is not implemented in tsfulmen yet\",\n operation: \"encode\",\n outputFormat: format,\n });\n }\n default: {\n throw new FulencodeError({\n code: \"UNSUPPORTED_FORMAT\",\n message: `Unsupported encoding format: ${format}`,\n operation: \"encode\",\n outputFormat: format,\n });\n }\n }\n } catch (err) {\n if (err instanceof FulencodeError) throw err;\n throw new FulencodeError({\n code: \"ENCODE_FAILED\",\n message: (err as Error).message,\n operation: \"encode\",\n outputFormat: format,\n cause: err,\n });\n }\n\n if (lineLength !== null) {\n data = wrapLines(data, lineLength, lineEnding);\n }\n\n if (data.length > maxEncodedSize) {\n throw new FulencodeError({\n code: \"OUTPUT_TOO_LARGE\",\n message: `Encoded output exceeds maxEncodedSize (${maxEncodedSize})`,\n operation: \"encode\",\n outputFormat: format,\n details: { maxEncodedSize, outputSize: data.length },\n });\n }\n\n const checksum = await computeChecksumIfRequested(inputBytes, options.computeChecksum);\n\n return {\n data,\n format,\n inputSize: inputBytes.length,\n outputSize: data.length,\n warnings,\n ...checksum,\n };\n}\n\nexport async function decode(\n input: string | Uint8Array,\n format: EncodingFormat,\n options: DecodeOptions = {},\n): Promise<DecodingResult> {\n const warnings: string[] = [];\n const ignoreWhitespace =\n options.ignoreWhitespace ??\n (format === \"base64\" ||\n format === \"base64url\" ||\n format === \"hex\" ||\n format === \"base32\" ||\n format === \"base32hex\");\n const validatePadding =\n options.validatePadding ??\n (format === \"base64\" ||\n format === \"base64url\" ||\n format === \"base32\" ||\n format === \"base32hex\");\n const maxDecodedSize = options.maxDecodedSize ?? 100 * 1024 * 1024;\n const onError = options.onError ?? \"strict\";\n\n const inputStr = typeof input === \"string\" ? input : Buffer.from(input).toString(\"utf8\");\n const normalized = normalizeWhitespace(inputStr, ignoreWhitespace);\n let decoded: Uint8Array;\n const correctionsApplied = 0;\n\n try {\n switch (format) {\n case \"base64\": {\n const s = applyBase64Padding(normalized, true);\n decoded =\n onError === \"strict\"\n ? decodeBase64Strict(s, \"base64\", validatePadding)\n : Uint8Array.from(Buffer.from(s, \"base64\"));\n break;\n }\n case \"base64url\": {\n const s = applyBase64Padding(normalized, true);\n decoded =\n onError === \"strict\"\n ? decodeBase64Strict(s, \"base64url\", validatePadding)\n : Uint8Array.from(Buffer.from(s.replace(/-/g, \"+\").replace(/_/g, \"/\"), \"base64\"));\n break;\n }\n case \"base64_raw\": {\n const s = applyBase64Padding(normalized, true);\n decoded = Uint8Array.from(Buffer.from(s, \"base64\"));\n if (validatePadding) warnings.push(\"base64_raw does not support padding validation\");\n break;\n }\n case \"hex\": {\n const s = normalized;\n if (onError === \"strict\") {\n if (!/^[0-9a-fA-F]*$/.test(s) || s.length % 2 !== 0) {\n throw new Error(\"Invalid hex input\");\n }\n }\n decoded = Uint8Array.from(Buffer.from(s, \"hex\"));\n break;\n }\n case \"base32\":\n case \"base32hex\": {\n decoded = decodeBase32(normalized, format, {\n ignoreWhitespace,\n validatePadding,\n });\n break;\n }\n case \"utf-8\": {\n // Text-to-bytes\n decoded = new TextEncoder().encode(typeof input === \"string\" ? input : inputStr);\n break;\n }\n case \"utf-16le\": {\n decoded = Uint8Array.from(\n Buffer.from(typeof input === \"string\" ? input : inputStr, \"utf16le\"),\n );\n break;\n }\n case \"utf-16be\": {\n const buf = Buffer.from(typeof input === \"string\" ? input : inputStr, \"utf16le\");\n for (let i = 0; i + 1 < buf.length; i += 2) {\n const a = buf[i];\n buf[i] = buf[i + 1];\n buf[i + 1] = a;\n }\n decoded = Uint8Array.from(buf);\n break;\n }\n case \"iso-8859-1\": {\n decoded = Uint8Array.from(\n Buffer.from(typeof input === \"string\" ? input : inputStr, \"latin1\"),\n );\n break;\n }\n case \"ascii\": {\n decoded = Uint8Array.from(\n Buffer.from(typeof input === \"string\" ? input : inputStr, \"ascii\"),\n );\n break;\n }\n case \"cp1252\": {\n throw new FulencodeError({\n code: \"UNSUPPORTED_FORMAT\",\n message: \"cp1252 is not implemented in tsfulmen yet\",\n operation: \"decode\",\n inputFormat: format,\n });\n }\n default: {\n throw new FulencodeError({\n code: \"UNSUPPORTED_FORMAT\",\n message: `Unsupported decoding format: ${format}`,\n operation: \"decode\",\n inputFormat: format,\n });\n }\n }\n } catch (err) {\n if (err instanceof FulencodeError) throw err;\n throw new FulencodeError({\n code: \"DECODE_FAILED\",\n message: (err as Error).message,\n operation: \"decode\",\n inputFormat: format,\n cause: err,\n });\n }\n\n if (decoded.length > maxDecodedSize) {\n throw new FulencodeError({\n code: \"OUTPUT_TOO_LARGE\",\n message: `Decoded output exceeds maxDecodedSize (${maxDecodedSize})`,\n operation: \"decode\",\n inputFormat: format,\n details: { maxDecodedSize, outputSize: decoded.length },\n });\n }\n\n const checksum = await computeChecksumIfRequested(decoded, options.computeChecksum);\n\n return {\n data: decoded,\n format,\n inputSize: typeof input === \"string\" ? Buffer.byteLength(input, \"utf8\") : input.length,\n outputSize: decoded.length,\n warnings,\n correctionsApplied,\n ...checksum,\n };\n}\n","const RFC4648_BASE32_ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\nconst RFC4648_BASE32HEX_ALPHABET = \"0123456789ABCDEFGHIJKLMNOPQRSTUV\";\n\nfunction getAlphabet(variant: \"base32\" | \"base32hex\"): string {\n return variant === \"base32\" ? RFC4648_BASE32_ALPHABET : RFC4648_BASE32HEX_ALPHABET;\n}\n\nexport function encodeBase32(\n data: Uint8Array,\n variant: \"base32\" | \"base32hex\",\n options: { padding: boolean },\n): string {\n if (data.length === 0) return \"\";\n\n const alphabet = getAlphabet(variant);\n let bits = 0;\n let value = 0;\n let out = \"\";\n\n for (const b of data) {\n value = (value << 8) | b;\n bits += 8;\n while (bits >= 5) {\n const idx = (value >>> (bits - 5)) & 31;\n out += alphabet[idx];\n bits -= 5;\n }\n }\n\n if (bits > 0) {\n const idx = (value << (5 - bits)) & 31;\n out += alphabet[idx];\n }\n\n if (options.padding) {\n while (out.length % 8 !== 0) out += \"=\";\n }\n\n return out;\n}\n\nfunction buildDecodeMap(alphabet: string): Map<string, number> {\n const map = new Map<string, number>();\n for (let i = 0; i < alphabet.length; i++) {\n const ch = alphabet[i];\n map.set(ch, i);\n map.set(ch.toLowerCase(), i);\n }\n return map;\n}\n\nexport function decodeBase32(\n input: string,\n variant: \"base32\" | \"base32hex\",\n options: { ignoreWhitespace: boolean; validatePadding: boolean },\n): Uint8Array {\n const alphabet = getAlphabet(variant);\n const decodeMap = buildDecodeMap(alphabet);\n\n let s = input;\n if (options.ignoreWhitespace) {\n s = s.replace(/[\\n\\r\\t\\s]/g, \"\");\n }\n\n // Split padding for strict checks.\n const firstPad = s.indexOf(\"=\");\n if (firstPad !== -1) {\n if (options.validatePadding) {\n for (let i = firstPad; i < s.length; i++) {\n if (s[i] !== \"=\") {\n throw new Error(\"Invalid base32 padding\");\n }\n }\n if (s.length % 8 !== 0) {\n throw new Error(\"Invalid base32 length (padding)\");\n }\n }\n s = s.slice(0, firstPad);\n }\n\n let bits = 0;\n let value = 0;\n const out: number[] = [];\n\n for (let i = 0; i < s.length; i++) {\n const ch = s[i];\n const v = decodeMap.get(ch);\n if (v === undefined) {\n throw new Error(`Invalid base32 character: ${ch}`);\n }\n\n value = (value << 5) | v;\n bits += 5;\n if (bits >= 8) {\n out.push((value >>> (bits - 8)) & 255);\n bits -= 8;\n }\n }\n\n return Uint8Array.from(out);\n}\n","/**\n * Fulencode - canonical encoding/decoding facade.\n */\n\nexport const VERSION = \"0.1.0\";\n\nexport * from \"./errors.js\";\nexport * from \"./types.js\";\n\nimport { decode, encode } from \"./fulencode.js\";\nexport { decode, encode };\n\nexport const fulencode = {\n encode,\n decode,\n} as const;\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { DocScribeError, DocScribeFormat, DocScribeFrontmatterResult, DocScribeH
|
|
|
3
3
|
export { ERROR_CODES, FULPACK_VERSION, FulpackOperationError, checkDecompressionBomb, create, createFulpackError, extract, hasPathTraversal, info, isAbsolutePath, scan, validatePath, verify } from './fulpack/index.js';
|
|
4
4
|
export { ArchiveEntry, ArchiveFormat, ArchiveInfo, ArchiveManifest, CreateOptions, EntryType, ExtractOptions, ExtractResult, FulpackError, Operation, ScanOptions, ValidationResult } from './crucible/fulpack/index.js';
|
|
5
5
|
import './fulmen-error-B_kX8jSC.js';
|
|
6
|
-
import './types-
|
|
6
|
+
import './types-DdoeE7F5.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* TSFulmen - TypeScript Fulmen Helper Library
|
|
@@ -11,6 +11,6 @@ import './types-BJswWpQC.js';
|
|
|
11
11
|
* Provides ergonomic access to Crucible SSOT assets and core utilities
|
|
12
12
|
* for TypeScript/Node.js applications in the FulmenHQ ecosystem.
|
|
13
13
|
*/
|
|
14
|
-
declare const VERSION = "0.2.
|
|
14
|
+
declare const VERSION = "0.2.2";
|
|
15
15
|
|
|
16
16
|
export { VERSION };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { dirname, join, relative, extname, basename } from 'path';
|
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import glob from 'fast-glob';
|
|
7
7
|
import Ajv from 'ajv';
|
|
8
|
+
import Ajv2019 from 'ajv/dist/2019';
|
|
9
|
+
import Ajv2020 from 'ajv/dist/2020';
|
|
10
|
+
import AjvDraft04 from 'ajv-draft-04';
|
|
8
11
|
import addFormats from 'ajv-formats';
|
|
9
12
|
import { pipeline, Readable } from 'stream';
|
|
10
13
|
import picomatch from 'picomatch';
|
|
@@ -1494,20 +1497,14 @@ async function loadMetaSchema(draft) {
|
|
|
1494
1497
|
const content = await readFile(metaSchemaPath, "utf-8");
|
|
1495
1498
|
return JSON.parse(content);
|
|
1496
1499
|
}
|
|
1497
|
-
async function loadVocabularySchemas() {
|
|
1500
|
+
async function loadVocabularySchemas(draft) {
|
|
1501
|
+
if (draft !== "draft-2019-09" && draft !== "draft-2020-12") {
|
|
1502
|
+
return [];
|
|
1503
|
+
}
|
|
1498
1504
|
const __filename3 = fileURLToPath(import.meta.url);
|
|
1499
1505
|
const __dirname4 = dirname(__filename3);
|
|
1500
|
-
const vocabDir = join(
|
|
1501
|
-
|
|
1502
|
-
"..",
|
|
1503
|
-
"..",
|
|
1504
|
-
"schemas",
|
|
1505
|
-
"crucible-ts",
|
|
1506
|
-
"meta",
|
|
1507
|
-
"draft-2020-12",
|
|
1508
|
-
"meta"
|
|
1509
|
-
);
|
|
1510
|
-
const vocabFiles = [
|
|
1506
|
+
const vocabDir = join(__dirname4, "..", "..", "schemas", "crucible-ts", "meta", draft, "meta");
|
|
1507
|
+
const vocabFiles = draft === "draft-2020-12" ? [
|
|
1511
1508
|
"core.json",
|
|
1512
1509
|
"applicator.json",
|
|
1513
1510
|
"unevaluated.json",
|
|
@@ -1515,6 +1512,13 @@ async function loadVocabularySchemas() {
|
|
|
1515
1512
|
"meta-data.json",
|
|
1516
1513
|
"format-annotation.json",
|
|
1517
1514
|
"content.json"
|
|
1515
|
+
] : [
|
|
1516
|
+
"core.json",
|
|
1517
|
+
"applicator.json",
|
|
1518
|
+
"validation.json",
|
|
1519
|
+
"meta-data.json",
|
|
1520
|
+
"format.json",
|
|
1521
|
+
"content.json"
|
|
1518
1522
|
];
|
|
1519
1523
|
const schemas = [];
|
|
1520
1524
|
for (const file of vocabFiles) {
|
|
@@ -1569,47 +1573,68 @@ async function loadReferencedSchema(uri) {
|
|
|
1569
1573
|
}
|
|
1570
1574
|
return JSON.parse(content);
|
|
1571
1575
|
}
|
|
1572
|
-
function
|
|
1573
|
-
if (!
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1576
|
+
function detectDialect(schema) {
|
|
1577
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
1578
|
+
const maybeSchema = schema;
|
|
1579
|
+
const declared = maybeSchema.$schema;
|
|
1580
|
+
if (typeof declared === "string") {
|
|
1581
|
+
if (declared.includes("draft-04")) return "draft-04";
|
|
1582
|
+
if (declared.includes("draft-06")) return "draft-06";
|
|
1583
|
+
if (declared.includes("draft-07")) return "draft-07";
|
|
1584
|
+
if (declared.includes("draft/2019-09")) return "draft-2019-09";
|
|
1585
|
+
if (declared.includes("draft/2020-12")) return "draft-2020-12";
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
return "draft-2020-12";
|
|
1589
|
+
}
|
|
1590
|
+
function createAjv(dialect) {
|
|
1591
|
+
const AjvCtor = dialect === "draft-2020-12" ? Ajv2020 : dialect === "draft-2019-09" ? Ajv2019 : dialect === "draft-04" ? AjvDraft04 : Ajv;
|
|
1592
|
+
const ajv = new AjvCtor({
|
|
1593
|
+
strict: false,
|
|
1594
|
+
allErrors: true,
|
|
1595
|
+
verbose: true,
|
|
1596
|
+
// Allow schemas with $id to be added without replacing existing ones
|
|
1597
|
+
addUsedSchema: false,
|
|
1598
|
+
// draft-04 uses "id"; later drafts use "$id"
|
|
1599
|
+
schemaId: dialect === "draft-04" ? "id" : "$id",
|
|
1600
|
+
// Enable async schema loading for YAML references
|
|
1601
|
+
loadSchema: loadReferencedSchema
|
|
1602
|
+
});
|
|
1603
|
+
addFormats(ajv, {
|
|
1604
|
+
mode: "fast",
|
|
1605
|
+
formats: ["date-time", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference"]
|
|
1606
|
+
});
|
|
1607
|
+
return ajv;
|
|
1608
|
+
}
|
|
1609
|
+
async function getAjv(dialect) {
|
|
1610
|
+
const existing = ajvInstances.get(dialect);
|
|
1611
|
+
if (existing) {
|
|
1612
|
+
const ready = metaschemaReady.get(dialect);
|
|
1613
|
+
if (ready) await ready;
|
|
1614
|
+
return existing;
|
|
1615
|
+
}
|
|
1616
|
+
const ajv = createAjv(dialect);
|
|
1617
|
+
ajvInstances.set(dialect, ajv);
|
|
1618
|
+
const readyPromise = Promise.all([loadVocabularySchemas(dialect), loadMetaSchema(dialect)]).then(([vocabSchemas, metaSchema]) => {
|
|
1619
|
+
for (const vocabSchema of vocabSchemas) {
|
|
1620
|
+
try {
|
|
1621
|
+
ajv.addMetaSchema(vocabSchema);
|
|
1622
|
+
} catch {
|
|
1596
1623
|
}
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1624
|
+
}
|
|
1625
|
+
try {
|
|
1626
|
+
ajv.addMetaSchema(metaSchema);
|
|
1627
|
+
} catch {
|
|
1628
|
+
}
|
|
1629
|
+
}).catch((error) => {
|
|
1630
|
+
throw new Error(`Failed to load metaschemas (${dialect}): ${error}`);
|
|
1631
|
+
});
|
|
1632
|
+
metaschemaReady.set(dialect, readyPromise);
|
|
1633
|
+
await readyPromise;
|
|
1634
|
+
return ajv;
|
|
1602
1635
|
}
|
|
1603
1636
|
async function compileSchema(schema, options = {}) {
|
|
1604
|
-
const
|
|
1605
|
-
if (metaschemaReady) {
|
|
1606
|
-
await metaschemaReady;
|
|
1607
|
-
}
|
|
1608
|
-
const cacheKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1609
|
-
const cached = schemaCache.get(cacheKey);
|
|
1610
|
-
if (cached !== void 0) {
|
|
1611
|
-
return cached;
|
|
1612
|
-
}
|
|
1637
|
+
const baseKey = typeof schema === "string" ? schema : JSON.stringify(schema);
|
|
1613
1638
|
let parsedSchema;
|
|
1614
1639
|
if (typeof schema === "string") {
|
|
1615
1640
|
try {
|
|
@@ -1627,18 +1652,27 @@ async function compileSchema(schema, options = {}) {
|
|
|
1627
1652
|
} else {
|
|
1628
1653
|
parsedSchema = schema;
|
|
1629
1654
|
}
|
|
1655
|
+
const dialect = detectDialect(parsedSchema);
|
|
1656
|
+
const ajv = await getAjv(dialect);
|
|
1657
|
+
const cacheKey = `${dialect}:${baseKey}`;
|
|
1658
|
+
const cached = schemaCache.get(cacheKey);
|
|
1659
|
+
if (cached !== void 0) {
|
|
1660
|
+
return cached;
|
|
1661
|
+
}
|
|
1630
1662
|
try {
|
|
1631
1663
|
if (options.aliases && options.aliases.length > 0) {
|
|
1632
1664
|
for (const alias of options.aliases) {
|
|
1633
1665
|
if (alias && ajv.getSchema(alias) === void 0) {
|
|
1634
1666
|
try {
|
|
1635
|
-
|
|
1667
|
+
if (typeof parsedSchema === "object" && parsedSchema !== null) {
|
|
1668
|
+
ajv.addSchema(parsedSchema, alias);
|
|
1669
|
+
}
|
|
1636
1670
|
} catch {
|
|
1637
1671
|
}
|
|
1638
1672
|
}
|
|
1639
1673
|
}
|
|
1640
1674
|
}
|
|
1641
|
-
const validator = await ajv.compileAsync(parsedSchema);
|
|
1675
|
+
const validator = typeof parsedSchema === "boolean" ? ajv.compile(parsedSchema) : await ajv.compileAsync(parsedSchema);
|
|
1642
1676
|
schemaCache.set(cacheKey, validator);
|
|
1643
1677
|
return validator;
|
|
1644
1678
|
} catch (error) {
|
|
@@ -1708,8 +1742,39 @@ async function validateFile(filePath, validator) {
|
|
|
1708
1742
|
}
|
|
1709
1743
|
async function validateSchema(schema) {
|
|
1710
1744
|
try {
|
|
1711
|
-
|
|
1712
|
-
|
|
1745
|
+
let parsedSchema;
|
|
1746
|
+
if (typeof schema === "string") {
|
|
1747
|
+
try {
|
|
1748
|
+
parsedSchema = JSON.parse(schema);
|
|
1749
|
+
} catch {
|
|
1750
|
+
parsedSchema = parse(schema);
|
|
1751
|
+
}
|
|
1752
|
+
} else if (Buffer.isBuffer(schema)) {
|
|
1753
|
+
const content = schema.toString("utf-8");
|
|
1754
|
+
try {
|
|
1755
|
+
parsedSchema = JSON.parse(content);
|
|
1756
|
+
} catch {
|
|
1757
|
+
parsedSchema = parse(content);
|
|
1758
|
+
}
|
|
1759
|
+
} else {
|
|
1760
|
+
parsedSchema = schema;
|
|
1761
|
+
}
|
|
1762
|
+
const dialect = detectDialect(parsedSchema);
|
|
1763
|
+
const ajv = await getAjv(dialect);
|
|
1764
|
+
const metaValid = ajv.validateSchema(parsedSchema);
|
|
1765
|
+
if (!metaValid && ajv.errors) {
|
|
1766
|
+
const diagnostics = ajv.errors.map(
|
|
1767
|
+
(error) => createDiagnostic(
|
|
1768
|
+
error.instancePath || "",
|
|
1769
|
+
error.message || "Schema meta-validation failed",
|
|
1770
|
+
error.keyword || "unknown",
|
|
1771
|
+
"ERROR",
|
|
1772
|
+
"ajv"
|
|
1773
|
+
)
|
|
1774
|
+
);
|
|
1775
|
+
return { valid: false, diagnostics, source: "ajv" };
|
|
1776
|
+
}
|
|
1777
|
+
await compileSchema(parsedSchema);
|
|
1713
1778
|
return {
|
|
1714
1779
|
valid: true,
|
|
1715
1780
|
diagnostics: [],
|
|
@@ -1780,14 +1845,15 @@ async function validateFileBySchemaId(filePath, schemaId, registryOptions) {
|
|
|
1780
1845
|
throw error;
|
|
1781
1846
|
}
|
|
1782
1847
|
}
|
|
1783
|
-
var
|
|
1848
|
+
var ajvInstances, metaschemaReady, schemaCache;
|
|
1784
1849
|
var init_validator = __esm({
|
|
1785
1850
|
"src/schema/validator.ts"() {
|
|
1786
1851
|
init_telemetry();
|
|
1787
1852
|
init_errors();
|
|
1788
1853
|
init_registry();
|
|
1789
1854
|
init_utils();
|
|
1790
|
-
|
|
1855
|
+
ajvInstances = /* @__PURE__ */ new Map();
|
|
1856
|
+
metaschemaReady = /* @__PURE__ */ new Map();
|
|
1791
1857
|
schemaCache = /* @__PURE__ */ new Map();
|
|
1792
1858
|
}
|
|
1793
1859
|
});
|
|
@@ -8050,7 +8116,7 @@ async function scanZip(archive, options) {
|
|
|
8050
8116
|
var FULPACK_VERSION = "1.0.0";
|
|
8051
8117
|
|
|
8052
8118
|
// src/index.ts
|
|
8053
|
-
var VERSION2 = "0.2.
|
|
8119
|
+
var VERSION2 = "0.2.2";
|
|
8054
8120
|
|
|
8055
8121
|
export { APP_IDENTITY_DIR, APP_IDENTITY_ENV_VAR, APP_IDENTITY_FILENAME, APP_IDENTITY_SCHEMA_ID, AppIdentityError, ArchiveFormat, DocScribeError, DocScribeParseError, DocScribeUnsupportedFormatError, ERROR_CODES, EntryType, FULPACK_VERSION, FulpackOperationError, MAX_ANCESTOR_SEARCH_DEPTH, Operation, VERSION2 as VERSION, __internal, buildEnvVar, checkDecompressionBomb, clearEmbeddedIdentity, clearIdentityCache, create, createFulpackError, detectFormat2 as detectFormat, extract, extractHeaders, extractMetadata, getBinaryName, getCachedIdentity, getConfigIdentifiers, getConfigName, getEmbeddedIdentity, getEnvPrefix, getEnvVar, getTelemetryNamespace, getVendor, hasEmbeddedIdentity, hasPathTraversal, info, inspectDocument, isAbsolutePath, loadIdentity, normalizeInput, parseFrontmatter, registerEmbeddedIdentity, scan, splitDocuments, stripFrontmatter, validatePath, verify };
|
|
8056
8122
|
//# sourceMappingURL=index.js.map
|