{"id":16322112,"url":"https://github.com/1999/sklad2","last_synced_at":"2025-04-04T10:59:04.364Z","repository":{"id":35059792,"uuid":"197767523","full_name":"1999/sklad2","owner":"1999","description":"Simplest-possible async-await/promises wrapper on top of IndexedDB with 🍌","archived":false,"fork":false,"pushed_at":"2022-12-04T04:42:28.000Z","size":273,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:55:23.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1999.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-19T12:17:24.000Z","updated_at":"2021-08-12T21:36:45.000Z","dependencies_parsed_at":"2023-01-15T13:00:22.622Z","dependency_job_id":null,"html_url":"https://github.com/1999/sklad2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999%2Fsklad2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999%2Fsklad2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999%2Fsklad2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999%2Fsklad2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1999","download_url":"https://codeload.github.com/1999/sklad2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166157,"owners_count":20894652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T22:50:02.119Z","updated_at":"2025-04-04T10:59:04.341Z","avatar_url":"https://github.com/1999.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## sklad2\n\nThis is a simplest-possible async-await/promises wrapper on top of IndexedDB. It's a successor to [sklad](https://github.com/1999/sklad) library.\n\n## API\n\n```javascript\nimport { open, deleteDatabase } from 'sklad2';\n\n// open connection to the database\nconst sklad = await open('databaseName', [...migrations]);\n\n// insert records into the object store(s)\nconst insertIds = await sklad.insertIntoOneStore('storeName', [...records]);\nconst insertIdsMultiple = await sklad.insertIntoMultiple({\n  storeName1: [...records1],\n  storeName2: [...records2],\n});\n\n// upsert records in the object store(s)\nconst upsertIds = await sklad.upsertIntoOneStore('storeName', [...records]);\nconst upsertIdsMultiple = await sklad.upsertIntoMultiple({\n  storeName1: [...records1],\n  storeName2: [...records2],\n});\n\n// delete records in the object store(s)\nawait sklad.deleteFromStore('storeName', 'key');\nawait sklad.deleteFromStores({\n  storeName1: 'key',\n  storeName2: IDBKeyRange.lowerBound('key'),\n});\n\n// count records in the object store(s)\nconst total = await sklad.countOneStore('storeName');\nconst totalMultiple = await sklad.countMultipleStores({\n  storeName1: {}, // count all records in the object store\n  storeName2: {\n    indexName: 'index',\n    range: IDBKeyRange.only('something'),\n  }, // all options are optional\n});\n\n// get records from the object store(s)\nconst records = await sklad.getOneStore('storeName');\nconst recordsMultiple = await sklad.getMultipleStores({\n  storeName1: {}, // get all records from the object store\n  storeName2, {\n    indexName: 'index',\n    range: IDBKeyRange.upperBound('key'),\n    direction: 'nextunique',\n    offset: 10,\n    limit: 10,\n  }, // all options are optional\n});\n\n// clear records in the object store(s)\nawait sklad.clearStore('storeName');\nawait sklad.clearStores(['storeName1', 'storeName2']);\n\n// delete the database\nawait deleteDatabase('databaseName');\n```\n\n## Differences with `sklad`\n\n### Browsers support\n\n`sklad` was designed to work in almost all browsers which had some IndexedDB support. `sklad2` is designed to work in the browsers which don't have IndexedDB implementation bugs which are the latest desktop Chrome, Firefox, Safari, mobile Chrome and Safari.\n\n### Testing\n\n`sklad` was heavily tested in different real browsers which had different IndexedDB implementation support. `sklad2` has only a couple end-to-end tests that you can run in your browser and see if it works or not. If you want to test your mobile browser you can consider running [ngrok](https://ngrok.com/) to open the test page in the browser.\n\n### Types\n\n`sklad2` is written in Typescript which means it has built-in types support.\n\n### API\n\n`sklad2` takes inspiration from `sklad` but still has slightly different method names: `get` in `sklad` has `getOneStore` and `getMultipleStores` in `sklad2`. See API section above for examples.\n\n### Bundle format\n\n`sklad2` NPM package has \"module\" support which is ES6 modules code, UMD code as \"unpkg\" and \"main\" which is CommonJS. It doesn't contain any polyfills for IndexedDB or Promises.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999%2Fsklad2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1999%2Fsklad2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999%2Fsklad2/lists"}