{"_id":"@aigne/afs-utils","_rev":"2-dfbec26afaf59bf62a3c91940d636d17","name":"@aigne/afs-utils","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aigne/afs-utils","version":"1.0.0","author":{"name":"Arcblock","email":"blocklet@arcblock.io"},"license":"Elastic-2.0","_id":"@aigne/afs-utils@1.0.0","maintainers":[{"name":"li-yechao","email":"liyechao@yechao.xyz"},{"name":"wangshijun","email":"shijun@arcblock.io"}],"homepage":"https://www.aigne.io/framework","bugs":{"url":"https://github.com/AIGNE-io/aigne-framework/issues"},"dist":{"shasum":"689aaf1929a39150f092b5b1117cfa4f9a10dcca","tarball":"https://registry.npmjs.org/@aigne/afs-utils/-/afs-utils-1.0.0.tgz","fileCount":26,"integrity":"sha512-qpongLxfOggpSUmY1d+F3CqLlMdS1dBYjHFAUjBAS8nFSr0rKKiNbs8e+TgCcDwvIiM9NmyEtdgpEHCYCi0SrQ==","signatures":[{"sig":"MEYCIQCKESEdGJSvcrLoKtSIN/kijFQtAvbVLUEbtXMxRpr7sAIhALzRBai5p/SxwynazCgKveSZsM+vD6Z8QdpmQFYZtxF9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21170},"main":"./lib/cjs/index.js","type":"module","_from":"file:aigne-afs-utils-1.0.0.tgz","types":"./lib/dts/index.d.ts","module":"./lib/esm/index.js","exports":{".":{"types":"./lib/dts/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"},"./*":{"types":"./lib/dts/*","import":"./lib/esm/*","require":"./lib/cjs/*"}},"scripts":{"lint":"tsc --noEmit","test":"bun test","build":"tsc --build scripts/tsconfig.build.json","clean":"rimraf lib test/coverage","postbuild":"node ../../scripts/post-build-lib.mjs","test:coverage":"bun test --coverage --coverage-reporter=lcov --coverage-reporter=text"},"_npmUser":{"name":"wangshijun","email":"shijun@arcblock.io"},"_resolved":"/tmp/e7235410d2ccb54005593dcf94518ab1/aigne-afs-utils-1.0.0.tgz","_integrity":"sha512-qpongLxfOggpSUmY1d+F3CqLlMdS1dBYjHFAUjBAS8nFSr0rKKiNbs8e+TgCcDwvIiM9NmyEtdgpEHCYCi0SrQ==","repository":{"url":"git+https://github.com/AIGNE-io/aigne-framework.git","type":"git"},"_npmVersion":"10.9.2","description":"Utility functions for AIGNE AFS modules","directories":{},"_nodeVersion":"23.11.1","dependencies":{"zod":"^3.25.67","zod-validation-error":"^3.5.4"},"publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["./lib/dts/*"],".":["./lib/dts/index.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.0.1","@types/bun":"^1.2.22","typescript":"^5.9.2","npm-run-all":"^4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/afs-utils_1.0.0_1768914693897_0.07852943071529728","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-01-20T13:11:33.790Z","modified":"2026-01-21T06:21:01.773Z","1.0.0":"2026-01-20T13:11:34.068Z"},"bugs":{"url":"https://github.com/AIGNE-io/aigne-framework/issues"},"author":{"name":"Arcblock","email":"blocklet@arcblock.io"},"license":"Elastic-2.0","homepage":"https://www.aigne.io/framework","repository":{"url":"git+https://github.com/AIGNE-io/aigne-framework.git","type":"git"},"description":"Utility functions for AIGNE AFS modules","maintainers":[{"email":"liyechao@yechao.xyz","name":"li-yechao"},{"email":"shijun@arcblock.io","name":"wangshijun"},{"email":"rob@arcblock.io","name":"mave99a"}],"readme":"# @aigne/afs-utils\n\nUtility functions for AIGNE AFS modules.\n\n## Overview\n\nThis package provides shared utility functions used across AIGNE AFS modules, including:\n\n- **Type utilities**: Type checking, validation, and manipulation helpers\n- **Schema utilities**: Zod schema helpers for validation and transformation\n- **Camelize utilities**: Object key transformation between camelCase and snake_case\n\n## Installation\n\n```bash\nnpm install @aigne/afs-utils\n```\n\n## Features\n\n- **Type checking and validation** - Runtime type checking utilities\n- **Zod schema parsing** - Parse and validate with human-readable error messages\n  - Synchronous and asynchronous validation support\n  - Optional error message prefix for better context\n  - Customizable error message formatting\n- **Object key transformation** - Convert between camelCase and snake_case\n  - Shallow and deep conversion modes\n  - Zod schema preprocessing support\n\n## API\n\n### Type Utilities\n\n- `isNil(value)` - Check if value is null or undefined\n- `isRecord(value)` - Check if value is a plain object\n- `isEmpty(obj)` - Check if object/array/string is empty\n- `isNonNullable(value)` - Type guard for non-nullable values\n- `get(obj, path)` - Safe nested property access\n\n### Schema Utilities\n\n- `zodParse(schema, data, options?)` - Parse and validate data with Zod schema and human-readable error messages\n  - `options.prefix` - Optional prefix for error messages\n  - `options.prefixSeparator` - Separator between prefix and error message (default: `\": \"`)\n  - `options.async` - Use async parsing with `parseAsync` for async refinements (default: `false`)\n- `optionalize(schema)` - Make Zod schema optional\n- `camelizeSchema(schema, options)` - Transform object keys to camelCase\n- `preprocessSchema(fn, schema)` - Apply preprocessing to schema\n\n### Camelize Utilities\n\n- `camelize(obj, shallow?)` - Convert object keys to camelCase\n- `snakelize(obj, shallow?)` - Convert object keys to snake_case\n\n## License\n\nElastic-2.0\n","readmeFilename":"README.md"}