bitwarden / directory-connector

A tool for syncing a directory (AD, LDAP, Azure, G Suite, Okta) to an organization.
https://bitwarden.com
GNU General Public License v3.0
249 stars 84 forks source link

[deps]: Update lowdb to v7 #458

Open renovate[bot] opened 6 months ago

renovate[bot] commented 6 months ago

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
lowdb 1.0.0 -> 7.0.1 age adoption passing confidence

Release Notes

typicode/lowdb (lowdb) ### [`v7.0.1`](https://togithub.com/typicode/lowdb/compare/v7.0.0...v7.0.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v7.0.0...v7.0.1) ### [`v7.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v7.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v6.1.1...v7.0.0) πŸš€ Simplified syntax with `db.update`, new adapter for more file format, consistent presets, automatic write error retry, and a TS error fix! #### What's New - **Simplified Syntax**: Introducing `db.update` for easier updates and writes. - **Flexible Adapters**: Added `DataFile` adapters for supporting various formats like `YAML` , `JSON5`, ... and adding features like encryption with minimal code. - **Automatic Retry**: Resolves write errors, especially for Windows users. #### Breaking Changes - **Node 16 Dropped**: discontinued support for Node 16. - **Consistent Naming**: Renamed presets for consistency: - `JSONPreset` to `JSONFilePreset` - `JSONSyncPreset` to `JSONFileSyncPreset`. #### Code Examples If you were using the `JSONPreset`, please rename it ```diff - import { JSONPreset } from 'lowdb/node' + import { JSONFilePreset } from 'lowdb/node' ``` Enjoy the simplified syntax with `db.update` ```diff - db.data.posts.push(newPost) - await db.write() + await db.update(({ posts }) => posts.push(newPost)) ``` Easily support other formats: ```js const yamlAdapter = new DataFile('db.yaml', { parse: YAML.parse, stringify: YAML.stringify }) const db = new Low(yamlAdapter, { posts: [] }) ``` #### Sponsors Special thanks to lowdb's current sponsor: [Mockend](https://mockend.com). Your support is essential, you can sponsor this project on [GitHub Sponsors](https://togithub.com/sponsors/typicode) :heart: ### [`v6.1.1`](https://togithub.com/typicode/lowdb/releases/tag/v6.1.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v6.1.0...v6.1.1) - Fix `JSONPreset` and `JSONSyncPreset` ### [`v6.1.0`](https://togithub.com/typicode/lowdb/releases/tag/v6.1.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v6.0.1...v6.1.0) ### New presets #### Before ```js import { Low } from 'lowdb' import { JSONFile } from 'lowdb/node' const adapter = new JSONFile(file) const defaultData = { posts: [] } const db = new Low(adapter, defaultData) await db.read() ``` #### Now ```js import { JSONPreset } from 'lowdb/node' const defaultData = { posts: [] } const db = await JSONPreset('db.json', defaultData) ``` This will also use the `Memory` adapter automatically when `NODE_ENV=test` making tests faster. ### TypeScript Lowdb now supports the broader `fs.PathLike` type which lets you use `URL` type in addition to `string`. This is useful for ESM. ```js // Read from 'db.json' relatively to the current module path using URL JSONPreset(new URL('db.json', import.meta.url), defaultData) ``` ### [`v6.0.1`](https://togithub.com/typicode/lowdb/releases/tag/v6.0.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v6.0.0...v6.0.1) #### What's Changed - fix: imported subpaths types correctly by [@​Krak798](https://togithub.com/Krak798) in [https://github.com/typicode/lowdb/pull/569](https://togithub.com/typicode/lowdb/pull/569) #### New Contributors - [@​Krak798](https://togithub.com/Krak798) made their first contribution in [https://github.com/typicode/lowdb/pull/569](https://togithub.com/typicode/lowdb/pull/569) **Full Changelog**: https://github.com/typicode/lowdb/compare/v6.0.0...v6.0.1 ### [`v6.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v6.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v5.1.0...v6.0.0) #### What's Changed - Drop Node 14 support - Require `defaultData` parameter for `Low` and `LowSync` constructors to improve TypeScript experience - Move examples from Markdown to real TypeScript files How to upgrade: ```js // v5 const defaultData = { posts: [] } const db = new Low(adapter) db.data ||= defaultData function add() { db.data.posts.push('title') // TS error } ``` ```js // v6 const defaultData = { posts: [] } const db = new Low(adapter, defaultData) function add() { db.data.posts.push('title') // No TS error } ``` If you like lowdb, please [sponsor my work](https://togithub.com/sponsors/typicode). If you cannot, a star or tweet is always appreciated. Thank you! ### [`v5.1.0`](https://togithub.com/typicode/lowdb/releases/tag/v5.1.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v5.0.5...v5.1.0) #### What's Changed - feat: add SessionStorage adapter by [@​crashmax-dev](https://togithub.com/crashmax-dev) in [https://github.com/typicode/lowdb/pull/560](https://togithub.com/typicode/lowdb/pull/560) #### New Contributors - [@​crashmax-dev](https://togithub.com/crashmax-dev) made their first contribution in [https://github.com/typicode/lowdb/pull/560](https://togithub.com/typicode/lowdb/pull/560) **Full Changelog**: https://github.com/typicode/lowdb/compare/v5.0.4...v5.1.0 ### [`v5.0.5`](https://togithub.com/typicode/lowdb/compare/v5.0.3...v5.0.5) [Compare Source](https://togithub.com/typicode/lowdb/compare/v5.0.3...v5.0.5) ### [`v5.0.3`](https://togithub.com/typicode/lowdb/compare/v5.0.2...v5.0.3) [Compare Source](https://togithub.com/typicode/lowdb/compare/v5.0.2...v5.0.3) ### [`v5.0.2`](https://togithub.com/typicode/lowdb/compare/v5.0.1...v5.0.2) [Compare Source](https://togithub.com/typicode/lowdb/compare/v5.0.1...v5.0.2) ### [`v5.0.1`](https://togithub.com/typicode/lowdb/compare/v5.0.0...v5.0.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v5.0.0...v5.0.1) ### [`v5.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v5.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v4.0.1...v5.0.0) **Better support for front-end tools like Vite, CodeSandbox, ...** To achieve this, Node and Browser (localStorage) adapters are now split in two. Besides that, there are no other breaking changes. #### Node ```js // Before import { Low, JSONFile } from 'lowdb' // After import { Low } from 'lowdb' import { JSONFile } from 'lowdb/node' ``` `lowdb/node` exports `JSONFile`, `JSONFileSync`, `TextFile` and `TextFileSync`. #### Browser ```js // Before import { LowSync, LocalStorage } from 'lowdb' // After import { LowSync } from 'lowdb' import { LocalStorage } from 'lowdb/browser' ``` `lowdb/browser` exports `LocalStorage`. ### [`v4.0.1`](https://togithub.com/typicode/lowdb/compare/v4.0.0...v4.0.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v4.0.0...v4.0.1) ### [`v4.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v4.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v3.0.0...v4.0.0) - Drop Node 12 support - Update dependencies ### [`v3.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v3.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.1.0...v3.0.0) - Switch license from "Sponsors and OSS Only" to MIT - Use native `#` instead of TypeScript `private` keyword for adapters - Update dependencies - No breaking change in terms of code **Many thanks to [Mockend](https://mockend.com) and [everyone on GitHub Sponsors](https://togithub.com/sponsors/typicode) for supporting this project** :heart: :owl: ### [`v2.1.0`](https://togithub.com/typicode/lowdb/releases/tag/v2.1.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.3...v2.1.0) - Add `TextFile` and `TextFileSync` adapters to simplify writing to different formats (YAML, XML, ...) and make encryption easier. ### [`v2.0.3`](https://togithub.com/typicode/lowdb/compare/v2.0.2...v2.0.3) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.2...v2.0.3) ### [`v2.0.2`](https://togithub.com/typicode/lowdb/compare/v2.0.1...v2.0.2) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.1...v2.0.2) ### [`v2.0.1`](https://togithub.com/typicode/lowdb/compare/v2.0.0...v2.0.1) [Compare Source](https://togithub.com/typicode/lowdb/compare/v2.0.0...v2.0.1) ### [`v2.0.0`](https://togithub.com/typicode/lowdb/releases/tag/v2.0.0) [Compare Source](https://togithub.com/typicode/lowdb/compare/v1.0.0...v2.0.0) - **Out of the box and improved TypeScript support.** - Uses new [steno](https://togithub.com/typicode/steno) version for fast async file writes. - Uses ECMAScript modules. - Plain JS can now be used to modify and query `db.data` - Reduced install size. - With native JavaScript improvements, **lodash is now optional** (you can still use it though as it provides powerful utilities). To help with OSS funding, lowdb v2 is released under Parity license for a limited time. It'll be released under MIT license once the goal of 100 [sponsors](https://togithub.com/sponsors/typicode) is reached (currently at 55) or in five months. See [README](https://togithub.com/typicode/lowdb#readme) for complete explanation. You can sponsor me on [GitHub Sponsors](https://togithub.com/sponsors/typicode). Thank you! ##### Migrate ##### Lowdb v1 ```js const low = require('lowdb') const FileSync = require('lowdb/adapters/FileSync') const adapter = new FileSync('db.json') const db = low(adapter) // Set some defaults db.defaults({ posts: [], user: {} }) .write() // Add a post db.get('posts') .push({ id: 1, title: 'lowdb is awesome'}) .write() // Set a user name using Lodash shorthand syntax db.set('user.name', 'typicode') .write() ``` ##### Lowdb v2 ```js import { Low, FileSync } from 'lowdb' const adapter = new FileSync('db.json') const db = new Low(adapter) // Set some defaults db.data ||= { posts: [], user: {} }) db.write() // Add a post db.data .posts .push({ id: 1, title: 'lowdb is awesome'}) db.write() // Set a user name using plain JS db.data.user.name = 'typicode' db.write() ``` **If you're using TypeScript, data can now be typed:** ```ts type Post = { id: number title: string } type Data = { posts: Post[] } const db = new Low(adapter) ``` **To continue using lodash with lowdb:** ```sh npm install lodash ``` ```js import lodash from 'lodash' // Set a user name using Lodash shorthand syntax db.chain = lodash.chain(db.data) db.chain .set('user.name', 'typicode') .value() db.write() ``` ##### Breaking changes The following methods and properties have been removed: - `db.getState` (use `db.data` instead) - `db.setState` (use `db.data = ...` instead) - `db._`

Configuration

πŸ“… Schedule: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

πŸ”• Ignore: Close this PR and you won't be reminded about this update again.



This PR was generated by Mend Renovate. View the repository job log.

bitwarden-bot commented 6 months ago

Internal tracking:

bitwarden-bot commented 6 months ago

Logo Checkmarx One – Scan Summary & Details – d6babcaf-33b7-44b6-9a14-76261d79f3af

No New Or Fixed Issues Found

sonarcloud[bot] commented 3 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud