Skip to content

feat: add @joshdb/indexeddb #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions benchmarks/src/lib/constants/benchmark-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [
}
},
{
name: `${Method.Random} (Duplicates)`,
name: `${Method.Random} (Unique)`,

beforeAll: async ({ provider, entries }) => {
await provider[Method.SetMany]({
Expand All @@ -402,7 +402,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [
},

run: async ({ provider }) => {
await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, duplicates: true });
await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, unique: true });
}
},
{
Expand All @@ -418,11 +418,11 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [
},

run: async ({ provider }) => {
await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, duplicates: false });
await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, unique: false });
}
},
{
name: `${Method.RandomKey} (Duplicates)`,
name: `${Method.RandomKey} (Unique)`,

beforeAll: async ({ provider, entries }) => {
await provider[Method.SetMany]({
Expand All @@ -434,7 +434,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [
},

run: async ({ provider }) => {
await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, duplicates: true });
await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, unique: true });
}
},
{
Expand All @@ -450,7 +450,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [
},

run: async ({ provider }) => {
await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, duplicates: false });
await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, unique: false });
}
},
{
Expand Down
3 changes: 3 additions & 0 deletions packages/indexeddb/.cliff-jumperrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: indexeddb
org: joshdb
packagePath: packages/indexeddb
1 change: 1 addition & 0 deletions packages/indexeddb/.typedoc-json-parserrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json: 'docs/api.json'
3 changes: 3 additions & 0 deletions packages/indexeddb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to this project will be documented in this file.
33 changes: 33 additions & 0 deletions packages/indexeddb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div align="center">

![Josh Logo](https://evie.codes/josh-light.png)

# @joshdb/indexeddb

**A provider for `@joshdb/core`**

[![GitHub](https://img.shields.io/github/license/josh-development/providers)](https://github.com/josh-development/providers/blob/main/LICENSE.md)
[![codecov](https://codecov.io/gh/josh-development/providers/branch/main/graph/badge.svg?token=JnJcjxqT3k)](https://codecov.io/gh/josh-development/providers)
[![npm](https://img.shields.io/npm/v/@joshdb/indexeddb?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@joshdb/indexeddb)

[![Support Server](https://discord.com/api/guilds/298508738623438848/embed.png?style=banner2)](https://discord.gg/N7ZKH3P)

</div>

## Description

A Josh provider

## Features

- Written in TypeScript
- Offers CommonJS and ESM bundles
- Fully tested

## Installation

You can use the following command to install this package, or replace `npm install` with your package manager of choice.

```sh
npm install @joshdb/indexeddb
```
61 changes: 61 additions & 0 deletions packages/indexeddb/cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[changelog]
header = """
# Changelog

All notable changes to this project will be documented in this file.

"""
body = """
{% if version %}\
# [{{ version | trim_start_matches(pat="v") }}]\
{% if previous %}\
{% if previous.version %}\
(https://github.com/josh-development/providers/compare/{{ previous.version }}...{{ version }})\
{% else %}\
(https://github.com/josh-development/providers/tree/{{ version }})\
{% endif %}\
{% endif %} \
- ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}\
# [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
## {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}\
**{{commit.scope}}:** \
{% endif %}\
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/josh-development/providers/commit/{{ commit.id }}))\
{% if commit.breaking %}\
{% for breakingChange in commit.footers %}\
\n{% raw %} {% endraw %}- 💥 **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
{% endfor %}\
{% endif %}\
{% endfor %}
{% endfor %}\n
"""
trim = true
footer = ""

[git]
conventional_commits = true
filter_unconventional = true
commit_parsers = [
{ message = "^feat", group = "🚀 Features" },
{ message = "^fix", group = "🐛 Bug Fixes" },
{ message = "^docs", group = "📝 Documentation" },
{ message = "^perf", group = "🏃 Performance" },
{ message = "^refactor", group = "🏠 Refactor" },
{ message = ".*deprecated", body = ".*deprecated", group = "🚨 Deprecation" },
{ message = "^revert", skip = true },
{ message = "^style", group = "🪞 Styling" },
{ message = "^test", group = "🧪 Testing" },
{ message = "^chore", skip = true },
{ message = "^ci", skip = true },
{ body = ".*security", group = "🛡️ Security" },
]
filter_commits = true
tag_pattern = "@joshdb/indexeddb@[0-9]*"
ignore_tags = ""
topo_order = false
sort_commits = "newest"
65 changes: 65 additions & 0 deletions packages/indexeddb/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@joshdb/indexeddb",
"version": "2.0.0",
"description": "A Josh provider",
"author": "Évelyne Lachance <eslachance@gmail.com> (https://evie.codes/)",
"contributors": [
"WilsontheWolf (https://shorty.systems/)",
"DanCodes <dan@dancodes.online> (https://dancodes.online/)"
],
"license": "Apache-2.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
"browser": "dist/index.umd.js",
"unpkg": "dist/index.umd.js",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"sideEffects": false,
"scripts": {
"test": "vitest run",
"docs": "typedoc-json-parser",
"lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
"build": "rollup -c rollup.config.ts",
"prepack": "rollup-type-bundler",
"bump": "cliff-jumper",
"check-update": "cliff-jumper --dry-run"
},
"dependencies": {
"@joshdb/provider": "2.0.0-next.1c9d8d9.0",
"@sapphire/utilities": "^3.12.0",
"property-helpers": "^2.0.0"
},
"devDependencies": {
"@favware/cliff-jumper": "^2.0.1",
"@favware/rollup-type-bundler": "^1.0.11",
"@vitest/coverage-v8": "^0.32.0",
"fake-indexeddb": "^4.0.1",
"typedoc": "^0.24.8",
"typedoc-json-parser": "^8.1.2",
"vitest": "^0.32.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/josh-development/providers.git"
},
"files": [
"dist",
"!dist/*tsbuildinfo"
],
"engines": {
"node": ">=16.6.0",
"npm": ">=7.0.0"
},
"keywords": [],
"bugs": {
"url": "https://github.com/josh-development/providers/issues"
},
"homepage": "https://josh.evie.dev",
"publishConfig": {
"access": "public"
}
}
34 changes: 34 additions & 0 deletions packages/indexeddb/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { resolve } from 'path';
import cleaner from 'rollup-plugin-cleaner';
import typescript from 'rollup-plugin-typescript2';
import versionInjector from 'rollup-plugin-version-injector';

export default {
input: 'src/index.ts',
output: [
{
file: './dist/index.js',
format: 'cjs',
exports: 'named',
sourcemap: true
},
{
file: './dist/index.mjs',
format: 'es',
exports: 'named',
sourcemap: true
},
{
file: './dist/index.umd.js',
format: 'umd',
name: 'JoshIndexedDBProvider',
exports: 'named',
sourcemap: true,
globals: {
'@joshdb/provider': 'JoshProvider'
}
}
],
external: ['@joshdb/provider'],
plugins: [cleaner({ targets: ['./dist'] }), typescript({ tsconfig: resolve(process.cwd(), 'src', 'tsconfig.json') }), versionInjector()]
};
1 change: 1 addition & 0 deletions packages/indexeddb/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/IndexedDBProvider';
Loading