@effect/platform-browser 4.0.0-beta.67 → 4.0.0-beta.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/BrowserCrypto.d.ts +23 -0
  2. package/dist/BrowserCrypto.d.ts.map +1 -0
  3. package/dist/BrowserCrypto.js +61 -0
  4. package/dist/BrowserCrypto.js.map +1 -0
  5. package/dist/BrowserHttpClient.d.ts +5 -5
  6. package/dist/BrowserHttpClient.js +4 -4
  7. package/dist/BrowserKeyValueStore.d.ts +3 -3
  8. package/dist/BrowserKeyValueStore.js +3 -3
  9. package/dist/BrowserSocket.d.ts +2 -2
  10. package/dist/BrowserSocket.js +2 -2
  11. package/dist/BrowserWorker.d.ts +2 -2
  12. package/dist/BrowserWorker.js +2 -2
  13. package/dist/BrowserWorkerRunner.d.ts +3 -3
  14. package/dist/BrowserWorkerRunner.js +3 -3
  15. package/dist/Clipboard.d.ts +5 -5
  16. package/dist/Clipboard.js +4 -4
  17. package/dist/Geolocation.d.ts +8 -8
  18. package/dist/Geolocation.js +6 -6
  19. package/dist/IndexedDb.d.ts +1 -1
  20. package/dist/IndexedDb.js +1 -1
  21. package/dist/IndexedDbQueryBuilder.d.ts +0 -1
  22. package/dist/IndexedDbQueryBuilder.d.ts.map +1 -1
  23. package/dist/IndexedDbQueryBuilder.js.map +1 -1
  24. package/dist/Permissions.d.ts +3 -3
  25. package/dist/Permissions.js +2 -2
  26. package/dist/index.d.ts +323 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +323 -0
  29. package/dist/index.js.map +1 -1
  30. package/package.json +3 -3
  31. package/src/BrowserCrypto.ts +71 -0
  32. package/src/BrowserHttpClient.ts +5 -5
  33. package/src/BrowserKeyValueStore.ts +3 -3
  34. package/src/BrowserSocket.ts +2 -2
  35. package/src/BrowserWorker.ts +2 -2
  36. package/src/BrowserWorkerRunner.ts +3 -3
  37. package/src/Clipboard.ts +5 -5
  38. package/src/Geolocation.ts +8 -8
  39. package/src/IndexedDb.ts +1 -1
  40. package/src/IndexedDbQueryBuilder.ts +0 -1
  41. package/src/Permissions.ts +3 -3
  42. package/src/index.ts +324 -0
package/src/Clipboard.ts CHANGED
@@ -28,7 +28,7 @@ const ErrorTypeId = "~@effect/platform-browser/Clipboard/ClipboardError"
28
28
  /**
29
29
  * Service interface for reading from, writing to, and clearing the browser clipboard.
30
30
  *
31
- * @category Models
31
+ * @category models
32
32
  * @since 4.0.0
33
33
  */
34
34
  export interface Clipboard {
@@ -44,7 +44,7 @@ export interface Clipboard {
44
44
  /**
45
45
  * Tagged error raised when a browser clipboard operation fails.
46
46
  *
47
- * @category Errors
47
+ * @category errors
48
48
  * @since 4.0.0
49
49
  */
50
50
  export class ClipboardError extends Data.TaggedError("ClipboardError")<{
@@ -57,7 +57,7 @@ export class ClipboardError extends Data.TaggedError("ClipboardError")<{
57
57
  /**
58
58
  * Service tag for the browser `Clipboard` service.
59
59
  *
60
- * @category Service
60
+ * @category services
61
61
  * @since 4.0.0
62
62
  */
63
63
  export const Clipboard: Context.Service<Clipboard, Clipboard> = Context.Service<Clipboard>(TypeId)
@@ -65,7 +65,7 @@ export const Clipboard: Context.Service<Clipboard, Clipboard> = Context.Service<
65
65
  /**
66
66
  * Builds a `Clipboard` service from primitive read and write operations, deriving `clear` and `writeBlob` helpers.
67
67
  *
68
- * @category Constructors
68
+ * @category constructors
69
69
  * @since 4.0.0
70
70
  */
71
71
  export const make = (
@@ -81,7 +81,7 @@ export const make = (
81
81
  /**
82
82
  * A layer that directly interfaces with the navigator.clipboard api
83
83
  *
84
- * @category Layers
84
+ * @category layers
85
85
  * @since 4.0.0
86
86
  */
87
87
  export const layer: Layer.Layer<Clipboard> = Layer.succeed(
@@ -31,7 +31,7 @@ const ErrorTypeId = "~@effect/platform-browser/Geolocation/GeolocationError"
31
31
  /**
32
32
  * Service interface for browser geolocation, providing effects for the current position and streams of watched positions.
33
33
  *
34
- * @category Models
34
+ * @category models
35
35
  * @since 4.0.0
36
36
  */
37
37
  export interface Geolocation {
@@ -51,7 +51,7 @@ export interface Geolocation {
51
51
  /**
52
52
  * Service tag for the browser `Geolocation` service.
53
53
  *
54
- * @category Service
54
+ * @category services
55
55
  * @since 4.0.0
56
56
  */
57
57
  export const Geolocation: Context.Service<Geolocation, Geolocation> = Context.Service<Geolocation>(TypeId)
@@ -59,7 +59,7 @@ export const Geolocation: Context.Service<Geolocation, Geolocation> = Context.Se
59
59
  /**
60
60
  * Tagged error wrapping a browser geolocation failure reason.
61
61
  *
62
- * @category Errors
62
+ * @category errors
63
63
  * @since 4.0.0
64
64
  */
65
65
  export class GeolocationError extends Data.TaggedError("GeolocationError")<{
@@ -84,7 +84,7 @@ export class GeolocationError extends Data.TaggedError("GeolocationError")<{
84
84
  /**
85
85
  * Error reason for the browser geolocation `POSITION_UNAVAILABLE` failure.
86
86
  *
87
- * @category Errors
87
+ * @category errors
88
88
  * @since 4.0.0
89
89
  */
90
90
  export class PositionUnavailable extends Data.TaggedError("PositionUnavailable")<{
@@ -98,7 +98,7 @@ export class PositionUnavailable extends Data.TaggedError("PositionUnavailable")
98
98
  /**
99
99
  * Error reason for the browser geolocation `PERMISSION_DENIED` failure.
100
100
  *
101
- * @category Errors
101
+ * @category errors
102
102
  * @since 4.0.0
103
103
  */
104
104
  export class PermissionDenied extends Data.TaggedError("PermissionDenied")<{
@@ -112,7 +112,7 @@ export class PermissionDenied extends Data.TaggedError("PermissionDenied")<{
112
112
  /**
113
113
  * Error reason for the browser geolocation `TIMEOUT` failure.
114
114
  *
115
- * @category Errors
115
+ * @category errors
116
116
  * @since 4.0.0
117
117
  */
118
118
  export class Timeout extends Data.TaggedError("Timeout")<{
@@ -126,7 +126,7 @@ export class Timeout extends Data.TaggedError("Timeout")<{
126
126
  /**
127
127
  * Union of browser geolocation error reasons represented by the service.
128
128
  *
129
- * @category Errors
129
+ * @category errors
130
130
  * @since 4.0.0
131
131
  */
132
132
  export type GeolocationErrorReason = PositionUnavailable | PermissionDenied | Timeout
@@ -173,7 +173,7 @@ const makeQueue = (
173
173
  /**
174
174
  * Layer that provides `Geolocation` using `navigator.geolocation`, with watched positions buffered in a sliding queue.
175
175
  *
176
- * @category Layers
176
+ * @category layers
177
177
  * @since 4.0.0
178
178
  */
179
179
  export const layer: Layer.Layer<Geolocation> = Layer.succeed(
package/src/IndexedDb.ts CHANGED
@@ -87,7 +87,7 @@ export const AutoIncrement = Schema.Int.check(
87
87
  /**
88
88
  * Creates an `IndexedDb` service from an `IDBFactory` and `IDBKeyRange` constructor.
89
89
  *
90
- * @category constructor
90
+ * @category constructors
91
91
  * @since 4.0.0
92
92
  */
93
93
  export const make = (impl: Omit<IndexedDb, typeof TypeId>): IndexedDb => IndexedDb.of({ [TypeId]: TypeId, ...impl })
@@ -170,7 +170,6 @@ export type KeyPathNumber<TableSchema extends IndexedDbTable.AnySchemaStruct> =
170
170
  /**
171
171
  * Namespace containing the typed IndexedDB query model interfaces and helper types.
172
172
  *
173
- * @category models
174
173
  * @since 4.0.0
175
174
  */
176
175
  export declare namespace IndexedDbQuery {
@@ -30,7 +30,7 @@ const ErrorTypeId = "~@effect/platform-browser/Permissions/PermissionsError"
30
30
  * Wrapper on the Permission API (`navigator.permissions`) with methods for
31
31
  * querying status of permissions.
32
32
  *
33
- * @category Models
33
+ * @category models
34
34
  * @since 4.0.0
35
35
  */
36
36
  export interface Permissions {
@@ -111,7 +111,7 @@ export class PermissionsError extends Data.TaggedError("PermissionsError")<{
111
111
  /**
112
112
  * Service tag for the browser `Permissions` service.
113
113
  *
114
- * @category Service
114
+ * @category services
115
115
  * @since 4.0.0
116
116
  */
117
117
  export const Permissions: Context.Service<Permissions, Permissions> = Context.Service<Permissions>(TypeId)
@@ -119,7 +119,7 @@ export const Permissions: Context.Service<Permissions, Permissions> = Context.Se
119
119
  /**
120
120
  * A layer that directly interfaces with the `navigator.permissions` api
121
121
  *
122
- * @category Layers
122
+ * @category layers
123
123
  * @since 4.0.0
124
124
  */
125
125
  export const layer: Layer.Layer<Permissions> = Layer.succeed(
package/src/index.ts CHANGED
@@ -5,81 +5,405 @@
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
7
  /**
8
+ * Browser platform implementation of the Crypto service.
9
+ *
10
+ * @since 1.0.0
11
+ */
12
+ export * as BrowserCrypto from "./BrowserCrypto.ts"
13
+
14
+ /**
15
+ * Browser implementations of the Effect `HttpClient`.
16
+ *
17
+ * This module exposes HTTP client layers for code that runs in a browser. It
18
+ * re-exports the fetch-based client for the common case, where requests should
19
+ * use the platform `fetch` implementation and optional `RequestInit` defaults,
20
+ * and it provides an `XMLHttpRequest`-backed layer for integrations that need
21
+ * XHR semantics such as response type control or environments where XHR is the
22
+ * required transport.
23
+ *
24
+ * Use these layers for single-page applications, browser tests, generated
25
+ * `HttpApiClient`s, and other client-side Effect programs that need HTTP
26
+ * requests to participate in interruption, typed transport / decode errors, and
27
+ * Effect's response body readers.
28
+ *
29
+ * Browser networking rules still apply. Cross-origin requests are subject to
30
+ * CORS preflights and server allowlists, especially when using custom headers,
31
+ * non-simple methods, or non-simple content types. Only CORS-exposed response
32
+ * headers are readable, and cookies / authentication are controlled by the
33
+ * browser and the configured fetch `RequestInit.credentials` policy. The XHR
34
+ * layer uses the browser's `XMLHttpRequest` defaults for credentials.
35
+ *
36
+ * Body handling differs between the transports. Fetch delegates body framing to
37
+ * the Web Fetch implementation. The XHR client sends empty, raw, `Uint8Array`,
38
+ * and `FormData` bodies directly, buffers `Stream` request bodies before
39
+ * sending, defaults responses to text, and can be switched to `ArrayBuffer`
40
+ * responses with `withXHRArrayBuffer`. When sending `FormData`, avoid setting
41
+ * an incompatible `Content-Type` header so the browser can generate the
42
+ * multipart boundary.
43
+ *
8
44
  * @since 4.0.0
9
45
  */
10
46
  export * as BrowserHttpClient from "./BrowserHttpClient.ts"
11
47
 
12
48
  /**
49
+ * Browser-backed `KeyValueStore` layers for Effect programs.
50
+ *
51
+ * This module provides `KeyValueStore` implementations backed by the browser's
52
+ * synchronous Web Storage APIs: `localStorage` for origin-scoped data that
53
+ * persists across page reloads and browser sessions, and `sessionStorage` for
54
+ * page-session data that is cleared when that tab or window's page session
55
+ * ends. They are useful for small client-side values such as user preferences,
56
+ * feature flags, lightweight caches, persisted drafts, or session-only workflow
57
+ * state.
58
+ *
59
+ * Web Storage is only available in browser environments and is scoped by origin.
60
+ * Browsers may deny access in private modes or restricted contexts, and writes
61
+ * can fail when storage quotas are exceeded. The API stores strings and runs
62
+ * synchronously on the main thread, so prefer it for small payloads and avoid
63
+ * treating it as a database or a secure place for sensitive data.
64
+ *
13
65
  * @since 4.0.0
14
66
  */
15
67
  export * as BrowserKeyValueStore from "./BrowserKeyValueStore.ts"
16
68
 
17
69
  /**
70
+ * Browser-backed persistence layers for Effect's persistence service.
71
+ *
72
+ * This module provides IndexedDB implementations of the Effect persistence services for applications that need a
73
+ * durable client-side cache, such as remembered query results, offline-capable workflows, or values that should survive
74
+ * page reloads. Entries are stored by persistence store id and key in a shared IndexedDB object store, with optional
75
+ * expiration timestamps for TTL-based invalidation.
76
+ *
77
+ * Because this storage depends on browser IndexedDB, operations can fail when storage is unavailable, quota is exceeded,
78
+ * data is cleared by the user or browser, or the payload cannot be structured-cloned by IndexedDB. Expired entries are
79
+ * removed lazily when they are read, so this module is best suited for application-managed cached objects rather than
80
+ * security-sensitive or authoritative data.
81
+ *
18
82
  * @since 4.0.0
19
83
  */
20
84
  export * as BrowserPersistence from "./BrowserPersistence.ts"
21
85
 
22
86
  /**
87
+ * Browser entry-point helpers for running Effect programs.
88
+ *
89
+ * This module exposes `runMain`, a browser-oriented main runner for launching
90
+ * an Effect as the root program of a page, single-page application, demo, or
91
+ * browser test harness. It delegates execution to the core Effect runtime while
92
+ * adding the browser lifecycle hook needed to interrupt the main fiber when the
93
+ * page receives `beforeunload`.
94
+ *
95
+ * `BrowserRuntime` does not provide application services by itself. Provide
96
+ * any required layers, such as browser HTTP, storage, worker, geolocation, or
97
+ * permission services, before passing the effect to `runMain`. Keep long-lived
98
+ * browser resources scoped so interruption can run their finalizers while the
99
+ * page is still active.
100
+ *
101
+ * Browser unload is more constrained than a process signal. Finalizers that
102
+ * need the network, timers, prompts, or long asynchronous work may not complete
103
+ * once navigation or tab close has started, and browsers do not expose a
104
+ * process exit status. Use `runMain` to connect the page lifecycle to Effect
105
+ * interruption, and use browser-specific persistence or delivery APIs for work
106
+ * that must survive page teardown.
107
+ *
23
108
  * @since 4.0.0
24
109
  */
25
110
  export * as BrowserRuntime from "./BrowserRuntime.ts"
26
111
 
27
112
  /**
113
+ * Browser WebSocket layers for Effect sockets.
114
+ *
115
+ * This module provides the browser entry point for `Socket.Socket` values
116
+ * backed by the platform `WebSocket` implementation. Use `layerWebSocket` when
117
+ * client-side Effect programs, browser tests, RPC transports, or realtime UI
118
+ * features need a bidirectional socket connected to a WebSocket URL, and use
119
+ * `layerWebSocketConstructor` when lower-level socket APIs need access to the
120
+ * browser constructor service.
121
+ *
122
+ * Browser WebSocket rules still apply. Connections are created through
123
+ * `globalThis.WebSocket`, so URL schemes, subprotocol negotiation, mixed-content
124
+ * blocking, cookies, authentication, CORS-like origin checks, and extension
125
+ * negotiation are controlled by the browser and server rather than by Effect.
126
+ * Close events are translated into socket errors unless the provided
127
+ * `closeCodeIsError` predicate classifies the close code as clean, which is
128
+ * useful for protocols that use application-specific close codes.
129
+ *
130
+ * Messages are delivered as strings or binary `Uint8Array` values; browser
131
+ * `Blob` messages are read into bytes before they reach the socket handler.
132
+ * Outgoing data should already be serialized to a string or bytes, and protocol
133
+ * frames that represent an intentional close should be sent as `CloseEvent`
134
+ * values so the underlying `WebSocket.close` code and reason are preserved.
135
+ *
28
136
  * @since 4.0.0
29
137
  */
30
138
  export * as BrowserSocket from "./BrowserSocket.ts"
31
139
 
32
140
  /**
141
+ * Browser `Stream` constructors for DOM event targets.
142
+ *
143
+ * This module provides typed helpers for turning `window.addEventListener` and
144
+ * `document.addEventListener` callbacks into Effect `Stream`s. They are useful
145
+ * for UI and runtime signals such as resize, visibility, keyboard, pointer,
146
+ * focus, online / offline, and other browser events that should be composed
147
+ * with Effect stream operators and finalized with the consuming fiber.
148
+ *
149
+ * Browser events are push-based `EventTarget` notifications, so they do not
150
+ * apply Web Streams backpressure to the browser event source. Events are
151
+ * buffered until downstream pulls them; the default buffer is unbounded, so
152
+ * high-frequency sources like scroll, pointermove, or mousemove should usually
153
+ * set `bufferSize` and use stream operators that sample, debounce, throttle, or
154
+ * drop work as appropriate.
155
+ *
156
+ * These helpers are for DOM events, not for adapting `ReadableStream` request
157
+ * or response bodies. Fetch bodies follow the Web Streams body rules, including
158
+ * single-consumer locking and disturbed bodies after reads, and should be
159
+ * handled with body-specific HTTP or Web Streams APIs instead. When using the
160
+ * browser `once` option, pair the stream with `Stream.take(1)` if a finite
161
+ * stream is required.
162
+ *
33
163
  * @since 4.0.0
34
164
  */
35
165
  export * as BrowserStream from "./BrowserStream.ts"
36
166
 
37
167
  /**
168
+ * Parent-side browser support for Effect workers.
169
+ *
170
+ * This module provides the `WorkerPlatform` used by browser applications that
171
+ * spawn or connect to `Worker`, `SharedWorker`, and `MessagePort` endpoints
172
+ * through Effect's worker protocol. Pair it with `BrowserWorkerRunner` in the
173
+ * worker entrypoint when building worker-backed RPC clients, moving CPU-bound
174
+ * work off the main thread, isolating browser-only services, or adapting an
175
+ * existing `MessageChannel` in tests and custom transports.
176
+ *
177
+ * Dedicated workers communicate through the worker object itself, while shared
178
+ * workers communicate through `worker.port`; raw `MessagePort` values are also
179
+ * accepted and are started when supported. Messages are posted with the browser
180
+ * structured-clone algorithm, so payloads must be cloneable by the target
181
+ * runtime. Transfer lists can avoid copying values such as `ArrayBuffer` or
182
+ * `MessagePort`, but transferring moves ownership away from the sender and
183
+ * invalid or mismatched transferables can fail the send. Scope finalization
184
+ * sends the worker close signal over the port; the application that created a
185
+ * dedicated `Worker` remains responsible for any broader lifecycle such as
186
+ * terminating it.
187
+ *
38
188
  * @since 4.0.0
39
189
  */
40
190
  export * as BrowserWorker from "./BrowserWorker.ts"
41
191
 
42
192
  /**
193
+ * Browser runtime support for Effect worker runners.
194
+ *
195
+ * This module is intended for code that is already executing in a browser
196
+ * worker context, or for tests and adapters that supply a `MessagePort` or
197
+ * `Window` endpoint directly. It provides the `WorkerRunnerPlatform` used by
198
+ * `WorkerRunner` and `RpcServer.layerProtocolWorkerRunner` to receive parent
199
+ * or client requests, run Effect handlers, and send responses through the
200
+ * browser `postMessage` channel.
201
+ *
202
+ * Use it with `BrowserWorker` when a browser application needs to move RPC
203
+ * handlers, CPU-bound computations, or browser-only services into a dedicated
204
+ * worker or shared worker. Dedicated workers communicate through the current
205
+ * `self` endpoint; shared workers accept multiple `onconnect` ports and cache
206
+ * ports that connect before the runner layer starts. Messages still use the
207
+ * browser structured-clone algorithm, so payload schemas, transfer lists,
208
+ * `messageerror` events, and the lifetime of each `MessagePort` must be
209
+ * considered when crossing worker boundaries.
210
+ *
43
211
  * @since 4.0.0
44
212
  */
45
213
  export * as BrowserWorkerRunner from "./BrowserWorkerRunner.ts"
46
214
 
47
215
  /**
216
+ * Browser clipboard service for Effect programs.
217
+ *
218
+ * This module wraps the browser `navigator.clipboard` API in a `Clipboard`
219
+ * service so client-side applications can read, write, and clear clipboard
220
+ * contents as typed Effects. It is useful for common UI workflows such as copy
221
+ * buttons, paste/import actions, sharing generated text, and moving rich
222
+ * clipboard payloads like `Blob`-backed `ClipboardItem`s through an Effect
223
+ * environment.
224
+ *
225
+ * Browser clipboard rules still apply. Clipboard access generally requires a
226
+ * secure context, and browsers may require a user gesture, permission prompt, or
227
+ * active focused document before reads or writes are allowed. Support also
228
+ * varies by operation and payload type: text helpers are the most portable,
229
+ * while `ClipboardItem` and non-text MIME types may be unavailable or restricted
230
+ * in some browsers. Failed browser operations are surfaced as `ClipboardError`.
231
+ *
48
232
  * @since 4.0.0
49
233
  */
50
234
  export * as Clipboard from "./Clipboard.ts"
51
235
 
52
236
  /**
237
+ * Browser geolocation support for Effect programs.
238
+ *
239
+ * This module provides a `Geolocation` service and browser-backed layer for
240
+ * reading device location through `navigator.geolocation`. Use
241
+ * `getCurrentPosition` when an application needs one location fix, such as a
242
+ * nearby-search, check-in, or delivery estimate, and `watchPosition` when it
243
+ * needs a stream of updates for navigation, tracking, or location-aware UI.
244
+ *
245
+ * The implementation is browser-only and relies on the browser permission and
246
+ * policy model for geolocation. Calls may prompt the user, fail when permission
247
+ * is denied, time out, or report that position data is unavailable because of
248
+ * device, browser, privacy, origin, or secure-context restrictions. Watched
249
+ * positions are scoped so the underlying browser watch is cleared when the
250
+ * stream is finalized, and slow consumers should account for the sliding
251
+ * buffer used by `watchPosition`.
252
+ *
53
253
  * @since 4.0.0
54
254
  */
55
255
  export * as Geolocation from "./Geolocation.ts"
56
256
 
57
257
  /**
258
+ * Browser IndexedDB primitives and key schemas for Effect applications.
259
+ *
260
+ * This module is the low-level bridge used by the platform-browser IndexedDB
261
+ * integration. It provides an `IndexedDb` service around the browser
262
+ * `indexedDB` factory and `IDBKeyRange` constructor, a `layerWindow` layer for
263
+ * wiring those primitives from `window`, and schemas for the key shapes accepted
264
+ * by IndexedDB object stores and indexes.
265
+ *
266
+ * Use it when building typed local persistence for browser caches,
267
+ * offline-first state, background queues, drafts, or other client-side data
268
+ * that should be validated before it reaches IndexedDB. Higher-level database,
269
+ * version, table, and query modules build on these primitives for migrations
270
+ * and typed transactions.
271
+ *
272
+ * IndexedDB still follows the browser rules: schema changes happen only during
273
+ * version upgrades, upgrades may be blocked by other open tabs or connections,
274
+ * and reads or writes must run in transactions scoped to the object stores they
275
+ * touch. The `layerWindow` constructor should be used only where browser
276
+ * globals are available, and code that also runs during SSR or in restricted
277
+ * browser contexts should account for `indexedDB` or `IDBKeyRange` being
278
+ * missing.
279
+ *
58
280
  * @since 4.0.0
59
281
  */
60
282
  export * as IndexedDb from "./IndexedDb.ts"
61
283
 
62
284
  /**
285
+ * Builds and opens typed IndexedDB databases from versioned schema migrations.
286
+ *
287
+ * This module turns an `IndexedDbVersion` migration chain into an
288
+ * `IndexedDbDatabase` layer. The layer opens the browser database, runs any
289
+ * pending upgrade migrations, provides a query builder for the current schema,
290
+ * and exposes a `rebuild` effect that deletes and reopens the database. It is
291
+ * the database-level companion to the table, version, and query builder
292
+ * modules.
293
+ *
294
+ * Use it for browser-local persistence such as offline-first application
295
+ * state, cached server data, background queues, drafts, and other client-side
296
+ * stores that need typed reads and writes backed by IndexedDB transactions.
297
+ *
298
+ * IndexedDB schema changes can only happen inside upgrade transactions, so
299
+ * every call to `make` or `.add` represents the next browser database version
300
+ * and only migrations after the existing browser version are run. Table and
301
+ * index definitions type the migration and query APIs, but object stores and
302
+ * indexes still need to be created or removed explicitly with the migration
303
+ * transaction helpers. Include the complete target table set in each version,
304
+ * create indexes before querying them, and treat key path or auto-increment
305
+ * changes as store migrations that copy data into a replacement object store.
306
+ * Upgrades can be blocked by other open connections, and all migration reads,
307
+ * writes, store changes, and index changes share the single upgrade
308
+ * transaction supplied by the browser.
309
+ *
63
310
  * @since 4.0.0
64
311
  */
65
312
  export * as IndexedDbDatabase from "./IndexedDbDatabase.ts"
66
313
 
67
314
  /**
315
+ * Builds effectful, schema-aware queries for typed browser IndexedDB versions.
316
+ *
317
+ * An `IndexedDbQueryBuilder` is created from an open database and a version's
318
+ * table descriptors, then exposes `from(tableName)` as the entry point for
319
+ * table operations. The resulting query objects can select, count, delete,
320
+ * insert, upsert, clear tables, stream paged reads, react to invalidations, and
321
+ * run multiple effects in a shared `IDBTransaction` with `withTransaction`.
322
+ *
323
+ * Use this module for local browser persistence such as caches, offline-first
324
+ * state, background queues, drafts, and other client-side data where writes
325
+ * should be encoded through `Schema` and reads should be decoded before they
326
+ * reach application code.
327
+ *
328
+ * Index and range helpers are thinly typed wrappers around IndexedDB object
329
+ * stores, indexes, `IDBKeyRange`, and cursors. Index names must be declared on
330
+ * the table and created during migrations; without an index, queries use the
331
+ * object store key path. Range values are encoded IndexedDB key values, and
332
+ * compound key paths must follow the declared key order. Filters, offsets,
333
+ * reverse reads, out-of-line keys, and limited deletes require cursor-based
334
+ * scans, while simpler selects can use `getAll`.
335
+ *
336
+ * Table schema details affect runtime behavior: auto-increment writes may omit
337
+ * the generated numeric key, stores without a key path require an out-of-line
338
+ * `key` for writes and add that `key` back to selected rows, and schema
339
+ * mismatches surface as `EncodeError` or `DecodeError` query failures.
340
+ *
68
341
  * @since 4.0.0
69
342
  */
70
343
  export * as IndexedDbQueryBuilder from "./IndexedDbQueryBuilder.ts"
71
344
 
72
345
  /**
346
+ * Defines typed table descriptors for the browser IndexedDB integration.
347
+ *
348
+ * An `IndexedDbTable` records the object store name, row schema, primary key
349
+ * path, indexes, auto-increment behavior, and transaction durability used by
350
+ * database versions, migrations, and typed queries. These descriptors are
351
+ * useful for local caches, offline-first application state, background queues,
352
+ * drafts, and other browser-persisted data that should be validated through
353
+ * `Schema`.
354
+ *
355
+ * Key paths and index paths must reference encoded schema fields whose values
356
+ * are valid IndexedDB keys, and compound paths are represented as readonly
357
+ * arrays. Tables without a key path use an out-of-line `key` that is added to
358
+ * reads and required for writes, so the row schema itself cannot define a
359
+ * `key` field. Auto-increment tables require a numeric key path; when that key
360
+ * is omitted on write, the module uses a derived schema without the generated
361
+ * key. Declaring indexes here types query builder index selection, but the
362
+ * indexes still need to be created during database migrations.
363
+ *
73
364
  * @since 4.0.0
74
365
  */
75
366
  export * as IndexedDbTable from "./IndexedDbTable.ts"
76
367
 
77
368
  /**
369
+ * Typed IndexedDB schema version definitions.
370
+ *
371
+ * This module represents one logical IndexedDB database version as a non-empty set of `IndexedDbTable` definitions.
372
+ * Versions are consumed by `IndexedDbDatabase.make` and `.add` to type query builders and migration transactions, so
373
+ * applications can describe the tables available after initialization or after each schema upgrade.
374
+ *
375
+ * Use an `IndexedDbVersion` when defining the initial stores for a browser database, adding or removing object stores,
376
+ * changing indexes, or moving data between differently shaped table schemas. The version value is a typed description of
377
+ * the target schema; creating and deleting object stores or indexes still happens explicitly inside the corresponding
378
+ * `IndexedDbDatabase` migration callback.
379
+ *
380
+ * IndexedDB versioning is ordered by the migration chain rather than by a number stored here. Each `.add` step becomes
381
+ * the next browser database version, and only migrations after the browser's current version are run. Include every table
382
+ * that should be queryable in each target version, avoid duplicate table names, and remember that key-path or
383
+ * auto-increment changes usually require creating a new object store and copying data during the upgrade transaction.
384
+ *
78
385
  * @since 4.0.0
79
386
  */
80
387
  export * as IndexedDbVersion from "./IndexedDbVersion.ts"
81
388
 
82
389
  /**
390
+ * Browser Permissions API support for Effect programs.
391
+ *
392
+ * This module provides a `Permissions` service and browser-backed layer for
393
+ * querying `navigator.permissions` from Effect code. Use it to check whether a
394
+ * browser capability is currently `granted`, `prompt`, or `denied` before
395
+ * showing UI for flows such as geolocation, notifications, clipboard access,
396
+ * camera, microphone, or persistent storage.
397
+ *
398
+ * Permission queries do not request access by themselves and should not replace
399
+ * the feature API that actually performs the operation. Browser support for
400
+ * permission names and states is uneven, queries may reject for unsupported or
401
+ * invalid descriptors, and some permissions are only meaningful in secure
402
+ * contexts or after user activation. Returned `PermissionStatus` objects can
403
+ * change when the user updates browser settings or responds to prompts; when
404
+ * watching `change` or `onchange`, account for browser differences and clean up
405
+ * listeners when the surrounding Effect scope ends.
406
+ *
83
407
  * @since 4.0.0
84
408
  */
85
409
  export * as Permissions from "./Permissions.ts"