{"_id":"@aurabx/jolt-js","name":"@aurabx/jolt-js","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@aurabx/jolt-js","version":"0.2.0","description":"JSON to JSON transformation library using the JOLT spec - TypeScript port of harmony-jolt","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","test":"vitest run","test:watch":"vitest","lint":"tsc --noEmit","prepublishOnly":"npm run build"},"keywords":["json","transform","jolt","shift","mapping"],"author":{"name":"Aurabox"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/aurabx/jolt-js.git"},"devDependencies":{"typescript":"^5.3.0","vitest":"^2.0.0"},"_id":"@aurabx/jolt-js@0.2.0","gitHead":"68d31aef7b1a90bccc09e599eb318756423881b4","bugs":{"url":"https://github.com/aurabx/jolt-js/issues"},"homepage":"https://github.com/aurabx/jolt-js#readme","_nodeVersion":"20.16.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-NjMJ4mgjD34phpAavgffnUoTqBlbuQt5Hgs0a6Zs4wPtiiq8UVdtkb5Z3OCWo8vwZW9r4Yyp0eJOMUJiKAmBrQ==","shasum":"9d5abfa7d2af30ebb3b8660d65b1a9511940dcfa","tarball":"https://registry.npmjs.org/@aurabx/jolt-js/-/jolt-js-0.2.0.tgz","fileCount":75,"unpackedSize":185743,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDFQnav+ZRx3lLHe2HIhaUrXI60y5Fvfw8ZQvEi+Sg8LQIhANb7lCjaqMz4+mW6ia6+f692VSYOwX0ICK3+OSqJ7pKm"}]},"_npmUser":{"name":"xtfer","email":"chris.skene@gmail.com"},"directories":{},"maintainers":[{"name":"xtfer","email":"chris.skene@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jolt-js_0.2.0_1765348599060_0.793955878162848"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-10T06:36:38.952Z","0.2.0":"2025-12-10T06:36:39.201Z","modified":"2025-12-10T06:36:39.573Z"},"maintainers":[{"name":"xtfer","email":"chris.skene@gmail.com"}],"description":"JSON to JSON transformation library using the JOLT spec - TypeScript port of harmony-jolt","homepage":"https://github.com/aurabx/jolt-js#readme","keywords":["json","transform","jolt","shift","mapping"],"repository":{"type":"git","url":"git+https://github.com/aurabx/jolt-js.git"},"author":{"name":"Aurabox"},"bugs":{"url":"https://github.com/aurabx/jolt-js/issues"},"license":"Apache-2.0","readme":"# jolt-js\n\nJSON to JSON transformation library using the JOLT spec.\n\nTypeScript port of [harmony-jolt](https://github.com/aurabx/harmony-jolt), which itself is a port of the Java [Jolt](https://github.com/bazaarvoice/jolt) library.\n\n## Installation\n\n```bash\nnpm install jolt-js\n```\n\n## Usage\n\n```typescript\nimport { transform, TransformSpec } from 'jolt-js';\n\nconst input = {\n  id: 1,\n  name: \"John Smith\",\n  account: {\n    id: 1000,\n    type: \"Checking\"\n  }\n};\n\nconst spec: TransformSpec = [\n  {\n    operation: \"shift\",\n    spec: {\n      name: \"data.name\",\n      account: \"data.account\"\n    }\n  }\n];\n\nconst output = transform(input, spec);\n// {\n//   data: {\n//     name: \"John Smith\",\n//     account: { id: 1000, type: \"Checking\" }\n//   }\n// }\n```\n\n## Supported Operations\n\n### 1. `shift`\nCopy data from the input tree and put it in the output tree.\n\n```typescript\n{\n  operation: \"shift\",\n  spec: {\n    \"name\": \"data.name\",\n    \"*\": \"data.&\"  // Wildcard matching\n  }\n}\n```\n\n#### Wildcards\n- `*` - match everything\n- `name1|name2|nameN` - match any of the specified names\n\n#### Special Characters\n- `&` - reference matched key from path (`&(x,y)` for specific level/match)\n- `$` - reference key value\n- `@` - reference data value at path\n- `[]` - array index notation\n\n### 2. `default`\nApply default values if not present in the input.\n\n```typescript\n{\n  operation: \"default\",\n  spec: {\n    \"phones\": {\n      \"code\": \"+1\"\n    }\n  }\n}\n```\n\n### 3. `remove`\nRemove data from the tree.\n\n```typescript\n{\n  operation: \"remove\",\n  spec: {\n    \"phones\": {\n      \"country\": \"\"\n    }\n  }\n}\n```\n\n### 4. `modify-overwrite-beta`\nModify data using functions.\n\n```typescript\n{\n  operation: \"modify-overwrite-beta\",\n  spec: {\n    \"fullName\": \"=concat(@(1,firstName),' ',@(1,lastName))\"\n  }\n}\n```\n\n#### Supported Functions\n- `concat` - Concatenate multiple strings\n- `toLower` - Convert string to lowercase\n- `toUpper` - Convert string to uppercase\n- `substring` - Extract substring (start, end)\n- `trim` - Remove leading/trailing whitespace\n- `join` - Join array elements with separator\n\n#### Modifier Variants\n- `modify-overwrite-beta` - Always writes the result\n- `modify-default-beta` - Only writes if key doesn't exist\n- `modify-define-beta` - Only writes if key doesn't exist or is null\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-e22a552a3c9d8e564554ec5600bb0bba"}