shelving 1.150.6 → 1.150.7
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/package.json +1 -1
- package/store/DataStore.d.ts +5 -5
- package/store/DataStore.js +9 -9
- package/store/DictionaryStore.d.ts +3 -3
- package/store/DictionaryStore.js +3 -3
- package/store/PathStore.d.ts +2 -1
- package/store/PathStore.js +7 -4
- package/store/Store.d.ts +0 -2
- package/store/Store.js +0 -4
package/package.json
CHANGED
package/store/DataStore.d.ts
CHANGED
|
@@ -23,14 +23,14 @@ export declare class OptionalDataStore<T extends Data> extends Store<T | undefin
|
|
|
23
23
|
set data(data: T);
|
|
24
24
|
/** Does the data exist or not? */
|
|
25
25
|
get exists(): boolean;
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/** Require the data for this data store, or throw `RequiredError` if it is not set. */
|
|
27
|
+
require(caller?: AnyCaller): T;
|
|
28
28
|
/** Update several props in this data. */
|
|
29
29
|
update(updates: Updates<T>): void;
|
|
30
30
|
/** Update a single named prop in this data. */
|
|
31
|
-
|
|
31
|
+
get<K extends DataKey<T>>(name: K): T[K];
|
|
32
32
|
/** Update a single named prop in this data. */
|
|
33
|
-
|
|
33
|
+
set<K extends DataKey<T>>(name: K, value: T[K]): void;
|
|
34
34
|
/** Set the data to `undefined`. */
|
|
35
|
-
|
|
35
|
+
delete(): void;
|
|
36
36
|
}
|
package/store/DataStore.js
CHANGED
|
@@ -30,7 +30,7 @@ export class DataStore extends Store {
|
|
|
30
30
|
export class OptionalDataStore extends Store {
|
|
31
31
|
/** Get current data value of this store (or throw `Promise` that resolves to the next required value). */
|
|
32
32
|
get data() {
|
|
33
|
-
return this.
|
|
33
|
+
return this.require(getGetter(this, "data"));
|
|
34
34
|
}
|
|
35
35
|
/** Set the data of this store. */
|
|
36
36
|
set data(data) {
|
|
@@ -40,8 +40,8 @@ export class OptionalDataStore extends Store {
|
|
|
40
40
|
get exists() {
|
|
41
41
|
return !!this.value;
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
|
|
43
|
+
/** Require the data for this data store, or throw `RequiredError` if it is not set. */
|
|
44
|
+
require(caller = this.require) {
|
|
45
45
|
const data = this.value;
|
|
46
46
|
if (!data)
|
|
47
47
|
throw new RequiredError("Data is empty", { caller });
|
|
@@ -49,18 +49,18 @@ export class OptionalDataStore extends Store {
|
|
|
49
49
|
}
|
|
50
50
|
/** Update several props in this data. */
|
|
51
51
|
update(updates) {
|
|
52
|
-
this.value = updateData(this.
|
|
52
|
+
this.value = updateData(this.require(this.update), updates);
|
|
53
53
|
}
|
|
54
54
|
/** Update a single named prop in this data. */
|
|
55
|
-
|
|
56
|
-
return this.
|
|
55
|
+
get(name) {
|
|
56
|
+
return this.require(this.get)[name];
|
|
57
57
|
}
|
|
58
58
|
/** Update a single named prop in this data. */
|
|
59
|
-
|
|
60
|
-
this.value = withProp(this.
|
|
59
|
+
set(name, value) {
|
|
60
|
+
this.value = withProp(this.require(this.set), name, value);
|
|
61
61
|
}
|
|
62
62
|
/** Set the data to `undefined`. */
|
|
63
|
-
|
|
63
|
+
delete() {
|
|
64
64
|
this.value = undefined;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -9,11 +9,11 @@ export declare class DictionaryStore<T> extends Store<ImmutableDictionary<T>> im
|
|
|
9
9
|
/** Set a named entry in this object with a different value. */
|
|
10
10
|
update(updates: Updates<ImmutableDictionary<T>>): void;
|
|
11
11
|
/** Remove a named entry from this object. */
|
|
12
|
-
|
|
12
|
+
deleteItems(...keys: string[]): void;
|
|
13
13
|
/** Get an item in this dictionary. */
|
|
14
|
-
|
|
14
|
+
get(name: string): T | undefined;
|
|
15
15
|
/** Set an item in this dictionary. */
|
|
16
|
-
|
|
16
|
+
set(name: string, value: T): void;
|
|
17
17
|
/** Iterate over the entries of the object. */
|
|
18
18
|
[Symbol.iterator](): Iterator<DictionaryItem<T>>;
|
|
19
19
|
}
|
package/store/DictionaryStore.js
CHANGED
|
@@ -16,15 +16,15 @@ export class DictionaryStore extends Store {
|
|
|
16
16
|
this.value = updateData(this.value, updates);
|
|
17
17
|
}
|
|
18
18
|
/** Remove a named entry from this object. */
|
|
19
|
-
|
|
19
|
+
deleteItems(...keys) {
|
|
20
20
|
this.value = omitDictionaryItems(this.value, ...keys);
|
|
21
21
|
}
|
|
22
22
|
/** Get an item in this dictionary. */
|
|
23
|
-
|
|
23
|
+
get(name) {
|
|
24
24
|
return this.value[name];
|
|
25
25
|
}
|
|
26
26
|
/** Set an item in this dictionary. */
|
|
27
|
-
|
|
27
|
+
set(name, value) {
|
|
28
28
|
this.value = withProp(this.value, name, value);
|
|
29
29
|
}
|
|
30
30
|
/** Iterate over the entries of the object. */
|
package/store/PathStore.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ import { Store } from "./Store.js";
|
|
|
3
3
|
/** Store an absolute path, e.g. `/a/b/c` */
|
|
4
4
|
export declare class PathStore extends Store<AbsolutePath> {
|
|
5
5
|
constructor(path?: string, time?: number);
|
|
6
|
+
get value(): AbsolutePath;
|
|
7
|
+
set value(path: string);
|
|
6
8
|
/** Based on the current store path, is a path active? */
|
|
7
9
|
isActive(path: AbsolutePath): boolean;
|
|
8
10
|
/** Based on the current store path, is a path proud (i.e. a child of the current store path)? */
|
|
9
11
|
isProud(path: AbsolutePath): boolean;
|
|
10
12
|
/** Get an absolute path from a path relative to the current store path. */
|
|
11
13
|
getPath(path: string): AbsolutePath;
|
|
12
|
-
set(path: string): void;
|
|
13
14
|
}
|
package/store/PathStore.js
CHANGED
|
@@ -5,6 +5,13 @@ export class PathStore extends Store {
|
|
|
5
5
|
constructor(path = ".", time) {
|
|
6
6
|
super(requirePath(path), time);
|
|
7
7
|
}
|
|
8
|
+
// Override to clean the path on set.
|
|
9
|
+
get value() {
|
|
10
|
+
return super.value;
|
|
11
|
+
}
|
|
12
|
+
set value(path) {
|
|
13
|
+
super.value = requirePath(path, super.value);
|
|
14
|
+
}
|
|
8
15
|
/** Based on the current store path, is a path active? */
|
|
9
16
|
isActive(path) {
|
|
10
17
|
return isPathActive(this.value, path);
|
|
@@ -17,8 +24,4 @@ export class PathStore extends Store {
|
|
|
17
24
|
getPath(path) {
|
|
18
25
|
return requirePath(path, this.value);
|
|
19
26
|
}
|
|
20
|
-
// Override to clean the path.
|
|
21
|
-
set(path) {
|
|
22
|
-
super.set(requirePath(path, this.value));
|
|
23
|
-
}
|
|
24
27
|
}
|
package/store/Store.d.ts
CHANGED
|
@@ -36,8 +36,6 @@ export declare class Store<T> implements AsyncIterable<T> {
|
|
|
36
36
|
private _starter;
|
|
37
37
|
/** Store is initiated with an initial store. */
|
|
38
38
|
constructor(value: T | typeof NONE, time?: number);
|
|
39
|
-
/** Set the value of the store. */
|
|
40
|
-
set(next: T): void;
|
|
41
39
|
/** Set the value of the store as values are pulled from a sequence. */
|
|
42
40
|
through(sequence: AsyncIterable<T>): AsyncIterable<T>;
|
|
43
41
|
[Symbol.asyncIterator](): AsyncGenerator<T, void, void>;
|
package/store/Store.js
CHANGED
|
@@ -70,10 +70,6 @@ export class Store {
|
|
|
70
70
|
this._value = value;
|
|
71
71
|
this._time = time;
|
|
72
72
|
}
|
|
73
|
-
/** Set the value of the store. */
|
|
74
|
-
set(next) {
|
|
75
|
-
this.value = next;
|
|
76
|
-
}
|
|
77
73
|
/** Set the value of the store as values are pulled from a sequence. */
|
|
78
74
|
async *through(sequence) {
|
|
79
75
|
for await (const value of sequence) {
|