{"_id":"@aliaksandarpratashchyk/metattron","name":"@aliaksandarpratashchyk/metattron","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aliaksandarpratashchyk/metattron","version":"1.0.0","description":"Attribute-style metadata helpers for TypeScript decorators.","main":"./dist/bundle.js","module":"./dist/bundle.js","types":"./dist/bundle.d.ts","author":{"name":"Aliaksandar Pratashchyk","email":"aliaksandarpratashchyk@gmail.com"},"license":"MIT","keywords":["metadata","decorator","typescript","reflection","runtime","attribute"],"repository":{"type":"git","url":"git+https://github.com/aliaksandarpratashchyk/metattron.git"},"bugs":{"url":"https://github.com/aliaksandarpratashchyk/metattron/issues"},"homepage":"https://github.com/aliaksandarpratashchyk/metattron#readme","scripts":{"build":"webpack && api-extractor run --local && api-documenter markdown -i ./dist/temp -o ./docs && rimraf ./dist/temp","test":"jest > COVERAGE.md && coverage-badges-cli -s ./coverage/coverage-summary.json -o ./coverage.svg --label Coverage","format":"npx prettier . --write","lint":"cross-env ESLINT_ENV=cli npx eslint . --fix"},"devDependencies":{"@eslint/js":"^9.39.0","@microsoft/api-documenter":"^7.28.2","@microsoft/api-extractor":"^7.54.0","@types/jest":"^30.0.0","@types/node":"^24.6.2","coverage-badges-cli":"^2.2.0","cpx":"^1.2.1","cross-env":"^10.1.0","eslint":"^9.39.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-import-x":"^4.16.1","eslint-plugin-jest":"^29.0.1","eslint-plugin-perfectionist":"^4.15.1","fork-ts-checker-webpack-plugin":"^9.1.0","jest":"^30.1.3","prettier":"3.6.2","rimraf":"^6.1.0","terser-webpack-plugin":"^5.3.14","ts-jest":"^29.4.4","ts-loader":"^9.5.4","ts-node":"^10.9.2","typescript":"^5.9.2","typescript-eslint":"^8.46.2","webpack":"^5.102.1","webpack-cli":"^6.0.1"},"_id":"@aliaksandarpratashchyk/metattron@1.0.0","gitHead":"66d249386e9d8d0b53710802e2bf701c34b3ab71","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-OVucBYdBOoVmxBYPb18zWY1Ez1srzL7pLlzYZpzvBBxy+IcJz16qPbISg0hfzGrhHDDom2Dz2ehfZsfKuqy9Kg==","shasum":"c16e26072b43f44af937d7df84f8c313701242e3","tarball":"https://registry.npmjs.org/@aliaksandarpratashchyk/metattron/-/metattron-1.0.0.tgz","fileCount":7,"unpackedSize":58934,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCIwFc5dB7JGMdXfRpFY7tBmNrmzSkKUxoLvmZ/xtWgPwIgAW3rriWlmbkR4YZDQc+hZOpyuyocB3MYz28jti1pVRo="}]},"_npmUser":{"name":"aliaksandarpratashchyk","email":"aliaksandarpratashchyk@gmail.com"},"directories":{},"maintainers":[{"name":"aliaksandarpratashchyk","email":"aliaksandarpratashchyk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/metattron_1.0.0_1765475888888_0.7202097102451899"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-11T17:58:08.788Z","1.0.0":"2025-12-11T17:58:09.033Z","modified":"2025-12-11T17:58:09.326Z"},"maintainers":[{"name":"aliaksandarpratashchyk","email":"aliaksandarpratashchyk@gmail.com"}],"description":"Attribute-style metadata helpers for TypeScript decorators.","homepage":"https://github.com/aliaksandarpratashchyk/metattron#readme","keywords":["metadata","decorator","typescript","reflection","runtime","attribute"],"repository":{"type":"git","url":"git+https://github.com/aliaksandarpratashchyk/metattron.git"},"author":{"name":"Aliaksandar Pratashchyk","email":"aliaksandarpratashchyk@gmail.com"},"bugs":{"url":"https://github.com/aliaksandarpratashchyk/metattron/issues"},"license":"MIT","readme":"﻿# Metattron\n\n![Tests](https://github.com/aliaksandarpratashchyk/metattron/actions/workflows/test.yml/badge.svg)\n[![Coverage](./coverage.svg)](./COVERAGE.md)\n\nAttribute-style metadata helpers for TypeScript decorators. Declare an attribute once, use it as a decorator on classes, constructors, methods, properties, and parameters, then read it back through the generated `for` helpers without touching Reflect metadata.\n\n## Installation\n\n```bash\nnpm install @aliaksandarpratashchyk/metattron\n```\n\n## Usage\n\n```ts\nimport {\n  buildAttribute,\n  FUNCTION,\n  METHOD,\n  METHOD_PARAMETER,\n  PROPERTY,\n  tag,\n} from '@aliaksandarpratashchyk/metattron';\n\nconst role = buildAttribute<string>('role').ofKind(METHOD, PROPERTY);\nconst required = buildAttribute<boolean>('required').ofKind(METHOD_PARAMETER);\n\n@role('service')\nclass UserService {\n  @role('admin')\n  activate(@required(true) userId: string) {}\n\n  @role('config')\n  static configPath = '/tmp/users';\n}\n\nrole.\n  for.\n  method('activate').\n  of(UserService).\n  single; // 'admin'\n\nrole.\n  for.\n  ownProperty('configPath').\n  of(UserService).\n  single; // 'config'\n\nrequired.\n  for.\n  methodParameterAt(0).\n  ofMethod('activate').\n  of(UserService).\n  single; // true\n\ntag.\n  for.\n  methodParameterAt(0).\n  ofMethod('activate').\n  of(UserService).\n  singleOrUndefined; // string | symbol | undefined\n\n```\n\n### Attribute kinds and readers\n\n- `FUNCTION`: decorators for classes/standalone functions, read via `attribute.for.function(Foo)`.\n- `FUNCTION_PARAMETER`: constructor/standalone function parameters, read via `attribute.for.parameterOfFunction(Foo).at(index)`.\n- `METHOD`: instance/static methods, read via `attribute.for.method(name).of(Foo)` or `attribute.for.ownMethod(name).of(Foo)`.\n- `METHOD_PARAMETER`: method parameters, read via `attribute.for.methodParameterAt(index).ofMethod(name).of(Foo)` or `attribute.for.methodParameterAt(index).ofOwnMethod(name).of(Foo)`.\n- `PROPERTY`: instance/static properties, read via `attribute.for.property(name).of(Foo)` or `attribute.for.ownProperty(name).of(Foo)`.\n\nEvery reader returns a `MetadataCollection` with `.all`, `.single`, and `.singleOrUndefined` helpers.\n\n### Built-in tag attribute\n\nUse the bundled `tag` attribute when you just need to write a string or symbol identifier to any supported target without defining a custom attribute.\n\n## Scripts\n\n- `npm test` — run the Jest suite, regenerate `COVERAGE.md`, and update `coverage.svg`.\n- `npm run build` — bundle the library and regenerate API docs (`docs/`).\n- `npm run lint` / `npm run format` — lint and format the codebase.\n\n## Publishing\n\nGitHub Actions runs tests on pushes/PRs and publishes to npm when the version in `package.json` changes on `main`. Set `NPM_TOKEN` in repository secrets to enable publishing.\n","readmeFilename":"README.md","_rev":"1-4cc45810bc95ac3463b538d85bfbaaef"}