-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
137 lines (123 loc) · 3.53 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
* Given zero or more manifest objects, returns a merged and enriched manifest object
* that has truthy properties for each of the features listed in {@link IManifest}.
*
* @param manifests Partial manifest(s) to merge.
*/
export function supports (...manifests: Array<Partial<IManifest>>): IManifest
/**
* Describes the capabilities of an
* [`abstract-level`](https://github.com/Level/abstract-level) database. Support matrices
* for known `abstract-level` implementations can be found in
* [`level-supports`](https://github.com/Level/supports#features).
*/
export interface IManifest {
/**
* Does the database read from a snapshot as described in
* [`abstract-level`](https://github.com/Level/abstract-level#reading-from-snapshots)?
*/
implicitSnapshots: boolean
/**
* Does the database implement `db.snapshot()` and do read methods accept a `snapshot`
* option as described in
* [`abstract-level`](https://github.com/Level/abstract-level#reading-from-snapshots)?
*/
explicitSnapshots: boolean
/**
* Alias of {@link implicitSnapshots} for backwards compatibility.
*/
snapshots: boolean
/**
* Does the database implement `has()` and `hasMany()`?
*/
has: boolean
/**
* Does data survive after process (or environment) exit?
*/
permanence: boolean
/**
* Do iterators support
* [`seek(..)`](https://github.com/Level/abstract-level/#iteratorseektarget-options)?
*/
seek: boolean
/**
* Does `db.open()` and the database constructor support this option?
*/
createIfMissing: boolean
/**
* Does `db.open()` and the database constructor support this option?
*/
errorIfExists: boolean
/**
* Can operations like `db.put()` be called without explicitly opening the db? Like so:
*
* ```js
* const db = new Level()
* await db.put('key', 'value')
* ```
*
* Always true since `abstract-level@1`.
*/
deferredOpen: boolean
/**
* Does database have the methods `createReadStream`, `createKeyStream` and
* `createValueStream`, following the API documented in `levelup`? For `abstract-level`
* databases, a standalone module called
* [`level-read-stream`](https://github.com/Level/read-stream) is available.
*/
streams: boolean
/**
* Which encodings (by name) does the database support, as indicated by nested
* properties? For example:
*
* ```js
* { utf8: true, json: true }
* ```
*/
encodings: Record<string, boolean>
/**
* Which events does the database emit, as indicated by nested properties? For example:
*
* ```js
* if (db.supports.events.put) {
* db.on('put', listener)
* }
* ```
*/
events: Record<string, boolean>
/**
* Declares support of additional methods, that are not part of the `abstract-level`
* interface. In the form of:
*
* ```js
* {
* foo: true,
* bar: true
* }
* ```
*
* Which says the db has two methods, `foo` and `bar`. It might be used like so:
*
* ```js
* if (db.supports.additionalMethods.foo) {
* db.foo()
* }
* ```
*/
additionalMethods: Record<string, boolean>
/**
* Which methods or method groups take a `signal` option? At the time of writing there
* is only one method group: `iterators`. This includes `db.iterator()`, `db.keys()` and
* `db.values()`. For example:
*
* ```js
* if (db.supports.signals.iterators) {
* const ac = new AbortController()
* const iterator = db.keys({ signal: ac.signal })
*
* ac.abort()
* }
* ```
*/
signals: Record<string, boolean>
}