{"_id":"@pvermeer/dexie-populate-addon","_rev":"39-042f055111af2cff241258b6d66212a7","name":"@pvermeer/dexie-populate-addon","dist-tags":{"latest":"1.0.5","beta":"2.0.0-beta.0"},"versions":{"1.0.0-beta.1":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.1","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.1","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"9a386e265796b90ec3c198b80ad591d18dcabb55","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.1.tgz","fileCount":32,"integrity":"sha512-qUxTtaVmhiyNhnt8yenEq69rs2zsSBITRGyqJ5nr7Z8gPYyDbDfR77IyMiBaJK6SoJLws7n5MctHtelp0FhRvQ==","signatures":[{"sig":"MEQCIEPJLwmKPrBr+mEIolgHpmDKIpPiYfX7JDzfAMyvU045AiAwYAQBUjotJ/yVDW8r26qVLiNBgpLUL120a+1k49CtYQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":366171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYmVDCRA9TVsSAnZWagAAUy4QAIMCNk0lwgpyUOp2P02A\nH0AKeiZ+igUuMPtInZQ0reYrug0yP8bDmayYzpZKdkDsAsrp0Q+FDdIq4k7G\nWJQLmyBO5PlMoQGYhGqnt8MUq1x9De/pc8fU1Y0OQf/wOt/t5Gi8HXgqLTxA\nXjNtCYQrl0Rhr9+aFGUYArqtiUW/dMYJCs4EqgLDFHrpSb8cGkKg8heaMAZ8\nGzvPS2+zX2dfyDRWClhpWg55MzU6Oke0/T1xybRvxOLoCe/aZafTbA6nosjs\nUCbeWYqDJcdn2+mvq+fmJv0lMfwQFRSZRn19hZncayouxNd0NmD357QD1XqF\n7Sc54ttiADKXHZyhKuEoGhzyhrm4cpey0jLc24EMF+U7lihmH2+xQhIgiILm\n+JsN/t5cVb+9amOGNnN3l05UFA2E7zq/gMQiRFc7mGqSdqMI0z9a1eigO3Vh\ngnmOX3AcVYmpDrQmFgMt6ROdBSwAf/NnQCjv8asouFY0H7v2Cj3+3aVhLq1D\nFaD1FF0QavGbrm77Oh7Qrk6trmtBzFjZRwfZyizmv4KRlbf/aDk1nRj6mxB6\nQ32X/h4HzK7da2d3zH/r3h5HK5fx+OKCoLG0bSJOHiIsIhA04bTuYhynATsC\nKXd5wd2Xy6WNa4DIKylXaYGDGloC0sDCgli5U0egjlUIPJK0gJWzI/D8kXmB\nFNBF\r\n=P9BM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"pre-push":"if git-branch-is -i -q -r \"master|next|next-major|beta|alpha|^v\\d+\\.\\d+(\\.\\d+)?(-\\S*)?$\"; then npm run test; fi","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"module":"dist/es6/index.js","gitHead":"5ce5ce0fa6450951589af70ce5ceb12115654013","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project test/tsconfig.json","test":"npm run build && npm run lint && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6","clean":"rimraf -rf coverage/ && rimraf -rf dist/ && rimraf -rf reports/","build:es6":"tsc -p src/tsconfig.es6.json","test:karma":"karma start test/karma.conf.js","test:jasmine":"jasmine --require=ts-node/register --config=test/jasmine.conf.json","build:bundles":"webpack --config webpack.config.js","semantic-release":"semantic-release","test:karma:debug":"karma start test/karma.debug.conf.js","test:jasmine:debug":"nodemon --ext ts --exec jasmine --require=ts-node/register --config=test/jasmine.conf.json --reporter=jasmine-console-reporter"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.13.7","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"12.16.1","dependencies":{"lodash":"^4.17.15"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dexie":"^3.0.0-rc.4","faker":"^4.1.0","husky":"^4.0.7","karma":"~4.4.1","rimraf":"^3.0.0","tslint":"^5.20.1","jasmine":"^3.5.0","nodemon":"^2.0.2","ts-node":"^8.6.2","webpack":"^4.41.5","lodash-es":"^4.17.15","ts-loader":"^6.2.1","typescript":"~3.5.3","simplytyped":"^3.2.3","webpack-cli":"^3.3.10","@types/faker":"^4.1.8","@types/karma":"^3.0.5","jasmine-core":"^3.5.0","@angular/core":"^8.2.14","@types/lodash":"^4.14.149","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","@types/jasmine":"^3.5.0","@commitlint/cli":"^8.3.4","@ngtools/webpack":"^8.3.23","@types/lodash-es":"^4.17.3","semantic-release":"^17.0.2","@angular/compiler":"^8.2.14","karma-ie-launcher":"^1.0.0","karma-edge-launcher":"^0.4.2","karma-mocha-reporter":"^2.2.5","karma-opera-launcher":"^1.0.0","semantic-release-cli":"^5.2.3","@angular/compiler-cli":"^8.2.14","@semantic-release/git":"^8.0.0","karma-chrome-launcher":"^3.1.0","karma-detect-browsers":"^2.3.3","karma-safari-launcher":"^1.0.0","@commitlint/travis-cli":"^8.3.4","karma-firefox-launcher":"^1.3.0","license-webpack-plugin":"^2.1.3","webpack-node-externals":"^1.7.2","webpack-bundle-analyzer":"^3.6.0","jasmine-console-reporter":"^3.1.0","karma-phantomjs-launcher":"^1.0.4","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.2","istanbul-instrumenter-loader":"^3.0.1","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1","karma-safaritechpreview-launcher":"^2.0.2"},"peerDependencies":{"dexie":"^3.0.0-rc.4"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.1_1583506754701_0.782314742899056","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.2":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.2","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.2","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"d6716ffe4b5006a6fa37cc092da8152c89268603","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.2.tgz","fileCount":32,"integrity":"sha512-pytFBQPNOHtGasbsGtlRDb2c5nu7UTVSK7P+tSVn5c10ADuDFhTQxo9aImFkGM1XXFJB4tTG3kIyZ4pXcsuwwQ==","signatures":[{"sig":"MEUCIQCmTTbSa7SqM494GQk5tkG9dsPf+4SjunO6PkFosxicXQIgObKpjxGozpjlVa7KPR3prbr4aDa6TgwMlJjHUrXtnkc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":370111,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYqVkCRA9TVsSAnZWagAAd2YP+gN6Mu+FsxAzZadbve+g\n2vR4SMIlyLgnA4zjZN4C48RvL7Xuz4WTwk/Dz5sIq92ChfPA7YpW9TXs2ov8\nB7HwA3pthSR/nM/VfbWzneYqYX8unAuBA9GOooi99JtuE+MUjQqtRU7RKElM\nKKvD4yiaCosY55j0x5Fy3IqDebcx4N7A6g9wdqJUcP5bmwHrM7e3u9sNaD7W\n6G2+yhKkaABqo6/gxS/pkYmmXLlJ2+bO4vdsZSMscsLz0DKtyvUUTAdMxMMh\nR0l0FJ8do5oqVgXP0TI9aiN7WIbawEPKefBNrLtg28ez5cXcDOyIZta1/Tbg\nprVkWIPVRMrKLSzw3PunI4FsfXc+TmGePg1VVMhFdTU22eB9NOU0LulYpHTE\nGfyY7bmZu2324d0wvrPOTPGp3FgF25vNzBv4LNAtbydO5ipi0h9c3R0W4+uK\nOzCRs1RvslfSp6kVJk/Mz0U7ee9AjCbOqH3nhm1YAI+AP5vpJqIt5PMFW7Vl\nL/jOocB9l4E5uZW91PscdRwrObUUUA8qFvyFXcFamxiwtUABFiAkMtjkiltv\nkRGoEWJxQFQhbiW0wtHYkekQ1a+Nu7FI1tEz1aeakZ20fesc/0v0LjAzp9cO\nj5m8b2GwQSlvO4mocKf61fL0n0mxFwpXrODNmIpVjkXKdjrJhDgh/HchICHx\n4/Lo\r\n=HdYl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"pre-push":"if git-branch-is -i -q -r \"master|next|next-major|beta|alpha|^v\\d+\\.\\d+(\\.\\d+)?(-\\S*)?$\"; then npm run test; fi","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"module":"dist/es6/index.js","readme":"ERROR: No README data found!","gitHead":"13a580cbf93585d889277a53974aaf865dff91ed","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project test/tsconfig.json","test":"npm run build && npm run lint && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6","clean":"rimraf -rf coverage/ && rimraf -rf dist/ && rimraf -rf reports/","build:es6":"tsc -p src/tsconfig.es6.json","test:karma":"karma start test/karma.conf.js","test:jasmine":"jasmine --require=ts-node/register --config=test/jasmine.conf.json","build:bundles":"webpack --config webpack.config.js","semantic-release":"semantic-release","test:karma:debug":"npm run build && karma start test/karma.debug.conf.js","test:jasmine:debug":"nodemon --ext ts --exec jasmine --require=ts-node/register --config=test/jasmine.conf.json --reporter=jasmine-console-reporter"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.13.7","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"12.16.1","dependencies":{"lodash":"^4.17.15"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dexie":"^3.0.0-rc.4","faker":"^4.1.0","husky":"^4.0.7","karma":"~4.4.1","rimraf":"^3.0.0","tslint":"^5.20.1","jasmine":"^3.5.0","nodemon":"^2.0.2","ts-node":"^8.6.2","webpack":"^4.41.5","lodash-es":"^4.17.15","ts-loader":"^6.2.1","typescript":"~3.5.3","simplytyped":"^3.2.3","webpack-cli":"^3.3.10","@types/faker":"^4.1.8","@types/karma":"^3.0.5","jasmine-core":"^3.5.0","@angular/core":"^8.2.14","@types/lodash":"^4.14.149","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","@types/jasmine":"^3.5.0","@commitlint/cli":"^8.3.4","@ngtools/webpack":"^8.3.23","@types/lodash-es":"^4.17.3","semantic-release":"^17.0.2","@angular/compiler":"^8.2.14","karma-ie-launcher":"^1.0.0","karma-edge-launcher":"^0.4.2","karma-mocha-reporter":"^2.2.5","karma-opera-launcher":"^1.0.0","semantic-release-cli":"^5.2.3","@angular/compiler-cli":"^8.2.14","@semantic-release/git":"^8.0.0","karma-chrome-launcher":"^3.1.0","karma-detect-browsers":"^2.3.3","karma-safari-launcher":"^1.0.0","@commitlint/travis-cli":"^8.3.4","karma-firefox-launcher":"^1.3.0","license-webpack-plugin":"^2.1.3","webpack-node-externals":"^1.7.2","webpack-bundle-analyzer":"^3.6.0","jasmine-console-reporter":"^3.1.0","karma-phantomjs-launcher":"^1.0.4","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.2","istanbul-instrumenter-loader":"^3.0.1","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1","karma-safaritechpreview-launcher":"^2.0.2"},"peerDependencies":{"dexie":"^3.0.0-rc.4"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.2_1583523171606_0.4386017376535636","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.3":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.3","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.3","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"da376cfa55a3bfdf6ac3dcd1ae421a0d6cf635cf","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.3.tgz","fileCount":43,"integrity":"sha512-5XYTWfjBEAePIwtWyXfy0M4E8Nc4XtJ2qhsEx7YXUfsFymJyL7vLiz54Wdb/gtPlUom6mRCQwM5jSME8gWslvA==","signatures":[{"sig":"MEUCIQDvX5TKYMv+1SZHYoVtsuS8G5EdtliV5QVZYBdSJZM8SgIge00eRouOP4bYH4oTu3jTX2nvxxRmRP28EKDUY/I8QgU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163090,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeb1zTCRA9TVsSAnZWagAA3LoP/1oUIJOtIle32Udj817Q\nUA5C287cTjkS5pc9JPlVb75kSv05e5r04uXNPqEfj+KroLJ/vUJdvfmhD6Tw\nVBeZRYh4NFL0TRwGQ2Nuxm0km8jYgkfYha0+gp3q3G75StP+lX3pusDOS53K\ncJ3xMUeNlJxRSk0EQ+BXwpuITRbX1yf3KSubf0LWIs7Jx08838TsbL+z5BuP\nRZyLi/gkqFmeE7NpiZAoZRNrFQwtVcwrC3rs203j4EXTCuJ2o0iRCinD0Om9\niDscvRVr+tZmYHWr6YtHb0TU9ZbQB9uhIJdgRyiavBVIbsDvVe/J2dG6FYCd\nVi7moCldK+u+tqAI/5pRR37boKoDht5Mj5w639pN9tdtvM1x8okohXRa3w5o\npa9+Au4FSvPlOEOcLineL0GS2wpQ0nYTKHXZuhToONfY4WrlJvUYdf3Jc+eN\neBdlKIoI56NzbIkFbELwXc6PxmL2q1yzMN0+N2pqkV7pNwUN2Ymt87xad6rl\npI/wgbdUhT6eylN5L0NPjOgamD1GF23ezSouU0weuqTD5aA/rgQyETgvqu0d\nMN0P6WmPbdtqqXmxP+sn282/L+fVA9hXU8B6D54wHxi4PoXedP3OEZFekNd1\nGS8rEiWPL42Y+vVfQDsHwWcTsKknlYGVdXa7H5TBNHJj85T9KS97UqZz25K1\nQdal\r\n=H9kv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"pre-push":"if git-branch-is -i -q -r \"master|next|next-major|beta|alpha|^v\\d+\\.\\d+(\\.\\d+)?(-\\S*)?$\"; then npm run test; fi","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"module":"dist/esm-es5/index.js","readme":"ERROR: No README data found!","gitHead":"238a8a3d548c93a302d82c9b61cc33e8e33fbfc1","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project tsconfig.json","test":"npm run build && npm run lint && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6 && npm run build:esm-es5 && npm run build:declaration","clean":"rimraf -rf dist/ && rimraf -rf reports/","build:es6":"tsc -p tsconfig.es6.json","test:karma":"karma start test/karma.conf.js","test:jasmine":"cd test && jasmine --require=ts-node/register --config=jasmine.conf.json --reporter=jasmine-console-reporter","build:bundles":"webpack --config webpack.config.js","build:esm-es5":"tsc -p tsconfig.esm-es5.json","test:coverage":"karma start test/karma.conf.js --browsers ChromeHeadless --reporters dots,coverage-istanbul","semantic-release":"semantic-release","test:karma:debug":"npm run build && karma start test/karma.debug.conf.js","build:declaration":"dts-bundle-generator --config dts-bundler.config.js","test:jasmine:debug":"cd test && nodemon --ext ts --exec jasmine --require=ts-node/register --config=jasmine.conf.json --reporter=jasmine-console-reporter"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.13.7","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"12.16.1","dependencies":{"tslib":"^1.11.1","lodash":"^4.17.15"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dexie":"^3.0.0-rc.5","faker":"^4.1.0","husky":"^4.2.3","is-ci":"^2.0.0","karma":"~4.4.1","rimraf":"^3.0.2","tslint":"^5.20.1","jasmine":"^3.5.0","nodemon":"^2.0.2","ts-node":"^8.6.2","webpack":"^4.42.0","lodash-es":"^4.17.15","ts-loader":"^6.2.1","typescript":"^3.8.3","@babel/core":"^7.8.7","simplytyped":"^3.2.3","webpack-cli":"^3.3.11","@types/faker":"^4.1.10","@types/is-ci":"^2.0.0","@types/karma":"^3.0.8","babel-loader":"^8.0.6","jasmine-core":"^3.5.0","@types/lodash":"^4.14.149","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","@babel/runtime":"^7.8.7","@types/jasmine":"^3.5.9","@commitlint/cli":"^8.3.5","@types/lodash-es":"^4.17.3","semantic-release":"^17.0.2","@babel/preset-env":"^7.8.7","dts-bundle-generator":"^3.3.1","karma-mocha-reporter":"^2.2.5","semantic-release-cli":"^5.2.3","@semantic-release/git":"^8.0.0","karma-chrome-launcher":"^3.1.0","karma-edgium-launcher":"github:PVermeer/karma-edgium-launcher#master","@commitlint/travis-cli":"^8.3.5","karma-firefox-launcher":"^1.3.0","license-webpack-plugin":"^2.1.4","webpack-node-externals":"^1.7.2","webpack-bundle-analyzer":"^3.6.1","jasmine-console-reporter":"^3.1.0","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.2","istanbul-instrumenter-loader":"^3.0.1","@babel/plugin-transform-runtime":"^7.8.3","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1"},"peerDependencies":{"dexie":"^3.0.0-rc.4"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.3_1584356563390_0.21613002724291142","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.4":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.4","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.4","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"02c4be265939063346092192be280176f178ed83","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.4.tgz","fileCount":44,"integrity":"sha512-0P4ls7Utqwfrba8xwTx5eZYP4gQthYAo2tg0zIkd4jIQHwwbJnarpyTHPbGOB2kVf2CsnIjr3zArcngEH3u3BA==","signatures":[{"sig":"MEQCIB/4R24ZwfqssH7l9dcKzMzJvc+h3/U9lKKlVoy6a3HKAiAWHlRbOBbY0Ork0e6bJaYIRfU10WAPA3VpSimb6p33kw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":173148,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJecl4vCRA9TVsSAnZWagAAiSEQAJxD5UF1w1RGn3MRMqds\nVMZS4LOVKumc1AlCmEE7iy+bNx29+mHYUs6OcupX9SMVMJ6cfo6jAQlZjgtm\nM8da9/29+mkNeYcKXXWbcIO7rRNUViv/HeYlYry3lkW+q4dI1ILsy5sB1/af\nWiy0zWdfp6UfqMeBhwi6gxHdYSaOXKHcFcGwbZhMixA7WnZ0cqCxN9iQhmA0\naCEm1BIS1SRBM391Cl2jzlZoLVr8N9gwytOKv84ijyK54vpjfelnQl5SK28L\n0KOIwzvzHvtmVk5GQmctX1/vuThndbEbfCXV0HiUSizmfQOTH+R9z9uKUiFr\nZfKJpFAqapMJ0B9UsC58XVqhw90tW/rhayZeSsRJfbmH+qaZH6Aq/D83iR5M\nW2lUqwRY+84WYeyI8lKpvGRUMLlWKd+Map43TBUyjJ1xpcoh5YyU+J33W10S\n7vwt4xk4WuU5dP2AneirN5HtlbxKBC1TvOr++nGOfdgjfzieVozhlDp69cg1\ny9AORwMRJWyAd/FvsnJmx9xUQ+0Ip1MmyQJugiI2r79dFERvHLlERZhEUtYV\n4Q1pmkwFAUy6eAntURyEj8e/gKwDt4C2jju0JFrZAz6W5rdq6iP3FDrpmdW0\n9m3fGKIXkT8KfBEbdQvZeIEtjXa1CwGhJ7bhmmdVmlfCYPlaMz+HYvwwnCzL\n1oKY\r\n=448M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"pre-push":"if git-branch-is -i -q -r \"master|next|next-major|beta|alpha|^v\\d+\\.\\d+(\\.\\d+)?(-\\S*)?$\"; then npm run test; fi","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"module":"dist/esm-es5/index.js","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![Build Status](https://travis-ci.org/PVermeer/dexie-populate-addon.svg?branch=master)](https://travis-ci.org/PVermeer/dexie-populate-addon)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. \n```\nnpm install dexie\n```\nAt the time of writing Dexie v3 is in the RC stage. To install this version you have to use the @next npm version. Current version of Dexie.js: [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie@next\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the typesystem know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n\n    constructor() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]` and a property `group` that can be assigned with the index key of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf` and `Group` in `group`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]` and for `group` it will be `Group | null`.\n\nThe ref type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no parameters are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, parameters can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ES6\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase', secret);\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"273e1916fc8ecc9a5141f15b2d3b85b98986e7e3","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project tsconfig.json","test":"npm run build && npm run lint && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6 && npm run build:esm-es5 && npm run build:declaration","clean":"rimraf -rf dist/ && rimraf -rf reports/","build:es6":"tsc -p tsconfig.es6.json","test:karma":"karma start test/karma.conf.js","test:jasmine":"cd test && jasmine --require=ts-node/register --config=jasmine.conf.json --reporter=jasmine-console-reporter","build:bundles":"webpack --config webpack.config.js","build:esm-es5":"tsc -p tsconfig.esm-es5.json","test:coverage":"karma start test/karma.conf.js --browsers ChromeHeadless --reporters dots,coverage-istanbul","semantic-release":"semantic-release","test:karma:debug":"npm run build && karma start test/karma.debug.conf.js","build:declaration":"dts-bundle-generator --config dts-bundler.config.js","test:jasmine:debug":"cd test && nodemon --ext ts --exec jasmine --require=ts-node/register --config=jasmine.conf.json --reporter=jasmine-console-reporter"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.13.7","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"12.16.1","dependencies":{"tslib":"^1.11.1","lodash":"^4.17.15"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"dexie":"^3.0.0-rc.5","faker":"^4.1.0","husky":"^4.2.3","is-ci":"^2.0.0","karma":"~4.4.1","rimraf":"^3.0.2","tslint":"^5.20.1","jasmine":"^3.5.0","nodemon":"^2.0.2","ts-node":"^8.6.2","webpack":"^4.42.0","lodash-es":"^4.17.15","ts-loader":"^6.2.1","typescript":"^3.8.3","@babel/core":"^7.8.7","simplytyped":"^3.2.3","webpack-cli":"^3.3.11","@types/faker":"^4.1.10","@types/is-ci":"^2.0.0","@types/karma":"^3.0.8","babel-loader":"^8.0.6","jasmine-core":"^3.5.0","@types/lodash":"^4.14.149","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","@babel/runtime":"^7.8.7","@types/jasmine":"^3.5.9","@commitlint/cli":"^8.3.5","@types/lodash-es":"^4.17.3","semantic-release":"^17.0.2","@babel/preset-env":"^7.8.7","dts-bundle-generator":"^3.3.1","karma-mocha-reporter":"^2.2.5","semantic-release-cli":"^5.2.3","@semantic-release/git":"^8.0.0","karma-chrome-launcher":"^3.1.0","karma-edgium-launcher":"github:PVermeer/karma-edgium-launcher#master","@commitlint/travis-cli":"^8.3.5","karma-firefox-launcher":"^1.3.0","license-webpack-plugin":"^2.1.4","webpack-node-externals":"^1.7.2","webpack-bundle-analyzer":"^3.6.1","jasmine-console-reporter":"^3.1.0","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.2","istanbul-instrumenter-loader":"^3.0.1","fork-ts-checker-webpack-plugin":"^4.1.0","@babel/plugin-transform-runtime":"^7.8.3","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1"},"peerDependencies":{"dexie":"^3.0.0-rc.4"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.4_1584553518765_0.18781900591565925","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.5":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.5","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.5","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"563634bba6a6cf0ae493aac56896c5bf8cf47f0f","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.5.tgz","fileCount":63,"integrity":"sha512-UOgmnxY7EIAw7odv3hPVGaf02evr2iT1W2N5CfQFfEfr7G/JlV5hubV//b+ZrU1baY02zPdoZY9VvmSvIjG0nA==","signatures":[{"sig":"MEUCIDtyZzBBV7ppU9PmdwlnAUNh7eK+pPLK8BWvJsjXM+tOAiEAvdlNnhZtA/n42EyrvOk+QE962rwtmf8LayHvYTiL1Q4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":213661,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeeLONCRA9TVsSAnZWagAAyXsP/3UWrTXSXrJHprc0FGX7\nbBs1fJYOdviSiXCyJbcRKCoN7OhmBRs44t912HdrHWSScVAxys3gqMpW/312\n9yhpJeSYMEyKqVz5QBkMS1xK6tJJ0FslINIO0D3FufRTu6MAAAlYVXeipjeK\nItuh1tl9zJlnyL+7LE/7ANEQSuQxqph4gDamFN61R4YR2BsWd4AlC+HnuF19\noT5bbMSP0RzHSMC9h7oE7id576Y/G/roqyKNKJ2lgknQD2+SaHfkWAhb78s9\nIP9CEeDDp9Ng8Pmsx4I43wQVP5VgEnvoq8QsEFaV4gH9xXBRIhaNSPLk4Hvl\n3qJuHJ0tIybOGakKntfhbzBMovN3kX+RNuacewarI8KAnsI27d3nNdKEWNXR\nRinUl+Ku26n3Ge9xPsSZYPsqN0zYprhWMW+h75yGv8Pr17GecPwZOpmMjjSd\nj7tMy8EidEAsDNk8UNRdMvbh1COkiSsVKLMWYO2rltGD/Xb2sWeQYlS37U6y\n5vPEsnfmkzK1ORpH2vkJgqBH0qPTbNe3MW91zW++0g5b9ZzPInFWf/F9vhDf\nBEwyWG0Om+ct1bWSeh64tlpvfxGv1eX/hPFsqU8rZO3KXVOdBZToHkDqI8uP\nmxqBk14O2z1K+LDqSpR6YNv83DVqX4aP7gVdaNXNx8wQkeLpiuNzjqmO2HYK\nqMB9\r\n=vVQG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"pre-push":"if git-branch-is -i -q -r \"master|next|next-major|beta|alpha|^v\\d+\\.\\d+(\\.\\d+)?(-\\S*)?$\"; then npm run test; fi","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"types":"./dist/index.d.ts","module":"dist/esm-es5/index.js","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![Build Status](https://travis-ci.com/PVermeer/dexie-populate-addon.svg?branch=master)](https://travis-ci.com/PVermeer/dexie-populate-addon)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. \n```\nnpm install dexie\n```\nAt the time of writing Dexie v3 is in the RC stage. To install this version you have to use the @next npm version. Current version of Dexie.js: [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie@next\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the typesystem know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n\n    constructor() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]` and a property `group` that can be assigned with the index key of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf` and `Group` in `group`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]` and for `group` it will be `Group | null`.\n\nThe ref type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no parameters are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, parameters can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ES6\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"e5eee10ae1c43b4d59a219faf8e4133d49d0c20c","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project tsconfig.json","test":"npm run build && npm run lint && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6 && npm run build:esm-es5 && npm run build:declaration && npm run build:dl-dts","clean":"rimraf -rf dist/ && rimraf -rf reports/","build:es6":"tsc -p tsconfig.es6.json","test:karma":"karma start test/karma.conf.js","build:dl-dts":"rimraf -rf dist/ts3.4 && downlevel-dts ./dist ./dist/ts3.4","test:jasmine":"cd test && jasmine --require=ts-node/register --config=jasmine.conf.json --reporter=jasmine-console-reporter","build:bundles":"webpack --config webpack.config.js","build:esm-es5":"tsc -p tsconfig.esm-es5.json","test:coverage":"karma start test/karma.conf.js --browsers ChromeHeadless --reporters dots,coverage-istanbul","semantic-release":"semantic-release","test:karma:debug":"npm run build && karma start test/karma.debug.conf.js","build:declaration":"dts-bundle-generator --config dts-bundler.config.js","test:jasmine:debug":"cd test && nodemon --ext ts --exec jasmine --require=ts-node/register --config=jasmine.conf.json --reporter=jasmine-console-reporter"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.13.7","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"12.16.1","dependencies":{"tslib":"^1.11.1","lodash":"^4.17.15"},"publishConfig":{"access":"public"},"typesVersions":{"<3.8":{"*":["./dist/ts3.4/index.d.ts"]}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"dexie":"^3.0.0-rc.5","faker":"^4.1.0","husky":"^4.2.3","is-ci":"^2.0.0","karma":"~4.4.1","rimraf":"^3.0.2","tslint":"^5.20.1","jasmine":"^3.5.0","nodemon":"^2.0.2","ts-node":"^8.6.2","webpack":"^4.42.0","lodash-es":"^4.17.15","ts-loader":"^6.2.1","typescript":"^3.8.3","@babel/core":"^7.8.7","simplytyped":"^3.2.3","webpack-cli":"^3.3.11","@types/faker":"^4.1.10","@types/is-ci":"^2.0.0","@types/karma":"^3.0.8","babel-loader":"^8.0.6","jasmine-core":"^3.5.0","@types/lodash":"^4.14.149","downlevel-dts":"^0.4.0","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","@babel/runtime":"^7.8.7","@types/jasmine":"^3.5.9","@commitlint/cli":"^8.3.5","@types/lodash-es":"^4.17.3","semantic-release":"^17.0.2","@babel/preset-env":"^7.8.7","dts-bundle-generator":"^3.3.1","karma-mocha-reporter":"^2.2.5","semantic-release-cli":"^5.2.3","@semantic-release/git":"^8.0.0","karma-chrome-launcher":"^3.1.0","karma-edgium-launcher":"github:PVermeer/karma-edgium-launcher#master","@commitlint/travis-cli":"^8.3.5","karma-firefox-launcher":"^1.3.0","license-webpack-plugin":"^2.1.4","webpack-node-externals":"^1.7.2","webpack-bundle-analyzer":"^3.6.1","jasmine-console-reporter":"^3.1.0","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.2","istanbul-instrumenter-loader":"^3.0.1","fork-ts-checker-webpack-plugin":"^4.1.0","@babel/plugin-transform-runtime":"^7.8.3","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1"},"peerDependencies":{"dexie":"^3.0.0-rc.4"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.5_1584968588616_0.9510626086434402","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.6":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.6","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.6","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"d0e6aefd888d564704666d6c08eabd9213ce9a7b","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.6.tgz","fileCount":63,"integrity":"sha512-s8gpgoOJJwjYOGK5f5PEe30K6mCD0FDn1Nuxsg6v4+n66aRm8WxgeOepRdl42L+cV+dEkAFCHAO4qXGMbhlAhQ==","signatures":[{"sig":"MEQCIBC6OtBp/x/Z5vFeXW08M2neD9c0bViNavGQIEey1EqIAiAkNGjUYMybT9NEBkqoZx9cG6SFDHp9W2j/X6LwRAANPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":207936,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfr+wUCRA9TVsSAnZWagAAU/sQAIdY4FEz3oCFbplF+jVU\nk0Gmu2AEAPmxox7AUvncpCu44WhKxphCsUuIt3+oEICgYGwuI1GBDGo2x9e6\nPD4yqdAuQcqJnI2JpX4tS24WuUqoqHazqhUWFlQ5tFmfF3h3JzJkYKVgHl2J\ncGVQocDBtA44aPTuxyRc1djlQJ9HAW50qk7yTS/dkjaoICHSFu67NpCW0g37\nMMJHhnANQCAskY5GpNl6UoU0+xFo5NueSZdLV7TscroW8Ybt7Rvzy+c18JaA\n3KxXWQWmm+xoEHIAN+4ofGUK3VuC4K/1BSL17RgzsqjZQ2TytamARSy+QKyV\n9m4PodV+qdFmz3NFi6c1tr/EZZLKSVqjAmUWc0ZfpvD/1voQ8gG8IqBS4wUW\n1sakPY7ZZ8bCQl2XdQ//vL6N2JfVNFc5eDRqGsgh8e9A99BEi1AxQs/wjOSt\nEGvTgLkOOnTfuAVrYP/iE95iF+Gt7JWhmZz6Xo40Daq0r9igCTAkCAOKboPM\nl29pLAf4rPHZUD5EfCf4tNMX2X+WK6hunBfw5987NNiezk586bD44v1+coKy\nVQAhyThLSIk8uYBLvtf0vQbPjtFf/cvuy58tBKvjRGabCOduX2TijqTa+yOt\nBkrzYSJXZDloMmUuFvX6252m/Pmn77wV3kgFIA7I/x610KQYA8ciTL9XF6c4\njWs2\r\n=ljlf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"types":"./dist/index.d.ts","module":"dist/esm-es5/index.js","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![Build Status](https://travis-ci.com/PVermeer/dexie-populate-addon.svg?branch=master)](https://travis-ci.com/PVermeer/dexie-populate-addon)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. \n```\nnpm install dexie\n```\nAt the time of writing Dexie v3 is in the RC stage. To install this version you have to use the @next npm version. Current version of Dexie.js: [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie@next\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the typesystem know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n\n    constructor() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]` and a property `group` that can be assigned with the index key of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf` and `Group` in `group`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]` and for `group` it will be `Group | null`.\n\nThe ref type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no parameters are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, parameters can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ES6\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"50462f31c7e606c081e6895d1a5f1db89d37644e","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project tsconfig.json","test":"npm run clean:test && npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6 && npm run build:esm-es5 && npm run build:declaration && npm run build:dl-dts","clean":"rimraf -rf dist/*","prepare":"patch-package","build:es6":"tsc -p tsconfig.es6.json","clean:test":"rimraf -rf reports/*","docker:dev":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev up --build --abort-on-container-exit","test:karma":"karma start test/karma.conf.js","docker:test":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.test.yml -p test build && docker-compose -f deployments/docker/docker-compose.test.yml -p test run test; docker-compose -f deployments/docker/docker-compose.test.yml -p test down","build:dl-dts":"rimraf -rf dist/ts3.4 && downlevel-dts ./dist ./dist/ts3.4","docker:build":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.yml -p build build && docker-compose -f deployments/docker/docker-compose.yml -p build run build; docker-compose -f deployments/docker/docker-compose.test.yml -p build down","test:jasmine":"cross-env TS_NODE_PROJECT='./test/tsconfig.test.json' ts-node --require=tsconfig-paths/register node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","build:bundles":"webpack --config webpack.config.js","build:esm-es5":"tsc -p tsconfig.esm-es5.json","test:coverage":"rimraf -rf reports/coverage/ && karma start test/karma.conf.js --browsers ChromeHeadless --reporters dots,coverage-istanbul","docker:test:ci":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.test.yml -p test build && docker-compose -f deployments/docker/docker-compose.test.yml -p test run test","build:es6:watch":"tsc -p tsconfig.es6.json --watch","docker:build:ci":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.yml -p build build && docker-compose -f deployments/docker/docker-compose.yml -p build run build","docker:dev:down":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev down","docker:dev:karma":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-karma build && docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-karma run -p 9339:9229 test-karma; docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-karma down","semantic-release":"semantic-release","test:karma:debug":"karma start test/karma.debug.conf.js","build:declaration":"dts-bundle-generator --config dts-bundler.config.js","docker:dev:jasmine":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-jasmine build && docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-jasmine run -p 9229:9229 test-jasmine; docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-jasmine down","test:jasmine:debug":"cross-env TS_NODE_PROJECT='./test/tsconfig.test.json' ts-node-dev --inspect=0.0.0.0:9229 --transpile-only --clear --respawn --rs --require=tsconfig-paths/register node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","build:bundles:watch":"webpack --config webpack.config.js --watch","build:esm-es5:watch":"tsc -p tsconfig.esm-es5.json --watch"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.14.8","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"14.15.0","dependencies":{"tslib":"^1.14.1","lodash":"^4.17.20"},"publishConfig":{"access":"public"},"typesVersions":{"<3.8":{"*":["./dist/ts3.4/index.d.ts"]}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"dexie":"^3.0.0","faker":"^4.1.0","husky":"^4.3.0","is-ci":"^2.0.0","karma":"~4.4.1","is-wsl":"^2.2.0","rimraf":"^3.0.2","tslint":"^5.20.1","jasmine":"^3.6.1","nodemon":"^2.0.4","ts-node":"^8.10.2","webpack":"^4.44.2","cross-env":"^7.0.2","is-docker":"^2.1.1","lodash-es":"^4.17.15","ts-loader":"^6.2.2","is-windows":"^1.0.2","typescript":"^3.9.7","@babel/core":"^7.11.6","simplytyped":"^3.2.3","ts-node-dev":"^1.0.0-pre.63","webpack-cli":"^3.3.12","@types/faker":"^4.1.12","@types/is-ci":"^2.0.0","@types/karma":"^3.0.9","babel-loader":"^8.1.0","jasmine-core":"^3.6.0","@types/lodash":"^4.14.162","downlevel-dts":"^0.4.0","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","patch-package":"^6.2.2","@babel/runtime":"^7.11.2","@types/jasmine":"^3.5.14","tsconfig-paths":"^3.9.0","@commitlint/cli":"^8.3.4","@types/lodash-es":"^4.17.3","semantic-release":"^17.1.2","@babel/preset-env":"^7.11.5","dts-bundle-generator":"^3.3.1","karma-mocha-reporter":"^2.2.5","semantic-release-cli":"^5.4.0","@semantic-release/git":"^8.0.0","karma-chrome-launcher":"^3.1.0","karma-edgium-launcher":"^4.0.0-0","@commitlint/travis-cli":"^8.3.4","karma-firefox-launcher":"^2.0.0","license-webpack-plugin":"^2.3.0","webpack-node-externals":"^1.7.2","webpack-bundle-analyzer":"^3.9.0","jasmine-console-reporter":"^3.1.0","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.4","istanbul-instrumenter-loader":"^3.0.1","fork-ts-checker-webpack-plugin":"^4.1.6","@babel/plugin-transform-runtime":"^7.11.5","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1"},"peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.6_1605364756001_0.6525112880226298","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.7":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.7","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.7","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-populate-addon#readme","bugs":{"url":"https://github.com/PVermeer/dexie-populate-addon/issues"},"dist":{"shasum":"fceda2de7e4cd1f14fe4e09cefd727120b6fc7cf","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.7.tgz","fileCount":63,"integrity":"sha512-t63S6mVAi/8NY6m+QJuSWbHfPAFbjKmhFhfY4t2+WToFdYaridi5NbHaSZ9aXCzZo/xZPJYZiiWX7EUB3QhKwA==","signatures":[{"sig":"MEYCIQDT8qJxs0qr4asnAc4CKLuR6f5kcp2QZM+TdFFOyJLgkgIhAKCiNAz5NbDHYVGg9rK8TQoCEF1ik+Z5eOUWHR0e6KYA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":226703,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfumItCRA9TVsSAnZWagAAVOcQAKIEdt7doMS8kL0JE8rr\ntAXL8y3JcnIRjjqIdWJV+ujAXeFCXMTaDOiHbbBUGNCjb5+jJgY/xvh9fnvE\n4c+kgcNF2obxN5Nq2NmIRWD/D6cY1X3F+oQWuPHCJEYvQt59t7OHYTCmd3Wo\nYKtBm+8GAMd5jG0JZm8jWcgKXNlgqXQFeRxhsvVDRaIxQ1koaYFWvI3awP44\n3YpKZIqZhKPjCi4HqHTPItVlZjUOxPqe6maxoObAjH9AXpozKMInSBtpEALM\n9ZMREeyGLr0kDv0I2v6/2y2K25LGQnPS2t4oGc18QHsS8e82fEuFQKvfgyLM\nPA7BpxPP/ca0hFuIJ4tJb72Pkf3hnzfJ2CZdl6EZsFKdDVWBYavarIhTbBoC\nqMu21F0t5zHrNHA6UPWKJKH3wTxoiHscR6pgnw+NYI0FFcL2yM/CNFuKdKfH\nNYplcPMP0hwx/CJebd/uwzvXkVBskEWU4EMTNqBsOG14KIh5OdN7eihuA+h+\n7Bchnxd3s7dLE7PcuD6L+1pw2JjjgwpTZSRMz4GL1MCJQ4EKtVHE1DmCC7y0\nxoo9cCc0eMxAoT7RJ9unPil+DiiKDft1EP8DmTUl0WsfIZLF35VF4Of63q1f\nnLjGfAQN1GvQqa2T/g4BIdG/e87vJua1C1Jrh4KOAagQ1iuJHqnXVHobLl4W\nw4Mr\r\n=2fZI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"types":"./dist/index.d.ts","module":"dist/esm-es5/index.js","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![Build Status](https://travis-ci.com/PVermeer/dexie-populate-addon.svg?branch=master)](https://travis-ci.com/PVermeer/dexie-populate-addon)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. \n```\nnpm install dexie\n```\nAt the time of writing Dexie v3 is in the RC stage. To install this version you have to use the @next npm version. Current version of Dexie.js: [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie@next\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the typesystem know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n\n    constructor() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]` and a property `group` that can be assigned with the index key of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf` and `Group` in `group`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]` and for `group` it will be `Group | null`.\n\nThe ref type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no parameters are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, parameters can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ES6\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"b80add43869e69c56416f1b3c0869d5ea86dcb0f","scripts":{"init":"semantic-release-cli setup","lint":"tslint --project tsconfig.json","test":"npm run clean:test && npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"npm run clean && npm run build:bundles && npm run build:es6 && npm run build:esm-es5 && npm run build:declaration && npm run build:dl-dts","clean":"rimraf -rf dist/*","prepare":"patch-package","build:es6":"tsc -p tsconfig.es6.json","clean:test":"rimraf -rf reports/*","docker:dev":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev up --build --abort-on-container-exit","test:karma":"karma start test/karma.conf.js","docker:test":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.test.yml -p test build && docker-compose -f deployments/docker/docker-compose.test.yml -p test run test; docker-compose -f deployments/docker/docker-compose.test.yml -p test down","build:dl-dts":"rimraf -rf dist/ts3.4 && downlevel-dts ./dist ./dist/ts3.4","docker:build":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.yml -p build build && docker-compose -f deployments/docker/docker-compose.yml -p build run build; docker-compose -f deployments/docker/docker-compose.test.yml -p build down","test:jasmine":"cross-env TS_NODE_PROJECT='./test/tsconfig.test.json' ts-node --require=tsconfig-paths/register node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","build:bundles":"webpack --config webpack.config.js","build:esm-es5":"tsc -p tsconfig.esm-es5.json","test:coverage":"rimraf -rf reports/coverage/ && karma start test/karma.conf.js --browsers ChromeHeadless --reporters dots,coverage-istanbul","docker:test:ci":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.test.yml -p test build && docker-compose -f deployments/docker/docker-compose.test.yml -p test run test","build:es6:watch":"tsc -p tsconfig.es6.json --watch","docker:build:ci":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.yml -p build build && docker-compose -f deployments/docker/docker-compose.yml -p build run build","docker:dev:down":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev down","docker:dev:karma":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-karma build && docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-karma run -p 9339:9229 test-karma; docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-karma down","semantic-release":"semantic-release","test:karma:debug":"karma start test/karma.debug.conf.js","build:declaration":"dts-bundle-generator --config dts-bundler.config.js","docker:dev:jasmine":"COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-jasmine build && docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-jasmine run -p 9229:9229 test-jasmine; docker-compose -f deployments/docker/docker-compose.dev.yml -p dev-jasmine down","test:jasmine:debug":"cross-env TS_NODE_PROJECT='./test/tsconfig.test.json' ts-node-dev --inspect=0.0.0.0:9229 --transpile-only --clear --respawn --rs --require=tsconfig-paths/register node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","build:bundles:watch":"webpack --config webpack.config.js --watch","build:esm-es5:watch":"tsc -p tsconfig.esm-es5.json --watch"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-populate-addon.git","type":"git"},"_npmVersion":"6.14.8","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"14.15.1","dependencies":{"tslib":"^1.14.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"typesVersions":{"<3.8":{"*":["./dist/ts3.4/index.d.ts"]}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"dexie":"^3.0.0","faker":"^4.1.0","husky":"^4.3.0","is-ci":"^2.0.0","karma":"~4.4.1","is-wsl":"^2.2.0","rimraf":"^3.0.2","tslint":"^5.20.1","jasmine":"^3.6.1","nodemon":"^2.0.4","ts-node":"^8.10.2","webpack":"^4.44.2","cross-env":"^7.0.2","is-docker":"^2.1.1","ts-loader":"^6.2.2","is-windows":"^1.0.2","typescript":"^3.9.7","@babel/core":"^7.11.6","simplytyped":"^3.2.3","ts-node-dev":"^1.0.0-pre.63","webpack-cli":"^3.3.12","@types/faker":"^4.1.12","@types/is-ci":"^2.0.0","@types/karma":"^3.0.9","babel-loader":"^8.1.0","jasmine-core":"^3.6.0","downlevel-dts":"^0.4.0","git-branch-is":"^3.1.0","karma-jasmine":"^2.0.1","karma-webpack":"^4.0.2","patch-package":"^6.2.2","@babel/runtime":"^7.11.2","@types/jasmine":"^3.5.14","tsconfig-paths":"^3.9.0","@commitlint/cli":"^8.3.4","semantic-release":"^17.1.2","@babel/preset-env":"^7.11.5","@types/lodash.uniqby":"^4.7.6","dts-bundle-generator":"^3.3.1","karma-mocha-reporter":"^2.2.5","semantic-release-cli":"^5.4.0","@semantic-release/git":"^8.0.0","@types/lodash.flatten":"^4.4.6","@types/lodash.isequal":"^4.5.5","karma-chrome-launcher":"^3.1.0","karma-edgium-launcher":"^4.0.0-0","@commitlint/travis-cli":"^8.3.4","karma-firefox-launcher":"^2.0.0","license-webpack-plugin":"^2.3.0","webpack-node-externals":"^1.7.2","@types/lodash.clonedeep":"^4.5.6","webpack-bundle-analyzer":"^3.9.0","jasmine-console-reporter":"^3.1.0","@semantic-release/changelog":"^3.0.6","karma-jasmine-html-reporter":"^1.5.4","istanbul-instrumenter-loader":"^3.0.1","fork-ts-checker-webpack-plugin":"^4.1.6","@babel/plugin-transform-runtime":"^7.11.5","@commitlint/config-conventional":"^8.3.4","karma-coverage-istanbul-reporter":"^2.1.1"},"peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.7_1606050348895_0.02861158281277021","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.8":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.8","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.8","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"48b7b83e91de3c1e0b8e8e6e2e18ccb8eeebe1f8","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.8.tgz","fileCount":24,"integrity":"sha512-3/bSwittxfnhAXNoGcqSOrF2uXYU3gBaTZpf3LajIUMcHR3gNNDFqKoxk1MxYYzrteUOHwQ2wWuprwrm/XR5qA==","signatures":[{"sig":"MEYCIQD2gw1DxxtJALPWbWRUwyI8PmAIQkEVw+sm69hD7eZRmAIhAMqD8MC1DkK1ucXbS6CCEqjYp6qZEh23tLSCS1tEs6PC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":740293,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmotjCRA9TVsSAnZWagAA+AIQAIC8wktRvQzzDVq1ahMn\nbib5gjbQihrVdmH+B9sZ+pWwGrN3YNpvHFeZrKPYDD899H8FM9XoJ00d5UGg\n1wey5qEOdYIKy1KFfk+CKe428n+Q3LLLmfDDv083feVDz6G1MTLe/ep7+lDI\nds9oh/4N7Js3Bzco8weDsRrRWgy4itw0VkKhDO1dlWMZj6fF7ui5IHtlpIxg\nWGqdR3mNPDC9t8RIPyrqIwGsvnjJqG0K+f63/rSTWHu1SQQCVjYmKnhtWbpJ\ntQu1MO5WSPTzbV5LLX3u9/RhkHnBcZsE8UFm5BjVR2y0HZbIlPXFJkFa/UQc\nWm1ZvwDjEHevnsD7uJ2n1B2R+9b0zQBJUbpghp1wLdC8S9ValVVij4epOqNY\nN6OB9thNrUlOA1wy4hB2bR0RILTDU7gZXIbsW9HPJiP4j1+r8z/XChNLKTFX\nve2h5IGeN1esR0Up5OGw+ADVkbMAsik8gwEsDdiCaQNg3k7HI+vE5TqOo4NC\nuURvGxR4iNCle/lYQ/MoQ66yid2lh+YsvTzuox9jSDaoAp+p7d5/pYyOJ1VJ\nG/dkKe1YDbdOWbkbPgwxvQ9NTzGcxQTYlSs5eyXRpk0DAX9oJNFEyW/5Vava\npwBN5T7R2C2rug/QiT0jX6s5Dww1fkePf8bAXrNDN9MVRZHPLq6uE1nszkX9\naUPZ\r\n=c0Kz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"3025a056e027ca1d53c30f8c5ba2d2df8337c17c","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.8_1637518179129_0.6492625884515286","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.9":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.9","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.9","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"2c23ae15394499cc0ff5640286305e0c0199b335","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.9.tgz","fileCount":24,"integrity":"sha512-hpxJhTolf+WlI5cP0tvLnI/SAD8RYV2hhofXS5JOdsRGYSO+53AUQhf4GtIXBjn4zLolRzUn+DCvVONNXerXtQ==","signatures":[{"sig":"MEQCIFeQVPO9eru+9c1zae9ozNlV15C4407SE9zq57gXwO2yAiBvD2+PO07sQ4G0kyxr1O4dIyRKQaPqaSEbEs6Rk76q0A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":740717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhxfEBCRA9TVsSAnZWagAAiaIQAIHGS85MvfRx06kdpnjS\nB2r0VOTkJnowY4n2Ks6q/RGDrZHmKQa2RldwVgxvGHk8GRzODXnsXLQMyKjX\nVNGJ9WhPqf/5SkTl7WX8RQYZp6hRWs33n+SwnHj3pJ/cRIdgGhOAF8QkljKG\n/FKQ9zHg/IgjBzwQhzmjS2yispwA4lD1PTbBmVEs4a4uPWakh8ktX/2CyKny\no+nZHGvlzZatDJghI9M0EzhlVRbgMAEClrCBFqWNsg+Zd9gC4kbGEPaw5AYQ\nAzVsyj4oJMRLNF2bu9gOu7vnHcZL/1kX66GqVd5g3pmfzkJeh1VkYrs74afR\njA7InQcabQDkCZcr0PAkAxQHt8THNlUD+HYVlR8Bt9q8hCORWVpZNtRwP/xp\n8bzHhOUnK+fPkY/OPeS2X+hoM2tzsToOV5H1mdIWgWdZJzDCO21yP3rpSiTH\nGJLFOYdqpGOHsfiUhCq5gnqCKezjOc3l84nsEXOtbvZrr4Q8MmkBBo25L+G+\nBdKqm63Pa0R87jqwPpu+G6rpsXLtfjp+Q4QD5/g17yOTIgTZYq8XSTr+/vqU\nTtVSqV99gX0tN9KF0rvfWbBQTEH6Wosbb6oBsx8x1PzvzDNizgZMjoI2ho1D\ngOk7HMmBN7wKzllY0LZGzPUw+bX1UPbqCAVY2kxV6YePGSGSHa4/kICMIUVo\nvhG0\r\n=dlMp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"2d4bde1ac79029954e85f0f8665ee169b272b157","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.9_1640362241548_0.9739877546470219","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.10":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.10","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.10","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"3cd8d42dda5cfcc0116fe3e3b3aa7cfd2fad2eaa","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.10.tgz","fileCount":24,"integrity":"sha512-cSY2TZHj1GfLeM8dXlf/EXGnpSyfXiyrjzcAOMAJvHURSLxSMJYSctRg3yGLVwsD81nfYeQ/ZG3sQO72ZW4z/A==","signatures":[{"sig":"MEYCIQCsZJ5nw5sFRp8YPOjQeUYIwDJVS2aegBHr5SOyaxcJsgIhAJUhbMcQ//cVYxgnDI5JBqCicEayHWyFA3JaakSNpzwC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":741512,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhytcwCRA9TVsSAnZWagAAMmgP/0x9B7bRud/jarGRRBsU\nQY4eTrCq1B/27VC5qwL3ab9QX1L7PK1LpFTN2DIOwHT3kkCtDiNAK5aztXwP\nzI4+culOzYZOvIzG5wBkvgR8ATV3R4E8Pz9hCI1MCmrW+HGLLXjWJe8mrmoL\nn3Q0Sh0NbHXe2t9Gl9awuulZS3C++CpwOy5ZVq9XH5EPJ2liAjJ1lJYq8lDG\npO45oHkaovvnY6HDtfir37DNdKd52ddzOQNfLZfrdznzejqPODEqOzqAJvTs\ncXTb5r25mSL5PuZ7oSfSPAv2HLZ08kOkBXQslI3Sf0DsUxtPUYjPSGzcIuLr\nzQkrKt/PewIR+nuLQowwcO4BpjZpJA+QdqB6AwNOZOtRkX0P1OyIlxUjuJwZ\nw/0kVvBIRANLBJk1ui0y9UnkZ6lwm4ErOkXTah7Cz7KiDv2s+Xlycf3tFJeQ\nhDru+EQavWkoRgJfqKzgPgogDRdK+goVPyphqBQGFKrJ0/A04itQM+9rhLJG\nNrxAlekgwgmegMuPEeNK9/qUqDRh+oGTuNMEI/o1bPqeeq0LySiztO4ONwni\nVFW7XeVKQKPDyllxzG5/KnvXHKPioUKXDcZuRGSD8zYApyqYmpTp/ZaQ9kSS\nKmOoTS1Q8Dfr2NT+A1zoW+QZWKKK5ga1jXrqwFPHy5UM19YCE+qzPWtYOgSy\nDm5o\r\n=G5zU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"128b2ca7c39b9f20c5cf116edf222727c138328a","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.10_1640683312550_0.4703809986869891","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.11":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.11","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.11","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"219a168d89b2c93f433a2605d22fcd02029803a2","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.11.tgz","fileCount":24,"integrity":"sha512-J1xHKhuGQaJ+uA4KoSVI8zjWW0rzaQtLC3NwK6lmsZShVbw6tIP/tQHb955V94+9QzhWxr1az+Uf5GBfXGPnCw==","signatures":[{"sig":"MEUCIFwEgblXvZp4V5YCyT8R1FmkBBfujAneIJL5rYKEdVVPAiEA9vm9XFDc8G1qvMiO28kUHy7YONOHcFps3LXJ5RJ3pn0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":741776,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzdpeCRA9TVsSAnZWagAAOa8P/jmhBJPqISKnTQm5sMmE\n35c34ZdA3aM/8VsfXGH/eX/Li+kC8PQ9a1V9kIFFeloU9wlBNRD9HV9jx7FP\ndmbSpLe3hyZwNhKzxShW8gMz6SDEDGVBvMPzijvQsc94HA4f0v+4hpkLTykr\n+Avz3tI5eqFuGBJFviCsKhqd4pErKjgg7oF2jPBV6KpCsZ8Nl//F5fAp8CK/\nFJBPzH0jWgjmZXVoM56wAjzmO+Td4GdbylSQx7juwPe5rko1opErbZlCmYZO\ngXUfup88VQB6+hTWSWFcCOZPf/hI+zm1fDX9XfCeV1Hzynk70VGft8tbS9nB\n+C8JNHW8hW1wp7c73Vk135MRl6vyFdghdTU0bMPYv9bKHqThJ0D2+jHFw5sE\nAGiWYaIovu/2ydqAOPpP8fSGC5qsGLVyP2xl0wktWRyMjpjeHajsh9hKE7VR\np1f3pWChL4NdPxRXsp2xanJszS5aaVGkBcC7JDjtzjJH+nNClhw/3/seio1W\noVRS+KYK5o7RS1qV49OxcZjTRlZR2qhi4sdfSFBqcDIdt5v5CgZI7zpDn5wp\nl1SVgcj3vzgCj9STH4wCV/kH9WLe3RI7VV/I82lYkvySBKPLOEEeJWpy8EhV\nJKG24xX/6oXXX2lUEZLxDqQfMpDSBbFa4l8nenMzeykXlpD64aCxHKXzSkV4\ncucd\r\n=FFUw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"4e419ecbc44432c458b84fa49e31bb1cefb1dee3","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.11_1640880734599_0.5631693683729957","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.12":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.12","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.12","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"3d7d15021292b405e82ade9f7b9fc96f9ce92b42","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.12.tgz","fileCount":24,"integrity":"sha512-2Q/bhHiEezYZMEDAcrLwCMdkbFlxzHwB14HarOAwt/tVTaAfpS9IZPH9wnK5PmKCjnBbWc/8gF1+yab1OXLMAA==","signatures":[{"sig":"MEUCIFk38czUn/tJjSXGOismA6wfyWvA0cm9cChMqKjQlPKBAiEAjNOPWYvLo9LC3oa4lbY5TmUrNvXcNveGIssJju+2S7g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":742040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzeqMCRA9TVsSAnZWagAAgmoP/R1dpJ8gFJ9NAtlvhJGj\n1U6Hv+/IMqGLfkd3M+hxTXA1B6SHWsV1t4Uu8xPnqdXQVCYH7UDDgc+RpL/9\nnoxz44iCU+ouQJZJCUNkzs6say0ksSkg2wvIcJ25IcStltVRKk/97IYC/x6t\nRykUsL7g0G8V+yZDrsE9hNpKVF7x3s/seWV7w8I8rX/965o217TE0kyHXxTr\nr6RK8d2r0+0McVdExwwB0wm9vPhzhUdRU3e6lo+rscgu/oXywTf8z6uHyZmD\nNhV58pO6p/dHV2nla6soUfIrOcUMMf6sbVUwXW3Tjx09fqixz5a3YqFgZIqQ\nSZ4tqhVqa3MF218mDrnRSwXIu2xQlmVZI7GwtQTzuIznQJ+foRF7S7Cn2EjQ\noqypkF9YirFA9CsBJZfXNuedzyxFyuQlT/8z8dM2y9na743yhVwRzHrDG8UU\nE+W32kW+w36DywFxOJzfyXXz7ao7lInMI+aVNEhM+bqfX4fnlNaZYE7W6eS0\nHQEdzM4WvFqbOT/YpH2s+aaarzMV6LgP4KtMX/J1AEqCPgdsh+D/YLUITPy7\ni6uSycDWa3uE8UmCagRLJ3aYjJGCm9e4S9E4I2tqm4sfvWjSmnS3j6yU9nft\nKhBxhoJJcABB5MsWYwXAf5FoXZc9Rz4pEgs0UW5pKPjHq4QWyzX3WAskslz5\njUIh\r\n=EfEX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"9ad05a2206c91dd0177a08ab3f4323ae515044b9","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.12_1640884876664_0.8119578874814033","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.13":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.13","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.13","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"a483ffe0576b83ab691c2b765821fc2479611ac6","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.13.tgz","fileCount":24,"integrity":"sha512-kWsKIKfzoYnUA6b3RTo86hSCfs5mFBJ3eQ6RFVK4qd3EXhZDQWPwakPeOEKNwPv/+cC98UWhH5Tta+8immgp/g==","signatures":[{"sig":"MEUCIQDgqjDQnRhoOsLlyiV9LiQ/QvdKoSutLzTkiAHu+GE10QIgfcBQyUMB6E+cEDapTgBq6xlUR6vud0wP14ZIJsQ5uT0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":742422,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1DgYCRA9TVsSAnZWagAAEA4P/jza3cEGUD5fAN/S9NuF\n39iAG3/ln3S9Chlyk9cewHv011JokJ2YQK72uAiLRf+eiWHrbgfJptapaWv+\njQ8A+KmOW11r7KAaT/eLz3yINseQd5LHIdMLkMMzgMPUqUWQ1PfHgfRxLdoP\nvD/0x+L/LBvFFKRufFG0fb0Tkjjrdts9j3e2ety2HTvocU8T7GMECMPzC7ph\nnaLRJsd+B6GCIIQHV0vB8KbMNz4zu7hK8FSQFftR2uBIbEnpaTJiB4fmJpOB\n+cDos6MoMCYkSD0UfvPMbDkyIef9Z0/XHlHGS6fmrKGbHxtf16gfBuklujXY\nw5hHb4JNLZVkt1GzK1MH4ML8awiHkBvoA9jprsdm59AlbAWNrrg6VkgOYnzq\n5cUQfzJg9hDYx+aC9NmMlXDjiGEJO8Xqd98NjeZs6TJpQ/XBdz4mOWPe15ml\nx93UUQJWxFt6LcY+l8aIDRCMjNi1y6HHKZk5la57UFXIfoJcdGpTBEziMmWp\nPJ4LcNhZx1BtRXShNAyXGlelXpLbJfJh4twpEVFk6gkgeDnugnkEszgNZgy+\nBLGCXDoGHG2KKa1xRbsovppvyU1NFOejSp9WvE4i24mSDfOC0V7qbmAZL0bI\nbD8zvE8rn9oaUcqwt68yqTa/7GRouhi8Fbkq10orGDleUJBi5gMjNmtnsYAv\nFblz\r\n=2WfF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"ce753649a437913f1427556a0df532119ec51ad7","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.13_1641297944237_0.6755770811444586","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.14":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.14","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.14","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"28f333c2883c41f1aa391774d17ce90c278a078d","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.14.tgz","fileCount":24,"integrity":"sha512-T7gJUSUcX8YLKP89s4c04hICVOPVZezE30EbSjIDWsrAV3vCJSb0Yh7iFZPbPwRKu9ynQVkROXxyq4RAd28XYQ==","signatures":[{"sig":"MEUCIQC/1W3lNuuNJd9xGKoN4MQtzGEI3F5TnNE8+TSzvt0cNAIgdT4VK+I/YEEwIPu7nS+f4kKo1GHeXS1Il6WL8Rfp7/s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":743477,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1GD+CRA9TVsSAnZWagAAt6QQAKH3Efp+oIAt0dTAnpwi\nvrfX2oIn0n9h+mfJ6pOIJ+zHQnDjPfG79NdQoKjras5kD14SoS07gtJES+Vq\nwvMPSOag/XL6U5zGM+xZYKmrt++NItwPpaBlGNr1rrNAe/fFRAYR067d07En\n6rZgLAUgEZD/cWCytliN9z1s3vCly4qlx5K6XpDg0jq/FO+rElEuyEpZBnjF\nR7QFUCKYabL9UgGlOZ80QWFIX/4PDHnN/pBS6RTlRoCxk3J/xiE5xfAnw1i5\nwkOror3L2b4fH3qv0muIKKeYrugsiHhNlVI0EXdjqDgH1mGesIye2HkgqeIg\n0sq6vjSmuWQEqONQpTRFY1IWj/Rz5zVD1sFAx8KX8uTkLnJLAIzA2nUZflFI\n0y+Q+vRoOa+nQ0ZpN0HbU/4F3uisv2UbNDOMhyWfcw5YtlTYigLV6sjUeFfr\nP5HyDAeYUx3lPfwW+AtKc2x8v+hkFLXIdLo5Kl0aCAOo/MorsMQEJp1WLQem\n4Rh/uufLeWLJAQ4jcYbup6VOWu05Plfk4wkcX1GERGRh97SuHGFfSG26Lmtl\nYf4f625XonA+2lATRD1g2mjs6hBbazx3ol8mpNoqmrnazLwj2cZtTiGHeJKy\nOteT+MfAgKdfSu/3qA1JvVrQ5GaKVe+Z32rATNRQhJmDIVPGVxomkh8z6Sgm\nIxn+\r\n=Zbfm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"ce3d4279426028b8c0a3e0b755860b92d2ddd9f5","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.14_1641308414557_0.8667454953071316","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.15":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.15","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.15","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"9b1d4011b633e9387fd8b1315ef6ec57918a9a29","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.15.tgz","fileCount":24,"integrity":"sha512-axP61UtwZ/A+ON5hwjd3MGUatpU7oZix70r11HA/wvETWMq7RDJO5IhE+N+O6nG1lXKwhdQH3AUm8DsIPhvMAQ==","signatures":[{"sig":"MEYCIQCcaw7qVCsDe0Xk9Hq5uDz8tgIHZctQkfQ4egkUiqegRgIhAOGGqCX0UYT+kBuDXYERRwCbmh/kTawsQeuGKENX6/H/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":750693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh100eCRA9TVsSAnZWagAAx9gP/1Yen9vZosMQOKsCZSJb\niNfaFRAtL4YycqfuDRqZjuvi/EPPf047WstB6pRzE9uYq9IU5oJVHSwhXIbl\nQ1gJZlup/uUkDUlvB3n09cGDWyw7CZIFQ22e1e/ZRU4LTKd8TzDgEEBDTBka\ni0iKnbn3i+/iUGTFiALla6WnQjKe5WT0/8JIo5Qwr24P3CNHUilVvlGq5HL9\n17E/l4GUwTN0EUyS4In878CLE7mLmDekbVLuUG1UjpEk/PhX3l3uRbUil6vs\n+l/mUvXnO5rfWm3DS4wT/B6BNsNKWXB+Q5cLrErE6JR0EFs32qIVNyHf/xPv\neh2CPW/nmK7RN+tM5MkLsWFnBjtz5ld13aLpF0AxC1fxkmrzCEz9t18dYa1s\nWUL3MYSyNmGvyMogEvd3K0bd4YLrhoeJXz9EyWSSEDENg0VQi/JjKH5o84WP\nvo5YvOvYhL4CRaJq8Na4QpqaNTCsBG4+xRLThuXka2iKUyNVDNtEL1iXeTMF\nrHNwrJy9zHT4YD8z+y7IHM7HSJ5ENEhrp50Bll0HaOjal09aRYYtIdWyzunp\nMMhATt3wdgiHoTESu29QMTyi2lXcTpvjqm0+ceAeMKxTECfTlLaKULZV6gcq\n/PtWk/U4eG3L+v0sF6lrClBmFJzulWzuQZvlUAo+/idBATD0LuRmnYffQ4xI\nqPku\r\n=ePS5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\nThe packet exposes two main exports:\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"c8d96e5ad470cafc81abf0569066a1973eb5b3d4","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.1","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.15_1641499934227_0.814987225999454","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.16":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.16","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.16","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"2f5b80fdb84966577940f23ae4ae55b8cbed639e","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.16.tgz","fileCount":24,"integrity":"sha512-eAyabC3LWuxe4SGsrENUBrvjaOCEqdvvPxlsEkTIvcL/DSwKDOulcozLjwJ9Zywh9ufz6ZTgDQch4EkKDt6b8w==","signatures":[{"sig":"MEUCIHT7+DlLZ6+MWa2tGNDGFcwSfBI7q15HAGKhOPg9fcytAiEAmHiW5VztyWzfLolsdRn+wC/gizW2nAeQ9JAXR12q+94=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":752078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6uoiCRA9TVsSAnZWagAAVJMP/0mpVO1+CaHtNPofOxOq\niuM3GB/uOp1aG8EORS97i2pejgdKtmGS8yazk0VY/hx5LlvhBKzHH7XTWcSI\nNdVPRDP1zX9Rx4SCleh8MIpTqWbaxinKgyE4iCVjDEtTjh6eBrmKSYIdSk16\nINBca/bMeSwJsrcywhAs9kYQ52kmnepeT6USCvhZAvZnJOSMzVRqVTWFCWMn\nde9hBZ0syKyb764qSCxmrWDjE5alwWAYMxQkTkYjhCulExFeAB0w0J5KGppu\nEnRe6JTN1v/vrhVyzTYCY5+VxyRRHQDqajg/KsTl1LF+L+avb4NbJwXfcHa/\nwftCy5LF44Ol2wDSXk03R0D3RkVGiufv4HjwIOSGm1N44fyYuVZddDWv8UH+\nxcenHl222mQbkFzDtwVVP4wnbUFJT7+iRXD+4eduqS5yxBXEjtvb2gS3E74J\nKaFgPg3Dp9QU72GpACry6aVja54J4xzOBz0RWVeDFxf8SvDPiTLC7ETcGfKI\nRc3f6xG2//Nfr14RFrCnzwnIykutJzo6DdeLEWhtZSA0Hk+2gKXhYDAaTAob\nrqjo53rQrOmgRQ0bBTESBI0Wk1BR8dx6ckSkbJ+hBhlKzE0hhHJJg+fI84cx\nB42dix4RGx0bVsx9TTD9irO4y/T8gTk7JW9lSl5aCiE52s3p1APQMtdJbaVC\n6R6V\r\n=uut4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"2bca9b30c31a703238ac9fd883f844e0bcddfca0","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.2","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.16_1642785314240_0.18438278409580167","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.17":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.17","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.17","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"c7c4e1c9c5dece885bb38920775b328a4c1b7698","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.17.tgz","fileCount":24,"integrity":"sha512-YjpbuqNQuIvMxQ2Mz0hTBZstexckUaFeIjMRtiUGzGs/dGplTN5UMEYWHaizundf9TiMrxFH1fUfcXAJmuGbJg==","signatures":[{"sig":"MEUCIQDSti5UvigkLjt0Xe/AACJyCX3VdRT9oH9ikGCHue3vOAIgXkzt+BXphdFjSZIyM3Y1AKt9g5ocod3vykCrD/uGsww=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":754403,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh9VwACRA9TVsSAnZWagAAhdEP/RVTil6Ez358LFg8fGi4\n4bB+5bnX1v0P/Sopy8sDyUHTsX98weES9/gsf7DAMhZRM6d+k6pwX6/ta8YL\nuWScc4Sy/ArLgXWi5INt5JpNO6CUQJqSrRQcN4vDXZTA85dxg9HtZUd8oVLK\nhsF7zZLsYSI8Nu9LVgnXdTrggfPt7aeSMiTSqP7TKn5BzgvsUYqP378VY3uo\nsasb23/n1Loq1rhyTT/jIM4WjLwhH074paTnDoPvBkIDQ61LwOdkcvOlaOwk\nAMdiBIV37r0sRs+ZMusED24bDePz+3EQwyl0IHHMAZVBTSqngC5/UrGziYAE\nCKMAd+q6hMtfX5MbIosHLWFUiZPEwec9cYqGHGRhw153qEREzlUSh2iEq7BT\nubzHr48O57U3aSNZIDQ6JV4zOfp1zYuaeNXdrWe7a1iYC5mGD4loBwx1thKf\nO674R5EDRHa3NzcwIK7Gi0zra4kAk0tOxAi+TIzWjFsV8WIun7xpoP2EXlNN\nwxhSc84fj8tfY55H6K15IP94jVBmo40QGIBWDV2Ouh4R7E6MhdX1yAojMLAP\ngL7EY8ea55bfEuMLdYN9Amqg3Rg0l5E1J2BuNCf4s1Do+BwYFy1ZuBWHLoPc\nDPjyZ4k+eDowGZxRJwIN5YEFuxbYVH9mzwb69lMkxKP/MHfOPkQnzg9nMXDl\nOvqw\r\n=F81u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club[], number[]>;\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number[]`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated (deep).\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\nThey cannot be used in conjunction (yet :D).\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club[], number[]>;\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\ntype Ref<O extends object, K extends IndexableType, _N = 'Ref'> = NominalT<O> | K;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"8b66191c8ec95af9955325fdc4029e4818735f1e","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.2","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.17_1643469823869_0.6614533057741145","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.18":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.18","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.18","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"b3f1f908bf21186173ae7ae71548f27e492bba7e","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.18.tgz","fileCount":24,"integrity":"sha512-SKHxtwK640vl5ndVbaWvO0LdhOXBeZ2om5i/KQRqBTb+y2ujcvIF7M3GJfNq+/Y3FVK5LudfHIswIg0gAvtg/Q==","signatures":[{"sig":"MEUCIQDmMaD76P6JuMROIM75S+xfcau9EwjkWGN0mZGebn7D3AIgc9em0Zdu82dRBfWzbplWXe/WkRGLmyQbEhP43hDGqG4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":752438,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh9smxCRA9TVsSAnZWagAAsnUQAJCIrpxzvi3richqM022\n7oqi9ZjT4stZvMzgSLdGnq7FWh0EpCgJTkXoQ4L12IlptftjjgIbqCRB7ijB\ngey5tW8gN7oIYi9CFoSwmaLVjYKm8tnm6TqB5S0gKNDF9BbOQuDpGFsUUU2j\niRsjNm4ZQXme5f/V0Ik+RuyDzkQAj+3hXGtDLDZzGsZ8mgz57ihke/Id+b4S\nRxPr4NcGE5VSn+NABMQUrxEuH+xyKD8URKOzmw4ZcPvjPfS40iC/aubmfxaP\n4eFMHlLy4/LscCH70YPYxvAT59ZVDjTo1Yp6IQYTmE2x//cEq3MUnMA3Nkqz\nhzoR4t75Ve7u6VbXlT1TEqOWbV/2z1JEb/mdSsuRbmJ6MDBeyTJx2EcVyvhd\nIt0TrezygXvDjiinEq9lFeaGX8VUJqTmjFpV2KZ/mbZsuwjGN0eqJoj2YZV4\njyYBa93zZGdtV3iaIMQONnC9qV4jrbP5TISbG4BEwcydaXcUuldA7TDobmxZ\n0D0PW8xUq5kwKU/gOh11TgzNVwy6rUdSVLgsNnvuklbab+pWEVXedo7J3eii\nKDv6hgxLk5l/5kwJp08WiEDmZh+lugSu/1mBlM31eSFiQDAyg1kAjqzcR3VU\nGJpvceArjy7zMIv4RIjrbXPBRECW1vLWpXn7E01cBSIgm8TM9vD12B8q++++\nGFxh\r\n=yjmo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"42a83cd8200af4c3869e739617dad82c23a2623e","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run build && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.2","dependencies":{"tslib":"^2.3.1","simplytyped":"^3.3.0","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.18_1643563441129_0.26171470874660696","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.19":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.19","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.19","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"2dd65cb0a35f9a2b8eb237ba2c0f049b606d7114","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.19.tgz","fileCount":14,"integrity":"sha512-kuFa6SRWxCXYQpxShFVj1s7WaH6/oqOEhLP7OQECl7TpqWxxntVN22khUlTg8Zkm+OKF5MWK1yNlEjxq8zErKA==","signatures":[{"sig":"MEUCIQDKb9IkWSzH6+0bWE/nPTUOMTrSmnJNZTazQOnCUev7GgIgRiTu1h8tFHE2DqcsNMD6ad3oA521v4xk9Bf7EA1vaPc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":49909,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+BJ7CRA9TVsSAnZWagAA9SEP/innpQFP6YL39bcSCN79\n5Ny5TIqcIv0MXHsK+QAXb/8Q2NLXBAId82Wqq6ZoBYPgTly5Shat3Hg882Rv\nfXZ7om5i2A71H31WNtG542DW1mr7UhnOvxgR/xOcEsuod+AkBwEi7Y+OXFhb\nyYwXoRCWZ8JYmGKLoNMPhqi3F4n5hVtVLyEL3FnV2Qd/xPZMXWsvo4F+khc/\ne6o7J273u5GACp2DoKF56raX5zE0SZHsr5kjcHluE+S21daK/yzi0cA+H4MU\n1iwFnDe59t7Ym50SMZEAEksJe/SkmTStnQwB3hgLEsl/+cKae88qYNxBgPG8\nYluXCWvKGlmbNzxRecsmpNu4DD/nMQ7wklO1uqg58koo00N72Boa6jOtpvG7\nOACRrRIGj6/Vtj/+9umspAhRttdEllB+U8CBodprK4W5un/ysQ3r0Xxu4M13\n2vV5TYiQa69crmWX6EoPYam4pC7WnIXLNJPoQH8ZgDtsn3Y+jq2dpDHMm8HQ\n8XOm9c7jSUErDpBBCvWdd3LygIlst2MBvWLLvOpfyJD6QOaShG8uG6DkwqgQ\nSrIK2/7uGR9+P8OlmcCRIU3is2cjm1kFz9VoPPhhZnWL7omUx+BGsqlDXGIp\nZ5S5ahXjthdkyeEh+MPYrjU+qeIIjrTCY9fOoA9mwE550x7oXcidsfqwyjvi\nuJt0\r\n=YOHs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"c1bc1930d1b59b86a4f059fda625e787b19f14ef","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.2","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.19_1643647611353_0.6459928525284764","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.20":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.20","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.20","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"5179d140d5975d6144321b5254d927e38d5760aa","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.20.tgz","fileCount":24,"integrity":"sha512-KmTnAM1Dyel3dj6MMYBF/V6Ovrih6jyZA1g2yiM+oTGs57o+UpMmJ3YI6WzyppYi6M7Uq4wWad7AHJ4iixhVMg==","signatures":[{"sig":"MEQCIAJQmlvFD63zeWLxKFc7SF38TwX+C78+4FCD8mvDKIk5AiAQMcmtS6TWyUuV62vILybZsSUAwr+0Bu1cBzBnTdrtMw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":752777,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+CJMCRA9TVsSAnZWagAAPTIP/ApC0w4AN1FVoXyxmat9\nV7MWURclB6rHasBNm/rREGQlMj8kafAl9BNyYYaSxOPEzq0197tPKr8x+hS/\n0tohlFJO/5KM67sWaQhcA3EKMn3GRqjep8WlO+WY3Kot8fIiv63qINmsnMr3\nNPMLhyEa5+cEmN2a3YWuLj7UbQAsq3aXP/MEG7vjaB1gOOLjFcViMpktyc4q\n5wq8IAA/wd+qy7dlpL07M2Pb56yVAfgoIiNzoRHHpbqvqr004qAo/S7YyCip\nHVq1N2QjwTHt4l6ie0mBrlDAVpZg9W15LykLmcEUjP7jpE27c0YYXo0uLEvj\nVOeZEBgl7wDQqljFWH0CTN+L514b+MDgNdkqbL3RHlZ8cnjbGH/cal5tp0th\n+1LDJ1q/Dw54BxNpkje2N5vED23pYX16zXGDrDfGk91hT1ox+bN2JE0brq0a\nWcVq17zqhC1NTOzZ8vnkOrlpGw8fqwFZPVr9vlvmoqlTnUEXphpoS/J+NuF0\nINyfBxzV4N3ZWSnVJSP/x/jvJW5VJ56s8OjVZqfMW3GyE9UVuF3V3jhniU1c\nKuXrzppiJOKFRqIKiz7djfk0km2NKIMebEprXACA/kiu1DG3bch4ob1E1ARn\nleuBR3y/R592btvvGNPUU9HCzn7EeVJbNiA1IiL0XbTKdE2cKGY5IYAGVhsO\np1FU\r\n=CgeQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\ndb.friends.populate().each(x => x); // Not recommendend, can be very slow\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"39fdadfbc48a62478b29653e6ec8aa561110bc57","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.20_1643651660184_0.6062171959204177","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.21":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.21","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.21","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"e84ceb4e0a912d2504bf93f687c899bedee01e4b","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.21.tgz","fileCount":26,"integrity":"sha512-NMT5QMvp80ul0acwLOq6CrwYx0Ehk+FFDoSz1p/vEknu8UCBGTDE+RnC5YhZTAG/U1UYabm8ye0YQNMGfYS3OQ==","signatures":[{"sig":"MEQCIElNOz3jc1gCFbAIci0TxBjJUieZIEbu8aICaKTJihuBAiAepBa20MFpIyKRffUrw9MI2JhRi7h7SS+6j3Y3BvAvWw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":782196,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+s/9CRA9TVsSAnZWagAASVIP/122QpoPFmDUqj0KLLFu\nC2Fq+7nCcThKCt7uXQZu4IHoXsp0XmO1qTOQdzP6GRSMXDxhCN3YMNc+2YSc\nKVvkgY9mr5Oq1E//VwxGl8LAyKO8RCXmyxmJ7V1GynSwuJw//wdiqq6pontT\nowLY4MHnlOGEgdOrSUR/ckSi6iFvcAZsYIoARW4rme/zeE7gNFipqEbjks7Z\ng2eR4F8gQcZUtlLU+A/w9kuqkqDiNWd4Ork+nFGaWfsQ83i00HbRKhifVo05\nZtin3eEgmsLwYUfgGcixj44EL2d2hwKHxxkmtUIrav5nWBM7+A9DKMOZt7Pz\noRTql3oVHmJ32ioJOTK7F8PcQjtTOShY3DDSbKvYGzIXULeJk50tc6lMNAKE\nboyRGUcUfnOg4WngtWuyYP71xaeOUR+RSWVc4J8dC5s6t2c5vGFzoxhBviiy\n+2uyoRfajIaGZ1UPdfBqkGIYA5FZYK2y7zy4mKSEPgZ3MG1YMXCA7CCZXmuS\nrCZ5Wkm11sLZZFF2MntQJVGxdBGfYcm4Tq7Rdllh/YFX1kKUo4LOfjTjzn7o\nacildrs+gEC2l5IIr3gcVFBu6l14Fhz283DTp7yzw3DyaRikSwU3OPGa7qTC\n5Gf9W/eTPezkMYNtaD3XbTtcraVfXHGhOEe+7D8tTssjobJ89ItWIiwZw1/Y\nG6AQ\r\n=WrG/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"47fafba3de557b6fc9208ef907656f90a97a5da6","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.13.2","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.21_1643827196959_0.7798893617429086","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.22":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.22","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.22","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"52c8da8652e2db7d70fb1e089f0fed6cf2b23a20","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.22.tgz","fileCount":26,"integrity":"sha512-b6DVrx5YJkSVHr7y1iE9PQn516vOi9TLuzCRmN2eJcD4hwnuXJiMos4usOwTHUL48QivmW1W16BJk4k+0+gR7Q==","signatures":[{"sig":"MEUCIAojRTAfi7rWG+ytfGGhUoOY1HmTey/5ur4W8J/P1gqAAiEArCzqeHoaw1Lx6CH6ybJS1wAYfZqqdS3dRhmUKCNNc7s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":783238,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJir1ClACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqGww/+JbZA5o42HOlbd3rGxpH5fT6Ul3F7d/uNlm1XyfHTpIr1I82A\r\nPcNUZJjewqeA5Af9WjaQhZIpWbiS8vDue8aQkLwyPioKIng0uCtkk0PwwTT6\r\ng9yXI7Fi9gWqaM0NTrRIX3cFHRJbZRtIP6FDhOdEj2PomsKUDHWeqZto4z+x\r\nvqyt6YUUllxDHUEFccogP4CYPu3h6uwx0DgyhkoJaFwE/cPPKP4d366UFrsn\r\neiq4sX9Lmmg4cuRpjobevrFVDn5lrjI7fGAv4cXejFNDOvlWZ0PvKL9XgH4w\r\nTu8cTR/4YRPuyoZ3YDl8HQbWPVczoFAM/l7uCzsryPNxAbB7QhaN6XLcrZKP\r\nBk5qX8bmeNDQUpv8Gy1H+R1qLzfCy1aJ3KHpbmE52NEfkthMFG4B07Pdp4Gz\r\nR40Ylc4lJzZlrDh//HlK3NcixspalpCj4rfDmewimgor3fE7Ag59YnhM8848\r\nT+Xeqp3VdvhBjwMpy7n773M/3wwcwSj3yLue0iUnis6wyiVL+Ye4cVCQORNb\r\nxV/+VWNvUdSp7nPzZou/9ZphZRjp2HMVeS+Z9AM5Wmv72maScGK2wTn4zQPp\r\n/sFsKq49O44seBRqOOw77yKHo8jbunMBs1Yg8yMWMek8786KGFMCQ6A5cn5H\r\nYVdyWEeu6sJCLZLNRyG8mEOtVNlOekUQmAk=\r\n=BtgO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n\n\nKnown issues\n========\n- Array.every does not work on array Ref types because of a weird type in the es5 library. TypeScript bug?\n","gitHead":"16896d42d801526e191cc38d720a5c8eb3e1dad1","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.15.1","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.22_1655656613744_0.2603448817973715","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0-beta.23":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.0-beta.23","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.0-beta.23","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"57932d08be2f5eb79688091c995339a0ecb8fdef","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.0-beta.23.tgz","fileCount":26,"integrity":"sha512-Pv7EEZ4W1l8kJG9HkvnesFrU6XT+wL0GfWqkuBNy+Ge+iQwhAwQnFO7Cj953LXwfbOAKv6MA0JArPzlPomWLmQ==","signatures":[{"sig":"MEYCIQCy/uA2cjjDQc/IlxxQ5wwoMx+P0kJ84adaabdsoGI6sQIhAPH3I2fL1PULDf0DESkmhDPPVWxeOgEnsRl+DBW5Wk+4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":783485,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0vYAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZug//TOpM6yVcmg+kOwSby1RalgBw8JnVzomZGcTpwa0Px0iT/+CJ\r\n6kuXSt7nHbuzwOKnvvlnxGqKLBiE5cBsBNKH7bV6ov6aoFc72lPlbANE7a4S\r\nhaEsuQ7NTkBpmtCTHP7XEDJEccJxldkdcmXu7H7eB8xpdq2C22f/PzQPXpAu\r\nzUqXcaHD1jwPcMAHwWEHzWpBp6KjtPTBum8mPz2YYg54w2Ax6S73Cvv3+rS/\r\noOQorR9dR0F4zhjSSVCNzXsX2lZm+wu7fbHC5UEeiP/D4Kl/2zZaC6EKLQLc\r\nlBFm4hU435PinB0lDJ5Mvi8Fkm598EGS3zy4rW0tBPmotqa3/2WTJ8sqIXzL\r\najiFk+e4hrKRKu927APMb0k1zBa58T61SnWnHHtEHaecjlSbWSLXhE1ZUjkz\r\n3ElKJAk48xoWxmoRVsq64rVxYk7Daf30hEdsLVEH19OSwgDok2eGtAvk/LRc\r\now8fbcUMVMZNe0WEv7pYs/tZ1xawdi2iWrkbiP5SLIucA95bg5fiH8YL92Ee\r\nKqHpYtwhlNwvbPBhkKzec2prs76z6+zpB29zQbMNs5zrtqjpHWHF0dYpeZLU\r\nZqWzIagbM6wjn3DT4E8C6Or3enqEB3cbI9hHPkXTjW9fv5C3Z1x0ADCXCT+J\r\n31CcnNoYoc01sccOgJhFREHY8OhPRbwfcOg=\r\n=wcFK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/test.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate(['memberOf', 'group'], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"a82fe247773dd19e5a0dd39cbbbf73c097ca1284","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.16.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.16.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.0-beta.23_1657992704064_0.40126137357745884","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.1":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.1","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.1","maintainers":[{"name":"pvermeer","email":"pim.vermeer@outlook.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"f084b426296b3f5a62d054bd52c69ba551779aa2","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.1.tgz","fileCount":26,"integrity":"sha512-EvCuz7kQYJc9PQVqLpRygj8Xv8ZUddtRc0Ah7edav2bdQcPwNi4SIPw4MconcPngDJ308p7iNUCVjKPdvlGeXA==","signatures":[{"sig":"MEYCIQC2sVShHWfvoLXcqiiuNLF447R0grDaLFxse9bfckOx1wIhAL7tRv9bCnXimcY0vAyukQ+qnEDNT+ssF8JkvqeeBozM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":783974,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2uGjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr+cg/9F7JS8WKL8T7kXUbcJabInD+uC2Tnf6AVeY0fY+aq0XphFELY\r\nPSOkS3GO74Zjv51GArhgyfU157232DOgR0CD6PUNOIMMXerpfCvt5BUjkTlO\r\nIJqp5UlVac1ZWjwuY0qDc1DwP5HqFTZfTGuph/Z8TKnLdSY1Uycqz4jdPvpC\r\njtuKnXWPzD3YFNx14V3zZMkkMFFNTc/M+3dmoytgfx7XAoFAwWnWyRLgij55\r\nbWw7QR2vVQODftJ7KppBx12/JzJtx400buPW3/WkrSNZkgYE6AYdzjljk5LW\r\noAWfRHf7tFeG12epPe+jDQ6HkTSYu9SfpkCgt61vJrqf69d+Lt0QmPoN0pHL\r\nZPqhFMq6Rmu/QzXvqVSIkKkWa6GmMyP6eOAS0t1SGdGL0+Ot7BBZ8cPX6ljq\r\n/Hi+zzlC1gLnOIOe58vdZeRo7QIdx1OPiU4s72RaVv4uhM0wEB0rTom/zo+P\r\nwem4FYdB2rvrJ1qzEci7R1YFBcZRHTn3Nl5KYcUaVyXixM9x2anZdi1Pz+2P\r\nkdFGrqaQ+5tjxVd6vAe9KXFBKZmKWGjsIvjlJledTSAfLOItGzWhs4PT0+D1\r\nUa+ZfJJBKBgzfVleS63Zn2tRqyLXx14MfO5kVt5s0ce/PgLpBdOVnTLHxs+p\r\nS4fAfP+2KPDucUM6/oJKD+/Ce9uIyugoltY=\r\n=LfWv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"e85919b74e555361b7ec6dba3ac7c33f65a56e1d","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@outlook.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.16.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.16.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.1_1658511779567_0.22231135503126032","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.2":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.2","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.2","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"7e499057446f09ac957bf1de90b2ad8d4e4fef31","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.2.tgz","fileCount":26,"integrity":"sha512-E+4PixxsN/wsviDFU3alfGvSxEsTp981QPytRI3CcHrfg0ph6WJ0kAV1dUPq9uaE5ENCwjDsrBQw50hqQ0buHQ==","signatures":[{"sig":"MEYCIQDxPnGE90ddjjTwGACoMwts1rMNJSgg8GnrFzpos3kqzgIhAPiZD7SL4wjIaS83hRuPPz1ESeyYoGbbjMB1zzy4dHs8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":784213,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2ulTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrgtA/+JkySuBY3uj0MxAPF6C95zvL0aey7w96wP+3Yf8TBonmWtpnK\r\nutHWH7ibqUfE3xGutmiWAH2958SVF3F79Qe7SZnXbhT21++6et8VKWFnCmZT\r\ngimHN+EQQthUqQRJij7z6OpWL2XzE2ye6GeUuDvUpLTVsVgXWZasQ/bPEtlq\r\nMmXsivtAS+rOzYJb78F0Ks/t8PpPgwu9nI5I3SVPM+bKXT/lhyzpeH74RMLb\r\npegedyH16qheIW/3kC15XuuSdub9MTgEZziqKA/IVtDVFO3oJV7QbWvxvwQb\r\nEi/9yaFfmDVXJaE9eYuQKxRtRuf8T5zBFdhBCjyCAWiWnq+wIzxhi26dyjHZ\r\nwE5Qpbc3ZRduDd6lxoRaL199vMIdm8gIJr91JQNsiYtx3SOW7/TDeQeebzmZ\r\ngHao+ZQGO1KLQmcbFlbTnMNzceJefImua+jvLBchSQ2Z9QllQDidSffXuumu\r\n/Az42BngkoiSX9eMwPDfGAuliGdWQ6KNItDV1ydb0DJEwBW9YzWsUqkNoYc6\r\nWDMlhZ1gpPN8ycPH1HLCDpeUE02zC5qKQIaCFrGB9FrGYabuuWM+qwaAZaof\r\nqLlQc97+AoDCqrzJPcppbe61EMRP+gGw+NCnyHacWClr3ECOaNq4cqzWL6mo\r\nA8sqFk014ZCbLkrAd79JYPVpLbpnOWP4R4Q=\r\n=av5W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"2436153946c9c4caa88b5e80d00a3b0edbf7f82d","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v16.16.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"16.16.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.2_1658513747341_0.650703597207724","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3-beta.0":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.3-beta.0","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.3-beta.0","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"6b80e4ddb79c9ca8c8084002f80acd26c9fe23cf","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.3-beta.0.tgz","fileCount":26,"integrity":"sha512-ne7mWBhYcpXwNCD71qszILGgqq/MnPBKERDshlq48MljZngwJ1ar4NMukbPUVY19CpY8L6Q8iZHPiF2vh6FtYA==","signatures":[{"sig":"MEYCIQDkiXRl7YOO+dtyY6Vh5jm1y9FUGnV+UZPdYFt0ZriafgIhALAli3f8GNzPiWUKND3bjjlikdRWAoTa5LYqymG1O9XI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":786427,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjaVCGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoo8BAAguVWxYo6BDlIbIQMPqT3hI9JZAzhrK0cEjLkNgjL7EJ31t6W\r\nbK1wG9oxMXzOTlJUvo7AmfNyVKIYc8rdVe6jbM5DYZv+J19TEfNYfRyGGgJP\r\njVoCUXQIl9CXJ25F+Plpl/+LQtmnmnMnHxM3rWJQATNR2DNrCn++RTEkxczt\r\nvxQ7wraMgVxCanwtb7HQBvAMXIa4/XvQbMtrKAmukQbSPDbZj+atiaW6z8h5\r\nS/vgLYd0qCQc0sP8K2sFwCH9gHMXpl9YXime5fIXytM57ChNRD4UPZyZBbxp\r\niwIgMKZSU7isXJALjZQZiMhYXo0Mf6hWG2dFzP11ZGc/oJzmud+PcYUR37Ru\r\nXfySsRsgUgTBb1jSled4kvOXAbg9i0tY4lMY9iSyBWclqDT7j3uV1+Onu7F8\r\nnSTV/pgnihoIhkzsei3Yfns9kiQ2FuLNQNenuIEkSITMZtWhOkgozdHGThf1\r\nUgAXV5fCQ7mQef2G58Qwb3mApgFH/+6uDDarxQ/o9OJF9Yv1181DSipvnX3p\r\nBmtROSLUfFx1znBUlC2D+6hbazgl5xjfQoQO3Hn4fTPoj2dOdYVzxHvE14Nj\r\n23gfT8YHagkdcQ8A0IXFPYJVN7TVxyGpzoF78P1N/U2780J6Rb5IQmQ83E0/\r\nvDcuWwBqSeOUZvKLIMxKropijF+vG4CsAnI=\r\n=fWHT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate(['memberOf', 'group'], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"ef7e7b21cfb0d3aea3712ad9f4b3879e73cfd99d","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v18.12.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.12.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.3-beta.0_1667846278057_0.18453785227242636","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3-beta.1":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.3-beta.1","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.3-beta.1","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"dcc5a222533e67ba1c5ad544a1f7862629989390","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.3-beta.1.tgz","fileCount":26,"integrity":"sha512-3Dz+sSRWOyDrFbke8Ncz0HA7n+EChkGuAZNaFTmVdTZ3Is7i8INki41phpOt/GuqUi/KuLGdjiYl2a9J26tg+g==","signatures":[{"sig":"MEQCICYg9uAJNMhYBnV8MkxwzYczNFiOdQGhlyU0f8U1JD7YAiAOil3r7Xbmn/TI5ULqo0ZLEZwqiTqrChroS3YLnzV6Qw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":784570,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJja/H5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoPRQ/9GIAzzIaZMLudCvHx5lCLujLMlL1CCBm9Sw/wngFAslCREoWv\r\nkmzupM6hl1/SjcDbYTMPAxq40IU1ZtXRjcdT0L42xBsvxW+aEXI1u+B/w6vj\r\nmNWrA8gKtYL8P2wEiqXux1gas/WmdZ3pfyLMb0vrpt+PsCp8pRF45l2CJTaI\r\nCx3mnCUV0Apnf8skfk87mx62bYPRhQY+hgg1LCRpOR6YSkThcIR9Yw5tUaJa\r\nGWNkUjVoXt/1a9R/QQVY0IdIvcgHkwCmx3yFCecUo4DvtQY7n1mZO0jFU9ON\r\n2qhWn/aCB9D6HF4zxD9geN9kvaTTJSOOPhMI7KttAmdZf/autcwRvq6L1DvY\r\n7G+dDdxPgtsiacBdL0uwmbAbHoRjtvX3lPXr7GifOgmRXD+zrdKyzTRh3Hsb\r\nUrBcGmlvz4ZzDiZtorbtLbvRf5hh81M7CfqDkoC6JcDXLoPPfTlrzWa0LuGj\r\nKOXScpWedjyiEZsrUgCiLDgj9jf06TU0ubZMFTBE28aZ7be4U9rcVBqOrrEn\r\neuTueU6mYsF7kueaGO1yLtRJJwgCSJhfMLlkpercuEG9jtQSVIDVHuxM8KLW\r\nrAL5Lh2QTYMd1MrO1wVyAVZD+/hQKdd1lvNiv6MTXEFIow54CHMJvqaXb25j\r\nCaWrH7VPCbTf7uDDfYCsiHJfYINK6kOMPiU=\r\n=Chzf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate(['memberOf', 'group'], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"bb51cb35be3f49e34e6dca67bac8ce6d312f0cf4","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v18.12.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.12.0","dependencies":{"tslib":"^2.3.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.3"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.3-beta.1_1668018680902_0.9005835753039273","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3-beta.2":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.3-beta.2","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.3-beta.2","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"c6bb44a651b51662844309595ab1572235760d0d","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.3-beta.2.tgz","fileCount":26,"integrity":"sha512-S7obGfURhpfy/UTahCoOJulnX5ndSRUHRkl9nvH/z3mEH1eqkgmKEHbmogatxbtC6Y8LXagPKdF1HKoC38EG2A==","signatures":[{"sig":"MEQCIEtCM4rODOk7HKvaYGeSiIcmgwjxqHcEeauB/TwZVtYYAiB8NImohHJ74ze4L3kUhTHT30MOMMCBMkEL3RAAfxR9BQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":816996,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjbtcTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqJAw//cKJocbWS1l7Rb1jq6u8ommMq52MCBDpFSTHZsrLIcD/1JyZT\r\nx26zeJjRbDKqc5494mwRrlfw0twFBOD2qIBfPfbJe0z+JraR1YA+sIEulYr8\r\nXoZktggBeQrJx+9CUqdmi6t97xLphA/AIwKjItfKsf31VQOssVo3J0MfXKEX\r\nZ83axvgCTdEOAv21XSRN1oLeUFywu5D5diY765dQ4wiPsoMw2CsLG4FJbQTN\r\nwRHCMQhwMI3w2XXBHU5wRf6vWcNVkPDnRBWoQNlpIgwx0o+xr/bJa+c2N1hr\r\nxJAywwYPIhpByaibPi1/cmfAzJN4GKFW3ddrszOu3qx3rIqBlbHdnxTLIi6S\r\nLEOHk7knn06fKvH0l8CkZavL6iTCskGbQPvJOt1pQ2XMwK7n1YY0Ifxiv8fJ\r\ndaB4ubHninzlGzhbIaQWBzVne91+WOhqLangSg4Y90irlIhNye+Np+3q9vgK\r\nTSWLVQ7mo8S7LDc1j1Vo6XAH4wqMf6OGxoywbJ9FVMH0L9T2XRYdUYsdZScY\r\nbtPUbehwtFx3WceoqWtw9tBs5GNzm7n5oEocLg3cCb0t1jRYm7OJ7XjvpdgB\r\nblBLMsvArsoWgga4pGkRpPVmz1joCd/DBmngNnTfIQru+6lgvTCC+WxbYm/L\r\nJdAbSU+yOpoZgSev1jhJLV3VIX+lizH1hhI=\r\n=hp0s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate(['memberOf', 'group'], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"9f07ebc92a654d468b14a5eaf32043ddf4a3f6a9","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.0.3/node@v18.12.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.12.0","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.2.2"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.3-beta.2_1668208403431_0.13783758247308397","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3-beta.3":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.3-beta.3","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.3-beta.3","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"245709936c5198ff72b310264aa2d444d5a0abc0","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.3-beta.3.tgz","fileCount":26,"integrity":"sha512-rsb+bKg7DO9fF5Ow7O+Ay2ttDsicTsn9cXpEl07l4Ocx/FbJlA8kYlhjXY8kBAs1koxwmUsfL6ePeJZRZZsy9g==","signatures":[{"sig":"MEQCIEMZNy2DPWhgB1dg8oDv3+wMRORg50vCF+dZhyWfmAy3AiAm+sA5sHYVEUAbyhGhqBrWE/QMhVTFYHMIhuUSxAh64w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":817355,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjb7FFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmokUw//SCmhIBvaMSOnuM0z2oq5a3BUOw8sHyItqJJiJesXtfP6ql+/\r\n6ZsvFMc4gNasO5eYJRHaksGQ8600G4Hu1qu4xLdvafCR6CTcwdlOyV8EtYUE\r\nqMfAWowx/H0iSInlEB6mydNXNAzV2D91yNEDL6T7dTKSN94mYXGCl3uYEPPG\r\n+X+OLW33o5OrdjmfDhYZwdFMgEAXwjOvqhLWpQEvqnNtLAK65lyGP6jozboV\r\n9hkSQrK7ATqpOt/Duc7aUZT14GfyVVP7gDatydeNkVGgOq6kneTwFLi5Q5ft\r\nHEfAndmoonbNJ0oSp+kXjGbQhAnAUWOxyJDUW2g2ZE42yjdlM/J7XN07DWv4\r\ngVhim89wra/B6OMEb/i0RmSiqejwwHfwKX1+wt38+1bSQPDi+94bJXrZM0vp\r\nO7xDCea961H5rWle6qvIRMpCr6gD13GhQTz2IRbF1rIH7IpSN8kiPKfDF2Dc\r\nR2rR8drFDWsO/5Nhqh4KZ1vhjgv84eKMbGCGfra2NTwXxMTrQ9uL5m7MelEq\r\nLJGqg1lZ71Ip1pbOD4A36yY9kBBqsiU44EPn0KgfiYOV+vTFIADy+rN1QL4D\r\nMAIiIW0g/HXacy7nTC/eLBZIIhTkSWptnx0rLViq5SKJHUyOH2989vTNHbYf\r\nH9dVCoXtPaJkxuf5fQ0QSNxxTWQv7QSGsco=\r\n=YeLB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"Dexie Populate Addon\n======\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\n that combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\nInstall over npm\n----------------\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n```\nnpm install dexie\n```\n\nDocumentation\n----------------\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\nSymbol | Description\n----- | ------\n=> | Relational notation: `group => groups.id`  (*group is indexed*)\n\n#### Population\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n#### Addon\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from '@pvermeer/dexie-populate-addon';\n\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    description: string;\n}\n\nexport class Friend {\n    id?: number;\n    firstName: string;\n    lastName: string;\n    memberOf: Ref<Club, number>[];\n\n    doSomething() { }\n}\n\n```\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\nOptions:\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate(['memberOf', 'group']).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate(['memberOf', 'group'], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\nArray methods:\n```ts\ndb.friends.populate().where(':id').equals(1).first();\ndb.friends.populate().toArray();\n```\nCompound:\n```ts\ndb.friends.populate().where('[id+group]').equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first()\n```\nAnd more... see https://dexie.org\n\n\n### Create Dexie database\n#### ESM\n```js\nimport Dexie from 'dexie';\nimport { populate } from '@pvermeer/dexie-populate-addon';\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n    addons: [populate]\n});\ndb.version(1).stores({\n    friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n    clubs: '++id, name, theme => themes.id',\n    themes: '++id, name, style => styles.styleId',\n    styles: '++styleId, name, color',\n    groups: '++id, name'\n});\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### Typescript\n```ts\nimport Dexie from 'dexie';\nimport { populate, Ref } from '@pvermeer/dexie-populate-addon';\n\n// Declare classes\nclass Style {\n    styleId?: number;\n    name: string;\n    color: string;\n    description: string;\n}\nclass Theme {\n    id?: number;\n    name: string;\n    style: Ref<Style, number>;\n    description: string;\n}\nclass Club {\n    id?: number;\n    name: string;\n    size: number;\n    theme: Ref<Theme, number>;\n    description: string;\n}\nclass Group {\n    id?: number;\n    name: string;\n    true: boolean;\n    description: string;\n}\nclass Friend {\n    id?: number;\n    name: string;\n    memberOf: Ref<Club, number>[];\n    group: Ref<Group, number>;\n\n    doSomething() { return 'done'; }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n\n    public friends: Dexie.Table<Friend, number>;\n    public clubs: Dexie.Table<Club, number>;\n    public themes: Dexie.Table<Theme, number>;\n    public groups: Dexie.Table<Group, number>;\n    public styles: Dexie.Table<Style, number>;\n\n    constructor(name: string) {\n        super(name);\n\n        populate(this);\n\n        this.version(1).stores({\n            friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n            clubs: '++id, name, theme => themes.id',\n            themes: '++id, name, style => styles.styleId',\n            styles: '++styleId, name, color',\n            groups: '++id, name'\n        });\n\n        this.friends.mapToClass(Friend);\n        this.clubs.mapToClass(Club);\n        this.themes.mapToClass(Theme);\n        this.groups.mapToClass(Group);\n        this.styles.mapToClass(Style);\n    }\n}\n\nconst db = new FriendDatabase('FriendsDatabase');\n\n// Open the database\ndb.open()\n    .then(() => {\n        console.log('DB loaded! :D')\n        // Use Dexie\n    });\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!doctype html>\n<html>\n    <head>\n        <!-- Include Dexie (@next if v3 is still in RC) -->\n        <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script> \n\n        <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n        <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n        <script>\n            // Define your database\n            const db = new Dexie(\"FriendDatabase\", {\n                addons: [DexiePopulateAddon.populate]\n            });\n            db.version(1).stores({\n                friends: '++id, name, *memberOf => clubs.id, group => groups.id, [id+group]',\n                clubs: '++id, name, theme => themes.id',\n                themes: '++id, name, style => styles.styleId',\n                styles: '++styleId, name, color',\n                groups: '++id, name'\n            });\n\n            // Open the database\n            db.open()\n                .then(() => {\n                    console.log('DB loaded! :D')\n                    // Do Dexie stuff\n                });\n        </script>\n    </head>\n</html>\n```\n\n\n\nAPI\n---\n\n#### populate - addon function\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> = NominalRef<O> | K | null;\n```\n\n### Populated - type\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---------------------------------------------------\n\nDexie.js\n========\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"691289cc25c05870a56675e26c63eeee7df3d0cb","scripts":{"lint":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './tsconfig.json'\"} ./src && npm run lint:test","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","lint:test":"eslint -c ../../.eslintrc.json --parser-options \"{'project': './test/tsconfig.json'\"} ./test","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.0.3/node@v18.12.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.12.0","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.3-beta.3_1668264260852_0.5059277250677809","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3-beta.4":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.3-beta.4","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.3-beta.4","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"7406885a413f414f37d2f742578c1ac77e48e69d","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.3-beta.4.tgz","fileCount":26,"integrity":"sha512-ZixblAlqJ9mw1g7R/R4UpkV+rbqEZujyA0+ULgck3zD6XusbecKM+OT6A0818vM2J9qPB+exTFhtw2bfzkPr7w==","signatures":[{"sig":"MEUCIQCQNqQ2+B/Y3zxdMURp1Egkw32zeK0ysaSA5N4OY1tw+QIgaPob6BSxv56l5JXeaq1LmEDzrPJXiPean8P+kVF0AWU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":820652,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjoNPsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoBOQ/6Am5Ft0UVGGk+sykp2QyszkfpDGyDXJVYAeFl+Ohb8W5XFioT\r\n26HnsNym+gDtzY6UF2qENzqsCd5JpXNMelaieuO50Qfdg6sAJ7m/bhOGgHSJ\r\nQ8QBFXNKOQ7+9i+ZHtV6H5+C/6fVh7P8oP7yMfqL7RsyXPDLgiByeWeM5HcP\r\nW+KNb63U1Mp4cVykmH9/8svYNY32Vu/6Zar9clrqDuZ8VWY2RL963ZvtVt3Y\r\n4xWmqAZ4g+ybHSaGxMS7GdB3hD24FQKMJJ14c0BRTg9NLBC3J+JsWT/LRsCj\r\nvuGPFnogYlX2p7+fquxcrleI08VQERWwYOqJlaOBe7YH0nKU/u1lW/0KEpc5\r\nUtvoOacJsus3rm02lfCijTcJLSlLS0IypZ9ony6h9oH070Nwwakae8xn1Mtg\r\ngSE5qym/6/3oSV9r52r/HHRLaMWoHillOt4eBANvq8UNYyakwcmBoqXCjoE7\r\nyKFY6B4Fy90XBaoN5PUbTyU6VUfQPWflxm6tXue4g9wXW1o9WeHar1EOR/9x\r\n0p9n/3Rk09OSyyQ5jgwOjd2XAT+zThKH+Y4yZ90rJpJ79QY0oew9OCWbvOq8\r\n03Qe+hpW5UT0kgwF2TeUHGT7Ry8EpYSA5f8F6XGSrvxmVPVIur7aCt91/T4s\r\nJ6E1W86a364d94jrpaz2X7Z7a+RZPy1uyII=\r\n=b5zv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"# Dexie Populate Addon\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\nthat combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\n## Install over npm\n\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\n\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n\n```\nnpm install dexie\n```\n\n## Documentation\n\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\n\n| Symbol | Description                                                    |\n| ------ | -------------------------------------------------------------- |\n| =>     | Relational notation: `group => groups.id` (_group is indexed_) |\n\n#### Population\n\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\n\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n\n#### Addon\n\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\n\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from \"@pvermeer/dexie-populate-addon\";\n\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  description: string;\n}\n\nexport class Friend {\n  id?: number;\n  firstName: string;\n  lastName: string;\n  memberOf: Ref<Club, number>[];\n\n  doSomething() {}\n}\n```\n\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\n\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\n\nOptions:\n\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate([\"memberOf\", \"group\"]).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate([\"memberOf\", \"group\"], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\n\nArray methods:\n\n```ts\ndb.friends.populate().where(\":id\").equals(1).first();\ndb.friends.populate().toArray();\n```\n\nCompound:\n\n```ts\ndb.friends.populate().where(\"[id+group]\").equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first();\n```\n\nAnd more... see https://dexie.org\n\n### Create Dexie database\n\n#### ESM\n\n```js\nimport Dexie from \"dexie\";\nimport { populate } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n  addons: [populate],\n});\ndb.version(1).stores({\n  friends: \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n  clubs: \"++id, name, theme => themes.id\",\n  themes: \"++id, name, style => styles.styleId\",\n  styles: \"++styleId, name, color\",\n  groups: \"++id, name\",\n});\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### Typescript\n\n```ts\nimport Dexie from \"dexie\";\nimport { populate, Ref } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare classes\nclass Style {\n  styleId?: number;\n  name: string;\n  color: string;\n  description: string;\n}\nclass Theme {\n  id?: number;\n  name: string;\n  style: Ref<Style, number>;\n  description: string;\n}\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  theme: Ref<Theme, number>;\n  description: string;\n}\nclass Group {\n  id?: number;\n  name: string;\n  true: boolean;\n  description: string;\n}\nclass Friend {\n  id?: number;\n  name: string;\n  memberOf: Ref<Club, number>[];\n  group: Ref<Group, number>;\n\n  doSomething() {\n    return \"done\";\n  }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n  public friends: Dexie.Table<Friend, number>;\n  public clubs: Dexie.Table<Club, number>;\n  public themes: Dexie.Table<Theme, number>;\n  public groups: Dexie.Table<Group, number>;\n  public styles: Dexie.Table<Style, number>;\n\n  constructor(name: string) {\n    super(name);\n\n    populate(this);\n\n    this.version(1).stores({\n      friends:\n        \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n      clubs: \"++id, name, theme => themes.id\",\n      themes: \"++id, name, style => styles.styleId\",\n      styles: \"++styleId, name, color\",\n      groups: \"++id, name\",\n    });\n\n    this.friends.mapToClass(Friend);\n    this.clubs.mapToClass(Club);\n    this.themes.mapToClass(Theme);\n    this.groups.mapToClass(Group);\n    this.styles.mapToClass(Style);\n  }\n}\n\nconst db = new FriendDatabase(\"FriendsDatabase\");\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <!-- Include Dexie (@next if v3 is still in RC) -->\n    <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script>\n\n    <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n    <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n    <script>\n      // Define your database\n      const db = new Dexie(\"FriendDatabase\", {\n        addons: [DexiePopulateAddon.populate],\n      });\n      db.version(1).stores({\n        friends:\n          \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n        clubs: \"++id, name, theme => themes.id\",\n        themes: \"++id, name, style => styles.styleId\",\n        styles: \"++styleId, name, color\",\n        groups: \"++id, name\",\n      });\n\n      // Open the database\n      db.open().then(() => {\n        console.log(\"DB loaded! :D\");\n        // Do Dexie stuff\n      });\n    </script>\n  </head>\n</html>\n```\n\n## API\n\n#### populate - addon function\n\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> =\n  | NominalRef<O>\n  | K\n  | null;\n```\n\n### Populated - type\n\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---\n\n# Dexie.js\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"e553f7f8912323c4c020cfdd6e34110be2b26469","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.1.0/node@v18.12.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.12.1","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.3-beta.4_1671484395794_0.5533709769810433","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.3","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.3","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"0c1953c18c0d3dfc56feabcb724a2aedd8ecb90d","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.3.tgz","fileCount":26,"integrity":"sha512-KhcUFatCYN24OIV13QZMR7iln+CHj0jPnMrMq6m5t3s+duei7Eo5OYCOvtuI0cR1IpB60KAs1Z9+pBKTGJZDNQ==","signatures":[{"sig":"MEYCIQC41egsHJtRgkbfurzgz8VFITj3s4O9OvsXH44Q+p0KXwIhAPEMzwwAUDht9QnijPYWAT9FRglraD1URhbKOifIx836","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":820889,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrHU1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmgQ/8CsphbQL08r1CIr4/PuImQNzkMs0Uk4CW9sW0fVDlTYxSzS/5\r\nZnkqni6IcpC9CZmA1RIENwKan34M4dICezdAvqIi/4vKkOjh2gshrdrng34C\r\npk+Y5ib2h6obrEZWviagAzi/ErUOib1tOkF6/EO6QZu6jkwZbGPSYcxpxX6U\r\nLXTwUTj6n872Hh0mWZ/8PiViB4J4PLmKeUaa5v2eqM41A6i8jAEiUkhIeV8N\r\nyIb7REGrBi8fRl8o57rBe4Az0WbOPFPNnjXPyKbtm7WSpC2aiO93ofATvfc6\r\nRVM6TqprRB+pMNXXAPnDlPCSka1mURYf7UHbxu/TW1mib2U1Ja7KxM/uwMEq\r\nFelv0gYpFpehO9KJ7oIoqnCwmw7/JZbb2wVQ9icyxOJSRTCeFYrSFFikjTkq\r\npbNhLIkLtuD9PcC5zzY4o0eGIVie6UtcUBuGwFbkL6LVpinG3UnVPSA+0m6c\r\nB9fLcSYkR4rUD2pCOGe+Ozg0VsWebPsOV/vjnW5KicaP/agxVSnhBID2Of4h\r\nZmxm2f07uZEDb6fimSDq80n6i5X0JtYybSScg0lHEpRnwAkjeo9RQqnJFA9e\r\n/Grl9oy0hIQggvWAk+/Px7FT+1QC/mgOS6MzQFu15xVc4gzoaZxYH5tZCsZv\r\nGEix1lRVK3ftSlUYvN+YBF+CZog/ayLlHQc=\r\n=w/tb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"1a396be5b7eba70c9ad2020f74d8de8953859954","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.1.0/node@v18.12.1+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.12.1","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.3_1672246581483_0.816545009187206","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.4-beta.0":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.4-beta.0","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.4-beta.0","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"b3c8441f8f4eb48b12a1c187b282f745c1f4c97b","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.4-beta.0.tgz","fileCount":26,"integrity":"sha512-3KajPnaZisAB+IzATZ9nCbqWoxdU/s8T7WoHbH+Oqm7ePuZncKS1FW+89+WM7CD3+GHuFtsWtW3cSRwVqe+BRA==","signatures":[{"sig":"MEUCIQCUKQ0SGxV6jpvY75zm00heiXdtF/HeHfMAxj2H0anhyQIgGhnFy2XHJG8aJ9nHln6qnYxIA9mIjqDZ4sDLAB2EPhw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":821147,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjyurSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpn8Q//VG3yT+eYPRNKlgf8MnzZdUI5jSzNP11VykJ5Z0FfeUijQZLz\r\nmAJZGDlbjmTP3ogrATIR2In3pN/QBXNeUqvAiqyq/xppf0j983yt/kMsX2Y/\r\nT0m/PgcxOcGG81DJ6OKD6hTtj2CDv7vonpZJHmp0m3GOs1ucpx0WbaTWgUhB\r\nEbqxulLk0AGfEaUU86OWws5Ziu4PEw7ZPlJUtLalX3U4VROyyrDANcAv7wf8\r\nqHWBBAx4jsUdU+XhFZuSR24AlKFQz/uBS/VX3JTdBNRGKNhKhnOPWMxBEmVm\r\nC2FIuhAKrsTHle/RmpDr2XG1rZJRLvXIIBjrCUw8DF6TVJrQL1qHRcZxVSOB\r\n/SFr//d+OKIPXfcLDOoyPouoDjRBgcMwoAlWA90XIGRjIq1N3ixjQ4VrByWU\r\no5Wxx+HV2tU8QhF6ppKRHd53gukJjqbmhxKV5R9r5kDLtQRqQttT4t3zwWwR\r\nPtbt04nc24qsCGlrD+90RSFez5a4I6vS8cLxMZ3R8Lz3//tyHjLkAVpzRSud\r\nw2Asd7VOcKzgnlnrLQMadwlurbOqSl0hN9XM3sCO35/vuH5F2NvQeBtuuSwd\r\ngFJhJHNgQTakU19jKz07WOmZBj9R3Tgc9JiqKVX3jz1MAjN9WOYgPQQgpKRn\r\nMYs6Fpq9Xx4L8gBVXs/szp5uK6fgekr5U0U=\r\n=raEx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"# Dexie Populate Addon\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\nthat combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\n## Install over npm\n\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\n\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n\n```\nnpm install dexie\n```\n\n## Documentation\n\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\n\n| Symbol | Description                                                    |\n| ------ | -------------------------------------------------------------- |\n| =>     | Relational notation: `group => groups.id` (_group is indexed_) |\n\n#### Population\n\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\n\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n\n#### Addon\n\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\n\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from \"@pvermeer/dexie-populate-addon\";\n\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  description: string;\n}\n\nexport class Friend {\n  id?: number;\n  firstName: string;\n  lastName: string;\n  memberOf: Ref<Club, number>[];\n\n  doSomething() {}\n}\n```\n\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\n\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\n\nOptions:\n\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate([\"memberOf\", \"group\"]).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate([\"memberOf\", \"group\"], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\n\nArray methods:\n\n```ts\ndb.friends.populate().where(\":id\").equals(1).first();\ndb.friends.populate().toArray();\n```\n\nCompound:\n\n```ts\ndb.friends.populate().where(\"[id+group]\").equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first();\n```\n\nAnd more... see https://dexie.org\n\n### Create Dexie database\n\n#### ESM\n\n```js\nimport Dexie from \"dexie\";\nimport { populate } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n  addons: [populate],\n});\ndb.version(1).stores({\n  friends: \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n  clubs: \"++id, name, theme => themes.id\",\n  themes: \"++id, name, style => styles.styleId\",\n  styles: \"++styleId, name, color\",\n  groups: \"++id, name\",\n});\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### Typescript\n\n```ts\nimport Dexie from \"dexie\";\nimport { populate, Ref } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare classes\nclass Style {\n  styleId?: number;\n  name: string;\n  color: string;\n  description: string;\n}\nclass Theme {\n  id?: number;\n  name: string;\n  style: Ref<Style, number>;\n  description: string;\n}\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  theme: Ref<Theme, number>;\n  description: string;\n}\nclass Group {\n  id?: number;\n  name: string;\n  true: boolean;\n  description: string;\n}\nclass Friend {\n  id?: number;\n  name: string;\n  memberOf: Ref<Club, number>[];\n  group: Ref<Group, number>;\n\n  doSomething() {\n    return \"done\";\n  }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n  public friends: Dexie.Table<Friend, number>;\n  public clubs: Dexie.Table<Club, number>;\n  public themes: Dexie.Table<Theme, number>;\n  public groups: Dexie.Table<Group, number>;\n  public styles: Dexie.Table<Style, number>;\n\n  constructor(name: string) {\n    super(name);\n\n    populate(this);\n\n    this.version(1).stores({\n      friends:\n        \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n      clubs: \"++id, name, theme => themes.id\",\n      themes: \"++id, name, style => styles.styleId\",\n      styles: \"++styleId, name, color\",\n      groups: \"++id, name\",\n    });\n\n    this.friends.mapToClass(Friend);\n    this.clubs.mapToClass(Club);\n    this.themes.mapToClass(Theme);\n    this.groups.mapToClass(Group);\n    this.styles.mapToClass(Style);\n  }\n}\n\nconst db = new FriendDatabase(\"FriendsDatabase\");\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <!-- Include Dexie (@next if v3 is still in RC) -->\n    <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script>\n\n    <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n    <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n    <script>\n      // Define your database\n      const db = new Dexie(\"FriendDatabase\", {\n        addons: [DexiePopulateAddon.populate],\n      });\n      db.version(1).stores({\n        friends:\n          \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n        clubs: \"++id, name, theme => themes.id\",\n        themes: \"++id, name, style => styles.styleId\",\n        styles: \"++styleId, name, color\",\n        groups: \"++id, name\",\n      });\n\n      // Open the database\n      db.open().then(() => {\n        console.log(\"DB loaded! :D\");\n        // Do Dexie stuff\n      });\n    </script>\n  </head>\n</html>\n```\n\n## API\n\n#### populate - addon function\n\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> =\n  | NominalRef<O>\n  | K\n  | null;\n```\n\n### Populated - type\n\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---\n\n# Dexie.js\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"90a49c461df32f0bc5360f5e77c8a218689c7a74","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.1.0/node@v18.13.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.13.0","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.4-beta.0_1674242770091_0.02596799933187577","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.4":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.4","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.4","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"dc96336f406f91f2ff2e6f9076384d7725392a6a","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.4.tgz","fileCount":26,"integrity":"sha512-KyjMXHUNM/3m00hCs82TzTSBCIT9r8vPPCLnQ9WnXoiCyhfOM0Il60afElo+Lnt3KARXVOFLYOcXeCOrbuJGzQ==","signatures":[{"sig":"MEQCIEcLAc+IAeJZcd+7SS8Xzb04RXh5+LU8MatDXJgAJxvEAiBkpW02dEGs7ImECdm5qhUC6qGAE/cpWRj74Rzq5uhKvw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":821384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj3n4hACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmojFBAAod2JJVwxrqlB0vonmX001Ly/hs7eSSegyH433fbw9qeibpNe\r\n5lJP9D+pHPN81/0fPEZim/Wnvggya1GWsUIVoBBQA8SNlFteeEvmtHsh/Dbw\r\nOu7BtuIXX/BEEpG9K4P8MbqBSzVSpgR2M3cWCUMJm1GXsa+czq6PUrE/Zk8S\r\ng+ppyZavmW9PDqNznuQX4ig+BMm0Vz2suXewcIaurp9Ibb69l+peShcfIU88\r\n3/432SYkrBhkYcDAbNiPumtOMX3CszVYZSp6X8q10oldP3vH16kDYWBuHTJ/\r\nheMH7OVosfnJTFFkgEnZW/9mhXq8k/IJr0vLMF47IjkAgib/qBqVLqmr+5rk\r\nqiynGwbb2OUi9hJqWMR/oWetIb4aYcuTkFnpj+bTbJT4UIeXYx32WmV9/cqr\r\nG3A0ZsY82KeWH8wRF7EqXgbQmcjqJQVhzHtLLPQ1bEAYNv0Cy5fOgt3IRFaU\r\noDVXgFZDyvV06lOLnzOdT6dIiMLE6rkOEnhSNhMzAsE/tuOHLocRtixJ9Iw8\r\nAM+DG1WBeVuE1EDlpnjBOA0HLW8UweHjC4E7Zf64LA/KUYPWG8LHWhLf4oYX\r\nd4j2oDxrwzIRESRFI2IMK9rtDAUhvv7/CLfuKCRcf0gL74TrcJ6YbNHMFaUV\r\nKNNo3hd+EsrpvMEy7FGV7wC9ByMnzFyGNVQ=\r\n=QSU+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"802ec1261061e4f9517d8460512989e98506585e","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.1.0/node@v18.13.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.13.0","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.4_1675525665368_0.3384875845799975","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.5-beta.0":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.5-beta.0","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.5-beta.0","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"379c472ba519cde2ecfdec9fe7f3bc74bfda6d7d","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.5-beta.0.tgz","fileCount":26,"integrity":"sha512-6ZMlkd7POp+jQPFOwtKBnTiziHpa7m5BLl2WK8L+VfQiPjpFzKn0nmvJ3sz7qtxO2/0JYUNDl9lVkfOffQvh8Q==","signatures":[{"sig":"MEUCIQCVdshwD21rrs4fgqbQIQCkBl8kWG8LH+6NKqX0EQxGGQIgZzyB/5rz1CMdRiRAxcnN4qDX+m4jIoQlUWUW7xxd5CQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":821642,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5+IpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr2Zg//ROkcNnnYj9ZkIQ/qG3pngolswrOxRyt+Hbce233zcbrrsSlI\r\nlum+JmEFm3A8KZmIXlFiYXxFtNn8ztR14jZqKEiOgvLuDt6ftb0nIyuUx6LB\r\nmSPi2tMcOrbdfSYOgpXq+PmV5aPscGijmkpMR+ZvB9+F2Q814tSZdwzwVlIR\r\nd7i48qBP7pKJXmKnq6CuLXM61ZtTh10UY2og8UyqDpWOCgDW8Bgr+Hrhm+Iz\r\nbERqrx6rwRIPQsj+UDt0ExjJRB3Po1Wos/lRJC76zQ/1EDPWq0Ap093ciCFJ\r\n+molusZY3UMQRJ0KLgszEXcL/neR2kCnf2nx1MykocdcENnflGeYwQ13DUU9\r\nK0gfbabpPvCtXHfq6/jVoIYfwZtfaA5+GOmqJvQJ95skkGGilH/4penNlIw5\r\n4MlH7y/2sbr5K1ksxhRyVcS4AsIs5RaC8rE0G4djho2PMmSXDSJead8qDXHi\r\nA+OzQonduJrxqq1Oo6/dTJHRzxc3M48gsBx5beDb3kyQ38MQc708bobmmNOP\r\nFeQB1cyZPdhydwfhYe3+MytYTYNhwHwYSlEZ4dsseYRMJZqbhvA9+yDaqL7/\r\nqfkDPNVl2qKQcclQN6l6DitoWbkbV9ovDAyVA63Ll10Ns/dz05FmquITOELn\r\nCWjlJHN8sJE22ldfCVwySJ8Qm5Lb/cGD8M8=\r\n=69gg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"# Dexie Populate Addon\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\nthat combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\n## Install over npm\n\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\n\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n\n```\nnpm install dexie\n```\n\n## Documentation\n\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\n\n| Symbol | Description                                                    |\n| ------ | -------------------------------------------------------------- |\n| =>     | Relational notation: `group => groups.id` (_group is indexed_) |\n\n#### Population\n\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\n\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n\n#### Addon\n\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\n\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from \"@pvermeer/dexie-populate-addon\";\n\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  description: string;\n}\n\nexport class Friend {\n  id?: number;\n  firstName: string;\n  lastName: string;\n  memberOf: Ref<Club, number>[];\n\n  doSomething() {}\n}\n```\n\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\n\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\n\nOptions:\n\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate([\"memberOf\", \"group\"]).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate([\"memberOf\", \"group\"], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\n\nArray methods:\n\n```ts\ndb.friends.populate().where(\":id\").equals(1).first();\ndb.friends.populate().toArray();\n```\n\nCompound:\n\n```ts\ndb.friends.populate().where(\"[id+group]\").equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first();\n```\n\nAnd more... see https://dexie.org\n\n### Create Dexie database\n\n#### ESM\n\n```js\nimport Dexie from \"dexie\";\nimport { populate } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n  addons: [populate],\n});\ndb.version(1).stores({\n  friends: \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n  clubs: \"++id, name, theme => themes.id\",\n  themes: \"++id, name, style => styles.styleId\",\n  styles: \"++styleId, name, color\",\n  groups: \"++id, name\",\n});\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### Typescript\n\n```ts\nimport Dexie from \"dexie\";\nimport { populate, Ref } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare classes\nclass Style {\n  styleId?: number;\n  name: string;\n  color: string;\n  description: string;\n}\nclass Theme {\n  id?: number;\n  name: string;\n  style: Ref<Style, number>;\n  description: string;\n}\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  theme: Ref<Theme, number>;\n  description: string;\n}\nclass Group {\n  id?: number;\n  name: string;\n  true: boolean;\n  description: string;\n}\nclass Friend {\n  id?: number;\n  name: string;\n  memberOf: Ref<Club, number>[];\n  group: Ref<Group, number>;\n\n  doSomething() {\n    return \"done\";\n  }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n  public friends: Dexie.Table<Friend, number>;\n  public clubs: Dexie.Table<Club, number>;\n  public themes: Dexie.Table<Theme, number>;\n  public groups: Dexie.Table<Group, number>;\n  public styles: Dexie.Table<Style, number>;\n\n  constructor(name: string) {\n    super(name);\n\n    populate(this);\n\n    this.version(1).stores({\n      friends:\n        \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n      clubs: \"++id, name, theme => themes.id\",\n      themes: \"++id, name, style => styles.styleId\",\n      styles: \"++styleId, name, color\",\n      groups: \"++id, name\",\n    });\n\n    this.friends.mapToClass(Friend);\n    this.clubs.mapToClass(Club);\n    this.themes.mapToClass(Theme);\n    this.groups.mapToClass(Group);\n    this.styles.mapToClass(Style);\n  }\n}\n\nconst db = new FriendDatabase(\"FriendsDatabase\");\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <!-- Include Dexie (@next if v3 is still in RC) -->\n    <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script>\n\n    <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n    <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n    <script>\n      // Define your database\n      const db = new Dexie(\"FriendDatabase\", {\n        addons: [DexiePopulateAddon.populate],\n      });\n      db.version(1).stores({\n        friends:\n          \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n        clubs: \"++id, name, theme => themes.id\",\n        themes: \"++id, name, style => styles.styleId\",\n        styles: \"++styleId, name, color\",\n        groups: \"++id, name\",\n      });\n\n      // Open the database\n      db.open().then(() => {\n        console.log(\"DB loaded! :D\");\n        // Do Dexie stuff\n      });\n    </script>\n  </head>\n</html>\n```\n\n## API\n\n#### populate - addon function\n\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> =\n  | NominalRef<O>\n  | K\n  | null;\n```\n\n### Populated - type\n\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---\n\n# Dexie.js\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"6513bccedaba5af491f52aa2e9ad3de895bd3a01","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.1.0/node@v18.14.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.14.0","dependencies":{"tslib":"^2.4.1","lodash.uniqby":"^4.7.0","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.5-beta.0_1676141097168_0.03196937845101955","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.5-beta.1":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.5-beta.1","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.5-beta.1","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"5adb9a4c4874a7566124102906dea33ba18eb203","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.5-beta.1.tgz","fileCount":26,"integrity":"sha512-RV+jEnNyPBoleuHq2kklNwi+O1/6rtiUjwlvcpfuslpd7X/O5xt67g9bMhcNRLc1vze5Utl+cJ8IL0OFZwm1uA==","signatures":[{"sig":"MEUCIF2//WE0//x9frnLRC3F+5Amw7/FizpX2ZQx3HXBWxMzAiEA0zpr9ab9gaV66HTpCqZDj8JQmXs+ELHds4ptj8hw6to=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":624154},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"# Dexie Populate Addon\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\nthat combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\n## Install over npm\n\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\n\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n\n```\nnpm install dexie\n```\n\n## Documentation\n\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\n\n| Symbol | Description                                                    |\n| ------ | -------------------------------------------------------------- |\n| =>     | Relational notation: `group => groups.id` (_group is indexed_) |\n\n#### Population\n\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\n\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n\n#### Addon\n\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\n\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from \"@pvermeer/dexie-populate-addon\";\n\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  description: string;\n}\n\nexport class Friend {\n  id?: number;\n  firstName: string;\n  lastName: string;\n  memberOf: Ref<Club, number>[];\n\n  doSomething() {}\n}\n```\n\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\n\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\n\nOptions:\n\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate([\"memberOf\", \"group\"]).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate([\"memberOf\", \"group\"], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\n\nArray methods:\n\n```ts\ndb.friends.populate().where(\":id\").equals(1).first();\ndb.friends.populate().toArray();\n```\n\nCompound:\n\n```ts\ndb.friends.populate().where(\"[id+group]\").equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first();\n```\n\nAnd more... see https://dexie.org\n\n### Create Dexie database\n\n#### ESM\n\n```js\nimport Dexie from \"dexie\";\nimport { populate } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n  addons: [populate],\n});\ndb.version(1).stores({\n  friends: \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n  clubs: \"++id, name, theme => themes.id\",\n  themes: \"++id, name, style => styles.styleId\",\n  styles: \"++styleId, name, color\",\n  groups: \"++id, name\",\n});\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### Typescript\n\n```ts\nimport Dexie from \"dexie\";\nimport { populate, Ref } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare classes\nclass Style {\n  styleId?: number;\n  name: string;\n  color: string;\n  description: string;\n}\nclass Theme {\n  id?: number;\n  name: string;\n  style: Ref<Style, number>;\n  description: string;\n}\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  theme: Ref<Theme, number>;\n  description: string;\n}\nclass Group {\n  id?: number;\n  name: string;\n  true: boolean;\n  description: string;\n}\nclass Friend {\n  id?: number;\n  name: string;\n  memberOf: Ref<Club, number>[];\n  group: Ref<Group, number>;\n\n  doSomething() {\n    return \"done\";\n  }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n  public friends: Dexie.Table<Friend, number>;\n  public clubs: Dexie.Table<Club, number>;\n  public themes: Dexie.Table<Theme, number>;\n  public groups: Dexie.Table<Group, number>;\n  public styles: Dexie.Table<Style, number>;\n\n  constructor(name: string) {\n    super(name);\n\n    populate(this);\n\n    this.version(1).stores({\n      friends:\n        \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n      clubs: \"++id, name, theme => themes.id\",\n      themes: \"++id, name, style => styles.styleId\",\n      styles: \"++styleId, name, color\",\n      groups: \"++id, name\",\n    });\n\n    this.friends.mapToClass(Friend);\n    this.clubs.mapToClass(Club);\n    this.themes.mapToClass(Theme);\n    this.groups.mapToClass(Group);\n    this.styles.mapToClass(Style);\n  }\n}\n\nconst db = new FriendDatabase(\"FriendsDatabase\");\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <!-- Include Dexie (@next if v3 is still in RC) -->\n    <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script>\n\n    <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n    <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n    <script>\n      // Define your database\n      const db = new Dexie(\"FriendDatabase\", {\n        addons: [DexiePopulateAddon.populate],\n      });\n      db.version(1).stores({\n        friends:\n          \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n        clubs: \"++id, name, theme => themes.id\",\n        themes: \"++id, name, style => styles.styleId\",\n        styles: \"++styleId, name, color\",\n        groups: \"++id, name\",\n      });\n\n      // Open the database\n      db.open().then(() => {\n        console.log(\"DB loaded! :D\");\n        // Do Dexie stuff\n      });\n    </script>\n  </head>\n</html>\n```\n\n## API\n\n#### populate - addon function\n\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> =\n  | NominalRef<O>\n  | K\n  | null;\n```\n\n### Populated - type\n\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---\n\n# Dexie.js\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"69dd1ebb273ef8adc25561c48515ee918f88e228","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.1.0/node@v18.16.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.16.0","dependencies":{"tslib":"^2.4.1","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.5-beta.1_1684944285900_0.7367893478851468","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.5":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.5","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.5","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"8dfaf3cd1aa12459cd9063c18cf13f63074e8684","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.5.tgz","fileCount":26,"integrity":"sha512-r3mvME02z6kgibZkLgngfMl9sIqCulVFhCnlUdRMng7QGUHLeZZGYIFAhd/6+hBY0gL9pK76Ynz55N6Q93kApQ==","signatures":[{"sig":"MEUCIBFp9RXPNy64RilxddaNWiaAL4sbSWuwi/ijUQDw2f3HAiEAoWg8oxjK9CRkUiJmUfP2y/d2QEdPsr82QHF5qyeffUs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":626578},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"2d91ce711d3d8f6cc2f63692fc5c88a6046c42c1","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v18.16.0+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"18.16.0","dependencies":{"tslib":"^2.4.1","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"dexie":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.5_1685013683178_0.03743775026134477","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.6-beta.0":{"name":"@pvermeer/dexie-populate-addon","version":"1.0.6-beta.0","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@1.0.6-beta.0","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"9b25914cf29e9eccde4e3bf74eb78175541db6ad","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-1.0.6-beta.0.tgz","fileCount":26,"integrity":"sha512-qzt0l0t4UF0ggSvT9JoaHwov24pOqDdzw5GYaPEq8vIt8ZtLFa/ade8cIajIedT+1wFCk/XxAAIwxwQetpDViQ==","signatures":[{"sig":"MEUCIDwyugvTZB+ktXIOWGrY0jibFNDsSooFTyZ7cwmmvGCBAiEAoeRCOo0yvR1UVDIjX/zXo+XngGYQRmxwzkOciykTo4I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":634767},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"# Dexie Populate Addon\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\nthat combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\n## Install over npm\n\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\n\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n\n```\nnpm install dexie\n```\n\n## Documentation\n\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\n\n| Symbol | Description                                                    |\n| ------ | -------------------------------------------------------------- |\n| =>     | Relational notation: `group => groups.id` (_group is indexed_) |\n\n#### Population\n\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\n\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n\n#### Addon\n\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\n\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from \"@pvermeer/dexie-populate-addon\";\n\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  description: string;\n}\n\nexport class Friend {\n  id?: number;\n  firstName: string;\n  lastName: string;\n  memberOf: Ref<Club, number>[];\n\n  doSomething() {}\n}\n```\n\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\n\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\n\nOptions:\n\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate([\"memberOf\", \"group\"]).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate([\"memberOf\", \"group\"], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\n\nArray methods:\n\n```ts\ndb.friends.populate().where(\":id\").equals(1).first();\ndb.friends.populate().toArray();\n```\n\nCompound:\n\n```ts\ndb.friends.populate().where(\"[id+group]\").equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first();\n```\n\nAnd more... see https://dexie.org\n\n### Create Dexie database\n\n#### ESM\n\n```js\nimport Dexie from \"dexie\";\nimport { populate } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n  addons: [populate],\n});\ndb.version(1).stores({\n  friends: \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n  clubs: \"++id, name, theme => themes.id\",\n  themes: \"++id, name, style => styles.styleId\",\n  styles: \"++styleId, name, color\",\n  groups: \"++id, name\",\n});\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### Typescript\n\n```ts\nimport Dexie from \"dexie\";\nimport { populate, Ref } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare classes\nclass Style {\n  styleId?: number;\n  name: string;\n  color: string;\n  description: string;\n}\nclass Theme {\n  id?: number;\n  name: string;\n  style: Ref<Style, number>;\n  description: string;\n}\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  theme: Ref<Theme, number>;\n  description: string;\n}\nclass Group {\n  id?: number;\n  name: string;\n  true: boolean;\n  description: string;\n}\nclass Friend {\n  id?: number;\n  name: string;\n  memberOf: Ref<Club, number>[];\n  group: Ref<Group, number>;\n\n  doSomething() {\n    return \"done\";\n  }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n  public friends: Dexie.Table<Friend, number>;\n  public clubs: Dexie.Table<Club, number>;\n  public themes: Dexie.Table<Theme, number>;\n  public groups: Dexie.Table<Group, number>;\n  public styles: Dexie.Table<Style, number>;\n\n  constructor(name: string) {\n    super(name);\n\n    populate(this);\n\n    this.version(1).stores({\n      friends:\n        \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n      clubs: \"++id, name, theme => themes.id\",\n      themes: \"++id, name, style => styles.styleId\",\n      styles: \"++styleId, name, color\",\n      groups: \"++id, name\",\n    });\n\n    this.friends.mapToClass(Friend);\n    this.clubs.mapToClass(Club);\n    this.themes.mapToClass(Theme);\n    this.groups.mapToClass(Group);\n    this.styles.mapToClass(Style);\n  }\n}\n\nconst db = new FriendDatabase(\"FriendsDatabase\");\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <!-- Include Dexie (@next if v3 is still in RC) -->\n    <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script>\n\n    <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n    <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n    <script>\n      // Define your database\n      const db = new Dexie(\"FriendDatabase\", {\n        addons: [DexiePopulateAddon.populate],\n      });\n      db.version(1).stores({\n        friends:\n          \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n        clubs: \"++id, name, theme => themes.id\",\n        themes: \"++id, name, style => styles.styleId\",\n        styles: \"++styleId, name, color\",\n        groups: \"++id, name\",\n      });\n\n      // Open the database\n      db.open().then(() => {\n        console.log(\"DB loaded! :D\");\n        // Do Dexie stuff\n      });\n    </script>\n  </head>\n</html>\n```\n\n## API\n\n#### populate - addon function\n\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> =\n  | NominalRef<O>\n  | K\n  | null;\n```\n\n### Populated - type\n\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---\n\n# Dexie.js\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"bd8be8ffe3c0f38734770351dff7deafe944145b","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v20.12.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"20.12.2","dependencies":{"tslib":"^2.4.1","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_1.0.6-beta.0_1714381972630_0.5766096631626789","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.0.0-beta.0":{"name":"@pvermeer/dexie-populate-addon","version":"2.0.0-beta.0","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"author":{"name":"PVermeer"},"license":"MIT","_id":"@pvermeer/dexie-populate-addon@2.0.0-beta.0","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"dist":{"shasum":"b6c5a2097681ae3c7952d04f0b8d4074b684bd69","tarball":"https://registry.npmjs.org/@pvermeer/dexie-populate-addon/-/dexie-populate-addon-2.0.0-beta.0.tgz","fileCount":26,"integrity":"sha512-f69joKKU5KywOgKMp+kpZ/qWdQPf4pVa/VVRNG4xX/G/H/TOS68OESy2ZYHqIKPKe+cJSEI0iKPqgvaz1eOEuA==","signatures":[{"sig":"MEUCIQDXy93Z/DoNIx93/Qw69AnKFavyCt6lTzq3jUokOsSicgIgRaPqUvvWEXjjziLNeLDSaw9H0QhN0e1Txg3AU0qkWSg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":635398},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","readme":"# Dexie Populate Addon\n\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n[![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-populate-addon/beta.svg)](https://www.npmjs.com/package/@pvermeer/dexie-populate-addon)\n![master](https://github.com/pvermeer/dexie-addon-suite-monorepo/actions/workflows/ci.yml/badge.svg?branch=master)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThis addon can be used as a stand-alone addon for Dexie.js yet is also part of dexie-addon-suite [![NPM Version](https://img.shields.io/npm/v/@pvermeer/dexie-addon-suite/latest.svg)](https://www.npmjs.com/package/@pvermeer/dexie-addon-suite)\nthat combines a number of addons for Dexie. It contains code to combine some addons like populated rxjs observables.\n\n## Install over npm\n\n```\nnpm install @pvermeer/dexie-populate-addon\n```\n\n#### Dexie.js\n\nDexie Populate Addon depends on Dexie.js v3. [![NPM Version](https://img.shields.io/npm/v/dexie/latest.svg)](https://www.npmjs.com/package/dexie)\n\n```\nnpm install dexie\n```\n\n## Documentation\n\n#### Populate your data the Dexie way!\n\nAddon is written to be as easy to use as Dexie.js itself.\n\n### Added Schema Syntax\n\n| Symbol | Description                                                    |\n| ------ | -------------------------------------------------------------- |\n| =>     | Relational notation: `group => groups.id` (_group is indexed_) |\n\n#### Population\n\nIndex keys of `group` may be an array of keys `[1, 2, 3]` or a single key `1`.\n\n#### Indices\n\nRelational keys will be indexed. Multi-index `*groups` and compound indices can be used `++id, group => groups.id, [id+group]`.\n\n### How to use\n\n#### Addon\n\nAdd populate() to your Dexie database. See below examples and https://dexie.org for more info.\n\n#### Ref type (TypeScript)\n\nFor typescript there is a special `Ref` type for your Classes and Interfaces to let the type system know that this is a potentially populated property:\n\n```ts\nimport { Ref } from \"@pvermeer/dexie-populate-addon\";\n\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  description: string;\n}\n\nexport class Friend {\n  id?: number;\n  firstName: string;\n  lastName: string;\n  memberOf: Ref<Club, number>[];\n\n  doSomething() {}\n}\n```\n\nWith this notation we let the typesystem know we have a property `memberOf` that can be assigned with index keys of `number`. When population methods are used, TypeScript now knows that this has changed to `Club[]` in `memberOf`. If a Ref is not found it is `null`, thus the result for `memberOf` will be `(Club | null)[]`.\n\nThe `Ref` type is a (fake) nominal type so the type system can differentiate this type from other assignable types.\n\n#### Populate method\n\nThe `Table` class of Dexie is extended with the `populate()` method:\n\n```ts\ninterface PopulateOptions {\n    shallow: boolean;\n}\n\npopulate(keysOrOptions?: string[] | PopulateOptions): PopulateTable;\n```\n\nIt returns a new `PopulateTable` with the available `Dexie.Table` methods that support population. Dexie `Table` methods can then be used as normal.\n\nWhen no options are provided, the return is a deep populated record. Since this is not always wanted and to speed up the database lookup, options can be provided:\n\n- Providing `string[]` expects population keys as provided in the table schema. Only thoses properties will be populated .\n- Providing `{ shallow: true }` disables deep population. Only one layer of population is applied.\n\n##### Examples:\n\nOptions:\n\n```ts\ndb.friends.populate().get(1); // Fully populated;\ndb.friends.populate({ shallow: true }).get(1); // Only the record itself is populated, no deeper;\ndb.friends.populate([\"memberOf\", \"group\"]).get(1); // Only 'memberOf' and 'group' are deep populated;\ndb.friends.populate([\"memberOf\", \"group\"], { shallow: true }).get(1); // Only 'memberOf' and 'group' are shallow populated;\n```\n\nArray methods:\n\n```ts\ndb.friends.populate().where(\":id\").equals(1).first();\ndb.friends.populate().toArray();\n```\n\nCompound:\n\n```ts\ndb.friends.populate().where(\"[id+group]\").equals([1, 2]).first();\ndb.friends.populate().where({ id: 1, group: 2 }).first();\n```\n\nAnd more... see https://dexie.org\n\n### Create Dexie database\n\n#### ESM\n\n```js\nimport Dexie from \"dexie\";\nimport { populate } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare Database\nconst db = new Dexie(\"FriendDatabase\", {\n  addons: [populate],\n});\ndb.version(1).stores({\n  friends: \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n  clubs: \"++id, name, theme => themes.id\",\n  themes: \"++id, name, style => styles.styleId\",\n  styles: \"++styleId, name, color\",\n  groups: \"++id, name\",\n});\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### Typescript\n\n```ts\nimport Dexie from \"dexie\";\nimport { populate, Ref } from \"@pvermeer/dexie-populate-addon\";\n\n// Declare classes\nclass Style {\n  styleId?: number;\n  name: string;\n  color: string;\n  description: string;\n}\nclass Theme {\n  id?: number;\n  name: string;\n  style: Ref<Style, number>;\n  description: string;\n}\nclass Club {\n  id?: number;\n  name: string;\n  size: number;\n  theme: Ref<Theme, number>;\n  description: string;\n}\nclass Group {\n  id?: number;\n  name: string;\n  true: boolean;\n  description: string;\n}\nclass Friend {\n  id?: number;\n  name: string;\n  memberOf: Ref<Club, number>[];\n  group: Ref<Group, number>;\n\n  doSomething() {\n    return \"done\";\n  }\n}\n\n// Declare Database\nclass FriendsDatabase extends Dexie {\n  public friends: Dexie.Table<Friend, number>;\n  public clubs: Dexie.Table<Club, number>;\n  public themes: Dexie.Table<Theme, number>;\n  public groups: Dexie.Table<Group, number>;\n  public styles: Dexie.Table<Style, number>;\n\n  constructor(name: string) {\n    super(name);\n\n    populate(this);\n\n    this.version(1).stores({\n      friends:\n        \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n      clubs: \"++id, name, theme => themes.id\",\n      themes: \"++id, name, style => styles.styleId\",\n      styles: \"++styleId, name, color\",\n      groups: \"++id, name\",\n    });\n\n    this.friends.mapToClass(Friend);\n    this.clubs.mapToClass(Club);\n    this.themes.mapToClass(Theme);\n    this.groups.mapToClass(Group);\n    this.styles.mapToClass(Style);\n  }\n}\n\nconst db = new FriendDatabase(\"FriendsDatabase\");\n\n// Open the database\ndb.open().then(() => {\n  console.log(\"DB loaded! :D\");\n  // Use Dexie\n});\n```\n\n#### HTML import\n\nBundled & minified package: <https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js>.\n\nAddon is export as namespace DexiePopulateAddon\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <!-- Include Dexie (@next if v3 is still in RC) -->\n    <script src=\"https://unpkg.com/dexie@latest/dist/dexie.js\"></script>\n\n    <!-- Include DexiePopulateAddon (always after Dexie, it's a dependency) -->\n    <script src=\"https://unpkg.com/@pvermeer/dexie-populate-addon@latest/dist/dexie-populate-addon.min.js\"></script>\n\n    <script>\n      // Define your database\n      const db = new Dexie(\"FriendDatabase\", {\n        addons: [DexiePopulateAddon.populate],\n      });\n      db.version(1).stores({\n        friends:\n          \"++id, name, *memberOf => clubs.id, group => groups.id, [id+group]\",\n        clubs: \"++id, name, theme => themes.id\",\n        themes: \"++id, name, style => styles.styleId\",\n        styles: \"++styleId, name, color\",\n        groups: \"++id, name\",\n      });\n\n      // Open the database\n      db.open().then(() => {\n        console.log(\"DB loaded! :D\");\n        // Do Dexie stuff\n      });\n    </script>\n  </head>\n</html>\n```\n\n## API\n\n#### populate - addon function\n\n```ts\nfunction populate(db: Dexie): void;\n```\n\n#### Ref - type\n\n```ts\n/**\n * Ref nominal type.\n * TS does not support nominal types. Fake implementation so the type system can match.\n */\nexport declare type Ref<O extends object, K extends IndexTypes, _N = \"Ref\"> =\n  | NominalRef<O>\n  | K\n  | null;\n```\n\n### Populated - type\n\n```ts\n/**\n * Overwrite the return type to the type as given in the Ref type after refs are populated.\n * T = object type;\n * B = boolean if shallow populate;\n * O = union type of object keys to populate or the string type to populate all.\n */\ntype Populated<T, B extends boolean = false, O extends string = string>;\n```\n\nAlso exports some other classes and types to support further extension. See declaration or source.\n\n---\n\n# Dexie.js\n\nDexie.js is a wrapper library for indexedDB - the standard database in the browser. https://dexie.org\n","gitHead":"c319825809c3ece9f5e1083564b84b0cf9a1bcf4","scripts":{"lint":"npm run eslint .","test":"npm run lint && npm run test:jasmine && npm run test:karma","build":"bash ../../scripts/build-package.sh","eslint":"eslint --max-warnings=0 --config ../../.eslintrc.json --ignore-path ../../.gitignore --parser-options project:../../tsconfig.base.json","lint:fix":"npm run eslint:fix .","eslint:fix":"npm run eslint -- --fix","test:karma":"karma start ../../karma.conf.js  --context=$PWD","test:jasmine":"ts-node ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'","test:karma:debug":"karma start ../../karma.conf.js --context=$PWD --debug","test:jasmine:debug":"nodemon --inspect-brk=127.0.0.1:9334 -r ts-node/register ../../node_modules/jasmine/bin/jasmine --reporter=jasmine-console-reporter 'test/unit-tests/jasmine/**/*.spec.ts'"},"_npmUser":{"name":"pvermeer","email":"pim.vermeer@gmail.com"},"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v20.12.2+x64 (linux)","description":"Addon for Dexie.js database to populate relationships","directories":{},"_nodeVersion":"20.12.2","dependencies":{"tslib":"^2.4.1","lodash.flatten":"^4.4.0","lodash.isequal":"^4.5.0","lodash.clonedeep":"^4.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"dexie":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dexie-populate-addon_2.0.0-beta.0_1714411338422_0.8375345743226987","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2020-03-06T14:59:14.458Z","modified":"2024-12-14T10:46:54.938Z","1.0.0-beta.1":"2020-03-06T14:59:14.944Z","1.0.0-beta.2":"2020-03-06T19:32:51.731Z","1.0.0-beta.3":"2020-03-16T11:02:43.510Z","1.0.0-beta.4":"2020-03-18T17:45:18.949Z","1.0.0-beta.5":"2020-03-23T13:03:08.810Z","1.0.0-beta.6":"2020-11-14T14:39:16.190Z","1.0.0-beta.7":"2020-11-22T13:05:49.076Z","1.0.0-beta.8":"2021-11-21T18:09:39.258Z","1.0.0-beta.9":"2021-12-24T16:10:41.702Z","1.0.0-beta.10":"2021-12-28T09:21:52.877Z","1.0.0-beta.11":"2021-12-30T16:12:14.804Z","1.0.0-beta.12":"2021-12-30T17:21:16.884Z","1.0.0-beta.13":"2022-01-04T12:05:44.627Z","1.0.0-beta.14":"2022-01-04T15:00:14.787Z","1.0.0-beta.15":"2022-01-06T20:12:14.454Z","1.0.0-beta.16":"2022-01-21T17:15:14.384Z","1.0.0-beta.17":"2022-01-29T15:23:44.042Z","1.0.0-beta.18":"2022-01-30T17:24:01.354Z","1.0.0-beta.19":"2022-01-31T16:46:51.528Z","1.0.0-beta.20":"2022-01-31T17:54:20.379Z","1.0.0-beta.21":"2022-02-02T18:39:57.171Z","1.0.0-beta.22":"2022-06-19T16:36:53.957Z","1.0.0-beta.23":"2022-07-16T17:31:44.229Z","1.0.1":"2022-07-22T17:42:59.786Z","1.0.2":"2022-07-22T18:15:47.513Z","1.0.3-beta.0":"2022-11-07T18:37:58.226Z","1.0.3-beta.1":"2022-11-09T18:31:21.140Z","1.0.3-beta.2":"2022-11-11T23:13:23.602Z","1.0.3-beta.3":"2022-11-12T14:44:21.070Z","1.0.3-beta.4":"2022-12-19T21:13:16.027Z","1.0.3":"2022-12-28T16:56:21.702Z","1.0.4-beta.0":"2023-01-20T19:26:10.299Z","1.0.4":"2023-02-04T15:47:45.565Z","1.0.5-beta.0":"2023-02-11T18:44:57.393Z","1.0.5-beta.1":"2023-05-24T16:04:46.154Z","1.0.5":"2023-05-25T11:21:23.384Z","1.0.6-beta.0":"2024-04-29T09:12:52.842Z","2.0.0-beta.0":"2024-04-29T17:22:18.665Z"},"bugs":{"url":"https://github.com/PVermeer/dexie-addon-suite-monorepo/issues"},"author":{"name":"PVermeer"},"license":"MIT","homepage":"https://github.com/PVermeer/dexie-addon-suite-monorepo#readme","keywords":["dexie","dexie.js","indexeddb","database","relation","relationships","populate"],"repository":{"url":"git+https://github.com/PVermeer/dexie-addon-suite-monorepo.git","type":"git"},"description":"Addon for Dexie.js database to populate relationships","maintainers":[{"name":"pvermeer","email":"pim.vermeer@gmail.com"}],"readme":"","readmeFilename":""}