@effect/platform-browser 4.0.0-beta.8 → 4.0.0-beta.80

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 (91) hide show
  1. package/dist/BrowserCrypto.d.ts +49 -0
  2. package/dist/BrowserCrypto.d.ts.map +1 -0
  3. package/dist/BrowserCrypto.js +87 -0
  4. package/dist/BrowserCrypto.js.map +1 -0
  5. package/dist/BrowserHttpClient.d.ts +48 -19
  6. package/dist/BrowserHttpClient.d.ts.map +1 -1
  7. package/dist/BrowserHttpClient.js +62 -21
  8. package/dist/BrowserHttpClient.js.map +1 -1
  9. package/dist/BrowserKeyValueStore.d.ts +37 -14
  10. package/dist/BrowserKeyValueStore.d.ts.map +1 -1
  11. package/dist/BrowserKeyValueStore.js +144 -10
  12. package/dist/BrowserKeyValueStore.js.map +1 -1
  13. package/dist/BrowserPersistence.d.ts +40 -0
  14. package/dist/BrowserPersistence.d.ts.map +1 -0
  15. package/dist/BrowserPersistence.js +207 -0
  16. package/dist/BrowserPersistence.js.map +1 -0
  17. package/dist/BrowserRuntime.d.ts +64 -4
  18. package/dist/BrowserRuntime.d.ts.map +1 -1
  19. package/dist/BrowserRuntime.js +19 -1
  20. package/dist/BrowserRuntime.js.map +1 -1
  21. package/dist/BrowserSocket.d.ts +33 -6
  22. package/dist/BrowserSocket.d.ts.map +1 -1
  23. package/dist/BrowserSocket.js +33 -6
  24. package/dist/BrowserSocket.js.map +1 -1
  25. package/dist/BrowserStream.d.ts +19 -7
  26. package/dist/BrowserStream.d.ts.map +1 -1
  27. package/dist/BrowserStream.js +19 -7
  28. package/dist/BrowserStream.js.map +1 -1
  29. package/dist/BrowserWorker.d.ts +25 -4
  30. package/dist/BrowserWorker.d.ts.map +1 -1
  31. package/dist/BrowserWorker.js +34 -6
  32. package/dist/BrowserWorker.js.map +1 -1
  33. package/dist/BrowserWorkerRunner.d.ts +31 -6
  34. package/dist/BrowserWorkerRunner.d.ts.map +1 -1
  35. package/dist/BrowserWorkerRunner.js +43 -10
  36. package/dist/BrowserWorkerRunner.js.map +1 -1
  37. package/dist/Clipboard.d.ts +59 -14
  38. package/dist/Clipboard.d.ts.map +1 -1
  39. package/dist/Clipboard.js +34 -12
  40. package/dist/Clipboard.js.map +1 -1
  41. package/dist/Geolocation.d.ts +80 -25
  42. package/dist/Geolocation.d.ts.map +1 -1
  43. package/dist/Geolocation.js +48 -17
  44. package/dist/Geolocation.js.map +1 -1
  45. package/dist/IndexedDb.d.ts +75 -0
  46. package/dist/IndexedDb.d.ts.map +1 -0
  47. package/dist/IndexedDb.js +85 -0
  48. package/dist/IndexedDb.js.map +1 -0
  49. package/dist/IndexedDbDatabase.d.ts +153 -0
  50. package/dist/IndexedDbDatabase.d.ts.map +1 -0
  51. package/dist/IndexedDbDatabase.js +327 -0
  52. package/dist/IndexedDbDatabase.js.map +1 -0
  53. package/dist/IndexedDbQueryBuilder.d.ts +422 -0
  54. package/dist/IndexedDbQueryBuilder.d.ts.map +1 -0
  55. package/dist/IndexedDbQueryBuilder.js +935 -0
  56. package/dist/IndexedDbQueryBuilder.js.map +1 -0
  57. package/dist/IndexedDbTable.d.ts +166 -0
  58. package/dist/IndexedDbTable.d.ts.map +1 -0
  59. package/dist/IndexedDbTable.js +71 -0
  60. package/dist/IndexedDbTable.js.map +1 -0
  61. package/dist/IndexedDbVersion.d.ts +99 -0
  62. package/dist/IndexedDbVersion.d.ts.map +1 -0
  63. package/dist/IndexedDbVersion.js +44 -0
  64. package/dist/IndexedDbVersion.js.map +1 -0
  65. package/dist/Permissions.d.ts +52 -16
  66. package/dist/Permissions.d.ts.map +1 -1
  67. package/dist/Permissions.js +42 -11
  68. package/dist/Permissions.js.map +1 -1
  69. package/dist/index.d.ts +38 -10
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +38 -10
  72. package/dist/index.js.map +1 -1
  73. package/package.json +4 -3
  74. package/src/BrowserCrypto.ts +97 -0
  75. package/src/BrowserHttpClient.ts +72 -27
  76. package/src/BrowserKeyValueStore.ts +160 -12
  77. package/src/BrowserPersistence.ts +334 -0
  78. package/src/BrowserRuntime.ts +64 -4
  79. package/src/BrowserSocket.ts +33 -6
  80. package/src/BrowserStream.ts +19 -7
  81. package/src/BrowserWorker.ts +34 -6
  82. package/src/BrowserWorkerRunner.ts +43 -10
  83. package/src/Clipboard.ts +56 -14
  84. package/src/Geolocation.ts +76 -21
  85. package/src/IndexedDb.ts +113 -0
  86. package/src/IndexedDbDatabase.ts +648 -0
  87. package/src/IndexedDbQueryBuilder.ts +2032 -0
  88. package/src/IndexedDbTable.ts +260 -0
  89. package/src/IndexedDbVersion.ts +138 -0
  90. package/src/Permissions.ts +47 -14
  91. package/src/index.ts +45 -10
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Typed object-store descriptors for the browser IndexedDB integration.
3
+ *
4
+ * An {@link IndexedDbTable} is the schema-backed description of one IndexedDB
5
+ * object store. It carries the store name, row schema, key path, index key
6
+ * paths, auto-increment mode, and transaction durability used by database
7
+ * versions, migrations, and typed queries. The `make` constructor also derives
8
+ * the read, array, and auto-increment write schemas used by the query builder.
9
+ *
10
+ * @see {@link make} for constructing table descriptors.
11
+ *
12
+ * @since 4.0.0
13
+ */
14
+ import { type Pipeable, pipeArguments } from "effect/Pipeable"
15
+ import * as Schema from "effect/Schema"
16
+ import * as Struct from "effect/Struct"
17
+ import type { NoInfer } from "effect/Types"
18
+ import * as IndexedDb from "./IndexedDb.ts"
19
+ import type * as IndexedDbQueryBuilder from "./IndexedDbQueryBuilder.ts"
20
+
21
+ const TypeId = "~@effect/platform-browser/IndexedDbTable"
22
+
23
+ /**
24
+ * Typed IndexedDB table definition containing its name, schema, key path, indexes, auto-increment setting, and transaction durability.
25
+ *
26
+ * @category interface
27
+ * @since 4.0.0
28
+ */
29
+ export interface IndexedDbTable<
30
+ out Name extends string,
31
+ out TableSchema extends AnySchemaStruct,
32
+ out Indexes extends Record<
33
+ string,
34
+ IndexedDbQueryBuilder.KeyPath<TableSchema>
35
+ >,
36
+ out KeyPath extends Readonly<IDBValidKey | undefined>,
37
+ out AutoIncrement extends boolean
38
+ > extends Pipeable {
39
+ new(_: never): {}
40
+ readonly [TypeId]: typeof TypeId
41
+ readonly tableName: Name
42
+ readonly tableSchema: TableSchema
43
+ readonly readSchema: Schema.Top
44
+ readonly autoincrementSchema: Schema.Top
45
+ readonly arraySchema: Schema.Top
46
+ readonly keyPath: KeyPath
47
+ readonly indexes: Indexes
48
+ readonly autoIncrement: AutoIncrement
49
+ readonly durability: IDBTransactionDurability
50
+ }
51
+
52
+ /**
53
+ * Schema constraint for table schemas that expose struct fields.
54
+ *
55
+ * @category models
56
+ * @since 4.0.0
57
+ */
58
+ export type AnySchemaStruct = Schema.Top & {
59
+ readonly fields: Schema.Struct.Fields
60
+ }
61
+
62
+ /**
63
+ * Type-erased shape of an `IndexedDbTable` used when table type parameters are not needed.
64
+ *
65
+ * @category models
66
+ * @since 4.0.0
67
+ */
68
+ export interface Any {
69
+ readonly [TypeId]: typeof TypeId
70
+ readonly keyPath: any
71
+ readonly tableName: string
72
+ readonly tableSchema: Schema.Top
73
+ readonly readSchema: Schema.Top
74
+ readonly autoincrementSchema: Schema.Top
75
+ readonly arraySchema: Schema.Top
76
+ readonly autoIncrement: boolean
77
+ readonly indexes: any
78
+ }
79
+
80
+ /**
81
+ * Type-erased `IndexedDbTable` retaining the table interface properties with broad type parameters.
82
+ *
83
+ * @category models
84
+ * @since 4.0.0
85
+ */
86
+ export type AnyWithProps = IndexedDbTable<
87
+ string,
88
+ AnySchemaStruct,
89
+ any,
90
+ any,
91
+ boolean
92
+ >
93
+
94
+ /**
95
+ * Extracts the table name type from an `IndexedDbTable`.
96
+ *
97
+ * @category models
98
+ * @since 4.0.0
99
+ */
100
+ export type TableName<Table extends Any> = Table["tableName"]
101
+ /**
102
+ * Extracts the key-path type from an `IndexedDbTable`.
103
+ *
104
+ * @category models
105
+ * @since 4.0.0
106
+ */
107
+ export type KeyPath<Table extends Any> = Table["keyPath"]
108
+
109
+ /**
110
+ * Extracts the auto-increment flag type from an `IndexedDbTable`.
111
+ *
112
+ * @category models
113
+ * @since 4.0.0
114
+ */
115
+ export type AutoIncrement<Table extends Any> = Table["autoIncrement"]
116
+
117
+ /**
118
+ * Extracts the schema type from an `IndexedDbTable`.
119
+ *
120
+ * @category models
121
+ * @since 4.0.0
122
+ */
123
+ export type TableSchema<Table extends Any> = Table["tableSchema"]
124
+ /**
125
+ * Extracts the decoding or encoding service requirements needed by an `IndexedDbTable` schema.
126
+ *
127
+ * @category models
128
+ * @since 4.0.0
129
+ */
130
+ export type Context<Table extends Any> =
131
+ | Table["tableSchema"]["DecodingServices"]
132
+ | Table["tableSchema"]["EncodingServices"]
133
+
134
+ /**
135
+ * Extracts the encoded row type from an `IndexedDbTable` schema.
136
+ *
137
+ * @category models
138
+ * @since 4.0.0
139
+ */
140
+ export type Encoded<Table extends Any> = Table["tableSchema"]["Encoded"]
141
+
142
+ /**
143
+ * Extracts the index definition map from an `IndexedDbTable`.
144
+ *
145
+ * @category models
146
+ * @since 4.0.0
147
+ */
148
+ export type Indexes<Table extends Any> = Table["indexes"]
149
+
150
+ /**
151
+ * Selects the table with the given name from a union of `IndexedDbTable` types.
152
+ *
153
+ * @category models
154
+ * @since 4.0.0
155
+ */
156
+ export type WithName<Table extends Any, TableName extends string> = Extract<
157
+ Table,
158
+ { readonly tableName: TableName }
159
+ >
160
+
161
+ const Proto = {
162
+ [TypeId]: TypeId,
163
+ pipe() {
164
+ return pipeArguments(this, arguments)
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Creates a typed IndexedDB table definition from its name, schema, optional key path, indexes, auto-increment flag, and durability.
170
+ *
171
+ * **When to use**
172
+ *
173
+ * Use to define a typed object-store descriptor for inclusion in an
174
+ * `IndexedDbVersion` and for migration or query APIs.
175
+ *
176
+ * **Details**
177
+ *
178
+ * `autoIncrement` defaults to `false` and `durability` defaults to `"relaxed"`.
179
+ * Tables without a key path get a read schema that includes an out-of-line
180
+ * `key`, while auto-increment tables use a write schema where the generated key
181
+ * may be omitted.
182
+ *
183
+ * **Gotchas**
184
+ *
185
+ * Tables without a key path cannot define a `key` field in their row schema.
186
+ * Key paths and index paths must point to encoded fields whose values are valid
187
+ * IndexedDB keys, and declared indexes still need to be created during
188
+ * database migrations.
189
+ *
190
+ * @see `IndexedDbVersion.make` for grouping table definitions into a schema version
191
+ *
192
+ * @category constructors
193
+ * @since 4.0.0
194
+ */
195
+ export const make = <
196
+ const Name extends string,
197
+ TableSchema extends AnySchemaStruct,
198
+ const Indexes extends Record<
199
+ string,
200
+ IndexedDbQueryBuilder.KeyPath<TableSchema>
201
+ >,
202
+ const KeyPath extends
203
+ | (AutoIncrement extends true ? IndexedDbQueryBuilder.KeyPathNumber<NoInfer<TableSchema>>
204
+ : IndexedDbQueryBuilder.KeyPath<NoInfer<TableSchema>>)
205
+ | undefined = undefined,
206
+ const AutoIncrement extends boolean = false
207
+ >(options: {
208
+ readonly name: Name
209
+ readonly schema: [KeyPath] extends [undefined]
210
+ ? "key" extends keyof TableSchema["fields"] ? "Cannot have a 'key' field when keyPath is undefined"
211
+ : TableSchema
212
+ : TableSchema
213
+ readonly keyPath?: KeyPath
214
+ readonly indexes?: Indexes | undefined
215
+ readonly autoIncrement?: IsValidAutoIncrementKeyPath<
216
+ TableSchema,
217
+ KeyPath
218
+ > extends true ? AutoIncrement | undefined
219
+ : never
220
+ readonly durability?: IDBTransactionDurability | undefined
221
+ }): IndexedDbTable<
222
+ Name,
223
+ TableSchema,
224
+ Indexes,
225
+ Extract<KeyPath, Readonly<IDBValidKey | undefined>>,
226
+ AutoIncrement
227
+ > => {
228
+ // oxlint-disable-next-line typescript/no-extraneous-class
229
+ class Table {}
230
+ Object.assign(Table, Proto)
231
+ const readSchema = options.keyPath === undefined
232
+ ? Schema.Struct({
233
+ ...(options.schema as Schema.Struct<{}>).fields,
234
+ key: IndexedDb.IDBValidKey
235
+ })
236
+ : options.schema
237
+ ;(Table as any).tableName = options.name
238
+ ;(Table as any).tableSchema = options.schema
239
+ ;(Table as any).readSchema = readSchema
240
+ ;(Table as any).arraySchema = Schema.Array(readSchema as any)
241
+ ;(Table as any).autoincrementSchema = options.autoIncrement
242
+ ? Schema.Struct(Struct.omit((options.schema as Schema.Struct<{}>).fields, [options.keyPath!] as any))
243
+ : options.schema
244
+ ;(Table as any).keyPath = options.keyPath
245
+ ;(Table as any).indexes = options.indexes
246
+ ;(Table as any).autoIncrement = options.autoIncrement === true
247
+ ;(Table as any).durability = options.durability ?? "relaxed"
248
+ return Table as any
249
+ }
250
+
251
+ // -----------------------------------------------------------------------------
252
+ // internal
253
+ // -----------------------------------------------------------------------------
254
+
255
+ type IsValidAutoIncrementKeyPath<
256
+ TableSchema extends AnySchemaStruct,
257
+ KeyPath
258
+ > = KeyPath extends keyof TableSchema["Encoded"] ? TableSchema["Encoded"][KeyPath] extends number ? true
259
+ : false
260
+ : false
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Typed IndexedDB schema version definitions.
3
+ *
4
+ * This module represents one logical IndexedDB database version as a non-empty set of `IndexedDbTable` definitions.
5
+ * Versions are consumed by `IndexedDbDatabase.make` and `.add` to type query builders and migration transactions, so
6
+ * applications can describe the tables available after initialization or after each schema upgrade.
7
+ *
8
+ * Use an `IndexedDbVersion` when defining the initial stores for a browser database, adding or removing object stores,
9
+ * changing indexes, or moving data between differently shaped table schemas. The version value is a typed description of
10
+ * the target schema; creating and deleting object stores or indexes still happens explicitly inside the corresponding
11
+ * `IndexedDbDatabase` migration callback.
12
+ *
13
+ * IndexedDB versioning is ordered by the migration chain rather than by a number stored here. Each `.add` step becomes
14
+ * the next browser database version, and only migrations after the browser's current version are run. Include every table
15
+ * that should be queryable in each target version, avoid duplicate table names, and remember that key-path or
16
+ * auto-increment changes usually require creating a new object store and copying data during the upgrade transaction.
17
+ *
18
+ * @since 4.0.0
19
+ */
20
+ import type { NonEmptyReadonlyArray } from "effect/Array"
21
+ import type { Pipeable } from "effect/Pipeable"
22
+ import { pipeArguments } from "effect/Pipeable"
23
+ import type * as IndexedDbTable from "./IndexedDbTable.ts"
24
+
25
+ const TypeId = "~@effect/platform-browser/IndexedDbVersion"
26
+
27
+ /**
28
+ * Typed IndexedDB version definition containing the tables available in that schema version.
29
+ *
30
+ * @category interface
31
+ * @since 4.0.0
32
+ */
33
+ export interface IndexedDbVersion<
34
+ out Tables extends IndexedDbTable.AnyWithProps
35
+ > extends Pipeable {
36
+ new(_: never): {}
37
+ readonly [TypeId]: typeof TypeId
38
+ readonly tables: ReadonlyMap<string, Tables>
39
+ }
40
+
41
+ /**
42
+ * Type-erased shape of an `IndexedDbVersion`.
43
+ *
44
+ * @category models
45
+ * @since 4.0.0
46
+ */
47
+ export interface Any {
48
+ readonly [TypeId]: typeof TypeId
49
+ }
50
+
51
+ /**
52
+ * Type-erased `IndexedDbVersion` retaining version properties with broad table types.
53
+ *
54
+ * @category models
55
+ * @since 4.0.0
56
+ */
57
+ export type AnyWithProps = IndexedDbVersion<IndexedDbTable.AnyWithProps>
58
+
59
+ /**
60
+ * Extracts the table union from an `IndexedDbVersion`.
61
+ *
62
+ * @category models
63
+ * @since 4.0.0
64
+ */
65
+ export type Tables<Db extends Any> = Db extends IndexedDbVersion<infer _Tables> ? _Tables : never
66
+
67
+ /**
68
+ * Selects a table by name from an `IndexedDbVersion`.
69
+ *
70
+ * @category models
71
+ * @since 4.0.0
72
+ */
73
+ export type TableWithName<
74
+ Db extends Any,
75
+ TableName extends string
76
+ > = IndexedDbTable.WithName<Tables<Db>, TableName>
77
+
78
+ /**
79
+ * Extracts the schema for a named table within an `IndexedDbVersion`.
80
+ *
81
+ * @category models
82
+ * @since 4.0.0
83
+ */
84
+ export type SchemaWithName<
85
+ Db extends Any,
86
+ TableName extends string
87
+ > = IndexedDbTable.TableSchema<IndexedDbTable.WithName<Tables<Db>, TableName>>
88
+
89
+ const Proto = {
90
+ [TypeId]: TypeId,
91
+ pipe() {
92
+ return pipeArguments(this, arguments)
93
+ }
94
+ }
95
+
96
+ const makeProto = <Tables extends IndexedDbTable.AnyWithProps>(options: {
97
+ readonly tables: ReadonlyMap<string, Tables>
98
+ }): IndexedDbVersion<Tables> => {
99
+ // oxlint-disable-next-line typescript/no-extraneous-class
100
+ class Version {}
101
+ Object.assign(Version, Proto)
102
+ ;(Version as any).tables = options.tables
103
+ return Version as any
104
+ }
105
+
106
+ /**
107
+ * Creates an `IndexedDbVersion` from one or more table definitions.
108
+ *
109
+ * **When to use**
110
+ *
111
+ * Use when you need a typed description of the target IndexedDB schema that a
112
+ * database migration will materialize.
113
+ *
114
+ * **Details**
115
+ *
116
+ * The returned version exposes a `tables` map keyed by each table's
117
+ * `tableName`, and its type is the union of the supplied table definitions.
118
+ *
119
+ * **Gotchas**
120
+ *
121
+ * This constructor only describes the target schema; object stores and indexes
122
+ * still need to be created in the corresponding `IndexedDbDatabase` migration.
123
+ * Duplicate table names are not rejected, and the runtime map keeps the later
124
+ * table for a repeated key.
125
+ *
126
+ * @see {@link IndexedDbTable.make} for creating table definitions consumed by this constructor
127
+ *
128
+ * @category constructors
129
+ * @since 4.0.0
130
+ */
131
+ export const make = <
132
+ const Tables extends NonEmptyReadonlyArray<IndexedDbTable.AnyWithProps>
133
+ >(
134
+ ...tables: Tables
135
+ ): IndexedDbVersion<Tables[number]> =>
136
+ makeProto({
137
+ tables: new Map(tables.map((table) => [table.tableName, table]))
138
+ })
@@ -1,10 +1,18 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Effect service for the browser Permissions API.
3
+ *
4
+ * This module defines a `Permissions` service backed by
5
+ * `navigator.permissions`. The service exposes `query`, which returns the
6
+ * browser `PermissionStatus` for a permission name. Failed browser operations
7
+ * are represented as `PermissionsError` values with `InvalidStateError` or
8
+ * `TypeError` reasons, and `layer` provides the browser-backed service.
9
+ *
10
+ * @since 4.0.0
3
11
  */
12
+ import * as Context from "effect/Context"
4
13
  import * as Data from "effect/Data"
5
14
  import * as Effect from "effect/Effect"
6
15
  import * as Layer from "effect/Layer"
7
- import * as ServiceMap from "effect/ServiceMap"
8
16
 
9
17
  const TypeId = "~@effect/platform-browser/Permissions"
10
18
  const ErrorTypeId = "~@effect/platform-browser/Permissions/PermissionsError"
@@ -13,8 +21,8 @@ const ErrorTypeId = "~@effect/platform-browser/Permissions/PermissionsError"
13
21
  * Wrapper on the Permission API (`navigator.permissions`) with methods for
14
22
  * querying status of permissions.
15
23
  *
16
- * @since 1.0.0
17
- * @category Models
24
+ * @category models
25
+ * @since 4.0.0
18
26
  */
19
27
  export interface Permissions {
20
28
  readonly [TypeId]: typeof TypeId
@@ -33,8 +41,10 @@ export interface Permissions {
33
41
  }
34
42
 
35
43
  /**
36
- * @since 1.0.0
44
+ * Error reason for an `InvalidStateError` raised by the browser Permissions API.
45
+ *
37
46
  * @category errors
47
+ * @since 4.0.0
38
48
  */
39
49
  export class PermissionsInvalidStateError extends Data.TaggedError("InvalidStateError")<{
40
50
  readonly cause: unknown
@@ -45,8 +55,10 @@ export class PermissionsInvalidStateError extends Data.TaggedError("InvalidState
45
55
  }
46
56
 
47
57
  /**
48
- * @since 1.0.0
58
+ * Error reason for a `TypeError` raised by the browser Permissions API.
59
+ *
49
60
  * @category errors
61
+ * @since 4.0.0
50
62
  */
51
63
  export class PermissionsTypeError extends Data.TaggedError("TypeError")<{
52
64
  readonly cause: unknown
@@ -57,14 +69,18 @@ export class PermissionsTypeError extends Data.TaggedError("TypeError")<{
57
69
  }
58
70
 
59
71
  /**
60
- * @since 1.0.0
72
+ * Union of browser Permissions API error reasons represented by the service.
73
+ *
61
74
  * @category errors
75
+ * @since 4.0.0
62
76
  */
63
77
  export type PermissionsErrorReason = PermissionsInvalidStateError | PermissionsTypeError
64
78
 
65
79
  /**
66
- * @since 1.0.0
80
+ * Tagged error wrapping a browser Permissions API failure reason.
81
+ *
67
82
  * @category errors
83
+ * @since 4.0.0
68
84
  */
69
85
  export class PermissionsError extends Data.TaggedError("PermissionsError")<{
70
86
  readonly reason: PermissionsErrorReason
@@ -84,16 +100,33 @@ export class PermissionsError extends Data.TaggedError("PermissionsError")<{
84
100
  }
85
101
 
86
102
  /**
87
- * @since 1.0.0
88
- * @category Service
103
+ * Service tag for browser permission querying.
104
+ *
105
+ * **When to use**
106
+ *
107
+ * Use when you need to require or provide browser permission querying through
108
+ * Effect's context.
109
+ *
110
+ * @category services
111
+ * @since 4.0.0
89
112
  */
90
- export const Permissions: ServiceMap.Service<Permissions, Permissions> = ServiceMap.Service<Permissions>(TypeId)
113
+ export const Permissions: Context.Service<Permissions, Permissions> = Context.Service<Permissions>(TypeId)
91
114
 
92
115
  /**
93
- * A layer that directly interfaces with the `navigator.permissions` api
116
+ * Provides the `Permissions` service using the browser `navigator.permissions` API.
117
+ *
118
+ * **When to use**
119
+ *
120
+ * Use when you need a live browser `Permissions` service backed by the ambient
121
+ * `navigator.permissions` implementation.
122
+ *
123
+ * **Details**
124
+ *
125
+ * `query` delegates to `navigator.permissions.query({ name })` and wraps
126
+ * rejected browser operations in `PermissionsError`.
94
127
  *
95
- * @since 1.0.0
96
- * @category Layers
128
+ * @category layers
129
+ * @since 4.0.0
97
130
  */
98
131
  export const layer: Layer.Layer<Permissions> = Layer.succeed(
99
132
  Permissions,
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
 
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
@@ -7,49 +7,84 @@
7
7
  /**
8
8
  * @since 1.0.0
9
9
  */
10
+ export * as BrowserCrypto from "./BrowserCrypto.ts"
11
+
12
+ /**
13
+ * @since 4.0.0
14
+ */
10
15
  export * as BrowserHttpClient from "./BrowserHttpClient.ts"
11
16
 
12
17
  /**
13
- * @since 1.0.0
18
+ * @since 4.0.0
14
19
  */
15
20
  export * as BrowserKeyValueStore from "./BrowserKeyValueStore.ts"
16
21
 
17
22
  /**
18
- * @since 1.0.0
23
+ * @since 4.0.0
24
+ */
25
+ export * as BrowserPersistence from "./BrowserPersistence.ts"
26
+
27
+ /**
28
+ * @since 4.0.0
19
29
  */
20
30
  export * as BrowserRuntime from "./BrowserRuntime.ts"
21
31
 
22
32
  /**
23
- * @since 1.0.0
33
+ * @since 4.0.0
24
34
  */
25
35
  export * as BrowserSocket from "./BrowserSocket.ts"
26
36
 
27
37
  /**
28
- * @since 1.0.0
38
+ * @since 4.0.0
29
39
  */
30
40
  export * as BrowserStream from "./BrowserStream.ts"
31
41
 
32
42
  /**
33
- * @since 1.0.0
43
+ * @since 4.0.0
34
44
  */
35
45
  export * as BrowserWorker from "./BrowserWorker.ts"
36
46
 
37
47
  /**
38
- * @since 1.0.0
48
+ * @since 4.0.0
39
49
  */
40
50
  export * as BrowserWorkerRunner from "./BrowserWorkerRunner.ts"
41
51
 
42
52
  /**
43
- * @since 1.0.0
53
+ * @since 4.0.0
44
54
  */
45
55
  export * as Clipboard from "./Clipboard.ts"
46
56
 
47
57
  /**
48
- * @since 1.0.0
58
+ * @since 4.0.0
49
59
  */
50
60
  export * as Geolocation from "./Geolocation.ts"
51
61
 
52
62
  /**
53
- * @since 1.0.0
63
+ * @since 4.0.0
64
+ */
65
+ export * as IndexedDb from "./IndexedDb.ts"
66
+
67
+ /**
68
+ * @since 4.0.0
69
+ */
70
+ export * as IndexedDbDatabase from "./IndexedDbDatabase.ts"
71
+
72
+ /**
73
+ * @since 4.0.0
74
+ */
75
+ export * as IndexedDbQueryBuilder from "./IndexedDbQueryBuilder.ts"
76
+
77
+ /**
78
+ * @since 4.0.0
79
+ */
80
+ export * as IndexedDbTable from "./IndexedDbTable.ts"
81
+
82
+ /**
83
+ * @since 4.0.0
84
+ */
85
+ export * as IndexedDbVersion from "./IndexedDbVersion.ts"
86
+
87
+ /**
88
+ * @since 4.0.0
54
89
  */
55
90
  export * as Permissions from "./Permissions.ts"