@welshman/lib 0.0.1
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/README.md +11 -0
- package/build/Deferred.cjs +13 -0
- package/build/Deferred.cjs.map +1 -0
- package/build/Deferred.d.ts +5 -0
- package/build/Deferred.mjs +9 -0
- package/build/Deferred.mjs.map +1 -0
- package/build/Emitter.cjs +13 -0
- package/build/Emitter.cjs.map +1 -0
- package/build/Emitter.d.ts +4 -0
- package/build/Emitter.mjs +9 -0
- package/build/Emitter.mjs.map +1 -0
- package/build/Fluent.cjs +47 -0
- package/build/Fluent.cjs.map +1 -0
- package/build/Fluent.d.ts +34 -0
- package/build/Fluent.mjs +43 -0
- package/build/Fluent.mjs.map +1 -0
- package/build/LRUCache.cjs +49 -0
- package/build/LRUCache.cjs.map +1 -0
- package/build/LRUCache.d.ts +19 -0
- package/build/LRUCache.mjs +44 -0
- package/build/LRUCache.mjs.map +1 -0
- package/build/Store.cjs +220 -0
- package/build/Store.cjs.map +1 -0
- package/build/Store.d.ts +105 -0
- package/build/Store.mjs +205 -0
- package/build/Store.mjs.map +1 -0
- package/build/Tools.cjs +189 -0
- package/build/Tools.cjs.map +1 -0
- package/build/Tools.d.ts +61 -0
- package/build/Tools.mjs +141 -0
- package/build/Tools.mjs.map +1 -0
- package/build/Worker.cjs +67 -0
- package/build/Worker.cjs.map +1 -0
- package/build/Worker.d.ts +17 -0
- package/build/Worker.mjs +63 -0
- package/build/Worker.mjs.map +1 -0
- package/build/index.cjs +30 -0
- package/build/index.cjs.map +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.mjs +9 -0
- package/build/index.mjs.map +1 -0
- package/build/normalize-url/index.cjs +254 -0
- package/build/normalize-url/index.cjs.map +1 -0
- package/build/normalize-url/index.d.ts +285 -0
- package/build/normalize-url/index.mjs +251 -0
- package/build/normalize-url/index.mjs.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @welshman/lib [](https://npmjs.com/package/@welshman/lib)
|
|
2
|
+
|
|
3
|
+
Some general-purpose utilities used elsewhere in @welshman.
|
|
4
|
+
|
|
5
|
+
- `Deferred` is just a promise with `resolve` and `reject` methods.
|
|
6
|
+
- `Emitter` extends EventEmitter to support `emitter.on('*', ...)`.
|
|
7
|
+
- `Fluent` is a wrapper around arrays with chained methods that modify and copy the underlying array.
|
|
8
|
+
- `LRUCache` is an implementation of an LRU cache.
|
|
9
|
+
- `Worker` is an implementation of an asynchronous queue.
|
|
10
|
+
- `Tools` is a collection of general-purpose utility functions.
|
|
11
|
+
- `Store` is an implementation of svelte-like subscribable stores with extra features.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defer = void 0;
|
|
4
|
+
const defer = () => {
|
|
5
|
+
let resolve, reject;
|
|
6
|
+
const p = new Promise((resolve_, reject_) => {
|
|
7
|
+
resolve = resolve_;
|
|
8
|
+
reject = reject_;
|
|
9
|
+
});
|
|
10
|
+
return Object.assign(p, { resolve, reject });
|
|
11
|
+
};
|
|
12
|
+
exports.defer = defer;
|
|
13
|
+
//# sourceMappingURL=Deferred.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deferred.cjs","sourceRoot":"","sources":["../Deferred.ts"],"names":[],"mappings":";;;AAKO,MAAM,KAAK,GAAG,GAAmB,EAAE;IACxC,IAAI,OAAO,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;QAC1C,OAAO,GAAG,QAAQ,CAAA;QAClB,MAAM,GAAG,OAAO,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,OAAQ,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,CAA4B,CAAA;AACxE,CAAC,CAAA;AARY,QAAA,KAAK,SAQjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deferred.mjs","sourceRoot":"","sources":["../Deferred.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,KAAK,GAAG,GAAmB,EAAE;IACxC,IAAI,OAAO,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;QAC1C,OAAO,GAAG,QAAQ,CAAA;QAClB,MAAM,GAAG,OAAO,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,OAAQ,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,CAA4B,CAAA;AACxE,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Emitter = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
class Emitter extends events_1.EventEmitter {
|
|
6
|
+
emit(type, ...args) {
|
|
7
|
+
const a = super.emit(type, ...args);
|
|
8
|
+
const b = super.emit('*', type, ...args);
|
|
9
|
+
return a && b;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.Emitter = Emitter;
|
|
13
|
+
//# sourceMappingURL=Emitter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emitter.cjs","sourceRoot":"","sources":["../Emitter.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,MAAa,OAAQ,SAAQ,qBAAY;IACvC,IAAI,CAAC,IAAqB,EAAE,GAAG,IAAW;QACxC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAA;QACnC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAA;QAExC,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;CACF;AAPD,0BAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emitter.mjs","sourceRoot":"","sources":["../Emitter.ts"],"names":[],"mappings":"OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ;AAEnC,MAAM,OAAO,OAAQ,SAAQ,YAAY;IACvC,IAAI,CAAC,IAAqB,EAAE,GAAG,IAAW;QACxC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAA;QACnC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAA;QAExC,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;CACF"}
|
package/build/Fluent.cjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fluent = void 0;
|
|
4
|
+
const Tools_1 = require("./Tools.cjs");
|
|
5
|
+
class Fluent {
|
|
6
|
+
constructor(xs) {
|
|
7
|
+
this.xs = xs;
|
|
8
|
+
this.valueOf = () => this.xs;
|
|
9
|
+
this.first = () => this.xs[0];
|
|
10
|
+
this.nth = (i) => this.xs[i];
|
|
11
|
+
this.last = () => (0, Tools_1.last)(this.xs);
|
|
12
|
+
this.count = () => this.xs.length;
|
|
13
|
+
this.exists = () => this.xs.length > 0;
|
|
14
|
+
this.has = (v) => this.xs.includes(v);
|
|
15
|
+
this.every = (f) => this.xs.every(f);
|
|
16
|
+
this.some = (f) => this.xs.some(f);
|
|
17
|
+
this.find = (f) => this.xs.find(f);
|
|
18
|
+
this.uniq = () => this.clone(Array.from(new Set(this.xs)));
|
|
19
|
+
this.slice = (a, b) => this.clone(this.xs.slice(a, b));
|
|
20
|
+
this.take = (n) => this.slice(0, n);
|
|
21
|
+
this.drop = (n) => this.slice(n);
|
|
22
|
+
this.filter = (f) => this.clone(this.xs.filter(f));
|
|
23
|
+
this.reject = (f) => this.clone(this.xs.filter(t => !f(t)));
|
|
24
|
+
this.keep = (xs) => this.filter(x => xs.includes(x));
|
|
25
|
+
this.without = (xs) => this.reject(x => xs.includes(x));
|
|
26
|
+
this.map = (f) => this.clone(this.xs.map(f));
|
|
27
|
+
this.mapTo = (f) => Fluent.from(this.xs.map(f));
|
|
28
|
+
this.flatMap = (f) => Fluent.from(this.xs.flatMap(f));
|
|
29
|
+
this.forEach = (f) => this.xs.forEach(f);
|
|
30
|
+
this.join = (s) => this.valueOf().join(s);
|
|
31
|
+
this.set = (i, x) => this.clone([...this.xs.slice(0, i), x, ...this.xs.slice(i + 1)]);
|
|
32
|
+
this.concat = (xs) => this.clone(this.xs.concat(xs));
|
|
33
|
+
this.append = (x) => this.concat([x]);
|
|
34
|
+
this.prepend = (x) => this.clone([x].concat(this.xs));
|
|
35
|
+
}
|
|
36
|
+
static create() {
|
|
37
|
+
return this.from([]);
|
|
38
|
+
}
|
|
39
|
+
static from(xs) {
|
|
40
|
+
return new Fluent(Array.from(xs));
|
|
41
|
+
}
|
|
42
|
+
clone(xs) {
|
|
43
|
+
return new this.constructor(xs);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Fluent = Fluent;
|
|
47
|
+
//# sourceMappingURL=Fluent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fluent.cjs","sourceRoot":"","sources":["../Fluent.ts"],"names":[],"mappings":";;;AAAA,uCAA4B;AAE5B,MAAa,MAAM;IACjB,YAAqB,EAAO;QAAP,OAAE,GAAF,EAAE,CAAK;QAc5B,YAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAA;QAEvB,UAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAExB,QAAG,G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5C,QAAG,GAAG,CAAC,CAAS,EAAE,CAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAE3F,WAAM,GAAG,CAAC,EAAO,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;QAEpD,WAAM,GAAG,CAAC,CAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAEnC,YAAO,GAAG,CAAC,CAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IAlEpB,CAAC;IAEhC,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,IAAI,CAAI,EAAe;QAC5B,OAAO,IAAI,MAAM,CAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IACtC,CAAC;IAED,KAAK,CAA+B,EAAO;QACzC,OAAO,IAAK,IAAI,CAAC,WAAoC,CAAC,EAAE,CAAC,CAAA;IAC3D,CAAC;CAuDF;AApED,wBAoEC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare class Fluent<T> {
|
|
2
|
+
readonly xs: T[];
|
|
3
|
+
constructor(xs: T[]);
|
|
4
|
+
static create(): Fluent<never>;
|
|
5
|
+
static from<T>(xs: Iterable<T>): Fluent<T>;
|
|
6
|
+
clone<K extends Fluent<T>>(this: K, xs: T[]): K;
|
|
7
|
+
valueOf: () => T[];
|
|
8
|
+
first: () => T;
|
|
9
|
+
nth: (i: number) => T;
|
|
10
|
+
last: () => T;
|
|
11
|
+
count: () => number;
|
|
12
|
+
exists: () => boolean;
|
|
13
|
+
has: (v: T) => boolean;
|
|
14
|
+
every: (f: (t: T) => boolean) => boolean;
|
|
15
|
+
some: (f: (t: T) => boolean) => boolean;
|
|
16
|
+
find: (f: (t: T) => boolean) => T | undefined;
|
|
17
|
+
uniq: () => this;
|
|
18
|
+
slice: (a: number, b?: number) => this;
|
|
19
|
+
take: (n: number) => this;
|
|
20
|
+
drop: (n: number) => this;
|
|
21
|
+
filter: (f: (t: T) => boolean) => this;
|
|
22
|
+
reject: (f: (t: T) => boolean) => this;
|
|
23
|
+
keep: (xs: T[]) => this;
|
|
24
|
+
without: (xs: T[]) => this;
|
|
25
|
+
map: (f: (t: T) => T) => this;
|
|
26
|
+
mapTo: <U>(f: (t: T) => U) => Fluent<U>;
|
|
27
|
+
flatMap: <U>(f: (t: T) => U[]) => Fluent<U>;
|
|
28
|
+
forEach: (f: (t: T, i: number) => void) => void;
|
|
29
|
+
join: (s: string) => string;
|
|
30
|
+
set: (i: number, x: T) => this;
|
|
31
|
+
concat: (xs: T[]) => this;
|
|
32
|
+
append: (x: T) => this;
|
|
33
|
+
prepend: (x: T) => this;
|
|
34
|
+
}
|
package/build/Fluent.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { last } from "./Tools.mjs";
|
|
2
|
+
export class Fluent {
|
|
3
|
+
constructor(xs) {
|
|
4
|
+
this.xs = xs;
|
|
5
|
+
this.valueOf = () => this.xs;
|
|
6
|
+
this.first = () => this.xs[0];
|
|
7
|
+
this.nth = (i) => this.xs[i];
|
|
8
|
+
this.last = () => last(this.xs);
|
|
9
|
+
this.count = () => this.xs.length;
|
|
10
|
+
this.exists = () => this.xs.length > 0;
|
|
11
|
+
this.has = (v) => this.xs.includes(v);
|
|
12
|
+
this.every = (f) => this.xs.every(f);
|
|
13
|
+
this.some = (f) => this.xs.some(f);
|
|
14
|
+
this.find = (f) => this.xs.find(f);
|
|
15
|
+
this.uniq = () => this.clone(Array.from(new Set(this.xs)));
|
|
16
|
+
this.slice = (a, b) => this.clone(this.xs.slice(a, b));
|
|
17
|
+
this.take = (n) => this.slice(0, n);
|
|
18
|
+
this.drop = (n) => this.slice(n);
|
|
19
|
+
this.filter = (f) => this.clone(this.xs.filter(f));
|
|
20
|
+
this.reject = (f) => this.clone(this.xs.filter(t => !f(t)));
|
|
21
|
+
this.keep = (xs) => this.filter(x => xs.includes(x));
|
|
22
|
+
this.without = (xs) => this.reject(x => xs.includes(x));
|
|
23
|
+
this.map = (f) => this.clone(this.xs.map(f));
|
|
24
|
+
this.mapTo = (f) => Fluent.from(this.xs.map(f));
|
|
25
|
+
this.flatMap = (f) => Fluent.from(this.xs.flatMap(f));
|
|
26
|
+
this.forEach = (f) => this.xs.forEach(f);
|
|
27
|
+
this.join = (s) => this.valueOf().join(s);
|
|
28
|
+
this.set = (i, x) => this.clone([...this.xs.slice(0, i), x, ...this.xs.slice(i + 1)]);
|
|
29
|
+
this.concat = (xs) => this.clone(this.xs.concat(xs));
|
|
30
|
+
this.append = (x) => this.concat([x]);
|
|
31
|
+
this.prepend = (x) => this.clone([x].concat(this.xs));
|
|
32
|
+
}
|
|
33
|
+
static create() {
|
|
34
|
+
return this.from([]);
|
|
35
|
+
}
|
|
36
|
+
static from(xs) {
|
|
37
|
+
return new Fluent(Array.from(xs));
|
|
38
|
+
}
|
|
39
|
+
clone(xs) {
|
|
40
|
+
return new this.constructor(xs);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=Fluent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fluent.mjs","sourceRoot":"","sources":["../Fluent.ts"],"names":[],"mappings":"OAAO,EAAC,IAAI,EAAC;AAEb,MAAM,OAAO,MAAM;IACjB,YAAqB,EAAO;QAAP,OAAE,GAAF,EAAE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exports.cached = exports.LRUCache = void 0;
|
|
4
|
+
class LRUCache {
|
|
5
|
+
constructor(maxSize) {
|
|
6
|
+
this.maxSize = maxSize;
|
|
7
|
+
this.map = new Map();
|
|
8
|
+
this.keys = [];
|
|
9
|
+
}
|
|
10
|
+
has(k) {
|
|
11
|
+
return this.map.has(k);
|
|
12
|
+
}
|
|
13
|
+
get(k) {
|
|
14
|
+
const v = this.map.get(k);
|
|
15
|
+
if (v !== undefined) {
|
|
16
|
+
this.keys.push(k);
|
|
17
|
+
if (this.keys.length > this.maxSize * 2) {
|
|
18
|
+
this.keys.splice(-this.maxSize);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return v;
|
|
22
|
+
}
|
|
23
|
+
set(k, v) {
|
|
24
|
+
this.map.set(k, v);
|
|
25
|
+
this.keys.push(k);
|
|
26
|
+
if (this.map.size > this.maxSize) {
|
|
27
|
+
this.map.delete(this.keys.shift());
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.LRUCache = LRUCache;
|
|
32
|
+
function cached({ maxSize, getKey, getValue, }) {
|
|
33
|
+
const cache = new LRUCache(maxSize);
|
|
34
|
+
const get = (...args) => {
|
|
35
|
+
const k = getKey(args);
|
|
36
|
+
let v = cache.get(k);
|
|
37
|
+
if (!v) {
|
|
38
|
+
v = getValue(args);
|
|
39
|
+
cache.set(k, v);
|
|
40
|
+
}
|
|
41
|
+
return v;
|
|
42
|
+
};
|
|
43
|
+
get.cache = cache;
|
|
44
|
+
get.getKey = getKey;
|
|
45
|
+
get.getValue = getValue;
|
|
46
|
+
return get;
|
|
47
|
+
}
|
|
48
|
+
exports.cached = cached;
|
|
49
|
+
//# sourceMappingURL=LRUCache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LRUCache.cjs","sourceRoot":"","sources":["../LRUCache.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAQ;IAInB,YAAqB,OAAe;QAAf,YAAO,G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I,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAEpB,IAAI,CAAC,CAAC,EAAE;YACN,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;YAElB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;SAChB;QAED,OAAO,CAAC,CAAA;IACV,CAAC,CAAA;IAED,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;IACjB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAA;IACnB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAEvB,OAAO,GAAG,CAAA;AACZ,CAAC;AA9BD,wBA8BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class LRUCache<T, U> {
|
|
2
|
+
readonly maxSize: number;
|
|
3
|
+
map: Map<T, U>;
|
|
4
|
+
keys: T[];
|
|
5
|
+
constructor(maxSize: number);
|
|
6
|
+
has(k: T): boolean;
|
|
7
|
+
get(k: T): U | undefined;
|
|
8
|
+
set(k: T, v: U): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function cached<T, V, Args extends any[]>({ maxSize, getKey, getValue, }: {
|
|
11
|
+
maxSize: number;
|
|
12
|
+
getKey: (args: Args) => T;
|
|
13
|
+
getValue: (args: Args) => V;
|
|
14
|
+
}): {
|
|
15
|
+
(...args: Args): V;
|
|
16
|
+
cache: LRUCache<T, V>;
|
|
17
|
+
getKey: (args: Args) => T;
|
|
18
|
+
getValue: (args: Args) => V;
|
|
19
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class LRUCache {
|
|
2
|
+
constructor(maxSize) {
|
|
3
|
+
this.maxSize = maxSize;
|
|
4
|
+
this.map = new Map();
|
|
5
|
+
this.keys = [];
|
|
6
|
+
}
|
|
7
|
+
has(k) {
|
|
8
|
+
return this.map.has(k);
|
|
9
|
+
}
|
|
10
|
+
get(k) {
|
|
11
|
+
const v = this.map.get(k);
|
|
12
|
+
if (v !== undefined) {
|
|
13
|
+
this.keys.push(k);
|
|
14
|
+
if (this.keys.length > this.maxSize * 2) {
|
|
15
|
+
this.keys.splice(-this.maxSize);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return v;
|
|
19
|
+
}
|
|
20
|
+
set(k, v) {
|
|
21
|
+
this.map.set(k, v);
|
|
22
|
+
this.keys.push(k);
|
|
23
|
+
if (this.map.size > this.maxSize) {
|
|
24
|
+
this.map.delete(this.keys.shift());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function cached({ maxSize, getKey, getValue, }) {
|
|
29
|
+
const cache = new LRUCache(maxSize);
|
|
30
|
+
const get = (...args) => {
|
|
31
|
+
const k = getKey(args);
|
|
32
|
+
let v = cache.get(k);
|
|
33
|
+
if (!v) {
|
|
34
|
+
v = getValue(args);
|
|
35
|
+
cache.set(k, v);
|
|
36
|
+
}
|
|
37
|
+
return v;
|
|
38
|
+
};
|
|
39
|
+
get.cache = cache;
|
|
40
|
+
get.getKey = getKey;
|
|
41
|
+
get.getValue = getValue;
|
|
42
|
+
return get;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=LRUCache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LRUCache.mjs","sourceRoot":"","sources":["../LRUCache.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IAInB,YAAqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAHpC,QAAG,GAAG,IAAI,GAAG,EAAQ,CAAA;QACrB,SAAI,GAAQ,EAAE,CAAA;IAEyB,CAAC;IAExC,GAAG,CAAC,CAAI;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACxB,CAAC;IAED,GAAG,CAAC,CAAI;QACN,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QAEzB,IAAI,CA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G,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAEvB,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/build/Store.cjs
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collection = exports.key = exports.derivedCollection = exports.readable = exports.derived = exports.writable = exports.DerivedCollection = exports.Collection = exports.DerivedKey = exports.Key = exports.Derived = exports.Writable = void 0;
|
|
4
|
+
const throttle_debounce_1 = require("throttle-debounce");
|
|
5
|
+
const Tools_1 = require("./Tools.cjs");
|
|
6
|
+
class Writable {
|
|
7
|
+
constructor(defaultValue, t) {
|
|
8
|
+
this.subs = [];
|
|
9
|
+
this.notify = () => {
|
|
10
|
+
for (const sub of this.subs) {
|
|
11
|
+
sub(this.value);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.throttle = (t) => {
|
|
15
|
+
return new Derived(this, Tools_1.identity, t);
|
|
16
|
+
};
|
|
17
|
+
this.value = defaultValue;
|
|
18
|
+
if (t) {
|
|
19
|
+
this.notify = (0, throttle_debounce_1.throttle)(t, this.notify);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
get() {
|
|
23
|
+
return this.value;
|
|
24
|
+
}
|
|
25
|
+
set(newValue) {
|
|
26
|
+
this.value = newValue;
|
|
27
|
+
this.notify();
|
|
28
|
+
}
|
|
29
|
+
update(f) {
|
|
30
|
+
this.set(f(this.value));
|
|
31
|
+
}
|
|
32
|
+
async updateAsync(f) {
|
|
33
|
+
this.set(await f(this.value));
|
|
34
|
+
}
|
|
35
|
+
subscribe(f) {
|
|
36
|
+
this.subs.push(f);
|
|
37
|
+
f(this.value);
|
|
38
|
+
return () => {
|
|
39
|
+
this.subs.splice(this.subs.findIndex(x => x === f), 1);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
derived(f) {
|
|
43
|
+
return new Derived(this, f);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Writable = Writable;
|
|
47
|
+
class Derived {
|
|
48
|
+
constructor(stores, getValue, t = 0) {
|
|
49
|
+
this.callerSubs = [];
|
|
50
|
+
this.mySubs = [];
|
|
51
|
+
this.notify = () => {
|
|
52
|
+
this.latestValue = undefined;
|
|
53
|
+
this.callerSubs.forEach(f => f(this.get()));
|
|
54
|
+
};
|
|
55
|
+
this.get = () => {
|
|
56
|
+
// Recalculate if we're not subscribed, because we won't get notified when deps change
|
|
57
|
+
if (this.latestValue === undefined || this.mySubs.length === 0) {
|
|
58
|
+
this.latestValue = this.getValue(this.getInput());
|
|
59
|
+
}
|
|
60
|
+
return this.latestValue;
|
|
61
|
+
};
|
|
62
|
+
this.throttle = (t) => {
|
|
63
|
+
return new Derived(this, Tools_1.identity, t);
|
|
64
|
+
};
|
|
65
|
+
this.stores = stores;
|
|
66
|
+
this.getValue = getValue;
|
|
67
|
+
if (t) {
|
|
68
|
+
this.notify = (0, throttle_debounce_1.throttle)(t, this.notify);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
getInput() {
|
|
72
|
+
if (Array.isArray(this.stores)) {
|
|
73
|
+
return this.stores.map(s => s.get());
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return this.stores.get();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
subscribe(f) {
|
|
80
|
+
if (this.callerSubs.length === 0) {
|
|
81
|
+
for (const s of (0, Tools_1.ensurePlural)(this.stores)) {
|
|
82
|
+
this.mySubs.push(s.subscribe(this.notify));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.callerSubs.push(f);
|
|
86
|
+
f(this.get());
|
|
87
|
+
return () => {
|
|
88
|
+
this.callerSubs.splice(this.callerSubs.findIndex(x => x === f), 1);
|
|
89
|
+
if (this.callerSubs.length === 0) {
|
|
90
|
+
for (const unsub of this.mySubs.splice(0)) {
|
|
91
|
+
unsub();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
derived(f) {
|
|
97
|
+
return new Derived(this, f);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.Derived = Derived;
|
|
101
|
+
class Key {
|
|
102
|
+
constructor(base, pk, key) {
|
|
103
|
+
this.get = () => this.base.get().get(this.key);
|
|
104
|
+
this.subscribe = (f) => this.store.subscribe(f);
|
|
105
|
+
this.derived = (f) => this.store.derived(f);
|
|
106
|
+
this.throttle = (t) => this.store.throttle(t);
|
|
107
|
+
this.exists = () => this.base.get().has(this.key);
|
|
108
|
+
this.update = (f) => this.base.update((m) => {
|
|
109
|
+
if (!this.key) {
|
|
110
|
+
throw new Error(`Cannot set key: "${this.key}"`);
|
|
111
|
+
}
|
|
112
|
+
// Make sure the pk always get set on the record
|
|
113
|
+
const { pk, key } = this;
|
|
114
|
+
const oldValue = { ...m.get(key), [pk]: key };
|
|
115
|
+
const newValue = { ...f(oldValue), [pk]: key };
|
|
116
|
+
m.set(this.key, newValue);
|
|
117
|
+
return m;
|
|
118
|
+
});
|
|
119
|
+
this.set = (v) => this.update(() => v);
|
|
120
|
+
this.merge = (d) => this.update(v => ({ ...v, ...d }));
|
|
121
|
+
this.remove = () => this.base.update(m => {
|
|
122
|
+
m.delete(this.key);
|
|
123
|
+
return m;
|
|
124
|
+
});
|
|
125
|
+
this.pop = () => {
|
|
126
|
+
const v = this.get();
|
|
127
|
+
this.remove();
|
|
128
|
+
return v;
|
|
129
|
+
};
|
|
130
|
+
if (!(base.get() instanceof Map)) {
|
|
131
|
+
throw new Error("`key` can only be used on map collections");
|
|
132
|
+
}
|
|
133
|
+
this.pk = pk;
|
|
134
|
+
this.key = key;
|
|
135
|
+
this.base = base;
|
|
136
|
+
this.store = base.derived(m => m.get(key));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.Key = Key;
|
|
140
|
+
class DerivedKey {
|
|
141
|
+
constructor(base, pk, key) {
|
|
142
|
+
this.get = () => this.base.get().get(this.key);
|
|
143
|
+
this.subscribe = (f) => this.store.subscribe(f);
|
|
144
|
+
this.derived = (f) => this.store.derived(f);
|
|
145
|
+
this.throttle = (t) => this.store.throttle(t);
|
|
146
|
+
this.exists = () => this.base.get().has(this.key);
|
|
147
|
+
if (!(base.get() instanceof Map)) {
|
|
148
|
+
throw new Error("`key` can only be used on map collections");
|
|
149
|
+
}
|
|
150
|
+
this.pk = pk;
|
|
151
|
+
this.key = key;
|
|
152
|
+
this.base = base;
|
|
153
|
+
this.store = base.derived(m => m.get(key));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.DerivedKey = DerivedKey;
|
|
157
|
+
class Collection {
|
|
158
|
+
constructor(pk, t) {
|
|
159
|
+
this.get = () => this.listStore.get();
|
|
160
|
+
this.getMap = () => this.mapStore.get();
|
|
161
|
+
this.subscribe = (f) => this.listStore.subscribe(f);
|
|
162
|
+
this.derived = (f) => this.listStore.derived(f);
|
|
163
|
+
this.throttle = (t) => this.listStore.throttle(t);
|
|
164
|
+
this.key = (k) => new Key(this.mapStore, this.pk, k);
|
|
165
|
+
this.set = (xs) => {
|
|
166
|
+
const m = new Map();
|
|
167
|
+
for (const x of xs) {
|
|
168
|
+
if (!x) {
|
|
169
|
+
console.error("Empty value passed to collection store");
|
|
170
|
+
}
|
|
171
|
+
else if (!x[this.pk]) {
|
|
172
|
+
console.error(`Value with empty ${this.pk} passed to collection store`, x);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
m.set(x[this.pk], x);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.mapStore.set(m);
|
|
179
|
+
};
|
|
180
|
+
this.update = (f) => this.set(f(this.get()));
|
|
181
|
+
this.updateAsync = async (f) => this.set(await f(this.get()));
|
|
182
|
+
this.reject = (f) => this.update((xs) => xs.filter(x => !f(x)));
|
|
183
|
+
this.filter = (f) => this.update((xs) => xs.filter(f));
|
|
184
|
+
this.map = (f) => this.update((xs) => xs.map(f));
|
|
185
|
+
this.pk = pk;
|
|
186
|
+
this.mapStore = (0, exports.writable)(new Map());
|
|
187
|
+
this.listStore = this.mapStore.derived((m) => Array.from(m.values()));
|
|
188
|
+
if (t) {
|
|
189
|
+
this.mapStore.notify = (0, throttle_debounce_1.throttle)(t, this.mapStore.notify);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.Collection = Collection;
|
|
194
|
+
class DerivedCollection {
|
|
195
|
+
constructor(pk, stores, getValue, t = 0) {
|
|
196
|
+
this.pk = pk;
|
|
197
|
+
this.get = () => this.listStore.get();
|
|
198
|
+
this.getMap = () => this.mapStore.get();
|
|
199
|
+
this.subscribe = (f) => this.listStore.subscribe(f);
|
|
200
|
+
this.derived = (f) => this.listStore.derived(f);
|
|
201
|
+
this.throttle = (t) => this.listStore.throttle(t);
|
|
202
|
+
this.key = (k) => new DerivedKey(this.mapStore, this.pk, k);
|
|
203
|
+
this.listStore = new Derived(stores, getValue, t);
|
|
204
|
+
this.mapStore = new Derived(this.listStore, xs => new Map(xs.map((x) => [x[pk], x])));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.DerivedCollection = DerivedCollection;
|
|
208
|
+
const writable = (v) => new Writable(v);
|
|
209
|
+
exports.writable = writable;
|
|
210
|
+
const derived = (stores, getValue) => new Derived(stores, getValue);
|
|
211
|
+
exports.derived = derived;
|
|
212
|
+
const readable = (v) => (0, exports.derived)(new Writable(v), Tools_1.identity);
|
|
213
|
+
exports.readable = readable;
|
|
214
|
+
const derivedCollection = (pk, stores, getValue) => new DerivedCollection(pk, stores, getValue);
|
|
215
|
+
exports.derivedCollection = derivedCollection;
|
|
216
|
+
const key = (base, pk, key) => new Key(base, pk, key);
|
|
217
|
+
exports.key = key;
|
|
218
|
+
const collection = (pk) => new Collection(pk);
|
|
219
|
+
exports.collection = collection;
|
|
220
|
+
//# sourceMappingURL=Store.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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