{"_id":"@msw/data","_rev":"12-4db8350cda2c0f2da61807050d1ec493","name":"@msw/data","dist-tags":{"latest":"1.1.8"},"versions":{"1.0.0":{"name":"@msw/data","version":"1.0.0","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.0.0","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data.git","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"d865031da4760563927e89408781c5e0ade2588e","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.0.0.tgz","fileCount":83,"integrity":"sha512-ncB+dfci2QWANybAnh8mH1D4JSd7NhQo8W99Ovz3tzEWrlGyQ371Mhmuw4RtDdAUxhDNPoOisWgIqptgSBV2SQ==","signatures":[{"sig":"MEQCIA9MgI+bN/Gtpl3nlXh17LTXH2naF+L7tNltEQiyr5TCAiB9kumcuNXxF/sDXZ6ep9TcxnhMLINuuXDPwbgpG0L8bg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":253183},"type":"module","_from":"file:msw-data-1.0.0.tgz","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./extensions":{"types":"./build/extensions/index.d.ts","default":"./build/extensions/index.js"}},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"_resolved":"/tmp/db807145ab7b367f4d82efc9545d7c2d/msw-data-1.0.0.tgz","_integrity":"sha512-ncB+dfci2QWANybAnh8mH1D4JSd7NhQo8W99Ovz3tzEWrlGyQ371Mhmuw4RtDdAUxhDNPoOisWgIqptgSBV2SQ==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"10.9.3","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"22.19.0","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","lodash-es":"^4.17.21","outvariant":"^1.4.3","@types/lodash-es":"^4.17.12","@standard-schema/spec":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.1.11","vite":"^7.1.7","tsdown":"^0.15.4","vitest":"^3.2.4","publint":"^0.3.13","prettier":"^3.6.2","typescript":"^5.9.2","@types/node":"^24.5.2","@ossjs/release":"^0.10.0","@playwright/test":"^1.55.0"},"_npmOperationalInternal":{"tmp":"tmp/data_1.0.0_1759083776863_0.9599718451247274","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@msw/data","version":"1.0.1","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.0.1","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data.git","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"6decedca57790cde9e7b307d199b0bef20dd3005","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.0.1.tgz","fileCount":84,"integrity":"sha512-KcFdswJieXN8K8Tub/F6GNDDYNhE3YaLCe23u9eSkKsRe3iM/aVoY+621tpqVJSMwMlHW4c90lXdhuvS00Kc7g==","signatures":[{"sig":"MEQCIF5Nu6DguPMSyJcCFx+lwtgn9rrwH1fHJjQYSNpXKPc2AiAo6SP+lh/QOTjsh4fQqrCE2LFuk+R3VkmsyOKHXZ2t0Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":270867},"type":"module","_from":"file:msw-data-1.0.1.tgz","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./extensions":{"types":"./build/extensions/index.d.ts","default":"./build/extensions/index.js"}},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"_resolved":"/tmp/181ddb780a324cd0286aea7202d13803/msw-data-1.0.1.tgz","_integrity":"sha512-KcFdswJieXN8K8Tub/F6GNDDYNhE3YaLCe23u9eSkKsRe3iM/aVoY+621tpqVJSMwMlHW4c90lXdhuvS00Kc7g==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"10.9.3","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"22.19.0","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","lodash-es":"^4.17.21","outvariant":"^1.4.3","@types/lodash-es":"^4.17.12","@standard-schema/spec":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.1.11","vite":"^7.1.7","tsdown":"^0.15.4","vitest":"^3.2.4","publint":"^0.3.13","prettier":"^3.6.2","typescript":"^5.9.2","@types/node":"^24.5.2","@ossjs/release":"^0.10.0","@playwright/test":"^1.55.0"},"_npmOperationalInternal":{"tmp":"tmp/data_1.0.1_1759483138902_0.5325609677616014","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@msw/data","version":"1.0.2","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.0.2","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data.git","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"a1bcd8a18cc41149977604df7df576dfe6b8ea57","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.0.2.tgz","fileCount":84,"integrity":"sha512-FC3m9fPsR6BO4ou+HywMuqbNq3cCleSpO/ynFMn42b6ztQJnSzo2lSEYozYS9sbPYU/bx6mVzR8QIbqYde9oVA==","signatures":[{"sig":"MEYCIQD7pd/tEM2JEP1/k+p5ZEIQPXifPksOa8A1u14ImwedGwIhAM5DkKpWL7ebWjMUwlImcLmJ6RUnzHTcUyfPB7iAMvnp","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":271143},"type":"module","_from":"file:msw-data-1.0.2.tgz","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./extensions":{"types":"./build/extensions/index.d.ts","default":"./build/extensions/index.js"},"./extensions/sync":{"types":"./build/extensions/sync.d.ts","default":"./build/extensions/sync.js"},"./extensions/persist":{"types":"./build/extensions/persist.d.ts","default":"./build/extensions/persist.js"}},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"_resolved":"/tmp/05ee4c26aa59e21690cd1296513ab401/msw-data-1.0.2.tgz","_integrity":"sha512-FC3m9fPsR6BO4ou+HywMuqbNq3cCleSpO/ynFMn42b6ztQJnSzo2lSEYozYS9sbPYU/bx6mVzR8QIbqYde9oVA==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"10.9.3","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","lodash-es":"^4.17.21","outvariant":"^1.4.3","@types/lodash-es":"^4.17.12","@standard-schema/spec":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.1.11","vite":"^7.1.7","tsdown":"^0.15.4","vitest":"^3.2.4","publint":"^0.3.13","prettier":"^3.6.2","typescript":"^5.9.2","@types/node":"^24.5.2","@ossjs/release":"^0.10.0","@playwright/test":"^1.55.0"},"_npmOperationalInternal":{"tmp":"tmp/data_1.0.2_1759570809543_0.09741062409152068","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@msw/data","version":"1.1.0","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.0","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data.git","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"a95ee045920834c39bc58ec77cdc0801964b69b9","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.0.tgz","fileCount":84,"integrity":"sha512-VSwRxoKV9J0WjkoTEwUDJEURyBI7rW34CH3qGHLbRn/7L8PpPv0VOKmWfQxGOejnt9V04pjb8XifUA64WSjJ5g==","signatures":[{"sig":"MEUCIAkZd4BWxkthEf01bh0rNZebSeGuXIIyXmOjOp1EmzO6AiEA6BdpEymBBCIDPn6S2dUPOebnzJqpiebgDKY/1h8pOIk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":275547},"type":"module","_from":"file:msw-data-1.1.0.tgz","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./extensions":{"types":"./build/extensions/index.d.ts","default":"./build/extensions/index.js"},"./extensions/sync":{"types":"./build/extensions/sync.d.ts","default":"./build/extensions/sync.js"},"./extensions/persist":{"types":"./build/extensions/persist.d.ts","default":"./build/extensions/persist.js"}},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"_resolved":"/tmp/92fc8f700e8d960bdf50b97a875ab032/msw-data-1.1.0.tgz","_integrity":"sha512-VSwRxoKV9J0WjkoTEwUDJEURyBI7rW34CH3qGHLbRn/7L8PpPv0VOKmWfQxGOejnt9V04pjb8XifUA64WSjJ5g==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"10.9.3","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","lodash-es":"^4.17.21","outvariant":"^1.4.3","@types/lodash-es":"^4.17.12","@standard-schema/spec":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.1.11","vite":"^7.1.7","tsdown":"^0.15.4","vitest":"^3.2.4","publint":"^0.3.13","prettier":"^3.6.2","typescript":"^5.9.2","@types/node":"^24.5.2","@ossjs/release":"^0.10.0","@playwright/test":"^1.55.0"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.0_1759593471243_0.08107636924099881","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@msw/data","version":"1.1.1","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.1","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data.git","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"6d1a940a0693daa9282952252abe7b295b528bee","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.1.tgz","fileCount":85,"integrity":"sha512-t73Dwln1PJrEpvI0itb5ZKpJOi9mL5ERRNgfAdbf7lmYfadVyWllENmKwsu9Iy5enJMbn5a7TkLypyxWL4KeGw==","signatures":[{"sig":"MEUCIEjz8Sbx68BRcwS7gEEWlrbygJVRGOwCzLy+s4FhPUrqAiEAz7dW2BSnV/fD7GWtx4Etwny+iPJg478HUlHE+GwvZqo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":276636},"type":"module","_from":"file:msw-data-1.1.1.tgz","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./extensions":{"types":"./build/extensions/index.d.ts","default":"./build/extensions/index.js"},"./extensions/sync":{"types":"./build/extensions/sync.d.ts","default":"./build/extensions/sync.js"},"./extensions/persist":{"types":"./build/extensions/persist.d.ts","default":"./build/extensions/persist.js"}},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"_resolved":"/tmp/e5f41af455609ed1b7a39642448247fd/msw-data-1.1.1.tgz","_integrity":"sha512-t73Dwln1PJrEpvI0itb5ZKpJOi9mL5ERRNgfAdbf7lmYfadVyWllENmKwsu9Iy5enJMbn5a7TkLypyxWL4KeGw==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"10.9.3","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","lodash-es":"^4.17.21","outvariant":"^1.4.3","@types/lodash-es":"^4.17.12","@standard-schema/spec":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.1.11","vite":"^7.1.9","tsdown":"^0.15.6","vitest":"^3.2.4","publint":"^0.3.13","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.0","@playwright/test":"^1.55.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.1_1759660407473_0.9270287427332975","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@msw/data","version":"1.1.2","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.2","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"ebc6a085495ccf41289e5c38ccdecf0824969921","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.2.tgz","fileCount":85,"integrity":"sha512-beEM1cfb59FdoSV9pmWI+Vllf+QxoYtIDiVE9b1awVAWTa9eeDIZAi1qispBuSSnzZam6lIljCFPYJbXOwEbvA==","signatures":[{"sig":"MEUCIQDbfPtfI9BIiZs/awi65pr+q1NKeMu04p/52SJDJ7vuVAIgY+BFqxsHEma1qpjtDTg/jxS8oS+uiQg4TR/dMR1OB94=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":277519},"type":"module","_from":"file:msw-data-1.1.2.tgz","exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./extensions":{"types":"./build/extensions/index.d.ts","default":"./build/extensions/index.js"},"./extensions/sync":{"types":"./build/extensions/sync.d.ts","default":"./build/extensions/sync.js"},"./extensions/persist":{"types":"./build/extensions/persist.d.ts","default":"./build/extensions/persist.js"}},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"kettanaito","email":"kettanaito@gmail.com"},"_resolved":"/tmp/b6f97be1da80a60abe3674af1a20f3fd/msw-data-1.1.2.tgz","_integrity":"sha512-beEM1cfb59FdoSV9pmWI+Vllf+QxoYtIDiVE9b1awVAWTa9eeDIZAi1qispBuSSnzZam6lIljCFPYJbXOwEbvA==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"10.9.3","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","es-toolkit":"^1.39.10","outvariant":"^1.4.3","@standard-schema/spec":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.1.11","vite":"^7.1.9","tsdown":"^0.15.6","vitest":"^3.2.4","publint":"^0.3.13","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.0","@playwright/test":"^1.55.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.2_1759683951238_0.14401621393417363","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@msw/data","version":"1.1.3","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.3","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"4d8070fd05fbd634457e0ce3a5a8bf1c8d156d3d","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.3.tgz","fileCount":80,"integrity":"sha512-o+YEAD5r9cJxXtdf+iex2UCS5ADk4X/NpZL0n25+oKEPT6Xj3RyaAsOQjS9c/hRejywq9Ksa7EfkGOn2BSYH/g==","signatures":[{"sig":"MEQCIFshHFufN8kz5iwSccQg3H2t8eJXKDqZhi/T54ALQH7gAiAGaDbOORbC2Umpy3TsxtvXDWI9EQS3skx0hD9Iq/9Z0w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":301802},"type":"module","_from":"file:msw-data-1.1.3.tgz","exports":{".":"./build/index.mjs","./extensions":"./build/extensions/index.mjs","./extensions/sync":"./build/extensions/sync.mjs","./extensions/persist":"./build/extensions/persist.mjs"},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d2089d46-1f01-4c8c-bfe9-028180ed18c5"}},"_resolved":"/tmp/afc8d31ad5957538670fb00fde3b9b74/msw-data-1.1.3.tgz","_integrity":"sha512-o+YEAD5r9cJxXtdf+iex2UCS5ADk4X/NpZL0n25+oKEPT6Xj3RyaAsOQjS9c/hRejywq9Ksa7EfkGOn2BSYH/g==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"11.11.0","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"rettime":"^0.7.0","mutative":"^1.3.0","es-toolkit":"^1.45.1","outvariant":"^1.4.3","@standard-schema/spec":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.3.6","vite":"^8.0.8","tsdown":"^0.21.9","vitest":"^4.1.4","publint":"^0.3.13","prettier":"^3.8.3","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.1","@playwright/test":"^1.59.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.3_1776614281257_0.44603932633339305","host":"s3://npm-registry-packages-npm-production"}},"1.1.4":{"name":"@msw/data","version":"1.1.4","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.4","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"c0b21a5588d1d3e509d751c6a15e50ce65d9d242","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.4.tgz","fileCount":80,"integrity":"sha512-BM0+e3Y8LfypQBGRvXeEGCcT3tkg0nqw75R+sI/JP6LHIf4ReB6yipOqc+dPBzRyXx5IzqTI3B9b5OstBqXD6Q==","signatures":[{"sig":"MEYCIQDN0fS/fa6X8NmJifgMaaDG2IZPhMFAMNtygEMD2KjiqgIhANRNN/4C7KOKDq77zh/bKj6yjhuX7AnsThBuxQYkGqQW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":301795},"type":"module","_from":"file:msw-data-1.1.4.tgz","exports":{".":"./build/index.mjs","./extensions":"./build/extensions/index.mjs","./extensions/sync":"./build/extensions/sync.mjs","./extensions/persist":"./build/extensions/persist.mjs"},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d2089d46-1f01-4c8c-bfe9-028180ed18c5"}},"_resolved":"/tmp/a9cc4e92d84dff3652be5060bde97012/msw-data-1.1.4.tgz","_integrity":"sha512-BM0+e3Y8LfypQBGRvXeEGCcT3tkg0nqw75R+sI/JP6LHIf4ReB6yipOqc+dPBzRyXx5IzqTI3B9b5OstBqXD6Q==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"11.11.0","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"rettime":"^0.11.8","mutative":"^1.3.0","es-toolkit":"^1.45.1","outvariant":"^1.4.3","@standard-schema/spec":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.3.6","vite":"^8.0.8","tsdown":"^0.21.9","vitest":"^4.1.4","publint":"^0.3.18","prettier":"^3.8.3","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.1","@playwright/test":"^1.59.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.4_1776617255600_0.8647539597773506","host":"s3://npm-registry-packages-npm-production"}},"1.1.5":{"name":"@msw/data","version":"1.1.5","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.5","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"6a5c8ea0b994bda1ee46e6abd56e5cd385dbdeff","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.5.tgz","fileCount":80,"integrity":"sha512-aqezecY8vvueOSMz8v19ZWpoM0Ei2VuuWt/MZuZ8NBvO2oJvZi5y8PGP6PVutuONu7ms0Or/Am4Rs6Ks9sfg7w==","signatures":[{"sig":"MEQCIAY0tEet9YtTJ18OyDBk/BDhh7WA6bm/rDPrpo9VCEYIAiAhyETLTowhgrI2mOPGkpC3JB7roXFtForlMGcN6OrfYg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":305161},"type":"module","_from":"file:msw-data-1.1.5.tgz","exports":{".":"./build/index.mjs","./extensions":"./build/extensions/index.mjs","./extensions/sync":"./build/extensions/sync.mjs","./extensions/persist":"./build/extensions/persist.mjs"},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d2089d46-1f01-4c8c-bfe9-028180ed18c5"}},"_resolved":"/tmp/53ca756c75e7cf0ea0d477a4db949904/msw-data-1.1.5.tgz","_integrity":"sha512-aqezecY8vvueOSMz8v19ZWpoM0Ei2VuuWt/MZuZ8NBvO2oJvZi5y8PGP6PVutuONu7ms0Or/Am4Rs6Ks9sfg7w==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"11.11.0","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"rettime":"^0.11.8","mutative":"^1.3.0","es-toolkit":"^1.45.1","outvariant":"^1.4.3","@standard-schema/spec":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.3.6","vite":"^8.0.8","tsdown":"^0.21.9","vitest":"^4.1.4","publint":"^0.3.18","prettier":"^3.8.3","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.1","@playwright/test":"^1.59.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.5_1776729060990_0.20442847093713623","host":"s3://npm-registry-packages-npm-production"}},"1.1.6":{"name":"@msw/data","version":"1.1.6","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.6","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"44d4b79c1098e05cebd2bbafd0115ec76066629d","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.6.tgz","fileCount":80,"integrity":"sha512-Kp0JhuaQBgMR4C6sXdoDYUNeaF/JhhzLToumYiV9flciOwSzZe7FSnlMNcL9Yj1tm1R/3f8mktDR4M6y1xVS8Q==","signatures":[{"sig":"MEUCIACqvrh4vjlWA0hcDyenkPDLNKbEZpkX4oJCOc8j/s25AiEAn0G4AJx8NCgJNXm8J7PF4E/6/ySCZPv/OKdgbPQDq5s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":315824},"type":"module","_from":"file:msw-data-1.1.6.tgz","exports":{".":"./build/index.mjs","./extensions":"./build/extensions/index.mjs","./extensions/sync":"./build/extensions/sync.mjs","./extensions/persist":"./build/extensions/persist.mjs"},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d2089d46-1f01-4c8c-bfe9-028180ed18c5"}},"_resolved":"/tmp/82c2785db88f4c604f0a243ef79b590c/msw-data-1.1.6.tgz","_integrity":"sha512-Kp0JhuaQBgMR4C6sXdoDYUNeaF/JhhzLToumYiV9flciOwSzZe7FSnlMNcL9Yj1tm1R/3f8mktDR4M6y1xVS8Q==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"11.12.1","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"rettime":"^0.11.8","mutative":"^1.3.0","es-toolkit":"^1.45.1","outvariant":"^1.4.3","@standard-schema/spec":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.3.6","vite":"^8.0.8","tsdown":"^0.21.9","vitest":"^4.1.4","publint":"^0.3.18","prettier":"^3.8.3","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.1","@playwright/test":"^1.59.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.6_1778889484032_0.2056832791777754","host":"s3://npm-registry-packages-npm-production"}},"1.1.7":{"name":"@msw/data","version":"1.1.7","keywords":["data","query","mock","model","testing","fake","msw"],"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","_id":"@msw/data@1.1.7","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"homepage":"https://github.com/mswjs/data","bugs":{"url":"https://github.com/mswjs/data/issues"},"dist":{"shasum":"8c1c6e9c215e82db91787d7e062c1c8fce792889","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.7.tgz","fileCount":80,"integrity":"sha512-S97H9BC9ErlykiTZwPWj/T3Sww5rmwCO2BBFvkv2wlgTM/E5cSbEiawHLJnqFZVMaHz7AD8cnQx2y311aK3WuA==","signatures":[{"sig":"MEQCIE/6QzBRCobyHYINmluC+I4pWDDfD2VlcLKX8kgdJHREAiBJUVN+/rFfCFhUoLU451WBW+AasMpT4cDgHwkveN3BBA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.7","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":317604},"type":"module","_from":"file:msw-data-1.1.7.tgz","exports":{".":"./build/index.mjs","./extensions":"./build/extensions/index.mjs","./extensions/sync":"./build/extensions/sync.mjs","./extensions/persist":"./build/extensions/persist.mjs"},"imports":{"#/src/*":"./src/*"},"scripts":{"dev":"tsdown -w","lint":"publint","build":"tsdown","release":"release publish","test:node":"vitest","test:browser":"playwright test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d2089d46-1f01-4c8c-bfe9-028180ed18c5"}},"_resolved":"/tmp/a91f1c9b8ee1f58cb9cffd066afc9ada/msw-data-1.1.7.tgz","_integrity":"sha512-S97H9BC9ErlykiTZwPWj/T3Sww5rmwCO2BBFvkv2wlgTM/E5cSbEiawHLJnqFZVMaHz7AD8cnQx2y311aK3WuA==","repository":{"url":"git+https://github.com/mswjs/data.git","type":"git"},"_npmVersion":"11.16.0","description":"Data querying library for testing JavaScript applications.","directories":{},"_nodeVersion":"24.18.0","dependencies":{"rettime":"^0.11.8","mutative":"^1.3.0","es-toolkit":"^1.45.1","outvariant":"^1.4.3","@standard-schema/spec":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.3.6","vite":"^8.0.8","tsdown":"^0.21.9","vitest":"^4.1.4","publint":"^0.3.18","prettier":"^3.8.3","typescript":"^5.9.3","@types/node":"^24.6.2","@ossjs/release":"^0.10.1","@playwright/test":"^1.59.1"},"_npmOperationalInternal":{"tmp":"tmp/data_1.1.7_1783556176440_0.5480949439521539","host":"s3://npm-registry-packages-npm-production"}},"1.1.8":{"type":"module","name":"@msw/data","version":"1.1.8","description":"Data querying library for testing JavaScript applications.","imports":{"#/src/*":"./src/*"},"exports":{".":"./build/index.mjs","./extensions":"./build/extensions/index.mjs","./extensions/sync":"./build/extensions/sync.mjs","./extensions/persist":"./build/extensions/persist.mjs"},"keywords":["data","query","mock","model","testing","fake","msw"],"license":"MIT","author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"homepage":"https://github.com/mswjs/data","repository":{"type":"git","url":"git+https://github.com/mswjs/data.git"},"devDependencies":{"@ossjs/release":"^0.11.1","@playwright/test":"^1.62.1","@types/node":"^24.6.2","prettier":"^3.9.6","publint":"^0.3.24","tsdown":"^0.22.14","typescript":"^5.9.3","vite":"^8.2.2","vitest":"^4.1.11","zod":"^4.5.2"},"dependencies":{"@standard-schema/spec":"^1.1.0","es-toolkit":"^1.52.0","mutative":"^1.3.0","outvariant":"^1.4.3","rettime":"^0.11.11"},"scripts":{"dev":"tsdown -w","test:node":"vitest","test:browser":"playwright test","lint":"publint","build":"tsdown","release":"release publish"},"_id":"@msw/data@1.1.8","bugs":{"url":"https://github.com/mswjs/data/issues"},"_integrity":"sha512-+kSNeBPNvHkr/84aIK2ddeef8ng62T8xAG1zof5z8lMNgGt/jVwoDsPs9cYUU2WV4T2fn22NFi0NasmTzW2mnA==","_resolved":"/tmp/fff6fbf798b5b9665414d64d450fa132/msw-data-1.1.8.tgz","_from":"file:msw-data-1.1.8.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-+kSNeBPNvHkr/84aIK2ddeef8ng62T8xAG1zof5z8lMNgGt/jVwoDsPs9cYUU2WV4T2fn22NFi0NasmTzW2mnA==","shasum":"d4b825019291ca75d902d519fd2f6080fb13aa27","tarball":"https://registry.npmjs.org/@msw/data/-/data-1.1.8.tgz","fileCount":80,"unpackedSize":338455,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@msw%2fdata@1.1.8","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIED+pxafOOV+Caln+v2vDRWqdwQJwjiz0nnicp+6OsZ8AiB1fUcMU7S4CIqpIrHyNKkADnwIMsPln8VBv83ENUkzrg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d2089d46-1f01-4c8c-bfe9-028180ed18c5"}},"directories":{},"maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/data_1.1.8_1788094992028_0.39639941746501917"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-28T18:22:56.772Z","modified":"2026-08-30T13:03:12.493Z","1.0.0":"2025-09-28T18:22:57.051Z","1.0.1":"2025-10-03T09:18:59.072Z","1.0.2":"2025-10-04T09:40:09.776Z","1.1.0":"2025-10-04T15:57:51.430Z","1.1.1":"2025-10-05T10:33:27.686Z","1.1.2":"2025-10-05T17:05:51.476Z","1.1.3":"2026-04-19T15:58:01.387Z","1.1.4":"2026-04-19T16:47:35.756Z","1.1.5":"2026-04-20T23:51:01.149Z","1.1.6":"2026-05-15T23:58:04.176Z","1.1.7":"2026-07-09T00:16:16.583Z","1.1.8":"2026-08-30T13:03:12.193Z"},"bugs":{"url":"https://github.com/mswjs/data/issues"},"author":{"name":"Artem Zakharchenko","email":"kettanaito@gmail.com"},"license":"MIT","homepage":"https://github.com/mswjs/data","keywords":["data","query","mock","model","testing","fake","msw"],"repository":{"type":"git","url":"git+https://github.com/mswjs/data.git"},"description":"Data querying library for testing JavaScript applications.","maintainers":[{"name":"kettanaito","email":"kettanaito@gmail.com"}],"readme":"[standard-schema]: https://standardschema.dev/\n\n<p align=\"center\">\n  <img src=\"logo.svg\" alt=\"Data logo\" width=\"124\" />\n</p>\n<h1 align=\"center\"><code>@msw/data</code></h1>\n<p align=\"center\">Data querying library for testing JavaScript applications.</p>\n\n## Motivation\n\nThis library exists to help developers model and query data when testing and developing their applications. It acts as a convenient way of creating schema-based fixtures and querying them with a familiar ORM-inspired syntax. It can be used standalone or in conjuncture with [Mock Service Worker](https://mswjs.io) for seamless mocking experience both on the network and the data layers.\n\n## Features\n\n- Relies on [Standard Schema][standard-schema] instead of inventing a proprietary modeling syntax you have to learn. You can use any Standard Schema-compliant object modeling library to describe your data, like Zod, ArkType, Valibot, yup, and many others.\n- Full runtime and type-safety.\n- Provides a powerful [querying syntax](#querying) (inspired by Prisma);\n- Supports [relations](#relations) for database-like behaviors (inspired by Drizzle);\n- Supports extensions (including custom extensions) for things like cross-tab collection synchronization or record persistence.\n\n---\n\n## Getting started\n\n### Install\n\n```\nnpm i @msw/data --save-dev\n```\n\n### Create collection\n\nYou start by defining a data _collection_.\n\n```ts\nimport { Collection } from '@msw/data'\nimport { z } from 'zod'\n\nconst users = new Collection({\n  schema: z.object({\n    id: z.number(),\n    name: z.string(),\n  }),\n})\n```\n\n> Above, I'm using [Zod](https://zod.dev/) to describe the `schema` for my users collection. You can use whichever [Standard Schema][standard-schema] compliant library of your choice instead.\n\n### Seed collection\n\nNext, let's put some values into our collection. Those values are called _records_ and you can create individual records via the `.create()` method or create a bunch of them with `.createMany()`.\n\n```ts\nawait users.create({ id: 1, name: 'John' })\n\nawait users.createMany(5, (index) => ({\n  id: index + 1,\n  name: faker.person.firstName(),\n}))\n```\n\n> Combine `.createMany()` with tools like [Faker](https://fakerjs.dev/) for random values in your records.\n\n### Use collection\n\nFrom this point on, you can use your `users` collection for anything data-related. You can create more records, query them, define relations to other collections, update and delete records, etc. Learn more you can do with the library in the documentation below. Good luck!\n\n---\n\n## Querying\n\n### Query syntax\n\nWhenever you have to target a record(s), you construct a _query_. A query acts as a predicate that a record must match in order to be targeted. The most basic query is that describing expected values of the record's properties:\n\n```ts\nusers.findFirst((q) => q.where({ name: 'John' }))\n```\n\n> Above, we are defining a query using the `q` builder that targets the first user whose `name` property equals to `'John'`.\n\nAdditionally, any property in a query can be expanded into a function that accepts the value and returns a boolean, indicating whether the record matches:\n\n```ts\nusers.findFirst((q) =>\n  q.where({\n    name: (name) => name.startsWith('John'),\n  }),\n)\n```\n\n> This query matches the first user whose `name` starts with `'John'`. Use functions as predicates to express more advanced logic in your queries.\n\nQuery functions are supported at any level of nesting, including the top-level record itself.\n\n```ts\nusers.findFirst((q) => q.where((user) => user.posts.length > 0))\n\nusers.findFirst((q) =>\n  q.where({\n    address: {\n      street: (street) => street !== 'Baker st.',\n    },\n  }),\n)\n```\n\n#### Logical operators\n\nYou can build complex queries via `.or()` and `.and()` logical operators exposed through the query builder. For example, here's a query that matches all users who have posts _or_ are editors:\n\n```ts\nusers.findMany((q) =>\n  q.where({ posts: (posts) => posts.length > 0 }).or({ role: 'editor' }),\n)\n```\n\nIf you prefer functional composition over method chaining, you can wrap predicates in `q.or()` and `q.and()` instead. Both syntaxes result in the same query.\n\n```ts\nusers.findMany((q) =>\n  q.or(\n    q.where({ posts: (posts) => posts.length > 0 }),\n    q.where({ role: 'editor' }),\n  ),\n)\n```\n\n## Pagination\n\nThis library supports offset and cursor-based pagination.\n\n### Offset-based pagination\n\nProvide the `take` property onto the options object of any bulk operation method, like `.findMany()`, `.updateMany()`, or `.deleteMany()`, to limit the number of results returned by the query.\n\n```ts\nconst users = new Collection({ schema })\n\nusers.findMany(\n  (q) => q.where({ email: (email) => email.includes('@google.com') }),\n  {\n    // Return the first 5 matching records.\n    take: 5,\n  },\n)\n```\n\nYou can also skip the number of first matching results by providing the `skip` property:\n\n```ts\nconst users = new Collection({ schema })\n\nusers.findMany(\n  (q) => q.where({ email: (email) => email.includes('@google.com') }),\n  {\n    // Skip the first 10 matching records.\n    skip: 10,\n    // And return the next 5.\n    take: 5,\n  },\n)\n```\n\nThe negative value for `take` is also supported to have backward pagination:\n\n```ts\nusers.findMany(\n  (q) => q.where({ email: (email) => email.includes('@google.com') }),\n  {\n    take: -5,\n  },\n)\n````\n\n### Cursor-based pagination\n\nProvide a reference to the record of the same collection as the `cursor` property for cursor-based pagination.\n\n```ts\nconst users = new Collection({ schema })\n\nconst john = users.findFirst((q) => q.where({ name: 'John' }))\n\nusers.findMany((q) => q.where({ subscribed: true }), {\n  cursor: john,\n  take: 5,\n})\n```\n\n## Sorting\n\nYou can sort the results of bulk operations, like `.findMany()`, `.updateMany()`, and `.deleteMany()`, by providing the `orderBy` property in that operation's options.\n\n```ts\n// Find all users whose name starts with \"J\"\n// and return them sorted by their `name`.\nusers.findMany((q) => q.where({ name: (name) => name.startsWith('J') }), {\n  orderBy: { name: 'asc' },\n})\n```\n\nYou can sort by multiple keys by listing them in the `orderBy` object:\n\n```ts\nusers.updateMany((q) => q.where({ name: (name) => name.startsWith('J') }), {\n  data(user) {\n    user.name = user.name.toUpperCase()\n  },\n  orderBy: {\n    name: 'asc',\n    id: 'desc',\n  },\n})\n```\n\nYou can sort by an ordered list of criteria by passing an array to `orderBy`. Each entry is applied in sequence: the first entry determines the primary sort, and each subsequent entry breaks ties among records that compare equal under the preceding criteria.\n\n```ts\nusers.findMany(undefined, {\n  orderBy: [{ age: 'asc' }, { name: 'desc' }]\n})\n```\n\n## Relations\n\nYou can define relations by calling the `.defineRelations()` method on the collection.\n\n- [One-to-one](#one-to-one)\n- [One-to-many](#one-to-many)\n- [One-to-many (inversed)](#one-to-many-inversed)\n- [Many-to-many](#many-to-many)\n- [Through relations](#through-relations)\n- [Unique relations](#unique-relations)\n- [Ambiguous relations](#ambiguous-relations)\n- [Polymorphic relations](#polymorphic-relations)\n\n### Defining relations\n\nBelow, you can find examples of defining various types of relations, but there are a few things that apply to all of them:\n\n- Describe relations on the schema level using your schema library. The `.defineRelations()` API has no effect on the model's schema/types and only operates on known properties;\n- Relations are described _after_ a collection is defined (to prevent circular references);\n- Relations do not require explicit `foreignKey` associations and instead are bound to internal IDs of related records.\n\n### One-to-one\n\n```ts\nconst userSchema = z.object({\n  // In Zod, relational properties are best described as getters\n  // so they can produce self-referencing schemas.\n  get country() {\n    return countrySchema\n  },\n})\nconst countrySchema = z.object({ code: z.string() })\n\nconst users = new Collection({ schema: userSchema })\nconst countries = new Collection({ schema: countrySchema })\n\n// Declare the relations on the `users` collection.\nusers.defineRelations(({ one }) => ({\n  // `user.country` is a one-of relation to the `countries` collection.\n  country: one(countries),\n}))\n\nconst user = await users.create({\n  country: await countries.create({ code: 'usa' }),\n})\nuser.country // { code: 'usa' }\n```\n\n### One-to-many\n\n```ts\nconst postSchema = z.object({\n  get comments() {\n    return z.array(countrySchema)\n  },\n})\nconst commentSchema = z.object({\n  text: z.string(),\n})\n\nconst posts = new Collection({ schema: postSchema })\nconst comments = new Collection({ schema: commentSchema })\n\nposts.defineRelations(({ many }) => ({\n  comments: many(comments),\n}))\n\nawait posts.create({\n  comments: [\n    await comments.create({ text: 'First!' }),\n    await comments.create({ text: 'Thanks for watching.' }),\n  ],\n})\n```\n\n### One-to-many (inversed)\n\nTwo collections may self-reference each other. For example, `post.comments` is a list of comments while each `comment.post` references to the parent post.\n\n```ts\nconst postSchema = z.object({\n  get comments() {\n    return z.array(countrySchema)\n  },\n})\nconst commentSchema = z.object({\n  text: z.string(),\n  get post() {\n    return postSchema\n  },\n})\n\nconst posts = new Collection({ schema: postSchema })\nconst comments = new Collection({ schema: commentSchema })\n\nposts.defineRelations(({ many }) => ({\n  comments: many(comments),\n}))\ncomments.defineRelations(({ one }) => ({\n  post: one(posts),\n}))\n\nawait posts.create({\n  comments: [await comments.create({ text: 'First!' })],\n})\n\nconst comment = comments.findFirst((q) => q.where({ text: 'First!' }))\ncomment.post // { comments: [{ text: 'First', post: Circular }] }\n```\n\n> Inversed relations are updated automatically. Whenever you add a new comment to a post, both `post.comments` and `comment.post` are updated to reference each other. The same is true when setting a new parent `post` on the comment.\n\n### Many-to-many\n\nIn the next example, every `user` may have multiple `posts` while each `post` may have multiple `authors`.\n\n```ts\nconst userSchema = z.object({\n  get posts() {\n    return z.array(postSchemas)\n  },\n})\nconst postSchema = z.object({\n  get authors() {\n    return z.array(userSchema)\n  },\n})\n\nconst users = new Collection({ schema: userSchema })\nconst posts = new Collection({ schema: postSchema })\n\nusers.defineRelations(({ many }) => ({\n  posts: many(posts),\n}))\nposts.defineRelations(({ many }) => ({\n  authors: many(users),\n}))\n```\n\n### Through relations\n\nSince relational properties resolve via getters, there's no need to define special \"through\" relations to reference one model through a relation from another.\n\n```ts\nconst owners = new Collection({ schema: ownerSchema })\nconst cars = new Collection({ schema: carSchema })\nconst mechanics = new Collection({ schema: mechanicSchema })\n\nowners.defineRelations(({ many }) => ({\n  cars: many(cars),\n}))\ncars.defineRelations(({ one }) => ({\n  owner: one(owners),\n}))\nmechanics.defineRelations(({ one }) => ({\n  car: one(cars),\n}))\n\nconst owner = await owners.create({ name: 'John' })\nconst car = await cars.create({ brand: 'bmw', owner })\nconst mechanic = await mechanics.create({ name: 'Kyle', car })\n\nmechanic.car.owner.name // \"John\"\n```\n\n> Note that although `mechanics` does not define an explicit relation to `owners`, you can get the owner of the car associated with a mechanic through the `car` relation.\n\n### Unique relations\n\nYou can mark a relation as unique by setting the `unique` property of the relation options to `true`. Unique relations cannot reference foreign records that are already associated with other owner records.\n\n```ts\nposts.defineRelations(({ one }) => ({\n  author: one(users, { unique: true }),\n}))\n```\n\n> In this example, the `author` of each post points to a single _unique_ user. If a post attempts to set its author to a user that's already associated with another post, an error will be thrown.\n\n### Ambiguous relations\n\nYou can use the `role` option of the relation to disambiguate between multiple properties referencing the same foreign model.\n\nFor example, a single `post` may have both `author` and `reviewer` referencing the same `user` model. To make those properties pointing to _different_ user records, use the `role` that acts as a relation identifier. This way, the library will update the corresponding relational properties for both `users` and `posts` when the referenced relation is updated.\n\n```ts\nconst users = new Collection({ schema: userSchema })\nconst posts = new Collection({ schema: postSchema })\n\nusers.defineRelations(({ many }) => ({\n  posts: many(posts, { role: 'author' }),\n  reviews: many(posts, { role: 'reviewer' }),\n}))\n\nposts.defineRelations(({ one }) => ({\n  author: one(user, { role: 'author' }),\n  reviewer: one(user, { role: 'reviewer' }),\n}))\n```\n\n> The `role` property acts as a de-facto ID of a relation when synchronizing related models.\n\n### Polymorphic relations\n\nProvide an array of foreign collections to a relation to define it as _polymorphic_.\n\n```ts\nconst posts = new Collection({ schema: postSchema })\nconst images = new Collection({ schema: imageSchema })\nconst videos = new Collection({ schema: videoSchema })\n\nposts.defineRelations(({ many }) => ({\n  // Providing a record of foreign collections allows\n  // all of their records to be set as the value.\n  attachments: many([images, videos]),\n}))\nimages.defineRelations(({ one }) => ({\n  post: one(posts),\n}))\nvideos.defineRelations(({ one }) => ({\n  post: one(posts),\n}))\n```\n\n> In this example, `post.attachments` is an array of either `images` or `videos`, where records from both collections are allowed.\n\n## Error handling\n\nData provides multiple different error classes to help you differentiate and handle different errors.\n\n### `OperationError`\n\n- `code` `<OperationErrorCode>`, the error code describing the failed operation;\n- `cause` `<Error>` (_optional_), a reference to the original thrown error.\n\nThrown whenever performing a record operation fails. For example:\n\n- When creating a new record whose initial values do not match the collection's schema;\n- When there are no records found for a strict query.\n\n### `RelationError`\n\n- `code` `<RelationErrorCode>`, the error code describing the relation operation;\n- `info` `<object>`, additional error information;\n  - `path` `<PropertyPath>`, path of the relational property;\n  - `ownerCollection` `<Collection>`, a reference to the owner collection;\n  - `foreignCollection` `<Array<Collection>>`, an array of foreign collections referenced by this relation;\n  - `options` `RelationDefinitionOptions`, the options object passed upon decaring this relation.\n\nThrown whenever performing a relation operation fails. For example:\n\n- When attempting to reference a foreign record that's already associated with another record in a unique relation;\n- When directly assigning value to a relational property.\n\n---\n\n## API\n\n### `new Collection(options)`\n\n- `options` `<Object>`\n  - `schema` [Standard Schema][standard-schema] A schema describing each record in this collection.\n  - `extensions` (optional) An array of [extensions](#extensions) to use on this collection.\n\nCreates a new collection of data.\n\n#### `.create(initialValues)`\n\n- `initialValues` Initial values for the new record.\n\nCreates a single record with the provided initial values.\n\n```ts\nconst user = await users.create({ id: 1, name: 'John' })\n```\n\n> The `.create()` method returns a promise to support potential asynchronous transformations in your schema.\n\n#### `.createMany(count, initialValuesFactory)`\n\n- `count` `<number>` A number of records to create.\n- `initialValuesFactory` `<Function>` A function that returns initial values for each record.\n\nCreates multiple records with the initial value factory.\n\n```ts\nconst users = await users.createMany(5, (index) => ({\n  id: index + 1,\n  name: 'John',\n}))\n```\n\nThe initial value factory function accepts the `index` argument indicating the index of the record that's being created. Use it, as well as the function's closure, to generate unique or random values.\n\n#### `.findFirst(query)`\n\n- `query` [`Query`](#new-querypredicate) A query matching the record.\n\nReturns the first record matching the query.\n\n```ts\nconst users = new Collection({\n  schema: z.object({\n    id: z.number(),\n    name: z.string(),\n  }),\n})\n\nawait users.create({ id: 1, name: 'John' })\nawait users.create({ id: 2, name: 'John' })\n\nusers.findFirst((q) => q.where({ name: 'John' }))\n// { id: 1, name: 'John' }\n```\n\n#### `.findMany(query)`\n\n- `query` [`Query`](#new-querypredicate) A query matching the records.\n\nReturns all records matching the query.\n\n```ts\nconst users = new Collection({\n  schema: z.object({\n    id: z.number(),\n    name: z.string(),\n  }),\n})\n\nawait users.create({ id: 1, name: 'John' })\nawait users.create({ id: 2, name: 'John' })\n\nusers.findMany((q) => q.where({ name: 'John' }))\n// [{ id: 1, name: 'John' }, { id: 2, name: 'John' }]\n```\n\n#### `.update(query, options)`\n\n- `query` [`Query`](#new-querypredicate) A query matching the record.\n- `options` `<Object>`\n  - `data` A function that produces changes by modifying the previous record.\n\nUpdates the first record matching the query. Returns a promise that resolves with the updated record.\n\n```ts\n// Change the name for the user with a specific `id`.\nconst updatedUser = await users.update((q) => q.where({ id: 123 }), {\n  data(user) {\n    user.name = 'Johnatan'\n  },\n})\n```\n\n> Update methods return a promise in order to support potential asynchronous transformations defined in your schema.\n\nThe `data` function allows you to perform multiple updates upon a record by mutating that record directly. Think of it as a draft function from libraries like `immer` or `mutative` because that's precisely what it is!\n\nYou can also provide a record reference as the predicate to the `.update()` method to update that particular record:\n\n```ts\nconst user = users.findFirst((q) => q.where({ id: 123 }))\nawait users.update(user, {\n  //               👆👆\n  data(user) {\n    user.id = 456\n  },\n})\n```\n\n#### `.updateMany(query, options)`\n\n- `query` [`Query`](#new-querypredicate) A query matching the records.\n- `options` `<Object>`\n  - `data` Changes to apply to each record.\n\nUpdates all records matching the query. Returns a promise that resolves with an array containing the updated records.\n\n```ts\n// Find all the users with the name \"John\"\n// and make their name truly stand out!\nconst updatedUsers = await users.updateMany((q) => q.where({ name: 'John' }), {\n  data(user) {\n    user.name = user.name.toUpperCase()\n  },\n})\n```\n\n#### `.delete(query)`\n\n- `query` [`Query`](#new-querypredicate) A query matching the record.\n\nDeletes the first record matching the query. Returns the deleted record.\n\n```ts\n// Delete a user with a particular `id`.\nconst deletedUser = users.delete((q) => q.where({ id: 123 }))\n```\n\nYou can also provide a record reference as the predicate to the `.delete()` method to delete that particular record:\n\n```ts\nconst user = users.findFirst((q) => q.where({ id: 123 }))\nusers.delete(user)\n```\n\n#### `.deleteMany(query)`\n\n- `query` [`Query`](#new-querypredicate) A query matching the records.\n\nDeletes all records matching the query. Returns an array containing the deleted records.\n\n```ts\n// Delete all users whose trial period has expired.\nconst deletedUsers = users.deleteMany((q) =>\n  q.where({ trial: { expiresAt: (expiresAt) => expiresAt <= Date.now() } }),\n)\n```\n\n#### `.defineRelations(definition)`\n\n- `definition` `<Function>` A function that accepts relation utilities and returns an object with relational properties.\n\nDefines relations on the current collection.\n\n```ts\nconst users = new Collection({ schema: userSchema })\nconst posts = new Collection({ schema: postSchema })\n\nusers.defineRelations(({ many }) => ({\n  // `user.posts` is a many-of relation to `posts`.\n  posts: many(posts)\n}))\n```\n\n> You can define nested relational properties by nesting them in the object returned from `.defineRelations()`.\n\n##### Relational utilities\n\nThe following relational utilities are exposed in the argument to this method:\n\n- `one(collection[, options])`, defines a one-of relation to the given collection;\n- `many(collection[, options])`, defines a many-of relation to the given collection.\n\n##### Relation options\n\n- `unique` `<boolean>`, marks this relation as unique. Foreign records referenced by this relation cannot be referenced by other models.\n\n```ts\nusers.defineRelations(({ many }) => ({\n  posts: many(posts)\n}))\nposts.defineRelations(({ one }) => ({\n  author: one(users, { unique: true })\n}))\n\nconst john = await users.create({\n  name: 'John',\n  // `john` is associated as the `author` of this post now.\n  posts: [await posts.create({ title: 'First post' })]\n})\n\nawait users.create({\n  name: 'Katy',\n  // Creating this user will error because it tries to list\n  // a post which `author` already references to another user.\n  posts: [john.posts[0]]\n})\n```\n\n- `role` `<string>`, an identifier to differentiate ambiguous relations to the same foreign collection;\n\n```ts\nusers.defineRelations(({ many }) => ({\n  // Both `users` and `posts` reference each other in multiple keys.\n  // Using `role` helps the library understand which keys are connected.\n  posts: many(posts, { role: 'author' }),\n  underReview: many(posts, { role: 'reviewer' })\n}))\n\nposts.defineRelations(({ one, many }) => ({\n  author: one(users, { role: 'author' }),\n  reviewers: many(users, { role: 'reviewer' })\n}))\n```\n\n- `onDelete` `\"cascade\" | undefined`, decides how to handle referenced foreign records when the owner is deleted.\n\n```ts\nusers.defineRelations(({ many }) => ({\n  // If a user gets deleted, delete all of the `posts` associated with them.\n  posts: many(posts, { onDelete: 'cascade' })\n}))\nposts.defineRelations(({ one }) => ({\n  author: one(users)\n}))\n```\n\n### `new Query([predicate])`\n\n- `predicate` (optional) An object or a function that acts as a predicate for records.\n\nCreates a new query to match records in a collection. Normally, you query records through the querying methods of the collection (see [Querying](#querying)). You can, however, construct a type-safe `Query` class to abstract common queries or query builders.\n\n```ts\nconst userSchema = z.object({\n  id: z.number(),\n  subscribed: z.boolean().default(false),\n  role: z.enum(['user', 'editor', 'admin']).default('user'),\n})\n\n// Creates a query builder for the users schema.\nconst query = new Query<typeof userSchema>()\n```\n\n#### `.where(predicate)`\n\n- `predicate` A predicate for the records.\n- Returns: [`Query`](#new-querypredicate).\n\n```ts\nquery.where({ id: 2 })\n```\n\n#### `.or(predicate)`\n\n- `predicate` A predicate or another [`Query`](#new-querypredicate).\n- Returns: [`Query`](#new-querypredicate).\n\nCreates a new query, merging the previous predicates with the new one under a `OR` relation. A record may match _any predicate_ to be considered matching.\n\n```ts\nconst unsubscribedOrEditorsQuery = query.or(\n  query.where({ subscribed: false }),\n  query.where({ role: 'editor' }),\n)\n```\n\n#### `.and(predicate)`\n\n- `predicate` A predicate or another [`Query`](#new-querypredicate).\n- Returns: [`Query`](#new-querypredicate).\n\nCreates a new query, merging the previous predicates with the new one under a `AND` relation. A record must match _all predicates_ to be considered matching.\n\n```ts\nconst exactAdminQuery = query.and(\n  query.where({ id: 1 }),\n  query.where({ role: 'admin' }),\n)\n```\n\n#### `.test(record)`\n\n- `record` `<Record>` A reference to a record to test.\n- Returns `<boolean>` Indicates whether the given record matches the query.\n\n```ts\nquery.test({ id: 1 })\n```\n\n---\n\n## Extensions\n\nYou can extend the behavior of collections via _extensions_. The library comes with the following default extensions, but you can always [create your own](#custom-extensions).\n\n### Default extensions\n\n#### `sync()`\n\n> [!WARNING]\n> The `sync()` extension is browser-only. It will be ignored in Node.js.\n\nSynchronizes collection changes, like creating/updating/deleting records, with the same collection in another browser tab via a `BroadcastChannel`.\n\n```ts\nimport { Collection } from '@msw/data'\nimport { sync } from '@msw/data/extensions/sync'\n\nconst users = new Collection({\n  schema,\n  extensions: [sync()],\n})\n```\n\n#### `persist()`\n\n> [!WARNING]\n> The `persist()` extension is browser-only. It will be ignored in Node.js.\n\nPersist the records in the collection between page reloads.\n\n```ts\nimport { Collection } from '@msw/data'\nimport { persist } from '@msw/data/extensions/persist'\n\nconst users = new Collection({\n  schema,\n  extensions: [persist()],\n})\n```\n\n### Custom extensions\n\n```ts\n// my-extension.ts\nimport { defineExtension } from '@msw/data/extensions'\n\nexport function myExtension() {\n  return defineExtension({\n    name: 'my-extension',\n    extend(collection) {\n      // Your logic here.\n    },\n  })\n}\n```\n\n```ts\nimport { Collection } from '@msw/data'\nimport { myExtension } from './my-extension.js'\n\nnew Collection({ schema, extensions: [myExtension()] })\n```\n","readmeFilename":"README.md"}