@effect/platform-browser 4.0.0-beta.66 → 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.
- package/dist/BrowserCrypto.d.ts +23 -0
- package/dist/BrowserCrypto.d.ts.map +1 -0
- package/dist/BrowserCrypto.js +61 -0
- package/dist/BrowserCrypto.js.map +1 -0
- package/dist/BrowserHttpClient.d.ts +23 -13
- package/dist/BrowserHttpClient.d.ts.map +1 -1
- package/dist/BrowserHttpClient.js +49 -12
- package/dist/BrowserHttpClient.js.map +1 -1
- package/dist/BrowserKeyValueStore.d.ts +15 -8
- package/dist/BrowserKeyValueStore.d.ts.map +1 -1
- package/dist/BrowserKeyValueStore.js +128 -4
- package/dist/BrowserKeyValueStore.js.map +1 -1
- package/dist/BrowserPersistence.d.ts +6 -2
- package/dist/BrowserPersistence.d.ts.map +1 -1
- package/dist/BrowserPersistence.js +6 -2
- package/dist/BrowserPersistence.js.map +1 -1
- package/dist/BrowserRuntime.d.ts +31 -4
- package/dist/BrowserRuntime.d.ts.map +1 -1
- package/dist/BrowserRuntime.js +3 -1
- package/dist/BrowserRuntime.js.map +1 -1
- package/dist/BrowserSocket.d.ts +31 -6
- package/dist/BrowserSocket.d.ts.map +1 -1
- package/dist/BrowserSocket.js +31 -6
- package/dist/BrowserSocket.js.map +1 -1
- package/dist/BrowserStream.d.ts +25 -3
- package/dist/BrowserStream.d.ts.map +1 -1
- package/dist/BrowserStream.js +25 -3
- package/dist/BrowserStream.js.map +1 -1
- package/dist/BrowserWorker.d.ts +8 -4
- package/dist/BrowserWorker.d.ts.map +1 -1
- package/dist/BrowserWorker.js +29 -5
- package/dist/BrowserWorker.js.map +1 -1
- package/dist/BrowserWorkerRunner.d.ts +12 -6
- package/dist/BrowserWorkerRunner.d.ts.map +1 -1
- package/dist/BrowserWorkerRunner.js +31 -7
- package/dist/BrowserWorkerRunner.js.map +1 -1
- package/dist/Clipboard.d.ts +35 -11
- package/dist/Clipboard.d.ts.map +1 -1
- package/dist/Clipboard.js +31 -9
- package/dist/Clipboard.js.map +1 -1
- package/dist/Geolocation.d.ts +52 -18
- package/dist/Geolocation.d.ts.map +1 -1
- package/dist/Geolocation.js +44 -14
- package/dist/Geolocation.js.map +1 -1
- package/dist/IndexedDb.d.ts +38 -11
- package/dist/IndexedDb.d.ts.map +1 -1
- package/dist/IndexedDb.js +35 -13
- package/dist/IndexedDb.js.map +1 -1
- package/dist/IndexedDbDatabase.d.ts +57 -10
- package/dist/IndexedDbDatabase.d.ts.map +1 -1
- package/dist/IndexedDbDatabase.js +36 -3
- package/dist/IndexedDbDatabase.js.map +1 -1
- package/dist/IndexedDbQueryBuilder.d.ts +102 -28
- package/dist/IndexedDbQueryBuilder.d.ts.map +1 -1
- package/dist/IndexedDbQueryBuilder.js +56 -26
- package/dist/IndexedDbQueryBuilder.js.map +1 -1
- package/dist/IndexedDbTable.d.ts +57 -13
- package/dist/IndexedDbTable.d.ts.map +1 -1
- package/dist/IndexedDbTable.js +21 -1
- package/dist/IndexedDbTable.js.map +1 -1
- package/dist/IndexedDbVersion.d.ts +37 -7
- package/dist/IndexedDbVersion.d.ts.map +1 -1
- package/dist/IndexedDbVersion.js +3 -1
- package/dist/IndexedDbVersion.js.map +1 -1
- package/dist/Permissions.d.ts +38 -11
- package/dist/Permissions.d.ts.map +1 -1
- package/dist/Permissions.js +33 -8
- package/dist/Permissions.js.map +1 -1
- package/dist/index.d.ts +334 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +334 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/BrowserCrypto.ts +71 -0
- package/src/BrowserHttpClient.ts +53 -14
- package/src/BrowserKeyValueStore.ts +144 -6
- package/src/BrowserPersistence.ts +19 -3
- package/src/BrowserRuntime.ts +31 -4
- package/src/BrowserSocket.ts +31 -6
- package/src/BrowserStream.ts +25 -3
- package/src/BrowserWorker.ts +29 -5
- package/src/BrowserWorkerRunner.ts +31 -7
- package/src/Clipboard.ts +35 -11
- package/src/Geolocation.ts +52 -18
- package/src/IndexedDb.ts +39 -21
- package/src/IndexedDbDatabase.ts +57 -10
- package/src/IndexedDbQueryBuilder.ts +171 -58
- package/src/IndexedDbTable.ts +57 -13
- package/src/IndexedDbVersion.ts +37 -7
- package/src/Permissions.ts +38 -11
- package/src/index.ts +335 -11
package/src/Geolocation.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Browser geolocation support for Effect programs.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a `Geolocation` service and browser-backed layer for
|
|
5
|
+
* reading device location through `navigator.geolocation`. Use
|
|
6
|
+
* `getCurrentPosition` when an application needs one location fix, such as a
|
|
7
|
+
* nearby-search, check-in, or delivery estimate, and `watchPosition` when it
|
|
8
|
+
* needs a stream of updates for navigation, tracking, or location-aware UI.
|
|
9
|
+
*
|
|
10
|
+
* The implementation is browser-only and relies on the browser permission and
|
|
11
|
+
* policy model for geolocation. Calls may prompt the user, fail when permission
|
|
12
|
+
* is denied, time out, or report that position data is unavailable because of
|
|
13
|
+
* device, browser, privacy, origin, or secure-context restrictions. Watched
|
|
14
|
+
* positions are scoped so the underlying browser watch is cleared when the
|
|
15
|
+
* stream is finalized, and slow consumers should account for the sliding
|
|
16
|
+
* buffer used by `watchPosition`.
|
|
17
|
+
*
|
|
18
|
+
* @since 4.0.0
|
|
3
19
|
*/
|
|
4
20
|
import * as Cause from "effect/Cause"
|
|
5
21
|
import * as Context from "effect/Context"
|
|
@@ -13,8 +29,10 @@ const TypeId = "~@effect/platform-browser/Geolocation"
|
|
|
13
29
|
const ErrorTypeId = "~@effect/platform-browser/Geolocation/GeolocationError"
|
|
14
30
|
|
|
15
31
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
32
|
+
* Service interface for browser geolocation, providing effects for the current position and streams of watched positions.
|
|
33
|
+
*
|
|
34
|
+
* @category models
|
|
35
|
+
* @since 4.0.0
|
|
18
36
|
*/
|
|
19
37
|
export interface Geolocation {
|
|
20
38
|
readonly [TypeId]: typeof TypeId
|
|
@@ -31,14 +49,18 @@ export interface Geolocation {
|
|
|
31
49
|
}
|
|
32
50
|
|
|
33
51
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
52
|
+
* Service tag for the browser `Geolocation` service.
|
|
53
|
+
*
|
|
54
|
+
* @category services
|
|
55
|
+
* @since 4.0.0
|
|
36
56
|
*/
|
|
37
57
|
export const Geolocation: Context.Service<Geolocation, Geolocation> = Context.Service<Geolocation>(TypeId)
|
|
38
58
|
|
|
39
59
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
60
|
+
* Tagged error wrapping a browser geolocation failure reason.
|
|
61
|
+
*
|
|
62
|
+
* @category errors
|
|
63
|
+
* @since 4.0.0
|
|
42
64
|
*/
|
|
43
65
|
export class GeolocationError extends Data.TaggedError("GeolocationError")<{
|
|
44
66
|
readonly reason: GeolocationErrorReason
|
|
@@ -60,8 +82,10 @@ export class GeolocationError extends Data.TaggedError("GeolocationError")<{
|
|
|
60
82
|
}
|
|
61
83
|
|
|
62
84
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
85
|
+
* Error reason for the browser geolocation `POSITION_UNAVAILABLE` failure.
|
|
86
|
+
*
|
|
87
|
+
* @category errors
|
|
88
|
+
* @since 4.0.0
|
|
65
89
|
*/
|
|
66
90
|
export class PositionUnavailable extends Data.TaggedError("PositionUnavailable")<{
|
|
67
91
|
readonly cause: unknown
|
|
@@ -72,8 +96,10 @@ export class PositionUnavailable extends Data.TaggedError("PositionUnavailable")
|
|
|
72
96
|
}
|
|
73
97
|
|
|
74
98
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
99
|
+
* Error reason for the browser geolocation `PERMISSION_DENIED` failure.
|
|
100
|
+
*
|
|
101
|
+
* @category errors
|
|
102
|
+
* @since 4.0.0
|
|
77
103
|
*/
|
|
78
104
|
export class PermissionDenied extends Data.TaggedError("PermissionDenied")<{
|
|
79
105
|
readonly cause: unknown
|
|
@@ -84,8 +110,10 @@ export class PermissionDenied extends Data.TaggedError("PermissionDenied")<{
|
|
|
84
110
|
}
|
|
85
111
|
|
|
86
112
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
113
|
+
* Error reason for the browser geolocation `TIMEOUT` failure.
|
|
114
|
+
*
|
|
115
|
+
* @category errors
|
|
116
|
+
* @since 4.0.0
|
|
89
117
|
*/
|
|
90
118
|
export class Timeout extends Data.TaggedError("Timeout")<{
|
|
91
119
|
readonly cause: unknown
|
|
@@ -96,8 +124,10 @@ export class Timeout extends Data.TaggedError("Timeout")<{
|
|
|
96
124
|
}
|
|
97
125
|
|
|
98
126
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
127
|
+
* Union of browser geolocation error reasons represented by the service.
|
|
128
|
+
*
|
|
129
|
+
* @category errors
|
|
130
|
+
* @since 4.0.0
|
|
101
131
|
*/
|
|
102
132
|
export type GeolocationErrorReason = PositionUnavailable | PermissionDenied | Timeout
|
|
103
133
|
|
|
@@ -141,8 +171,10 @@ const makeQueue = (
|
|
|
141
171
|
)
|
|
142
172
|
|
|
143
173
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
174
|
+
* Layer that provides `Geolocation` using `navigator.geolocation`, with watched positions buffered in a sliding queue.
|
|
175
|
+
*
|
|
176
|
+
* @category layers
|
|
177
|
+
* @since 4.0.0
|
|
146
178
|
*/
|
|
147
179
|
export const layer: Layer.Layer<Geolocation> = Layer.succeed(
|
|
148
180
|
Geolocation,
|
|
@@ -162,8 +194,10 @@ export const layer: Layer.Layer<Geolocation> = Layer.succeed(
|
|
|
162
194
|
)
|
|
163
195
|
|
|
164
196
|
/**
|
|
165
|
-
*
|
|
197
|
+
* Streams positions from the `Geolocation` service using `watchPosition`, with an optional sliding buffer size.
|
|
198
|
+
*
|
|
166
199
|
* @category Accessors
|
|
200
|
+
* @since 4.0.0
|
|
167
201
|
*/
|
|
168
202
|
export const watchPosition = (
|
|
169
203
|
options?:
|
package/src/IndexedDb.ts
CHANGED
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Browser IndexedDB primitives and key schemas for Effect applications.
|
|
3
|
+
*
|
|
4
|
+
* This module is the low-level bridge used by the platform-browser IndexedDB
|
|
5
|
+
* integration. It provides an `IndexedDb` service around the browser
|
|
6
|
+
* `indexedDB` factory and `IDBKeyRange` constructor, a `layerWindow` layer for
|
|
7
|
+
* wiring those primitives from `window`, and schemas for the key shapes accepted
|
|
8
|
+
* by IndexedDB object stores and indexes.
|
|
9
|
+
*
|
|
10
|
+
* Use it when building typed local persistence for browser caches,
|
|
11
|
+
* offline-first state, background queues, drafts, or other client-side data
|
|
12
|
+
* that should be validated before it reaches IndexedDB. Higher-level database,
|
|
13
|
+
* version, table, and query modules build on these primitives for migrations
|
|
14
|
+
* and typed transactions.
|
|
15
|
+
*
|
|
16
|
+
* IndexedDB still follows the browser rules: schema changes happen only during
|
|
17
|
+
* version upgrades, upgrades may be blocked by other open tabs or connections,
|
|
18
|
+
* and reads or writes must run in transactions scoped to the object stores they
|
|
19
|
+
* touch. The `layerWindow` constructor should be used only where browser
|
|
20
|
+
* globals are available, and code that also runs during SSR or in restricted
|
|
21
|
+
* browser contexts should account for `indexedDB` or `IDBKeyRange` being
|
|
22
|
+
* missing.
|
|
23
|
+
*
|
|
2
24
|
* @since 4.0.0
|
|
3
25
|
*/
|
|
4
|
-
import * as Config from "effect/Config"
|
|
5
26
|
import * as Context from "effect/Context"
|
|
6
27
|
import * as Effect from "effect/Effect"
|
|
7
28
|
import * as Layer from "effect/Layer"
|
|
8
29
|
import * as Schema from "effect/Schema"
|
|
9
|
-
import * as SchemaIssue from "effect/SchemaIssue"
|
|
10
30
|
|
|
11
31
|
const TypeId = "~@effect/platform-browser/IndexedDb"
|
|
12
32
|
|
|
13
33
|
/**
|
|
14
|
-
*
|
|
34
|
+
* Service interface that provides the browser `indexedDB` factory and `IDBKeyRange` constructor.
|
|
35
|
+
*
|
|
15
36
|
* @category models
|
|
37
|
+
* @since 4.0.0
|
|
16
38
|
*/
|
|
17
39
|
export interface IndexedDb {
|
|
18
40
|
readonly [TypeId]: typeof TypeId
|
|
@@ -21,8 +43,10 @@ export interface IndexedDb {
|
|
|
21
43
|
}
|
|
22
44
|
|
|
23
45
|
/**
|
|
24
|
-
*
|
|
46
|
+
* Service tag for browser IndexedDB primitives.
|
|
47
|
+
*
|
|
25
48
|
* @category tag
|
|
49
|
+
* @since 4.0.0
|
|
26
50
|
*/
|
|
27
51
|
export const IndexedDb: Context.Service<IndexedDb, IndexedDb> = Context.Service<IndexedDb, IndexedDb>(TypeId)
|
|
28
52
|
|
|
@@ -39,18 +63,18 @@ const IDBFlatKey = Schema.Union([
|
|
|
39
63
|
])
|
|
40
64
|
|
|
41
65
|
/**
|
|
42
|
-
* Schema for
|
|
66
|
+
* Schema for IndexedDB keys: strings, non-NaN numbers, valid dates, buffer sources, or arrays of those flat key values.
|
|
43
67
|
*
|
|
44
|
-
* @since 4.0.0
|
|
45
68
|
* @category schemas
|
|
69
|
+
* @since 4.0.0
|
|
46
70
|
*/
|
|
47
71
|
export const IDBValidKey = Schema.Union([IDBFlatKey, Schema.Array(IDBFlatKey)])
|
|
48
72
|
|
|
49
73
|
/**
|
|
50
|
-
* Schema for
|
|
74
|
+
* Schema for auto-incremented IndexedDB keys, accepting integers from 1 through `2 ** 53`.
|
|
51
75
|
*
|
|
52
|
-
* @since 4.0.0
|
|
53
76
|
* @category schemas
|
|
77
|
+
* @since 4.0.0
|
|
54
78
|
*/
|
|
55
79
|
export const AutoIncrement = Schema.Int.check(
|
|
56
80
|
Schema.isBetween({ minimum: 1, maximum: 2 ** 53 })
|
|
@@ -61,18 +85,20 @@ export const AutoIncrement = Schema.Int.check(
|
|
|
61
85
|
})
|
|
62
86
|
|
|
63
87
|
/**
|
|
88
|
+
* Creates an `IndexedDb` service from an `IDBFactory` and `IDBKeyRange` constructor.
|
|
89
|
+
*
|
|
90
|
+
* @category constructors
|
|
64
91
|
* @since 4.0.0
|
|
65
|
-
* @category constructor
|
|
66
92
|
*/
|
|
67
93
|
export const make = (impl: Omit<IndexedDb, typeof TypeId>): IndexedDb => IndexedDb.of({ [TypeId]: TypeId, ...impl })
|
|
68
94
|
|
|
69
95
|
/**
|
|
70
|
-
*
|
|
96
|
+
* Layer that provides `IndexedDb` from `window.indexedDB` and `window.IDBKeyRange`, failing with a config error when they are unavailable.
|
|
71
97
|
*
|
|
72
|
-
* @since 4.0.0
|
|
73
98
|
* @category constructors
|
|
99
|
+
* @since 4.0.0
|
|
74
100
|
*/
|
|
75
|
-
export const layerWindow: Layer.Layer<IndexedDb
|
|
101
|
+
export const layerWindow: Layer.Layer<IndexedDb> = Layer.effect(
|
|
76
102
|
IndexedDb,
|
|
77
103
|
Effect.suspend(() => {
|
|
78
104
|
if (window.indexedDB && window.IDBKeyRange) {
|
|
@@ -83,15 +109,7 @@ export const layerWindow: Layer.Layer<IndexedDb, Config.ConfigError> = Layer.eff
|
|
|
83
109
|
})
|
|
84
110
|
)
|
|
85
111
|
} else {
|
|
86
|
-
return Effect.
|
|
87
|
-
new Config.ConfigError(
|
|
88
|
-
new Schema.SchemaError(
|
|
89
|
-
new SchemaIssue.MissingKey({
|
|
90
|
-
messageMissingKey: "window.indexedDB is not available"
|
|
91
|
-
})
|
|
92
|
-
)
|
|
93
|
-
)
|
|
94
|
-
)
|
|
112
|
+
return Effect.die(new Error("window.indexedDB is not available"))
|
|
95
113
|
}
|
|
96
114
|
})
|
|
97
115
|
)
|
package/src/IndexedDbDatabase.ts
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Builds and opens typed IndexedDB databases from versioned schema migrations.
|
|
3
|
+
*
|
|
4
|
+
* This module turns an `IndexedDbVersion` migration chain into an
|
|
5
|
+
* `IndexedDbDatabase` layer. The layer opens the browser database, runs any
|
|
6
|
+
* pending upgrade migrations, provides a query builder for the current schema,
|
|
7
|
+
* and exposes a `rebuild` effect that deletes and reopens the database. It is
|
|
8
|
+
* the database-level companion to the table, version, and query builder
|
|
9
|
+
* modules.
|
|
10
|
+
*
|
|
11
|
+
* Use it for browser-local persistence such as offline-first application
|
|
12
|
+
* state, cached server data, background queues, drafts, and other client-side
|
|
13
|
+
* stores that need typed reads and writes backed by IndexedDB transactions.
|
|
14
|
+
*
|
|
15
|
+
* IndexedDB schema changes can only happen inside upgrade transactions, so
|
|
16
|
+
* every call to `make` or `.add` represents the next browser database version
|
|
17
|
+
* and only migrations after the existing browser version are run. Table and
|
|
18
|
+
* index definitions type the migration and query APIs, but object stores and
|
|
19
|
+
* indexes still need to be created or removed explicitly with the migration
|
|
20
|
+
* transaction helpers. Include the complete target table set in each version,
|
|
21
|
+
* create indexes before querying them, and treat key path or auto-increment
|
|
22
|
+
* changes as store migrations that copy data into a replacement object store.
|
|
23
|
+
* Upgrades can be blocked by other open connections, and all migration reads,
|
|
24
|
+
* writes, store changes, and index changes share the single upgrade
|
|
25
|
+
* transaction supplied by the browser.
|
|
26
|
+
*
|
|
2
27
|
* @since 4.0.0
|
|
3
28
|
*/
|
|
4
29
|
import * as Context from "effect/Context"
|
|
@@ -60,8 +85,10 @@ const SchemaProto = {
|
|
|
60
85
|
}
|
|
61
86
|
|
|
62
87
|
/**
|
|
63
|
-
*
|
|
88
|
+
* String union describing the failure categories for IndexedDB database opening, migration, and schema operations.
|
|
89
|
+
*
|
|
64
90
|
* @category errors
|
|
91
|
+
* @since 4.0.0
|
|
65
92
|
*/
|
|
66
93
|
export type ErrorReason =
|
|
67
94
|
| "TransactionError"
|
|
@@ -73,8 +100,10 @@ export type ErrorReason =
|
|
|
73
100
|
| "MissingIndex"
|
|
74
101
|
|
|
75
102
|
/**
|
|
76
|
-
*
|
|
103
|
+
* Tagged error for IndexedDB database operations, carrying a database error reason and the original cause.
|
|
104
|
+
*
|
|
77
105
|
* @category errors
|
|
106
|
+
* @since 4.0.0
|
|
78
107
|
*/
|
|
79
108
|
export class IndexedDbDatabaseError extends Data.TaggedError(
|
|
80
109
|
"IndexedDbDatabaseError"
|
|
@@ -83,6 +112,8 @@ export class IndexedDbDatabaseError extends Data.TaggedError(
|
|
|
83
112
|
cause: unknown
|
|
84
113
|
}> {
|
|
85
114
|
/**
|
|
115
|
+
* Marks this value as an IndexedDB database error for runtime guards.
|
|
116
|
+
*
|
|
86
117
|
* @since 4.0.0
|
|
87
118
|
*/
|
|
88
119
|
readonly [ErrorTypeId]: typeof ErrorTypeId = ErrorTypeId
|
|
@@ -90,8 +121,10 @@ export class IndexedDbDatabaseError extends Data.TaggedError(
|
|
|
90
121
|
}
|
|
91
122
|
|
|
92
123
|
/**
|
|
93
|
-
*
|
|
124
|
+
* Service tag for an open IndexedDB database, its `IDBKeyRange` constructor, reactivity service, and rebuild effect.
|
|
125
|
+
*
|
|
94
126
|
* @category models
|
|
127
|
+
* @since 4.0.0
|
|
95
128
|
*/
|
|
96
129
|
export class IndexedDbDatabase extends Context.Service<
|
|
97
130
|
IndexedDbDatabase,
|
|
@@ -104,8 +137,10 @@ export class IndexedDbDatabase extends Context.Service<
|
|
|
104
137
|
>()(TypeId) {}
|
|
105
138
|
|
|
106
139
|
/**
|
|
107
|
-
*
|
|
140
|
+
* Describes an IndexedDB schema version and its migrations, and acts as an effect that yields a query builder for the target version.
|
|
141
|
+
*
|
|
108
142
|
* @category models
|
|
143
|
+
* @since 4.0.0
|
|
109
144
|
*/
|
|
110
145
|
export interface IndexedDbSchema<
|
|
111
146
|
in out FromVersion extends IndexedDbVersion.AnyWithProps,
|
|
@@ -155,8 +190,10 @@ export interface IndexedDbSchema<
|
|
|
155
190
|
}
|
|
156
191
|
|
|
157
192
|
/**
|
|
158
|
-
*
|
|
193
|
+
* Query builder available during a database migration, extended with object-store and index management helpers for the active `IDBTransaction`.
|
|
194
|
+
*
|
|
159
195
|
* @category models
|
|
196
|
+
* @since 4.0.0
|
|
160
197
|
*/
|
|
161
198
|
export interface Transaction<
|
|
162
199
|
Source extends IndexedDbVersion.AnyWithProps = never
|
|
@@ -192,8 +229,10 @@ export interface Transaction<
|
|
|
192
229
|
}
|
|
193
230
|
|
|
194
231
|
/**
|
|
195
|
-
*
|
|
232
|
+
* Extracts the string-literal index names defined by an `IndexedDbTable`.
|
|
233
|
+
*
|
|
196
234
|
* @category models
|
|
235
|
+
* @since 4.0.0
|
|
197
236
|
*/
|
|
198
237
|
export type IndexFromTable<Table extends IndexedDbTable.AnyWithProps> = IsStringLiteral<
|
|
199
238
|
Extract<keyof IndexedDbTable.Indexes<Table>, string>
|
|
@@ -201,8 +240,10 @@ export type IndexFromTable<Table extends IndexedDbTable.AnyWithProps> = IsString
|
|
|
201
240
|
: never
|
|
202
241
|
|
|
203
242
|
/**
|
|
204
|
-
*
|
|
243
|
+
* Extracts the valid index names for a table name within an IndexedDB version.
|
|
244
|
+
*
|
|
205
245
|
* @category models
|
|
246
|
+
* @since 4.0.0
|
|
206
247
|
*/
|
|
207
248
|
export type IndexFromTableName<
|
|
208
249
|
Version extends IndexedDbVersion.AnyWithProps,
|
|
@@ -212,8 +253,10 @@ export type IndexFromTableName<
|
|
|
212
253
|
>
|
|
213
254
|
|
|
214
255
|
/**
|
|
215
|
-
*
|
|
256
|
+
* Type-erased IndexedDB schema shape used when traversing schema migration chains.
|
|
257
|
+
*
|
|
216
258
|
* @category models
|
|
259
|
+
* @since 4.0.0
|
|
217
260
|
*/
|
|
218
261
|
export interface Any {
|
|
219
262
|
readonly previous?: Any | undefined
|
|
@@ -227,8 +270,10 @@ export interface Any {
|
|
|
227
270
|
}
|
|
228
271
|
|
|
229
272
|
/**
|
|
230
|
-
*
|
|
273
|
+
* Type-erased `IndexedDbSchema` covering any source version, target version, and migration error type.
|
|
274
|
+
*
|
|
231
275
|
* @category models
|
|
276
|
+
* @since 4.0.0
|
|
232
277
|
*/
|
|
233
278
|
export type AnySchema = IndexedDbSchema<
|
|
234
279
|
IndexedDbVersion.AnyWithProps,
|
|
@@ -237,8 +282,10 @@ export type AnySchema = IndexedDbSchema<
|
|
|
237
282
|
>
|
|
238
283
|
|
|
239
284
|
/**
|
|
240
|
-
*
|
|
285
|
+
* Creates the initial `IndexedDbSchema` from a version and an initialization migration run during database upgrade.
|
|
286
|
+
*
|
|
241
287
|
* @category constructors
|
|
288
|
+
* @since 4.0.0
|
|
242
289
|
*/
|
|
243
290
|
export const make = <
|
|
244
291
|
InitialVersion extends IndexedDbVersion.AnyWithProps,
|