{"_id":"@advanced-rest-client/idb-store","_rev":"8-60e66f45a05a7975de6369be98d5a32a","name":"@advanced-rest-client/idb-store","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@advanced-rest-client/idb-store","version":"1.0.0","author":{"name":"Pawel Uchida-Psztyc","email":"pawel.psztyc@gmail.com"},"license":"Apache-2.0","_id":"@advanced-rest-client/idb-store@1.0.0","maintainers":[{"name":"jarrodek","email":"jarrodek@gmail.com"},{"name":"twoplustwoone","email":"francisco.digiandomenico@gmail.com"},{"name":"lbauret","email":"leandro.bauret@mulesoft.com"},{"name":"carowright","email":"carolina.wright@mulesoft.com"}],"contributors":[{"name":"Your name can be here!"}],"homepage":"https://github.com/advanced-rest-client/arc-models#readme","bugs":{"url":"https://github.com/advanced-rest-client/arc-models/issues","email":"arc@mulesoft.com"},"dist":{"shasum":"5f471b135ac3a6c523c09f6e319825dc00a3e293","tarball":"https://registry.npmjs.org/@advanced-rest-client/idb-store/-/idb-store-1.0.0.tgz","fileCount":77,"integrity":"sha512-0Pzl+KreKnFsYV+BZXnBPg5zpNT6SHrsNh3kNAyyk7NfFg9cTBeaB7n1e3CCS3vakm6eWC+7j1LrNxVWHBUGKQ==","signatures":[{"sig":"MEUCIQDO9AKS0Y/1XjbkPar6tUG01QRcVvmZ9dtYDf/R+0mPaQIgK1nQfitobJBG8IC2e2YnDhCJWVsLv0m/I8IbkA2POyw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":524675},"main":"index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"module":"index.js","gitHead":"51ac5861001d1d5e339796dd2bab1519fff9f356","scripts":{"lint":"npm run lint:eslint","test":"web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium","start":"web-dev-server --app-index demo/index.html --node-resolve --open --watch --root-dir .","format":"npm run format:eslint","gen:wc":"wca analyze \"*.js\" --outFile custom-elements.json","test:all":"web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium firefox webkit","lint:types":"tsc","test:watch":"web-test-runner --config wtr-dev.config.mjs","lint:eslint":"eslint --ext .js,.html . --ignore-path .gitignore","format:eslint":"eslint --ext .js,.html . --fix --ignore-path .gitignore"},"_npmUser":{"name":"jarrodek","email":"jarrodek@gmail.com"},"repository":{"url":"git://github.com/advanced-rest-client/arc-models.git","type":"git"},"_npmVersion":"6.14.15","description":"Event based access to ARC datastores","directories":{},"lint-staged":{"*.js":["eslint --fix"]},"_nodeVersion":"14.18.0","dependencies":{"lit-html":"^1.4.1","lit-element":"^2.5.1","@advanced-rest-client/libs":"^1.0.0","@advanced-rest-client/uuid":"^4.0.0","@advanced-rest-client/events":"^0.2.22","@advanced-rest-client/arc-mock":"^5.0.0","@advanced-rest-client/pouchdb-quick-search":"^2.0.3"},"eslintConfig":{"extends":["@open-wc/eslint-config","eslint-config-prettier"],"overrides":[{"files":["demo/**/*.js","test/**/*.js","test/*.js","**/demo/**/*.html"],"rules":{"no-console":"off","no-continue":"off","no-plusplus":"off","no-param-reassign":"off","prefer-destructuring":"off","no-unused-expressions":"off","class-methods-use-this":"off","no-template-curly-in-string":"off","import/no-extraneous-dependencies":"off"}}]},"_hasShrinkwrap":false,"devDependencies":{"husky":"^7.0.2","sinon":"^11.1.2","eslint":"^8.0.1","pouchdb":"^7.2.2","typescript":"^4.4.4","lint-staged":"^11.2.3","@types/pouchdb":"^6.4.0","@web/dev-server":"^0.1.25","@open-wc/testing":"^3.0.1","@web/test-runner":"^0.13.20","@types/har-format":"^1.2.7","@polymer/paper-toast":"^3.0.0","@open-wc/eslint-config":"^6.0.0","eslint-config-prettier":"^8.3.0","typescript-lit-html-plugin":"^0.9.0","@web/test-runner-playwright":"^0.8.8"},"peerDependencies":{"pouchdb":"^7.2.2"},"_npmOperationalInternal":{"tmp":"tmp/idb-store_1.0.0_1634672454493_0.6233540149461043","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@advanced-rest-client/idb-store","version":"1.0.1","author":{"name":"Pawel Uchida-Psztyc","email":"pawel.psztyc@gmail.com"},"license":"Apache-2.0","_id":"@advanced-rest-client/idb-store@1.0.1","maintainers":[{"name":"jarrodek","email":"jarrodek@gmail.com"},{"name":"twoplustwoone","email":"francisco.digiandomenico@gmail.com"},{"name":"lbauret","email":"leandro.bauret@mulesoft.com"},{"name":"carowright","email":"carolina.wright@mulesoft.com"}],"contributors":[{"name":"Your name can be here!"}],"homepage":"https://github.com/advanced-rest-client/arc-models#readme","bugs":{"url":"https://github.com/advanced-rest-client/arc-models/issues","email":"arc@mulesoft.com"},"dist":{"shasum":"822921421e2e901321ff24c9ee5bae2e1227f803","tarball":"https://registry.npmjs.org/@advanced-rest-client/idb-store/-/idb-store-1.0.1.tgz","fileCount":77,"integrity":"sha512-2C2T0oH5luSdqKSvBM9K4Gkw2lPp6rC5qWSG4muioj3PHtz7m9dj+dhH6bhJqh4Z1kHKXHsh/Zbyiig1lQMKkw==","signatures":[{"sig":"MEUCIBuFBLcMTs/Km3S1HVtpqSqZN7+6XS3CFdphsLz3egDJAiEAmr6LJxbaL+BOSDbyawccCnMQdr0x4jNF0BMxPHI6e6Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":524736,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhwuACCRA9TVsSAnZWagAAnYAP/3sTrnAE3KD79UYy60N8\nOPzlsHc7bi5bwX9xoPhU0uxJIC5yPtkO0nKgbPEEyvcXeA7nH7vjzECQXiAn\n2CJ8fnCW4Ng86fJJ5aAtXMqlnCCe8ULHwgEXcv+C3XOD4+KxhwAsLOIhmCe/\nSfcISir8BsKUgpfU4jxWos3OjEmV9/Y5hiAQERXkydISLheauabFfCrGCRzk\nxO2HQZqbWl/IyRYxTEBmkqNMrb2y2ZCb8Vwq5+J8WKtejvHXeLxE6oN0uieP\nOuwpegIUn6UslEKVsjToLOTbylwqopjzXLaaVs5XNELryHB7x75mjtZK8Dot\nV3Z+wpkVlqAoSnGYiPAUoLrmiDAeogHaXTaIMquMczaM5VTiEct2q0yF/WFV\n2hCTkmxU8u8gUnQ4bL9CsP0rXd850s7mn3JZtlnM1Z03GSqveaqhvTkyZKHP\nt2MmQQ5efVQejYSkQZwfA2EU+AHiKqox5nuXRk9E8jXvOhzeKBSRaYxBSJLL\nhBhMT92qDh/MLIDb5JCgjSIwWrgfpBfXT50uCLWGYRZsD6BKCLuAQvsn0L/8\ng01ZPwGsi84kozAxfR6aoxAHOpC/Iw6Au32QGr4X5KBp+LUGkl5P0+9aJqvv\nnz0gGWnb7/K3KEUN+WG2ixjAhhAM1/m8W/vO5VzkhyI4ppIDbAhyENfxtWs/\nFhqu\r\n=48EB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"./index.d.ts","module":"index.js","gitHead":"9b7a41a1c1e94dd4188fc27e9a0ca489286d9bc5","scripts":{"lint":"npm run lint:eslint","test":"web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium","start":"web-dev-server --app-index demo/index.html --node-resolve --open --watch --root-dir .","format":"npm run format:eslint","gen:wc":"wca analyze \"*.js\" --outFile custom-elements.json","test:all":"web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium firefox webkit","lint:types":"tsc","test:watch":"web-test-runner --config wtr-dev.config.mjs","lint:eslint":"eslint --ext .js,.html . --ignore-path .gitignore","format:eslint":"eslint --ext .js,.html . --fix --ignore-path .gitignore"},"_npmUser":{"name":"jarrodek","email":"jarrodek@gmail.com"},"repository":{"url":"git://github.com/advanced-rest-client/arc-models.git","type":"git"},"_npmVersion":"8.1.0","description":"Event based access to ARC datastores","directories":{},"lint-staged":{"*.js":["eslint --fix"]},"_nodeVersion":"16.13.0","dependencies":{"lit-html":"^1.4.1","lit-element":"^2.5.1","@advanced-rest-client/libs":"^1.0.0","@advanced-rest-client/uuid":"^4.0.0","@advanced-rest-client/events":"^0.2.22","@advanced-rest-client/arc-mock":"^5.0.0","@advanced-rest-client/pouchdb-quick-search":"^2.0.3"},"eslintConfig":{"extends":["@open-wc/eslint-config","eslint-config-prettier"],"overrides":[{"files":["demo/**/*.js","test/**/*.js","test/*.js","**/demo/**/*.html"],"rules":{"no-console":"off","no-continue":"off","no-plusplus":"off","no-param-reassign":"off","prefer-destructuring":"off","no-unused-expressions":"off","class-methods-use-this":"off","no-template-curly-in-string":"off","import/no-extraneous-dependencies":"off"}}]},"_hasShrinkwrap":false,"devDependencies":{"husky":"^7.0.2","sinon":"^12.0.1","eslint":"^8.0.1","pouchdb":"^7.2.2","typescript":"^4.4.4","lint-staged":"^11.2.3","@types/pouchdb":"^6.4.0","@web/dev-server":"^0.1.25","@open-wc/testing":"^3.0.1","@web/test-runner":"^0.13.20","@types/har-format":"^1.2.7","@polymer/paper-toast":"^3.0.0","@open-wc/eslint-config":"^7.0.0","eslint-config-prettier":"^8.3.0","typescript-lit-html-plugin":"^0.9.0","@web/test-runner-playwright":"^0.8.8"},"peerDependencies":{"pouchdb":"^7.2.2"},"_npmOperationalInternal":{"tmp":"tmp/idb-store_1.0.1_1636136379782_0.8251538582367788","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-10-19T19:40:54.427Z","modified":"2026-04-07T19:24:46.008Z","1.0.0":"2021-10-19T19:40:54.632Z","1.0.1":"2021-11-05T18:19:39.980Z"},"bugs":{"url":"https://github.com/advanced-rest-client/arc-models/issues","email":"arc@mulesoft.com"},"author":{"name":"Pawel Uchida-Psztyc","email":"pawel.psztyc@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/advanced-rest-client/arc-models#readme","repository":{"url":"git://github.com/advanced-rest-client/arc-models.git","type":"git"},"description":"Event based access to ARC datastores","contributors":[{"name":"Your name can be here!"}],"maintainers":[{"email":"jarrodek@gmail.com","name":"jarrodek"},{"email":"alexperez@mulesoft.com","name":"alexperez_march_2024"},{"email":"elmellidiego@gmail.com","name":"dmacias"}],"readme":"# ARC's IDB data store\n\nData models for Advanced REST Client application. This module contains the logic used by the application to store and restore data to the UI.\n\nIt also provides DOM events based access to the API. Each operation has corresponding event that can be used to access the data.\nA convenient way of using the events API is to by using the `ArcModelEvents` and `ArcModelEventTypes` interfaces.\nThe first provides access to function which call creates and dispatches events on a given node. The later provides the definition of the event types for manual handling.\n\nIt is highly recommended to use this models with the support of typescript. The library and each component has types definition with documentation for convenient use. Types are declared in `@advanced-rest-client/events` module.\n\n[![Published on NPM](https://img.shields.io/npm/v/@advanced-rest-client/idb-store.svg)](https://www.npmjs.com/package/@advanced-rest-client/idb-store)\n\n[![Tests and publishing](https://github.com/advanced-rest-client/idb-store/actions/workflows/deployment.yml/badge.svg)](https://github.com/advanced-rest-client/idb-store/actions/workflows/deployment.yml)\n\n## Usage\n\nThe models are modularized so the ARC application can easily replace each interface depending on the interface. It also allows to extract part of the application logic to the outside the application\nand use the same models to add storage support.\n\n### Installation\n\n```sh\nnpm install --save @advanced-rest-client/idb-store\n```\n\n### Working with the events\n\nEach model has a corresponding to (almost) each public method an event that can be used instead of directly accessing the model instance.\nIt is more convenient than direct use of the library in each component as it's easier to manage API changes if the components are using an abstract layer instead of the direct API. This way it's a much simpler task to change the data store implementation that when the components would use the library directly.\n\nSay, you want to list ARC requests data stored in the application. This is supported by the `request-model`. You can access the data by dispatching the list event:\n\n```javascript\nimport { RequestModel } from '@advanced-rest-client/idb-store';\nimport { ArcModelEvents } '@advanced-rest-client/events';\n\nconst store = new RequestModel(window);\nstore.listen(window);\n\nconst result = await ArcModelEvents.Request.list(document.body, 'saved', {\n  limit: 25,\n});\nconst { items } = result;\n```\n\n### Pagination\n\nAll components uses the same interface to list the data. When calling `list()` function (or the corresponding event) an the model\nit always accept an object with the `limit` and `nextPageToken` property. Both are optional.\nThe limit tells the model how many entities to return with the response. Then next page token is returned with each list result and contains hashed data about the current position in the pagination.\n\n```javascript\nimport { RequestModel } from '@advanced-rest-client/idb-store';\nimport { ArcModelEvents } '@advanced-rest-client/events';\n\nconst store = new RequestModel(window);\nstore.listen(window);\n\nconst result = await ArcModelEvents.Request.list(document.body, 'saved', {\n  limit: 25,\n});\nconst { items, nextPageToken } = result;\n```\n\nThe `items` array contains a list of `ARCSavedRequest` entities. The second property returned by the query is the `nextPageToken` that now can be passed to the next list request to request the next page of the results.\n\n```javascript\nconst next = await ArcModelEvents.Request.list(document.body, 'saved', {\n  limit: 25,\n  nextPageToken,\n});\n```\n\nNote that limit has to be defined for each call as the page cursor does not  store this information.\n\n## Development\n\n```sh\ngit clone https://github.com/@advanced-rest-client/idb-store\ncd idb-store\nnpm install\n```\n\n### Running the demo locally\n\n```sh\nnpm start\n```\n\n### Running the tests\n\n```sh\nnpm test\n```\n","readmeFilename":"README.md"}