{"_id":"@actualwave/type-checker-levels-storage","_rev":"5-1cacf3774d8c3628ea0832114d0f599a","name":"@actualwave/type-checker-levels-storage","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.2":{"name":"@actualwave/type-checker-levels-storage","version":"0.0.2","keywords":["js","javascript","proxy","tree","E4X"],"author":{"url":"http://actualwave.com/","name":"Oleg Galaburda","email":"burdiuz@gmail.com"},"license":"MIT","_id":"@actualwave/type-checker-levels-storage@0.0.2","maintainers":[{"name":"actualwave","email":"burdiuz@gmail.com"}],"homepage":"https://github.com/burdiuz/js-type-checker-levels-storage","bugs":{"url":"https://github.com/burdiuz/js-type-checker-levels-storage/issues","email":"burdiuz@gmail.com"},"dist":{"shasum":"f2b6a46d2796721fe9b53b842f235a4fcacdeeb5","tarball":"https://registry.npmjs.org/@actualwave/type-checker-levels-storage/-/type-checker-levels-storage-0.0.2.tgz","fileCount":7,"integrity":"sha512-X5IbwQtUFGkVuCFomySuro/o9THtq1/NMJea/dSj2b8sbr0OKr/0MTpRpq6NtQg22uKpavb4hsZb+kMhqD+JaQ==","signatures":[{"sig":"MEUCIQDELHt6OAkwDZbSWsFvGnHgPylblt/E03B1/JkXWMImsQIgK6VTLdJVeAVd+GYsEEgYX8FdZnZdZCR7Q7hNEhxodvY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32756,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsyOjCRA9TVsSAnZWagAAXQYP/3kcQ36iY9TXv/d/M2hc\nvYjYKT6sWpAc9EaUBkxyqVYGMDcDIqxR9Swho2NJhzvmiqHkyf1/7Q0hiU9P\n3H8dcHR3lD4Ft5Yhr0bGdHF8XfN4bF2GmSChqhQkxmoGxz+fsU+bCwGWRI+k\neYz4vyLtd7UJR9PUmzhGx3XpVH22EoIZlRn+1kWhUvPnA0Eqey/hLtqAEmM7\noQARmdyYcMQ4Kskj/24phD3ranBStMcz0kWgxDYz7EXBs0hHkVCH2NAM/n1Z\n4/NCPmYZMk+pzfX4JyfiYyReOeyJrvH1EXR5uJ0se0LQj8k5dwzo+8WfZ4r+\nS9VC3j3jQKdQhtcKDRxNWgkz0XjEKccJjXxK3Hn0OuiRmLgnyt2AQuK9YFLV\ne/Ktt7tdrGvmsTaSkIzL+3Ff3Z7pn/mfWEd1f/ie94ZAsKxY0yeNc8KO8DGY\nQKGfLew1AQg8f2kwTFtttyp5/KOZRN3eO8Mqoiy3csgIg3iOs9tp3qOn4v4k\n5bkAHc1COAhHYU0wjJHjkq06TUQIsypXFXPxRUgAWmnFFtz6JSvyagzMFdq+\n7mJhYAYKt4vzAmLHtOvxoYiVNu/JxGRokaP9SRqzI+YJE5rfzczMbFMvNM7Q\nxNBeIoHqKeMILYlmWnfZmWQFDworMJraXM3bVrLNozsuDFmCjOUKG6euwVva\nApcR\r\n=yEud\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"collectCoverage":true,"coverageDirectory":"coverage","coverageReporters":["json","lcov"],"collectCoverageFrom":["source/**/*.js","!**/node_modules/**","!**/vendor/**"],"modulePathIgnorePatterns":["\\/\\."]},"main":"index.js","babel":{"env":{"test":{"plugins":["babel-plugin-transform-es2015-modules-commonjs","babel-plugin-transform-flow-strip-types","babel-plugin-transform-class-properties",["babel-plugin-transform-object-rest-spread",{"useBuiltIns":true}]],"presets":["jest"]}}},"gitHead":"42ec832e4ab81b40d3f7e9971b17512d0771834b","scripts":{"lint":"eslint \"source/**/*.js\"","test":"jest --colors","build":"rollup --config","start":"build","precommit":"npm run lint-staged && npm run build && npm run test","test:watch":"jest --colors --watch","build:watch":"rollup --config --watch \"./source\"","lint-staged":"lint-staged"},"_npmUser":{"name":"actualwave","email":"burdiuz@gmail.com"},"repository":{"url":"git+https://github.com/burdiuz/js-type-checker-levels-storage.git","type":"git"},"_npmVersion":"5.6.0","description":"Type information storage","directories":{},"lint-staged":{"source/**/*.js":["eslint --fix","git add"]},"_nodeVersion":"8.11.2","dependencies":{"@actualwave/has-own":"0.0.1","@actualwave/map-of-sets":"0.0.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.5.0","husky":"^0.14.3","dotenv":"^6.0.0","eslint":"^5.4.0","flow-bin":"^0.79.1","prettier":"^1.14.2","uglify-es":"^3.3.9","babel-core":"^6.26.3","lint-staged":"^7.2.2","babel-eslint":"^8.2.6","babel-loader":"^7.1.5","babel-preset-jest":"^23.2.0","rollup-plugin-json":"^3.0.0","eslint-plugin-react":"^7.11.1","rollup-plugin-babel":"^3.0.7","rollup-plugin-serve":"^0.4.2","eslint-config-airbnb":"^17.1.0","eslint-plugin-import":"^2.14.0","rollup-plugin-uglify":"^4.0.0","babel-plugin-istanbul":"^4.1.6","eslint-plugin-jsx-a11y":"^6.1.1","rollup-plugin-commonjs":"^9.1.5","rollup-plugin-node-resolve":"^3.3.0","babel-plugin-external-helpers":"^6.22.0","babel-plugin-transform-class-properties":"^6.24.1","babel-plugin-transform-flow-strip-types":"^6.22.0","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-plugin-syntax-trailing-function-commas":"^6.22.0","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2"},"peerDependencies":{"@actualwave/type-checkers":"^0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/type-checker-levels-storage_0.0.2_1538466722618_0.9832855944747518","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@actualwave/type-checker-levels-storage","version":"0.0.3","keywords":["js","javascript","proxy","tree","E4X"],"author":{"url":"http://actualwave.com/","name":"Oleg Galaburda","email":"burdiuz@gmail.com"},"license":"MIT","_id":"@actualwave/type-checker-levels-storage@0.0.3","maintainers":[{"name":"actualwave","email":"burdiuz@gmail.com"}],"homepage":"https://github.com/burdiuz/js-type-checkers","bugs":{"url":"https://github.com/burdiuz/js-type-checkers/issues","email":"burdiuz@gmail.com"},"dist":{"shasum":"f3b15963e01828bb8d7759bfa0b932f158123a6d","tarball":"https://registry.npmjs.org/@actualwave/type-checker-levels-storage/-/type-checker-levels-storage-0.0.3.tgz","fileCount":9,"integrity":"sha512-z/CeH2LznbEBZut0P2mh1F9mcb+5iJ7xnHKWN4bgP52y1/ta5em/Ew3r0lXCKnF8FwsY2M3UzKEBdwPdLtzbFA==","signatures":[{"sig":"MEUCIAtkLAJGvm9JWKRG3JvFdnrk0voUBvK1lKrnq3wbQ/KwAiEA9i5LvCv0E4t3biLJJNWPnyB53nHfvmLaNrLzHpa5VVc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27228},"main":"index.js","types":"index.d.ts","gitHead":"7c6955bf01147d07e25a8c8d766b1548ebf4aeaf","_npmUser":{"name":"actualwave","email":"burdiuz@gmail.com"},"repository":{"url":"git+https://github.com/burdiuz/js-type-checkers.git","type":"git"},"_npmVersion":"11.5.1","description":"Type information storage","directories":{},"_nodeVersion":"24.6.0","dependencies":{"@actualwave/map-of-sets":"0.0.3"},"_hasShrinkwrap":false,"peerDependencies":{"@actualwave/type-checkers":">=0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/type-checker-levels-storage_0.0.3_1777847292986_0.665420521512859","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@actualwave/type-checker-levels-storage","version":"0.0.4","keywords":["js","javascript","proxy","tree","E4X"],"author":{"url":"http://actualwave.com/","name":"Oleg Galaburda","email":"burdiuz@gmail.com"},"license":"MIT","_id":"@actualwave/type-checker-levels-storage@0.0.4","maintainers":[{"name":"actualwave","email":"burdiuz@gmail.com"}],"homepage":"https://github.com/burdiuz/js-type-checkers","bugs":{"url":"https://github.com/burdiuz/js-type-checkers/issues","email":"burdiuz@gmail.com"},"dist":{"shasum":"55089e133f8d6c5a965e605df4a2f43cd85d72eb","tarball":"https://registry.npmjs.org/@actualwave/type-checker-levels-storage/-/type-checker-levels-storage-0.0.4.tgz","fileCount":11,"integrity":"sha512-rjK2KhbL8AyS79EEZO1cWRObMfstS3nLAh9Dt6R7v+sI1E/kgUWfpBBHRL5IRqbhYFUCMkXc3sNS2BCHZB+nWw==","signatures":[{"sig":"MEUCIETW7FiROPgX6DLyFIfISXN2vepS5Bm0iLgBEEQ/yqYiAiEAg12vc01Wm2+x91gUptwazutU+LTMVIMQbMu+vOcNFfY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39046},"main":"index.js","types":"index.d.ts","gitHead":"f2032c863ba9a88ce339980b3fec2a22abb6c964","_npmUser":{"name":"actualwave","email":"burdiuz@gmail.com"},"repository":{"url":"git+https://github.com/burdiuz/js-type-checkers.git","type":"git"},"_npmVersion":"11.5.1","description":"Type information storage","directories":{},"_nodeVersion":"24.6.0","dependencies":{"@actualwave/map-of-sets":"0.0.3"},"_hasShrinkwrap":false,"peerDependencies":{"@actualwave/type-checkers":">=0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/type-checker-levels-storage_0.0.4_1778181344115_0.039036346275985734","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@actualwave/type-checker-levels-storage","description":"Type information storage","version":"0.0.5","main":"index.js","types":"index.d.ts","keywords":["js","javascript","proxy","tree","E4X"],"homepage":"https://github.com/burdiuz/js-type-checkers","bugs":{"url":"https://github.com/burdiuz/js-type-checkers/issues","email":"burdiuz@gmail.com"},"license":"MIT","author":{"name":"Oleg Galaburda","email":"burdiuz@gmail.com","url":"http://actualwave.com/"},"repository":{"type":"git","url":"git+https://github.com/burdiuz/js-type-checkers.git"},"dependencies":{"@actualwave/map-of-sets":"0.0.3"},"peerDependencies":{"@actualwave/type-checkers":">=0.1.1"},"jest":{"testEnvironment":"node","injectGlobals":false,"transform":{"^.+\\.ts$":["ts-jest",{"tsconfig":{"module":"CommonJS","moduleResolution":"node"}}]},"testMatch":["**/*.spec.ts"],"collectCoverage":true,"coverageReporters":["json","lcov"],"coverageDirectory":"coverage","collectCoverageFrom":["src/**/*.ts","!src/**/*.spec.ts","!**/node_modules/**"]},"scripts":{"build":"rollup --config","build:watch":"rollup --config --watch","test":"jest --colors","test:watch":"jest --colors --watch"},"_id":"@actualwave/type-checker-levels-storage@0.0.5","gitHead":"df5acbfd71bc599e56b086449b344ea075242c92","_nodeVersion":"24.6.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-LcLTPzd7w6IKlBgXR26nB5Cjyj5nIazZOJ/Ag8C2wKasxt0SGVLSxZn3UHSPWcgPcTfF6mzm3lZ3Ee2ovTQhfA==","shasum":"1686668f3bb2673a57e4c1190b22f7db760cd6db","tarball":"https://registry.npmjs.org/@actualwave/type-checker-levels-storage/-/type-checker-levels-storage-0.0.5.tgz","fileCount":5,"unpackedSize":13854,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDrhdDyYzKDKM74HIvVKlQLY2O0Vjej/rCEmDrKFi9S3AIgLmok3SD1g8lwVTbfIHlE10lX5GU6WlfTvySp/FGErj4="}]},"_npmUser":{"name":"actualwave","email":"burdiuz@gmail.com"},"directories":{},"maintainers":[{"name":"actualwave","email":"burdiuz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/type-checker-levels-storage_0.0.5_1778181983265_0.13548105771541508"},"_hasShrinkwrap":false}},"time":{"created":"2018-10-02T07:52:02.454Z","modified":"2026-05-07T19:26:23.503Z","0.0.2":"2018-10-02T07:52:02.867Z","0.0.3":"2026-05-03T22:28:13.112Z","0.0.4":"2026-05-07T19:15:44.258Z","0.0.5":"2026-05-07T19:26:23.408Z"},"bugs":{"url":"https://github.com/burdiuz/js-type-checkers/issues","email":"burdiuz@gmail.com"},"author":{"name":"Oleg Galaburda","email":"burdiuz@gmail.com","url":"http://actualwave.com/"},"license":"MIT","homepage":"https://github.com/burdiuz/js-type-checkers","keywords":["js","javascript","proxy","tree","E4X"],"repository":{"type":"git","url":"git+https://github.com/burdiuz/js-type-checkers.git"},"description":"Type information storage","maintainers":[{"name":"actualwave","email":"burdiuz@gmail.com"}],"readme":"# @actualwave/type-checker-levels-storage\n\nType information storage for [`@actualwave/type-checkers`](https://github.com/burdiuz/js-type-checkers). Stores the set of types ever observed for each property and controls *how much* type history to retain via reporting levels.\n\n## Installation\n\n```bash\nnpm install @actualwave/type-checker-levels-storage\n```\n\n## Reporting levels\n\nA reporting level determines what type information is stored for a property.\n\n| Constant | Value | Description |\n|---|---|---|\n| `REPORT_ALL_ASSIGNED_TYPES` | `'all'` | Accumulate every distinct type ever assigned — each new type is reported once |\n| `REPORT_FIRST_TYPE_ONLY` | `'first'` | Record only the first observed type — every subsequent mismatch is reported |\n| `REPORT_NEVER` | `'never'` | Do not store any type information |\n\nThe global default is `REPORT_FIRST_TYPE_ONLY`.\n\n## Usage\n\n### Creating a storage\n\n```typescript\nimport { createTypesStorage } from '@actualwave/type-checker-levels-storage';\n\nconst storage = createTypesStorage();\n```\n\n### Adding type observations\n\n```typescript\nimport {\n  createTypesStorage,\n  REPORT_ALL_ASSIGNED_TYPES,\n  REPORT_FIRST_TYPE_ONLY,\n} from '@actualwave/type-checker-levels-storage';\n\nconst storage = createTypesStorage<string, string>();\n\nstorage.add('count', 'number', REPORT_ALL_ASSIGNED_TYPES);\nstorage.add('count', 'string', REPORT_ALL_ASSIGNED_TYPES); // second type stored too\n\nstorage.add('label', 'string', REPORT_FIRST_TYPE_ONLY);\nstorage.add('label', 'number', REPORT_FIRST_TYPE_ONLY);    // ignored — first type wins\n```\n\n### Checking stored types\n\n```typescript\nstorage.has('count');        // true\nstorage.get('count');        // Set { 'number', 'string' }\nstorage.has('unknown');      // false\n```\n\n### Per-target reporting levels\n\nSet reporting levels on individual objects or per-property:\n\n```typescript\nimport {\n  setReportingLevel,\n  getReportingLevel,\n  REPORT_ALL_ASSIGNED_TYPES,\n  REPORT_FIRST_TYPE_ONLY,\n  REPORT_NEVER,\n} from '@actualwave/type-checker-levels-storage';\n\nconst obj = { id: 1, label: 'hello', internal: null };\n\nsetReportingLevel(obj, REPORT_ALL_ASSIGNED_TYPES, {\n  label: REPORT_FIRST_TYPE_ONLY, // override for this property\n  internal: REPORT_NEVER,        // never track 'internal'\n});\n\ngetReportingLevel(obj, 'id');       // 'all'\ngetReportingLevel(obj, 'label');    // 'first'\ngetReportingLevel(obj, 'internal'); // 'never'\n```\n\nLevel resolution priority (highest to lowest):\n\n1. Per-property level on the instance\n2. Object-level on the instance\n3. Per-property level on the constructor\n4. Object-level on the constructor\n5. Global default\n\n### Adding observations via a target object\n\n`addFor` and `setFor` automatically resolve the level from the target object:\n\n```typescript\nstorage.addFor('label', 'string', obj);  // uses getReportingLevel(obj, 'label')\nstorage.setFor('label', types, obj);\n```\n\n### Global reporting level\n\n```typescript\nimport {\n  setGlobalReportingLevel,\n  getGlobalReportingLevel,\n  REPORT_ALL_ASSIGNED_TYPES,\n} from '@actualwave/type-checker-levels-storage';\n\nsetGlobalReportingLevel(REPORT_ALL_ASSIGNED_TYPES);\n```\n\n### Merging storages\n\nCopy all entries from one storage into another with `copyTo()`. When both storages contain the same key a merge strategy resolves the conflict:\n\n```typescript\nimport { createTypesStorage, defaultMergeStrategy } from '@actualwave/type-checker-levels-storage';\n\nsourceStorage.copyTo(targetStorage);\n\n// Custom merge strategy: keep only types present in both sets (intersection)\nsourceStorage.copyTo(targetStorage, obj, (key, target, source) => {\n  source.forEach((type) => {\n    if (!target.has(type)) target.delete(type);\n  });\n  return target;\n});\n```\n\nThe `defaultMergeStrategy` performs a union — all types from the source are added to the target.\n\n## API reference\n\n### Storage — `TypeInfoStorage<K, T>`\n\nCreated via `createTypesStorage<K, T>()`.\n\n| Method | Description |\n|---|---|\n| `add(key, type, level?)` | Record a type observation; level defaults to `REPORT_ALL_ASSIGNED_TYPES` |\n| `addFor(key, type, target)` | Like `add()` but resolves the level from `target` |\n| `set(key, types, level?)` | Replace the stored type set for a key |\n| `setFor(key, types, target)` | Like `set()` but resolves the level from `target` |\n| `has(key)` | Returns `true` if any types are stored for `key` |\n| `get(key)` | Returns the `Set` of stored types for `key` |\n| `remove(key)` | Delete all type data for `key` |\n| `clone()` | Return a deep copy of the storage |\n| `copyTo(storage, target?, mergeStrategy?)` | Merge this storage into `storage` |\n\n### Levels\n\n| Function | Description |\n|---|---|\n| `setGlobalReportingLevel(level)` | Change the global default level |\n| `getGlobalReportingLevel()` | Read the global default level |\n| `setReportingLevel(target, level, perPropertyLevels?)` | Attach levels to a target object |\n| `getReportingLevel(target, key)` | Resolve the effective level for a property |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}