From dc06bbe829f85bb63db41aa9c61feaf5489fab43 Mon Sep 17 00:00:00 2001
From: Art <4998038+Alorel@users.noreply.github.com>
Date: Sat, 27 Jul 2024 13:40:34 +0100
Subject: [PATCH] refactor: Redesign API for `serde` support
BREAKING CHANGE: API redesigned for serde & Stream support & msrv bumped to 1.75. See [MIGRATING/v0.6.0.md](https://github.com/Alorel/rust-indexed-db/blob/v0.6.0/MIGRATING/v0.6.0.md) for details.
---
.github/actions/changelog/action.yml | 56 ++
.github/actions/prep-release/action.yml | 30 -
.github/actions/release/action.yml | 33 -
.github/workflows/_test.yml | 71 --
.github/workflows/inc/unit-test.yml | 59 ++
.github/workflows/release.yml | 120 +++-
.github/workflows/test.yml | 122 +++-
.gitignore | 1 +
.idea/dictionaries/.gitignore | 2 +
.idea/dictionaries/default_user.xml | 7 +
.idea/indexed_db.iml | 6 +-
.idea/runConfigurations/Sync_readme.xml | 17 -
.../{Build.xml => build.xml} | 5 +-
.idea/runConfigurations/build_tests.xml | 20 +
.../runConfigurations/build_tests_default.xml | 20 +
.../{Clippy.xml => clippy.xml} | 6 +-
.../{Clippy__fix.xml => clippy__fix.xml} | 6 +-
.idea/runConfigurations/{Doc.xml => doc.xml} | 10 +-
.idea/runConfigurations/{Fmt.xml => fmt.xml} | 4 +-
.idea/runConfigurations/test_all.xml | 17 +
.idea/runConfigurations/test_all_chrome.xml | 17 +
.idea/runConfigurations/test_all_firefox.xml | 17 +
.idea/runConfigurations/test_default.xml | 17 +
Cargo.lock | 660 ++++++++++++++++--
Cargo.toml | 173 +++--
README.md | 144 ++--
internal_macros/Cargo.toml | 18 +
internal_macros/README.md | 2 +
internal_macros/src/build_into_fut.rs | 66 ++
internal_macros/src/commons/fn_target.rs | 45 ++
internal_macros/src/commons/mod.rs | 3 +
internal_macros/src/errdoc.rs | 70 ++
internal_macros/src/errdoc/namespace.rs | 206 ++++++
internal_macros/src/from_dom_exception.rs | 213 ++++++
internal_macros/src/generate_with.rs | 97 +++
internal_macros/src/generic_bounds.rs | 77 ++
internal_macros/src/lib.rs | 93 +++
internal_macros/src/poll_unpinned.rs | 55 ++
internal_macros/src/struct_name.rs | 42 ++
internal_macros/src/struct_name_debug.rs | 116 +++
src/build.rs | 62 ++
src/cursor.rs | 184 +++++
src/cursor/base_cursor.rs | 251 +++++++
src/cursor/cursor_sys.rs | 33 +
src/cursor/key_cursor.rs | 159 +++++
src/cursor/stream.rs | 157 +++++
src/cursor/update.rs | 110 +++
src/database.rs | 181 +++++
src/database/db_sys.rs | 26 +
src/database/store_builder.rs | 136 ++++
src/database/store_name.rs | 174 +++++
src/database/tx_builder.rs | 133 ++++
src/database/version_change_event.rs | 38 +
src/database/version_change_listener.rs | 114 +++
src/date.rs | 67 ++
src/dom_string_iterator.rs | 51 --
src/error.rs | 71 ++
src/error/dom_exception.rs | 81 +++
src/error/js_error.rs | 64 ++
src/error/open_db.rs | 29 +
src/error/serde.rs | 79 +++
src/error/serialisation.rs | 13 +
src/error/simple_value.rs | 97 +++
src/error/unexpected_data.rs | 34 +
src/factory.rs | 143 ++++
src/factory/db_version.rs | 71 ++
src/factory/list_dbs.rs | 83 +++
src/factory/req_builder.rs | 252 +++++++
src/future/array_map.rs | 62 ++
src/future/basic.rs | 66 ++
src/future/cursor.rs | 69 ++
src/future/cursor_next.rs | 69 ++
src/future/get_all.rs | 31 +
src/future/list_dbs.rs | 13 +
src/future/maybe_errored.rs | 44 ++
src/future/mod.rs | 31 +
src/future/open_db.rs | 101 +++
src/future/open_db/listener.rs | 121 ++++
src/future/open_db/listeners.rs | 87 +++
src/future/request.rs | 72 ++
src/future/request/listeners.rs | 69 ++
src/future/request/untyped.rs | 78 +++
src/future/traits.rs | 32 +
src/idb_cursor.rs | 362 ----------
src/idb_cursor/idb_cursor_with_value.rs | 65 --
src/idb_database.rs | 454 ------------
src/idb_database/idb_version_change_event.rs | 84 ---
src/idb_index.rs | 36 -
src/idb_key_path.rs | 118 ----
src/idb_object_store.rs | 326 ---------
.../idb_object_store_parameters.rs | 51 --
src/idb_query_source.rs | 243 -------
src/idb_transaction.rs | 136 ----
src/idb_transaction/idb_transaction_future.rs | 29 -
.../idb_transaction_listeners.rs | 107 ---
src/idb_transaction/idb_transaction_result.rs | 34 -
src/index.rs | 37 +
src/index/index_builder.rs | 138 ++++
src/index/object_store_ext.rs | 52 ++
src/internal_utils.rs | 147 +---
src/internals.rs | 29 +
src/iter/array_map.rs | 54 ++
src/iter/dom_string_list.rs | 43 ++
src/iter/get_all.rs | 43 ++
src/iter/list_dbs.rs | 13 +
src/iter/mod.rs | 17 +
src/key_path.rs | 177 +++++
src/key_range.rs | 141 ++++
src/lib.rs | 381 ++--------
src/object_store.rs | 162 +++++
src/object_store/add_put.rs | 340 +++++++++
src/object_store/delete.rs | 52 ++
src/prelude.rs | 20 +-
src/primitive.rs | 25 +
src/primitive/from_js.rs | 298 ++++++++
src/primitive/switch.rs | 127 ++++
src/primitive/try_to_js.rs | 165 +++++
src/query_source.rs | 359 ++++++++++
src/query_source/count.rs | 108 +++
src/query_source/cursor.rs | 354 ++++++++++
src/query_source/get.rs | 70 ++
src/query_source/get_all.rs | 346 +++++++++
src/query_source/get_key.rs | 72 ++
src/request/futures/count_future.rs | 29 -
.../cursor/idb_cursor_advancement_future.rs | 30 -
.../futures/cursor/idb_cursor_future.rs | 65 --
.../cursor/idb_cursor_with_value_future.rs | 32 -
src/request/futures/cursor/mod.rs | 7 -
.../futures/idb_open_db_request_future.rs | 26 -
src/request/futures/idb_request_future.rs | 144 ----
src/request/futures/jscast_request_future.rs | 49 --
src/request/futures/map.rs | 36 -
src/request/futures/mod.rs | 67 --
src/request/futures/optional_jsval_future.rs | 29 -
src/request/futures/void_future.rs | 20 -
src/request/idb_open_db_request_ref.rs | 132 ----
src/request/idb_request_ref.rs | 59 --
src/request/mod.rs | 68 --
src/request/open_db_request.rs | 41 --
src/request/request_like.rs | 16 -
src/request/void_open_db_request.rs | 13 -
src/request/void_request.rs | 12 -
src/serde.rs | 35 +
src/transaction.rs | 162 +++++
src/transaction/listeners.rs | 98 +++
src/transaction/options.rs | 108 +++
src/transaction/tx_sys.rs | 11 +
src/typed_array.rs | 208 ++++++
tests/browser.rs | 6 +
tests/dedicated_worker.rs | 5 +
tests/shared_worker.rs | 5 +
tests/tests/database/delete_and_list.rs | 48 ++
tests/tests/database/delete_obj_store.rs | 42 ++
tests/tests/database/mod.rs | 18 +
tests/tests/database/obj_store_create.rs | 50 ++
tests/tests/database/open.rs | 62 ++
tests/tests/database/transaction.rs | 20 +
tests/tests/database/versionchange.rs | 46 ++
tests/tests/date.rs | 16 +
tests/tests/index/create.rs | 29 +
tests/tests/index/mod.rs | 9 +
tests/tests/index/query_source.rs | 190 +++++
tests/tests/index/query_source/cursor.rs | 412 +++++++++++
tests/tests/key_path.rs | 30 +
tests/tests/mod.rs | 182 +++++
tests/tests/object_store/add_put.rs | 104 +++
tests/tests/object_store/clear.rs | 20 +
tests/tests/object_store/delete.rs | 61 ++
tests/tests/object_store/mod.rs | 4 +
tests/tests/object_store/query_source.rs | 168 +++++
.../tests/object_store/query_source/cursor.rs | 593 ++++++++++++++++
.../object_store/query_source/key_path.rs | 52 ++
tests/tests/primitive.rs | 120 ++++
tests/tests/transaction/commit_rollback.rs | 35 +
tests/tests/transaction/mod.rs | 1 +
tests/tests/utils/conditional_build.rs | 77 ++
tests/tests/utils/dummy_data.rs | 236 +++++++
tests/tests/utils/init.rs | 50 ++
tests/tests/utils/mod.rs | 17 +
179 files changed, 12822 insertions(+), 3779 deletions(-)
create mode 100644 .github/actions/changelog/action.yml
delete mode 100644 .github/actions/prep-release/action.yml
delete mode 100644 .github/actions/release/action.yml
delete mode 100644 .github/workflows/_test.yml
create mode 100644 .github/workflows/inc/unit-test.yml
create mode 100644 .idea/dictionaries/.gitignore
create mode 100644 .idea/dictionaries/default_user.xml
delete mode 100644 .idea/runConfigurations/Sync_readme.xml
rename .idea/runConfigurations/{Build.xml => build.xml} (76%)
create mode 100644 .idea/runConfigurations/build_tests.xml
create mode 100644 .idea/runConfigurations/build_tests_default.xml
rename .idea/runConfigurations/{Clippy.xml => clippy.xml} (81%)
rename .idea/runConfigurations/{Clippy__fix.xml => clippy__fix.xml} (79%)
rename .idea/runConfigurations/{Doc.xml => doc.xml} (83%)
rename .idea/runConfigurations/{Fmt.xml => fmt.xml} (91%)
create mode 100644 .idea/runConfigurations/test_all.xml
create mode 100644 .idea/runConfigurations/test_all_chrome.xml
create mode 100644 .idea/runConfigurations/test_all_firefox.xml
create mode 100644 .idea/runConfigurations/test_default.xml
create mode 100644 internal_macros/Cargo.toml
create mode 100644 internal_macros/README.md
create mode 100644 internal_macros/src/build_into_fut.rs
create mode 100644 internal_macros/src/commons/fn_target.rs
create mode 100644 internal_macros/src/commons/mod.rs
create mode 100644 internal_macros/src/errdoc.rs
create mode 100644 internal_macros/src/errdoc/namespace.rs
create mode 100644 internal_macros/src/from_dom_exception.rs
create mode 100644 internal_macros/src/generate_with.rs
create mode 100644 internal_macros/src/generic_bounds.rs
create mode 100644 internal_macros/src/lib.rs
create mode 100644 internal_macros/src/poll_unpinned.rs
create mode 100644 internal_macros/src/struct_name.rs
create mode 100644 internal_macros/src/struct_name_debug.rs
create mode 100644 src/build.rs
create mode 100644 src/cursor.rs
create mode 100644 src/cursor/base_cursor.rs
create mode 100644 src/cursor/cursor_sys.rs
create mode 100644 src/cursor/key_cursor.rs
create mode 100644 src/cursor/stream.rs
create mode 100644 src/cursor/update.rs
create mode 100644 src/database.rs
create mode 100644 src/database/db_sys.rs
create mode 100644 src/database/store_builder.rs
create mode 100644 src/database/store_name.rs
create mode 100644 src/database/tx_builder.rs
create mode 100644 src/database/version_change_event.rs
create mode 100644 src/database/version_change_listener.rs
create mode 100644 src/date.rs
delete mode 100644 src/dom_string_iterator.rs
create mode 100644 src/error.rs
create mode 100644 src/error/dom_exception.rs
create mode 100644 src/error/js_error.rs
create mode 100644 src/error/open_db.rs
create mode 100644 src/error/serde.rs
create mode 100644 src/error/serialisation.rs
create mode 100644 src/error/simple_value.rs
create mode 100644 src/error/unexpected_data.rs
create mode 100644 src/factory.rs
create mode 100644 src/factory/db_version.rs
create mode 100644 src/factory/list_dbs.rs
create mode 100644 src/factory/req_builder.rs
create mode 100644 src/future/array_map.rs
create mode 100644 src/future/basic.rs
create mode 100644 src/future/cursor.rs
create mode 100644 src/future/cursor_next.rs
create mode 100644 src/future/get_all.rs
create mode 100644 src/future/list_dbs.rs
create mode 100644 src/future/maybe_errored.rs
create mode 100644 src/future/mod.rs
create mode 100644 src/future/open_db.rs
create mode 100644 src/future/open_db/listener.rs
create mode 100644 src/future/open_db/listeners.rs
create mode 100644 src/future/request.rs
create mode 100644 src/future/request/listeners.rs
create mode 100644 src/future/request/untyped.rs
create mode 100644 src/future/traits.rs
delete mode 100644 src/idb_cursor.rs
delete mode 100644 src/idb_cursor/idb_cursor_with_value.rs
delete mode 100644 src/idb_database.rs
delete mode 100644 src/idb_database/idb_version_change_event.rs
delete mode 100644 src/idb_index.rs
delete mode 100644 src/idb_key_path.rs
delete mode 100644 src/idb_object_store.rs
delete mode 100644 src/idb_object_store/idb_object_store_parameters.rs
delete mode 100644 src/idb_query_source.rs
delete mode 100644 src/idb_transaction.rs
delete mode 100644 src/idb_transaction/idb_transaction_future.rs
delete mode 100644 src/idb_transaction/idb_transaction_listeners.rs
delete mode 100644 src/idb_transaction/idb_transaction_result.rs
create mode 100644 src/index.rs
create mode 100644 src/index/index_builder.rs
create mode 100644 src/index/object_store_ext.rs
create mode 100644 src/internals.rs
create mode 100644 src/iter/array_map.rs
create mode 100644 src/iter/dom_string_list.rs
create mode 100644 src/iter/get_all.rs
create mode 100644 src/iter/list_dbs.rs
create mode 100644 src/iter/mod.rs
create mode 100644 src/key_path.rs
create mode 100644 src/key_range.rs
create mode 100644 src/object_store.rs
create mode 100644 src/object_store/add_put.rs
create mode 100644 src/object_store/delete.rs
create mode 100644 src/primitive.rs
create mode 100644 src/primitive/from_js.rs
create mode 100644 src/primitive/switch.rs
create mode 100644 src/primitive/try_to_js.rs
create mode 100644 src/query_source.rs
create mode 100644 src/query_source/count.rs
create mode 100644 src/query_source/cursor.rs
create mode 100644 src/query_source/get.rs
create mode 100644 src/query_source/get_all.rs
create mode 100644 src/query_source/get_key.rs
delete mode 100644 src/request/futures/count_future.rs
delete mode 100644 src/request/futures/cursor/idb_cursor_advancement_future.rs
delete mode 100644 src/request/futures/cursor/idb_cursor_future.rs
delete mode 100644 src/request/futures/cursor/idb_cursor_with_value_future.rs
delete mode 100644 src/request/futures/cursor/mod.rs
delete mode 100644 src/request/futures/idb_open_db_request_future.rs
delete mode 100644 src/request/futures/idb_request_future.rs
delete mode 100644 src/request/futures/jscast_request_future.rs
delete mode 100644 src/request/futures/map.rs
delete mode 100644 src/request/futures/mod.rs
delete mode 100644 src/request/futures/optional_jsval_future.rs
delete mode 100644 src/request/futures/void_future.rs
delete mode 100644 src/request/idb_open_db_request_ref.rs
delete mode 100644 src/request/idb_request_ref.rs
delete mode 100644 src/request/mod.rs
delete mode 100644 src/request/open_db_request.rs
delete mode 100644 src/request/request_like.rs
delete mode 100644 src/request/void_open_db_request.rs
delete mode 100644 src/request/void_request.rs
create mode 100644 src/serde.rs
create mode 100644 src/transaction.rs
create mode 100644 src/transaction/listeners.rs
create mode 100644 src/transaction/options.rs
create mode 100644 src/transaction/tx_sys.rs
create mode 100644 src/typed_array.rs
create mode 100644 tests/browser.rs
create mode 100644 tests/dedicated_worker.rs
create mode 100644 tests/shared_worker.rs
create mode 100644 tests/tests/database/delete_and_list.rs
create mode 100644 tests/tests/database/delete_obj_store.rs
create mode 100644 tests/tests/database/mod.rs
create mode 100644 tests/tests/database/obj_store_create.rs
create mode 100644 tests/tests/database/open.rs
create mode 100644 tests/tests/database/transaction.rs
create mode 100644 tests/tests/database/versionchange.rs
create mode 100644 tests/tests/date.rs
create mode 100644 tests/tests/index/create.rs
create mode 100644 tests/tests/index/mod.rs
create mode 100644 tests/tests/index/query_source.rs
create mode 100644 tests/tests/index/query_source/cursor.rs
create mode 100644 tests/tests/key_path.rs
create mode 100644 tests/tests/mod.rs
create mode 100644 tests/tests/object_store/add_put.rs
create mode 100644 tests/tests/object_store/clear.rs
create mode 100644 tests/tests/object_store/delete.rs
create mode 100644 tests/tests/object_store/mod.rs
create mode 100644 tests/tests/object_store/query_source.rs
create mode 100644 tests/tests/object_store/query_source/cursor.rs
create mode 100644 tests/tests/object_store/query_source/key_path.rs
create mode 100644 tests/tests/primitive.rs
create mode 100644 tests/tests/transaction/commit_rollback.rs
create mode 100644 tests/tests/transaction/mod.rs
create mode 100644 tests/tests/utils/conditional_build.rs
create mode 100644 tests/tests/utils/dummy_data.rs
create mode 100644 tests/tests/utils/init.rs
create mode 100644 tests/tests/utils/mod.rs
diff --git a/.github/actions/changelog/action.yml b/.github/actions/changelog/action.yml
new file mode 100644
index 0000000..0d27730
--- /dev/null
+++ b/.github/actions/changelog/action.yml
@@ -0,0 +1,56 @@
+name: Generate changelog
+description: Generate the changelog
+outputs:
+ release-type:
+ description: Release type
+ value: ${{ steps.log.outputs.release-type }}
+ version:
+ description: Next version
+ value: ${{ steps.log.outputs.next-version }}
+ issues-closed:
+ description: Issues closed
+ value: ${{ steps.log.outputs.issues-closed }}
+ changelog:
+ description: Changelog value
+ value: ${{ steps.log.outputs.changelog }}
+ should-release:
+ description: Should release
+ value: ${{ steps.log.outputs.should-release }}
+runs:
+ using: composite
+ steps:
+ - name: Conditional args
+ id: args
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ shell: bash
+ run: >
+ echo "before=${{ github.ref_name }}" >> $GITHUB_OUTPUT &&
+ echo "until=${{ github.ref_name }}" >> $GITHUB_OUTPUT
+
+ - name: Get last tag
+ id: last-tag
+ uses: alorel-actions/semantic-release-lite/last-tag@v0
+ with:
+ before: ${{ steps.args.outputs.before }}
+
+ - name: Generate changelog
+ id: log
+ uses: alorel-actions/semantic-release-lite/generate-changelog@v0
+ with:
+ last-tag: ${{ steps.last-tag.outputs.last-tag }}
+ from: ${{ steps.last-tag.outputs.last-tag }}
+ until: ${{ steps.args.outputs.until || github.sha }}
+ stay-at-zero: true
+ minor-types: |
+ feat: Features
+ rm: Removals
+ patch-types: |
+ fix: Bug Fixes
+ perf: Performance
+ chore: Maintenance
+ deps: Dependency updates
+ refactor: Refactors
+ docs: Documentation
+ trivial-types: |
+ ci: CI & Build
+ build: CI & Build
diff --git a/.github/actions/prep-release/action.yml b/.github/actions/prep-release/action.yml
deleted file mode 100644
index e232ed4..0000000
--- a/.github/actions/prep-release/action.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: Prep release
-description: Prepare the release
-inputs:
- release-type:
- description: Release type
- required: true
- version:
- description: Next version
- required: true
-outputs:
- in-sync:
- description: Sync check
- value: ${{ steps.sync-check.outputs.in-sync }}
-runs:
- using: composite
- steps:
- - name: Git identity
- uses: alorel-actions/git-ident@v1
- - name: Init toolchain
- uses: alorel-actions/cargo/init@v1
- id: toolchain
- with:
- cache-prefix: release
- - name: cargo-bump
- uses: alorel-actions/cargo/bump@v1
- with:
- release-type: ${{ inputs.release-type }}
- - name: Sync check
- id: sync-check
- uses: alorel-actions/semantic-release-lite/sync-check@v0
diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml
deleted file mode 100644
index e09a911..0000000
--- a/.github/actions/release/action.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-name: Release
-description: Do the release
-inputs:
- version:
- description: Version to release
- required: true
- changelog:
- description: The changelog
- required: true
- issues-closed:
- description: Issues we've closed
- crates-io-token:
- description: crates.io API token
- required: true
-runs:
- using: composite
- steps:
- - uses: alorel-actions/cargo/release-git@v1
- with:
- version: ${{ inputs.version }}
- changelog: ${{ inputs.changelog }}
-
- - name: Publish crate
- shell: bash
- run: cargo publish --locked --token ${{ inputs.crates-io-token }}
-
- - name: Notify
- if: ${{ inputs.issues-closed }}
- uses: alorel-actions/semantic-release-lite/notify@v0
- with:
- tag: ${{ inputs.version }}
- issues: ${{ inputs.issues-closed }}
- allow-out-of-sync: true
diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml
deleted file mode 100644
index a5c4677..0000000
--- a/.github/workflows/_test.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: Test
-on:
- workflow_call: {}
-
-permissions:
- contents: read
-
-env:
- CARGO_INCREMENTAL: 0
- RUSTFLAGS: --deny warnings
-
-jobs:
- lint:
- name: Lint
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Init toolchain
- uses: alorel-actions/cargo/init@v1
- id: toolchain
- with:
- components: rustfmt,clippy
- cache-prefix: lint
- local: true
-
- - name: Fmt
- run: cargo fmt --check
-
- - name: Clippy
- run: cargo clippy --workspace --tests
-
- - name: Doc
- run: cargo doc --workspace --no-deps
-
- test:
- name: Test on ${{matrix.toolchain}}
- runs-on: ubuntu-latest
- strategy:
- matrix:
- toolchain:
- - nightly-2024-07-25
- - stable
- - 1.74.0
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Init toolchain
- uses: alorel-actions/cargo/init@v1
- with:
- toolchain: ${{matrix.toolchain}}
- cache-prefix: test
- local: true
-
- - name: Install wasm-pack
- uses: alorel-actions/cargo-global-dep@v1
- with:
- name: wasm-pack
- version: 0.13.0
-
- - name: Test (no features)
- run: wasm-pack test --headless --firefox --chrome --locked --no-default-features
-
- - name: Test (default features)
- run: wasm-pack test --headless --firefox --chrome --locked
-
- - name: Test (nightly)
- run: wasm-pack test --headless --firefox --chrome --locked --all-features
- if: ${{startsWith(matrix.toolchain, 'nightly')}}
diff --git a/.github/workflows/inc/unit-test.yml b/.github/workflows/inc/unit-test.yml
new file mode 100644
index 0000000..d0b5ec1
--- /dev/null
+++ b/.github/workflows/inc/unit-test.yml
@@ -0,0 +1,59 @@
+name: Unit test
+on:
+ workflow_call:
+ inputs:
+ toolchain:
+ description: Rust version
+ default: stable
+ type: string
+ os:
+ description: OS to run on
+ default: ubuntu-latest
+ type: string
+ flags:
+ description: cli args
+ type: string
+
+permissions:
+ contents: read
+
+env:
+ CARGO_INCREMENTAL: 0
+ RUSTFLAGS: --deny warnings
+
+jobs:
+ test:
+ name: Test with ${{ inputs.flags || 'no flags' }} on ${{ inputs.os }}, ${{ inputs.toolchain }}
+ runs-on: ${{ inputs.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Init toolchain
+ uses: alorel-actions/cargo/init@v1
+ with:
+ toolchain: ${{ inputs.toolchain }}
+ cache-prefix: test
+ cache-suffix: ${{inputs.flags}}
+ local: true
+
+ - name: Build
+ run: cargo build --locked ${{ inputs.flags }}
+
+ - name: Install wasm-pack
+ uses: alorel-actions/cargo-global-dep@v1
+ with:
+ name: wasm-pack
+ version: 0.13.0
+
+ - name: Test (Chrome)
+ if: ${{ runner.os != 'macOS' }}
+ run: wasm-pack test --chrome --headless --locked ${{ inputs.flags }}
+
+ - name: Test (Firefox)
+ if: ${{ runner.os != 'macOS' }}
+ run: wasm-pack test --firefox --headless --locked ${{ inputs.flags }}
+
+ - name: Test (Safari)
+ if: ${{ runner.os == 'macOS' }}
+ run: wasm-pack test --safari --headless --locked ${{ inputs.flags }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 08e301e..a673e3b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,7 +1,7 @@
name: Release
concurrency: release
on:
- workflow_dispatch: {}
+ workflow_dispatch: { }
permissions:
contents: read
@@ -13,14 +13,38 @@ env:
jobs:
test:
name: Test
- uses: ./.github/workflows/_test.yml
+ uses: ./.github/workflows/test.yml
+ with:
+ is-workflow-call: true
- release:
- name: Release
+ prepare:
+ name: Set up
+ runs-on: ubuntu-latest
+ outputs:
+ release-type: ${{ steps.changelog.outputs.release-type }}
+ version: ${{ steps.changelog.outputs.version }}
+ issues-closed: ${{ steps.changelog.outputs.issues-closed }}
+ changelog: ${{ steps.changelog.outputs.changelog }}
+ should-release: ${{ steps.changelog.outputs.should-release }}
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+
+ - name: Generate changelog
+ id: changelog
+ uses: ./.github/actions/changelog
+
+ git:
+ name: Git release
+ runs-on: ubuntu-latest
needs:
- test
- runs-on: ubuntu-latest
- environment: crates-io
+ - prepare
+ if: ${{ needs.prepare.outputs.should-release }}
+ environment: github
permissions:
contents: write
steps:
@@ -31,37 +55,63 @@ jobs:
fetch-tags: true
token: ${{ secrets.GH_TOKEN }}
- - name: Parse
- id: parse
- uses: alorel-actions/semantic-release-lite@v0
+ - name: Git identity
+ uses: alorel-actions/git-ident@v1
+
+ - name: Init toolchain
+ uses: alorel-actions/cargo/init@v1
+ with:
+ cache-prefix: release
+
+ - name: cargo-bump
+ uses: alorel-actions/cargo/bump@v1
+ with:
+ release-type: ${{ needs.prepare.outputs.release-type }}
+
+ - name: Git release
+ uses: alorel-actions/cargo/release-git@v1
with:
- stay-at-zero: true
- minor-types: |
- feat: Features
- patch-types: |
- fix: Bug Fixes
- trivial-types: |
- chore: Maintenance
- deps: Dependency updates
- ci: CI & Build
- build: CI & Build
- refactor: Refactors
- docs: Documentation
- perf: Performance
+ version: ${{ needs.prepare.outputs.version }}
+ changelog: ${{ needs.prepare.outputs.changelog }}
- - name: Prep release
- if: ${{ steps.parse.outputs.should-release }}
- id: prep
- uses: ./.github/actions/prep-release
+ release:
+ name: Crate release
+ needs:
+ - git
+ if: ${{ needs.prepare.outputs.should-release }}
+ runs-on: ubuntu-latest
+ environment: crates-io
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout
with:
- release-type: ${{ steps.parse.outputs.release-type }}
- version: ${{ steps.parse.outputs.next-version }}
+ fetch-tags: true
+ ref: ${{ needs.prepare.outputs.version }}
- - name: Release
- if: ${{ steps.prep.outputs.in-sync }}
- uses: ./.github/actions/release
+ - name: Init toolchain
+ uses: alorel-actions/cargo/init@v1
+ with:
+ cache-prefix: release
+
+ - name: Publish crate
+ run: cargo publish --locked --token ${{ secrets.CRATES_IO_TOKEN }}
+
+ notify:
+ name: Notify closed issues
+ needs:
+ - release
+ - prepare
+ if: ${{ needs.prepare.outputs.should-release && needs.prepare.outputs.issues-closed }}
+ runs-on: ubuntu-latest
+ environment: github
+ permissions:
+ contents: write
+ steps:
+ - name: Notify
+ if: ${{ needs.prepare.outputs.issues-closed }}
+ uses: alorel-actions/semantic-release-lite/notify@v0
with:
- version: ${{ steps.parse.outputs.next-version }}
- changelog: ${{ steps.parse.outputs.changelog }}
- issues-closed: ${{ steps.parse.outputs.issues-closed }}
- crates-io-token: ${{ secrets.CRATES_IO_TOKEN }}
+ tag: ${{ needs.prepare.outputs.version }}
+ issues: ${{ needs.prepare.outputs.issues-closed }}
+ allow-out-of-sync: true
+ gh-token: ${{ secrets.GH_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 943b239..fd735f3 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,5 +1,10 @@
name: Test
on:
+ workflow_call:
+ inputs:
+ is-workflow-call:
+ type: boolean
+ required: true
push:
branches:
- master
@@ -28,7 +33,118 @@ env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: --deny warnings
+concurrency:
+ group: test-${{ github.ref }}
+ cancel-in-progress: ${{ !inputs.is-workflow-call }}
+
jobs:
- test:
- name: Test
- uses: ./.github/workflows/_test.yml
+ doc:
+ name: Doc build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Init toolchain
+ uses: alorel-actions/cargo/init@v1
+ id: toolchain
+ with:
+ toolchain: nightly-2024-09-29
+ cache-prefix: doc
+ local: true
+
+ - name: Doc
+ run: cargo doc --workspace --all-features --no-deps
+ env:
+ RUSTDOCFLAGS: --cfg doc_cfg --deny warnings
+
+ - name: Cleanup
+ run: rm -rf target/doc
+
+ lint:
+ name: Lint
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Init toolchain
+ uses: alorel-actions/cargo/init@v1
+ id: toolchain
+ with:
+ components: rustfmt,clippy
+ cache-prefix: lint
+ local: true
+
+ - name: Fmt
+ run: cargo fmt --check
+
+ - name: Clippy
+ run: cargo clippy --workspace --tests --all-features --locked --no-deps
+
+ environment:
+ name: Environment test for ${{ matrix.toolchain }} on ${{ matrix.os }}
+ uses: ./.github/workflows/inc/unit-test.yml
+ with:
+ toolchain: ${{ matrix.toolchain }}
+ os: ${{ matrix.os }}
+ flags: --all-features
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - toolchain: nightly-2024-09-29
+ os: ubuntu-latest
+ - toolchain: 1.75.0
+ os: ubuntu-latest
+ - toolchain: stable
+ os: ubuntu-latest
+ - toolchain: stable
+ os: macos-latest
+
+ feature:
+ name: Feature test for ${{ matrix.flags || 'no flags' }}
+ uses: ./.github/workflows/inc/unit-test.yml
+ with:
+ flags: ${{ matrix.flags }}
+ strategy:
+ fail-fast: false
+ matrix:
+ flags:
+ - ''
+ - --features cursors
+ - --features dates
+ - --features indices
+ - --features list-databases
+ - --features serde
+ - --features "cursors streams"
+ - --features switch
+ - --features typed-arrays
+ - --features "typed-arrays serde"
+ - --features "cursors streams serde"
+ - --features "indices serde"
+ - --features "indices cursors"
+ - --features "indices cursors serde"
+ - --features "indices cursors streams"
+ - --features "indices cursors streams serde"
+ - --features "dates serde"
+ - --features "cursors serde"
+
+ done:
+ name: All tests
+ runs-on: ubuntu-latest
+ needs:
+ - doc
+ - lint
+ - feature
+ - environment
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+
+ - name: Generate changelog
+ id: changelog
+ uses: ./.github/actions/changelog
diff --git a/.gitignore b/.gitignore
index 494026c..1037032 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*.log
/target
/tmp.js
+/examples/adhoc.rs
diff --git a/.idea/dictionaries/.gitignore b/.idea/dictionaries/.gitignore
new file mode 100644
index 0000000..9546a67
--- /dev/null
+++ b/.idea/dictionaries/.gitignore
@@ -0,0 +1,2 @@
+/*.xml
+!/default_user.xml
diff --git a/.idea/dictionaries/default_user.xml b/.idea/dictionaries/default_user.xml
new file mode 100644
index 0000000..c8135ce
--- /dev/null
+++ b/.idea/dictionaries/default_user.xml
@@ -0,0 +1,7 @@
+
+
+
+ bindgen
+
+
+
\ No newline at end of file
diff --git a/.idea/indexed_db.iml b/.idea/indexed_db.iml
index d990dbf..9a0ec41 100644
--- a/.idea/indexed_db.iml
+++ b/.idea/indexed_db.iml
@@ -2,7 +2,11 @@
+
+
+
+
@@ -11,4 +15,4 @@
-
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Sync_readme.xml b/.idea/runConfigurations/Sync_readme.xml
deleted file mode 100644
index 5bef6ce..0000000
--- a/.idea/runConfigurations/Sync_readme.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/Build.xml b/.idea/runConfigurations/build.xml
similarity index 76%
rename from .idea/runConfigurations/Build.xml
rename to .idea/runConfigurations/build.xml
index c20fe0a..758cb33 100644
--- a/.idea/runConfigurations/Build.xml
+++ b/.idea/runConfigurations/build.xml
@@ -1,6 +1,7 @@
-
-
+
+
+
diff --git a/.idea/runConfigurations/build_tests.xml b/.idea/runConfigurations/build_tests.xml
new file mode 100644
index 0000000..74a5304
--- /dev/null
+++ b/.idea/runConfigurations/build_tests.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/build_tests_default.xml b/.idea/runConfigurations/build_tests_default.xml
new file mode 100644
index 0000000..64340f9
--- /dev/null
+++ b/.idea/runConfigurations/build_tests_default.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Clippy.xml b/.idea/runConfigurations/clippy.xml
similarity index 81%
rename from .idea/runConfigurations/Clippy.xml
rename to .idea/runConfigurations/clippy.xml
index 95ea093..55a0792 100644
--- a/.idea/runConfigurations/Clippy.xml
+++ b/.idea/runConfigurations/clippy.xml
@@ -1,7 +1,8 @@
-
-
+
+
+
@@ -9,7 +10,6 @@
-
diff --git a/.idea/runConfigurations/Clippy__fix.xml b/.idea/runConfigurations/clippy__fix.xml
similarity index 79%
rename from .idea/runConfigurations/Clippy__fix.xml
rename to .idea/runConfigurations/clippy__fix.xml
index a11c5da..3ceadb1 100644
--- a/.idea/runConfigurations/Clippy__fix.xml
+++ b/.idea/runConfigurations/clippy__fix.xml
@@ -1,7 +1,8 @@
-
-
+
+
+
@@ -9,7 +10,6 @@
-
diff --git a/.idea/runConfigurations/Doc.xml b/.idea/runConfigurations/doc.xml
similarity index 83%
rename from .idea/runConfigurations/Doc.xml
rename to .idea/runConfigurations/doc.xml
index 72ed2e8..688b17e 100644
--- a/.idea/runConfigurations/Doc.xml
+++ b/.idea/runConfigurations/doc.xml
@@ -1,7 +1,10 @@
-
-
+
+
+
+
+
@@ -9,9 +12,6 @@
-
-
-
diff --git a/.idea/runConfigurations/Fmt.xml b/.idea/runConfigurations/fmt.xml
similarity index 91%
rename from .idea/runConfigurations/Fmt.xml
rename to .idea/runConfigurations/fmt.xml
index 401f695..1056aa1 100644
--- a/.idea/runConfigurations/Fmt.xml
+++ b/.idea/runConfigurations/fmt.xml
@@ -1,7 +1,8 @@
-
+
+
@@ -9,7 +10,6 @@
-
diff --git a/.idea/runConfigurations/test_all.xml b/.idea/runConfigurations/test_all.xml
new file mode 100644
index 0000000..639c914
--- /dev/null
+++ b/.idea/runConfigurations/test_all.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/test_all_chrome.xml b/.idea/runConfigurations/test_all_chrome.xml
new file mode 100644
index 0000000..259ff86
--- /dev/null
+++ b/.idea/runConfigurations/test_all_chrome.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/test_all_firefox.xml b/.idea/runConfigurations/test_all_firefox.xml
new file mode 100644
index 0000000..e8f8c9b
--- /dev/null
+++ b/.idea/runConfigurations/test_all_firefox.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/test_default.xml b/.idea/runConfigurations/test_default.xml
new file mode 100644
index 0000000..2f43e15
--- /dev/null
+++ b/.idea/runConfigurations/test_default.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 2efcdb1..8316ce6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "accessory"
-version = "1.3.1"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87537f9ae7cfa78d5b8ebd1a1db25959f5e737126be4d8eb44a5452fc4b63cde"
+checksum = "bb3791c4beae5b827e93558ac83a88e63a841aad61759a05d9b577ef16030470"
dependencies = [
"macroific",
"proc-macro2",
@@ -14,12 +14,63 @@ dependencies = [
"syn",
]
+[[package]]
+name = "addr2line"
+version = "0.24.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
+
+[[package]]
+name = "autocfg"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
+
+[[package]]
+name = "backtrace"
+version = "0.3.74"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
+dependencies = [
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-targets",
+]
+
[[package]]
name = "bumpalo"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+
+[[package]]
+name = "cc"
+version = "1.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f"
+dependencies = [
+ "shlex",
+]
+
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -36,23 +87,56 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "console_log"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f"
+dependencies = [
+ "log",
+ "web-sys",
+]
+
[[package]]
name = "delegate-display"
-version = "2.1.1"
+version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98a85201f233142ac819bbf6226e36d0b5e129a47bd325084674261c82d4cd66"
+checksum = "9926686c832494164c33a36bf65118f4bd6e704000b58c94681bf62e9ad67a74"
dependencies = [
+ "impartial-ord",
+ "itoa",
"macroific",
"proc-macro2",
"quote",
"syn",
]
+[[package]]
+name = "derive_more"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05"
+dependencies = [
+ "derive_more-impl",
+]
+
+[[package]]
+name = "derive_more-impl"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "unicode-xid",
+]
+
[[package]]
name = "fancy_constructor"
-version = "1.2.2"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f71f317e4af73b2f8f608fac190c52eac4b1879d2145df1db2fe48881ca69435"
+checksum = "fac0fd7f4636276b4bd7b3148d0ba2c1c3fbede2b5214e47e7fedb70b02cde44"
dependencies = [
"macroific",
"proc-macro2",
@@ -60,6 +144,95 @@ dependencies = [
"syn",
]
+[[package]]
+name = "futures"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
+
+[[package]]
+name = "futures-executor"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
+
+[[package]]
+name = "futures-macro"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "futures-sink"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
+
+[[package]]
+name = "futures-task"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+
+[[package]]
+name = "futures-util"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-macro",
+ "futures-sink",
+ "futures-task",
+ "memchr",
+ "pin-project-lite",
+ "pin-utils",
+ "slab",
+]
+
[[package]]
name = "getrandom"
version = "0.2.15"
@@ -73,36 +246,84 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "gimli"
+version = "0.31.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
+
+[[package]]
+name = "impartial-ord"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ab604ee7085efba6efc65e4ebca0e9533e3aff6cb501d7d77b211e3a781c6d5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "indexed_db_futures"
version = "0.5.0"
dependencies = [
"accessory",
"cfg-if",
+ "console_log",
"delegate-display",
+ "derive_more",
"fancy_constructor",
+ "futures",
+ "futures-core",
+ "impartial-ord",
+ "indexed_db_futures_macros_internal",
"js-sys",
+ "log",
+ "rand",
+ "sealed",
+ "serde",
+ "serde-wasm-bindgen",
+ "smallvec",
+ "thiserror",
+ "tokio",
"uuid",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test",
"web-sys",
+ "web-time",
]
+[[package]]
+name = "indexed_db_futures_macros_internal"
+version = "1.0.0"
+dependencies = [
+ "macroific",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
+
[[package]]
name = "js-sys"
-version = "0.3.69"
+version = "0.3.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
+checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "libc"
-version = "0.2.155"
+version = "0.2.161"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
+checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
[[package]]
name = "log"
@@ -112,9 +333,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "macroific"
-version = "1.3.1"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f05c00ac596022625d01047c421a0d97d7f09a18e429187b341c201cb631b9dd"
+checksum = "89f276537b4b8f981bf1c13d79470980f71134b7bdcc5e6e911e910e556b0285"
dependencies = [
"macroific_attr_parse",
"macroific_core",
@@ -123,32 +344,33 @@ dependencies = [
[[package]]
name = "macroific_attr_parse"
-version = "1.3.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd94d5da95b30ae6e10621ad02340909346ad91661f3f8c0f2b62345e46a2f67"
+checksum = "ad4023761b45fcd36abed8fb7ae6a80456b0a38102d55e89a57d9a594a236be9"
dependencies = [
- "cfg-if",
"proc-macro2",
"quote",
+ "sealed",
"syn",
]
[[package]]
name = "macroific_core"
-version = "1.0.2"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13198c120864097a565ccb3ff947672d969932b7975ebd4085732c9f09435e55"
+checksum = "d0a7594d3c14916fa55bef7e9d18c5daa9ed410dd37504251e4b75bbdeec33e3"
dependencies = [
"proc-macro2",
"quote",
+ "sealed",
"syn",
]
[[package]]
name = "macroific_macro"
-version = "1.1.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0c9853143cbed7f1e41dc39fee95f9b361bec65c8dc2a01bf609be01b61f5ae"
+checksum = "4da6f2ed796261b0a74e2b52b42c693bb6dee1effba3a482c49592659f824b3b"
dependencies = [
"macroific_attr_parse",
"macroific_core",
@@ -157,63 +379,287 @@ dependencies = [
"syn",
]
+[[package]]
+name = "memchr"
+version = "2.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+
+[[package]]
+name = "minicov"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169"
+dependencies = [
+ "cc",
+ "walkdir",
+]
+
+[[package]]
+name = "miniz_oxide"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
+dependencies = [
+ "adler2",
+]
+
+[[package]]
+name = "object"
+version = "0.36.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "once_cell"
-version = "1.19.0"
+version = "1.20.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
+dependencies = [
+ "zerocopy",
+]
[[package]]
name = "proc-macro2"
-version = "1.0.86"
+version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.36"
+version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
+
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
+[[package]]
+name = "sealed"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22f968c5ea23d555e670b449c1c5e7b2fc399fdaec1d304a17cd48e288abc107"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.210"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde-wasm-bindgen"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b"
+dependencies = [
+ "js-sys",
+ "serde",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.210"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "slab"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "syn"
-version = "2.0.72"
+version = "2.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
+checksum = "198514704ca887dd5a1e408c6c6cdcba43672f9b4062e1b24aa34e74e6d7faae"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
+[[package]]
+name = "thiserror"
+version = "1.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tokio"
+version = "1.40.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
+dependencies = [
+ "backtrace",
+ "pin-project-lite",
+ "tokio-macros",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "unicode-ident"
-version = "1.0.12"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "uuid"
-version = "1.10.0"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
+checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
dependencies = [
"getrandom",
"wasm-bindgen",
]
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -222,19 +668,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.92"
+version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
+checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
dependencies = [
"cfg-if",
+ "once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.92"
+version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
+checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
dependencies = [
"bumpalo",
"log",
@@ -247,9 +694,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.42"
+version = "0.4.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
+checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
dependencies = [
"cfg-if",
"js-sys",
@@ -259,9 +706,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.92"
+version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
+checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -269,9 +716,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.92"
+version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
+checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
dependencies = [
"proc-macro2",
"quote",
@@ -282,18 +729,19 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.92"
+version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
+checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
[[package]]
name = "wasm-bindgen-test"
-version = "0.3.42"
+version = "0.3.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b"
+checksum = "d381749acb0943d357dcbd8f0b100640679883fcdeeef04def49daf8d33a5426"
dependencies = [
"console_error_panic_hook",
"js-sys",
+ "minicov",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -302,9 +750,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-test-macro"
-version = "0.3.42"
+version = "0.3.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0"
+checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0"
dependencies = [
"proc-macro2",
"quote",
@@ -313,10 +761,124 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.69"
+version = "0.3.72"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "web-time"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
dependencies = [
"js-sys",
+ "serde",
"wasm-bindgen",
]
+
+[[package]]
+name = "winapi-util"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "zerocopy"
+version = "0.7.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
+dependencies = [
+ "byteorder",
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.7.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
diff --git a/Cargo.toml b/Cargo.toml
index 75dce34..4e4fa2a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,81 +1,152 @@
+[workspace]
+resolver = "2"
+members = [
+ ".",
+ "internal_macros",
+]
+
[package]
name = "indexed_db_futures"
version = "0.5.0"
-authors = ["Arturas Molcanovas "]
+authors = ["Arturas Molcanovas "]
edition = "2021"
-rust-version = "1.64.0"
+rust-version = "1.75.0"
license = "MIT"
description = "Future bindings for IndexedDB via web_sys"
repository = "https://github.com/Alorel/rust-indexed-db"
keywords = ["wasm", "indexeddb", "future", "webassembly", "idb"]
categories = ["asynchronous", "database", "wasm", "web-programming"]
include = [
- "src/",
- "Cargo.toml",
- "README.md"
-]
-
-[package.metadata.docs.rs]
-all-features = true
-rustdoc-args = [
- "--cfg",
- "doc_cfg",
+ "src/",
+ "Cargo.toml",
+ "README.md"
]
[features]
-default = [
- "cursors",
- "indices"
-]
cursors = [
- "web-sys/IdbCursor",
- "web-sys/IdbCursorWithValue",
- "web-sys/IdbCursorDirection"
+ "web-sys/IdbCursor",
+ "web-sys/IdbCursorWithValue",
+ "web-sys/IdbCursorDirection",
+]
+dates = [
+ "dep:web-time",
+ "_serialise-deserialise-dyn",
]
indices = [
- "web-sys/IdbIndex",
- "web-sys/IdbIndexParameters"
+ "web-sys/IdbIndex",
+ "web-sys/IdbIndexParameters",
+]
+list-databases = [
+ "dep:impartial-ord",
+]
+serde = [
+ "dep:serde",
+ "dep:serde-wasm-bindgen",
+ "smallvec/serde",
+ "web-time/serde",
+]
+streams = [
+ "dep:futures-core",
]
-nightly = []
+switch = []
+typed-arrays = []
+version-change = ["tokio/macros"]
+_serialise-deserialise-dyn = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["lib"]
-[dev-dependencies]
-wasm-bindgen-test = "0.3.42"
+[workspace.dependencies]
+accessory = { version = "2" }
+cfg-if = "1"
+console_log = "1"
+delegate-display = { version = "3" }
+derive_more = { version = "1", default-features = false }
+fancy_constructor = { version = "2" }
+futures = "0.3.30"
+futures-core = "0.3"
+impartial-ord = "1.0.6"
+js-sys = "0.3.72"
+log = "0.4.22"
+macroific = { version = "2" }
+rand = "0.8"
+sealed = "0.6"
+serde = "1"
+serde-wasm-bindgen = "0.6"
+smallvec = "1.13"
+thiserror = "1"
+tokio = { version = "1.30", default-features = false }
+uuid = "1.8"
+wasm-bindgen = "0.2.95"
+wasm-bindgen-futures = "0.4.45"
+wasm-bindgen-test = "0.3.45"
+web-time = "1.1"
+web-sys = "0.3.72"
+
+proc-macro2 = "1"
+quote = "1"
+syn = "2"
[dependencies]
-accessory = "1"
-cfg-if = "1"
-delegate-display = "2"
-fancy_constructor = "1.2"
-js-sys = "0.3.64"
-uuid = {version = "1.8", features = ["v4", "js"]}
-wasm-bindgen = "0.2.92"
-wasm-bindgen-futures = "0.4"
+accessory = { workspace = true }
+cfg-if = { workspace = true }
+delegate-display = { workspace = true }
+derive_more = { workspace = true, features = ["as_ref", "from", "deref", "deref_mut", "into", "debug"], default-features = false }
+fancy_constructor = { workspace = true }
+futures-core = { workspace = true, optional = true }
+impartial-ord = { workspace = true, optional = true }
+js-sys = { workspace = true }
+sealed = { workspace = true }
+serde = { workspace = true, optional = true }
+smallvec = { workspace = true }
+serde-wasm-bindgen = { workspace = true, optional = true }
+thiserror = { workspace = true }
+tokio = { workspace = true, features = ["sync"], default-features = false }
+wasm-bindgen = { workspace = true }
+wasm-bindgen-futures = { workspace = true }
+web-time = { workspace = true, optional = true }
+
+[dependencies.internal_macros]
+version = "1"
+package = "indexed_db_futures_macros_internal"
+path = "internal_macros"
[dependencies.web-sys]
-version = "0.3.64"
+workspace = true
features = [
- "DomException",
- "DomStringList",
- "Event",
- "EventTarget",
- "IdbDatabase",
- "IdbFactory",
- "IdbObjectStore",
- "IdbObjectStoreParameters",
- "IdbOpenDbRequest",
- "IdbKeyRange",
- "IdbRequest",
- "IdbRequestReadyState",
- "IdbTransaction",
- "IdbTransactionMode",
- "IdbVersionChangeEvent",
- "Window",
- "WorkerGlobalScope",
+ "console",
+ "DomException",
+ "DomStringList",
+ "Event",
+ "EventTarget",
+ "IdbDatabase",
+ "IdbFactory",
+ "IdbObjectStore",
+ "IdbObjectStoreParameters",
+ "IdbRequestReadyState",
+ "IdbOpenDbRequest",
+ "IdbKeyRange",
+ "IdbRequest",
+ "IdbTransaction",
+ "IdbTransactionMode",
+ "IdbVersionChangeEvent",
+ "Window",
+ "WorkerGlobalScope",
]
+[dev-dependencies]
+console_log = { workspace = true }
+futures = { workspace = true }
+impartial-ord = { workspace = true }
+log = { workspace = true }
+rand = { workspace = true }
+uuid = { workspace = true, features = ["v4", "js"] }
+wasm-bindgen-test = { workspace = true }
+
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "doc_cfg"]
+
[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(doc_cfg)'] }
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] }
diff --git a/README.md b/README.md
index 908d8b9..84bbe89 100644
--- a/README.md
+++ b/README.md
@@ -1,87 +1,95 @@
-# Indexed DB Futures
-
-
-
Wraps the [web_sys](https://crates.io/crates/web_sys) Indexed DB API in a Future-based API and
-removes the pain of dealing with Javascript callbacks in Rust.
+removes the pain of dealing with JS callbacks or `JSValue` in Rust.
[![master CI badge](https://github.com/Alorel/rust-indexed-db/actions/workflows/test.yml/badge.svg)](https://github.com/Alorel/rust-indexed-db/actions/workflows/test.yml)
[![crates.io badge](https://img.shields.io/crates/v/indexed_db_futures)](https://crates.io/crates/indexed_db_futures)
[![docs.rs badge](https://img.shields.io/docsrs/indexed_db_futures?label=docs.rs)](https://docs.rs/indexed_db_futures)
[![dependencies badge](https://img.shields.io/librariesio/release/cargo/indexed_db_futures)](https://libraries.io/cargo/indexed_db_futures)
-### Overall API design
-
-In most cases API methods will return a `Result` containing a wrapped
-`IdbRequest` that implements `IntoFuture`, such as
-`VoidRequest`, or, when more appropriate, the `Future`
-directly, e.g. `CountFuture`.
-
-The key difference between a wrapped Request and Future is that Requests don't have _any_ event
-listeners attached, which aims to make quickfire operations such as inserting several records
-into an `IdbObjectStore` a little bit more efficient.
+Goals & features:
-### Features
+- **Shield you from having to interact with [`web_sys`](https://crates.io/crates/web-sys) or
+ [`js_sys`](https://crates.io/crates/js-sys) APIs** - this should feel like a native Rust API.
+- **Integrate with [`serde`](https://crates.io/crates/serde), but don't require it** - as a rule of thumb, you'll use
+ `serde`-serialisable types when working with JS objects & bypass `serde` for Javascript primitives.
+- **Implement [`Stream`](https://docs.rs/futures/0.3.31/futures/prelude/trait.Stream.html) where applicable** - cursors
+ and key cursors have this at the time of writing.
+- **Implement a more Rust-oriented API** - for example, transactions will roll back by default unless explicitly
+ committed to allow you to use `?`s.
-The library can ship without cursor or index support for apps that just need a simple key-value
-store akin to `localStorage`.
+Non-goals:
-- `cursors` - Enable cursor support
-- `indices` - Enable index support
-- `nightly` - Use unsafe nightly features where appropriate, such as [`unwrap_unchecked`](Option::unwrap_unchecked).
-- `default`:
- - `cursors`
- - `indices`
-
-### Examples
-
-#### Connecting to a DB and doing basic CRUD
-
-Variable types included for clarity.
+- Becoming a feature-rich `IndexedDB` framework - this library only provides Rust-friendly access to the `IndexedDB`
+ API & integrates with some standard libraries in the ecosystem.
```rust
+use indexed_db_futures::database::Database;
use indexed_db_futures::prelude::*;
-
-pub async fn example() -> Result<(), DomException> {
- // Open my_db v1
- let mut db_req: OpenDbRequest = IdbDatabase::open_u32("my_db", 1)?;
- db_req.set_on_upgrade_needed(Some(|evt: &IdbVersionChangeEvent| -> Result<(), JsValue> {
- // Check if the object store exists; create it if it doesn't
- if let None = evt.db().object_store_names().find(|n| n == "my_store") {
- evt.db().create_object_store("my_store")?;
+use indexed_db_futures::transaction::TransactionMode;
+
+#[derive(serde::Serialize, serde::Deserialize)]
+struct MySerdeType(u8, String);
+
+async fn main() -> indexed_db_futures::OpenDbResult<()> {
+ let db = Database::open("my_db")
+ .with_version(2u8)
+ .with_on_upgrade_needed(|event, db| {
+ match (event.old_version(), event.new_version()) {
+ (0.0, Some(1.0)) => {
+ db.create_object_store("my_store")
+ .with_auto_increment(true)
+ .build()?;
+ }
+ (prev, Some(2.0)) => {
+ if prev == 1.0 {
+ let _ = db.delete_object_store("my_store");
+ }
+
+ db.create_object_store("my_other_store").build()?;
+ }
+ _ => {}
+ }
+
+ Ok(())
+ })
+ .await?;
+
+ // Populate some data
+ let transaction = db
+ .transaction("my_other_store")
+ .with_mode(TransactionMode::Readwrite)
+ .build()?;
+
+ let store = transaction.object_store("my_other_store")?;
+
+ store
+ .put("a primitive value that doesn't need serde")
+ .await?;
+
+ // awaiting individual requests is optional - they still go out
+ store.put(MySerdeType(10, "foos".into())).serde()?;
+
+ // Unlike JS, transactions ROLL BACK INSTEAD OF COMMITTING BY DEFAULT
+ transaction.commit().await?;
+
+ // Read some data
+ let transaction = db.transaction("my_other_store").build()?;
+ let store = transaction.object_store("my_other_store")?;
+ let Some(mut cursor) = store.open_cursor().await? else {
+ // `None` is returned if the cursor is empty
+ return Ok(());
+ };
+
+ loop {
+ match cursor.next_record_ser::().await {
+ Ok(Some(record)) => handle_record(record),
+ Ok(None) => break,
+ Err(e) => handle_error(e),
}
- Ok(())
- }));
-
- let db: IdbDatabase = db_req.await?;
-
- // Insert/overwrite a record
- let tx: IdbTransaction = db
- .transaction_on_one_with_mode("my_store", IdbTransactionMode::Readwrite)?;
- let store: IdbObjectStore = tx.object_store("my_store")?;
-
- let value_to_put: JsValue = get_some_js_value();
- store.put_key_val_owned("my_key", &value_to_put)?;
-
- // IDBTransactions can have an Error or an Abort event; into_result() turns both into a
- // DOMException
- tx.await.into_result()?;
-
- // Delete a record
- let tx = db.transaction_on_one_with_mode("my_store", IdbTransactionMode::Readwrite)?;
- let store = tx.object_store("my_store")?;
- store.delete_owned("my_key")?;
- tx.await.into_result()?;
-
- // Get a record
- let tx = db.transaction_on_one("my_store")?;
- let store = tx.object_store("my_store")?;
-
- let value: Option = store.get_owned("my_key")?.await?;
- use_value(value);
+ }
Ok(())
}
```
-
+Head over to the docs for a proper introduction!
diff --git a/internal_macros/Cargo.toml b/internal_macros/Cargo.toml
new file mode 100644
index 0000000..491eac5
--- /dev/null
+++ b/internal_macros/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "indexed_db_futures_macros_internal"
+version = "1.0.0"
+edition = "2021"
+license = "MIT"
+authors = ["Arturas Molcanovas "]
+description = "Internal macros for the `indexed_db_futures` crate"
+keywords = []
+categories = []
+
+[lib]
+proc-macro = true
+
+[dependencies]
+macroific = { workspace = true, features = ["attr_parse", "attributed", "generic-impl", "module-prefix"] }
+proc-macro2 = { workspace = true }
+quote = { workspace = true }
+syn = { workspace = true, features = ["full"] }
diff --git a/internal_macros/README.md b/internal_macros/README.md
new file mode 100644
index 0000000..b85714b
--- /dev/null
+++ b/internal_macros/README.md
@@ -0,0 +1,2 @@
+Internal macros for the [indexed_db_futures](https://crates.io/crates/indexed_db_futures) crate. The API is to be
+considered unstable and subject to breaking changes at any time, although these will follow semver.
diff --git a/internal_macros/src/build_into_fut.rs b/internal_macros/src/build_into_fut.rs
new file mode 100644
index 0000000..1da6426
--- /dev/null
+++ b/internal_macros/src/build_into_fut.rs
@@ -0,0 +1,66 @@
+use macroific::elements::module_prefix::RESULT;
+use macroific::elements::ModulePrefix;
+use proc_macro2::{Ident, TokenStream};
+use quote::quote;
+use syn::parse::{Parse, ParseStream};
+use syn::{parse_quote, DeriveInput, GenericParam, Generics, WherePredicate};
+
+const UNPIN: ModulePrefix<'static, 3> = ModulePrefix::new(["core", "marker", "Unpin"]);
+const BUILD: ModulePrefix<'static, 3> =
+ ModulePrefix::new(["crate", "build", "Build"]).with_leading_sep(false);
+
+const MB_ERR: ModulePrefix<'static, 3> =
+ ModulePrefix::new(["crate", "future", "MaybeErrored"]).with_leading_sep(false);
+
+pub(crate) struct BuildIntoFut {
+ ident: Ident,
+
+ generics: Generics,
+}
+
+impl Parse for BuildIntoFut {
+ fn parse(input: ParseStream) -> syn::Result {
+ let DeriveInput {
+ ident, generics, ..
+ } = input.parse()?;
+ Ok(Self { ident, generics })
+ }
+}
+
+impl BuildIntoFut {
+ pub fn into_token_stream(self) -> TokenStream {
+ let Self { ident, generics } = self;
+ let mut gen2 = generics.clone();
+
+ gen2.params.extend::<[GenericParam; 3]>([
+ parse_quote!(_pFut),
+ parse_quote!(_pOut),
+ parse_quote!(_pErr),
+ ]);
+
+ gen2.make_where_clause().predicates.extend::<[WherePredicate; 3]>([
+ parse_quote!(Self: #BUILD),
+ parse_quote!(_pFut: crate::future::PollUnpinned