Skip to content

Added modules for IndexedDb#1240

Merged
tim-smart merged 14 commits intoEffect-TS:mainfrom
SandroMaglione:sandromaglione/indexed-db
Mar 29, 2026
Merged

Added modules for IndexedDb#1240
tim-smart merged 14 commits intoEffect-TS:mainfrom
SandroMaglione:sandromaglione/indexed-db

Conversation

@SandroMaglione
Copy link
Copy Markdown
Contributor

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Porting of the IndexedDb PR from v3 to v4 (original source).

@SandroMaglione
Copy link
Copy Markdown
Contributor Author

A few adjustments are still needed for the v4 migrations.

@tim-smart what's the Effectable (CommitPrototype) equivalent in v4? What about Effect.runtime() and Fiber.RuntimeFiber (inside IndexedDbDatabase.ts)?

@gcanti IndexedDbQuery was using Schema.Struct.Constructor (source) and IndexedDbTable was defined from Schema.TypeId, can you point me to the equivalents in v4?

Copy link
Copy Markdown

@lewxdev lewxdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a non-exhaustive feedback on the current changes.
@tim-smart please feel free to review these comments before @SandroMaglione makes any changes

Comment thread packages/platform-browser/src/IndexedDb.ts Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IndexedDB is effectively a NoSQL database, and I think using vocabulary like "Table" is incorrect. This module would be more accurate renamed to IndexedDbObjectStore. ("Table" makes sense if you have columns)

Note that the "Table" vocabulary is also used throughout and should be updated as well.

Comment thread packages/platform-browser/src/IndexedDb.ts Outdated
Comment thread packages/platform-browser/src/IndexedDb.ts
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but with the current implementation it's not possible to create an index or key on a deeply nested field.
This is a big limitation that could be addressed by taking an annotation-driven approach to defining ObjectStore schemas (although this may not work well with the query builder unless some TypeScript wizardry is employed, but maybe that's an okay tradeoff).

@harrysolovay
Copy link
Copy Markdown

harrysolovay commented Mar 4, 2026

This API is fascinating. A few thoughts:

  • Any thoughts on how one would integrate with the reactivity module to get a stream of updates from a given table within all contexts of the current partition?
  • Can one circumvent schemas / transcoding? One of the great use cases of idb is direct storage and retrieval of non-extractable web crypto keys.
  • The migration DX looks superb.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 8, 2026

🦋 Changeset detected

Latest commit: a90cd6c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@effect/platform-browser Patch
effect Patch
@effect/opentelemetry Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@SandroMaglione
Copy link
Copy Markdown
Contributor Author

@tim-smart I updated the implementation to v4 (typed ids, effect/yieldable encoding, schema and apis). All the tests are now passing.

What's the next step to move this forward?

@tim-smart tim-smart force-pushed the sandromaglione/indexed-db branch from 47c1d56 to ae53dcd Compare March 29, 2026 09:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 29, 2026

📊 JSDoc Documentation Analysis

📈 Current Analysis Results
Analyzing 135 TypeScript files in packages/effect/src/ (including schema and config subdirectories)...

============================================================
         EFFECT JSDOC ANALYSIS REPORT
============================================================

📊 SUMMARY STATISTICS
------------------------------
Total files analyzed: 135
Total exported members: 4270
Missing @example: 2137 (50.0%)
Missing @category: 403 (9.4%)

🎯 TOP FILES NEEDING ATTENTION
----------------------------------------
1. Schema.ts
   📝 489 missing examples, 🏷️  213 missing categories
   📦 489 total exports
2. Array.ts
   📝 135 missing examples, 🏷️  2 missing categories
   📦 140 total exports
3. SchemaRepresentation.ts
   📝 96 missing examples, 🏷️  12 missing categories
   📦 96 total exports
4. SchemaAST.ts
   📝 77 missing examples, 🏷️  21 missing categories
   📦 77 total exports
5. Cause.ts
   📝 79 missing examples, 🏷️  2 missing categories
   📦 79 total exports
6. Channel.ts
   📝 81 missing examples, 🏷️  0 missing categories
   📦 152 total exports
7. Option.ts
   📝 66 missing examples, 🏷️  3 missing categories
   📦 66 total exports
8. Sink.ts
   📝 64 missing examples, 🏷️  2 missing categories
   📦 81 total exports
9. SchemaTransformation.ts
   📝 37 missing examples, 🏷️  26 missing categories
   📦 37 total exports
10. Predicate.ts
   📝 57 missing examples, 🏷️  0 missing categories
   📦 57 total exports
11. SchemaGetter.ts
   📝 49 missing examples, 🏷️  0 missing categories
   📦 49 total exports
12. Result.ts
   📝 46 missing examples, 🏷️  0 missing categories
   📦 46 total exports
13. Config.ts
   📝 35 missing examples, 🏷️  6 missing categories
   📦 35 total exports
14. Types.ts
   📝 38 missing examples, 🏷️  0 missing categories
   📦 38 total exports
15. Effect.ts
   📝 31 missing examples, 🏷️  2 missing categories
   📦 253 total exports

✅ PERFECTLY DOCUMENTED FILES
-----------------------------------
   Chunk.ts (86 exports)
   Clock.ts (5 exports)
   FiberHandle.ts (15 exports)
   FiberMap.ts (19 exports)
   FiberSet.ts (14 exports)
   HKT.ts (4 exports)
   HashMap.ts (44 exports)
   HashSet.ts (21 exports)
   Match.ts (57 exports)
   MutableRef.ts (17 exports)
   NonEmptyIterable.ts (3 exports)
   Random.ts (9 exports)
   Redacted.ts (9 exports)
   RegExp.ts (3 exports)
   Symbol.ts (1 exports)
   Trie.ts (29 exports)
   TxChunk.ts (22 exports)
   TxDeferred.ts (7 exports)
   TxHashMap.ts (41 exports)
   TxHashSet.ts (24 exports)
   TxPriorityQueue.ts (19 exports)
   TxReentrantLock.ts (17 exports)
   TxRef.ts (7 exports)
   TxSemaphore.ts (14 exports)
   TxSubscriptionRef.ts (12 exports)
   Unify.ts (8 exports)
   index.ts (0 exports)

🔍 SAMPLE MISSING ITEMS FROM Schema.ts
-----------------------------------
   Optionality (type, line 150): missing example, category
   Mutability (type, line 159): missing example, category
   ConstructorDefault (type, line 169): missing example, category
   MakeOptions (interface, line 182): missing example, category
   Bottom (interface, line 210): missing example, category
   declareConstructor (interface, line 268): missing example
   declareConstructor (function, line 334): missing example
   declare (interface, line 361): missing example
   declare (function, line 392): missing example
   revealBottom (function, line 432): missing example, category

📋 BREAKDOWN BY EXPORT TYPE
-----------------------------------
const: 1106 missing examples, 122 missing categories
interface: 329 missing examples, 90 missing categories
type: 250 missing examples, 79 missing categories
function: 345 missing examples, 91 missing categories
namespace: 48 missing examples, 20 missing categories
class: 59 missing examples, 1 missing categories

📈 DOCUMENTATION PROGRESS
------------------------------
Examples: 2133/4270 (50.0% complete)
Categories: 3867/4270 (90.6% complete)

============================================================
Analysis complete! 2540 items need attention.
============================================================

📄 Detailed results saved to: jsdoc-analysis-results.json

This comment is automatically updated on each push. View the analysis script for details.

@github-actions
Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.69 KB 6.69 KB 0.00 KB (0.00%)
batching.ts 8.86 KB 8.86 KB 0.00 KB (0.00%)
brand.ts 6.32 KB 6.32 KB 0.00 KB (0.00%)
cache.ts 9.94 KB 9.94 KB 0.00 KB (0.00%)
config.ts 16.95 KB 16.95 KB 0.00 KB (0.00%)
differ.ts 15.33 KB 15.33 KB 0.00 KB (0.00%)
http-client.ts 19.77 KB 19.77 KB 0.00 KB (0.00%)
logger.ts 9.15 KB 9.15 KB 0.00 KB (0.00%)
metric.ts 8.54 KB 8.54 KB 0.00 KB (0.00%)
optic.ts 7.57 KB 7.57 KB 0.00 KB (0.00%)
pubsub.ts 13.76 KB 13.76 KB 0.00 KB (0.00%)
queue.ts 11.03 KB 11.03 KB 0.00 KB (0.00%)
schedule.ts 10.22 KB 10.22 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 24.66 KB 24.66 KB 0.00 KB (0.00%)
schema-string-transformation.ts 11.87 KB 11.87 KB 0.00 KB (0.00%)
schema-string.ts 10.19 KB 10.19 KB 0.00 KB (0.00%)
schema-template-literal.ts 12.80 KB 12.80 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 17.02 KB 17.02 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 19.70 KB 19.70 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 16.19 KB 16.19 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 16.18 KB 16.18 KB 0.00 KB (0.00%)
schema-toFormatter.ts 16.02 KB 16.02 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 18.54 KB 18.54 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 16.59 KB 16.59 KB 0.00 KB (0.00%)
schema.ts 15.65 KB 15.65 KB 0.00 KB (0.00%)
stm.ts 11.89 KB 11.89 KB 0.00 KB (0.00%)
stream.ts 9.23 KB 9.23 KB 0.00 KB (0.00%)

@tim-smart tim-smart enabled auto-merge (squash) March 29, 2026 12:01
@tim-smart tim-smart merged commit 583ea00 into Effect-TS:main Mar 29, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants