@quantform/core 0.7.0-beta.29 → 0.7.0-beta.31
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/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/operators.d.ts +5 -0
- package/dist/operators.d.ts.map +1 -0
- package/dist/operators.js +16 -0
- package/dist/replay/with-replay.d.ts.map +1 -1
- package/dist/storage/use-storage.d.ts.map +1 -1
- package/dist/storage/use-storage.js +1 -1
- package/dist/with-memo.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +1 -4
- package/src/operators.ts +18 -0
- package/src/replay/with-replay.ts +1 -1
- package/src/storage/use-storage.ts +1 -1
- package/src/with-memo.ts +1 -1
- package/dist/as-readonly.d.ts +0 -3
- package/dist/as-readonly.d.ts.map +0 -1
- package/dist/as-readonly.js +0 -8
- package/dist/defined.d.ts +0 -3
- package/dist/defined.d.ts.map +0 -1
- package/dist/defined.js +0 -8
- package/dist/errored.d.ts +0 -2
- package/dist/errored.d.ts.map +0 -1
- package/dist/errored.js +0 -4
- package/dist/exclude.d.ts +0 -3
- package/dist/exclude.d.ts.map +0 -1
- package/dist/exclude.js +0 -8
- package/src/as-readonly.ts +0 -5
- package/src/defined.ts +0 -6
- package/src/errored.ts +0 -1
- package/src/exclude.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,7 @@ export * from './replay';
|
|
|
16
16
|
export * from './replay/use-replay-coordinator';
|
|
17
17
|
export * from './when-socket';
|
|
18
18
|
export * from './with-request';
|
|
19
|
-
export * from './defined';
|
|
20
|
-
export * from './as-readonly';
|
|
21
19
|
export * from './with-memo';
|
|
22
20
|
export * from './session';
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './errored';
|
|
21
|
+
export * from './operators';
|
|
25
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -32,9 +32,6 @@ __exportStar(require("./replay"), exports);
|
|
|
32
32
|
__exportStar(require("./replay/use-replay-coordinator"), exports);
|
|
33
33
|
__exportStar(require("./when-socket"), exports);
|
|
34
34
|
__exportStar(require("./with-request"), exports);
|
|
35
|
-
__exportStar(require("./defined"), exports);
|
|
36
|
-
__exportStar(require("./as-readonly"), exports);
|
|
37
35
|
__exportStar(require("./with-memo"), exports);
|
|
38
36
|
__exportStar(require("./session"), exports);
|
|
39
|
-
__exportStar(require("./
|
|
40
|
-
__exportStar(require("./errored"), exports);
|
|
37
|
+
__exportStar(require("./operators"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export declare function asReadonly<T>(): (input: Observable<T>) => Observable<Readonly<T>>;
|
|
3
|
+
export declare function defined<T>(): (observable: Observable<T | undefined | null>) => Observable<T | null | undefined>;
|
|
4
|
+
export declare function exclude<T, S extends symbol>(s: S): (observable: Observable<T | S>) => Observable<Exclude<T, S>>;
|
|
5
|
+
//# sourceMappingURL=operators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../src/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,MAAM,CAAC;AAE/C,wBAAgB,UAAU,CAAC,CAAC,aACX,WAAW,CAAC,CAAC,6BAC7B;AAED,wBAAgB,OAAO,CAAC,CAAC,kBACH,WAAW,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,sCAErD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,gBAC3B,WAAW,CAAC,GAAG,CAAC,CAAC,+BAKtC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exclude = exports.defined = exports.asReadonly = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
function asReadonly() {
|
|
6
|
+
return (input) => input.pipe((0, rxjs_1.map)(it => it));
|
|
7
|
+
}
|
|
8
|
+
exports.asReadonly = asReadonly;
|
|
9
|
+
function defined() {
|
|
10
|
+
return (observable) => observable.pipe((0, rxjs_1.filter)(it => it !== undefined && it !== null));
|
|
11
|
+
}
|
|
12
|
+
exports.defined = defined;
|
|
13
|
+
function exclude(s) {
|
|
14
|
+
return (observable) => observable.pipe((0, rxjs_1.filter)(it => it !== s), (0, rxjs_1.map)(it => it));
|
|
15
|
+
}
|
|
16
|
+
exports.exclude = exclude;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-replay.d.ts","sourceRoot":"","sources":["../../src/replay/with-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"with-replay.d.ts","sourceRoot":"","sources":["../../src/replay/with-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,wBAAgB,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAChF,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GACpB,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAEnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-storage.d.ts","sourceRoot":"","sources":["../../src/storage/use-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-storage.d.ts","sourceRoot":"","sources":["../../src/storage/use-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAKpD,eAAO,MAAM,UAAU,6DAKrB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useStorage = void 0;
|
|
4
|
-
const with_memo_1 = require("../with-memo");
|
|
5
4
|
const use_hash_1 = require("../use-hash");
|
|
5
|
+
const with_memo_1 = require("../with-memo");
|
|
6
6
|
const use_storage_factory_1 = require("./use-storage-factory");
|
|
7
7
|
exports.useStorage = (0, with_memo_1.withMemo)((dependencies) => {
|
|
8
8
|
const key = (0, use_hash_1.useHash)(dependencies);
|
package/dist/with-memo.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withMemo = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
-
const as_readonly_1 = require("./as-readonly");
|
|
7
6
|
const module_1 = require("./module");
|
|
7
|
+
const operators_1 = require("./operators");
|
|
8
8
|
const use_memo_1 = require("./use-memo");
|
|
9
9
|
function withMemo(fn) {
|
|
10
10
|
(0, module_1.throwWithContext)();
|
|
@@ -12,7 +12,7 @@ function withMemo(fn) {
|
|
|
12
12
|
return (...args) => (0, use_memo_1.useMemo)(() => {
|
|
13
13
|
const value = fn(...args);
|
|
14
14
|
if ((0, rxjs_1.isObservable)(value)) {
|
|
15
|
-
return value.pipe((0,
|
|
15
|
+
return value.pipe((0, operators_1.asReadonly)(), (0, rxjs_1.shareReplay)(1));
|
|
16
16
|
}
|
|
17
17
|
return value;
|
|
18
18
|
}, [uniqueId, ...args]);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,9 +16,6 @@ export * from '@lib/replay';
|
|
|
16
16
|
export * from '@lib/replay/use-replay-coordinator';
|
|
17
17
|
export * from '@lib/when-socket';
|
|
18
18
|
export * from '@lib/with-request';
|
|
19
|
-
export * from '@lib/defined';
|
|
20
|
-
export * from '@lib/as-readonly';
|
|
21
19
|
export * from '@lib/with-memo';
|
|
22
20
|
export * from '@lib/session';
|
|
23
|
-
export * from '@lib/
|
|
24
|
-
export * from '@lib/errored';
|
|
21
|
+
export * from '@lib/operators';
|
package/src/operators.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { filter, map, Observable } from 'rxjs';
|
|
2
|
+
|
|
3
|
+
export function asReadonly<T>() {
|
|
4
|
+
return (input: Observable<T>) => input.pipe(map(it => it as Readonly<T>));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function defined<T>() {
|
|
8
|
+
return (observable: Observable<T | undefined | null>) =>
|
|
9
|
+
observable.pipe(filter(it => it !== undefined && it !== null));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function exclude<T, S extends symbol>(s: S) {
|
|
13
|
+
return (observable: Observable<T | S>) =>
|
|
14
|
+
observable.pipe(
|
|
15
|
+
filter(it => it !== s),
|
|
16
|
+
map(it => it as Exclude<T, typeof s>)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
|
|
3
|
-
import { withMemo } from '@lib/with-memo';
|
|
4
3
|
import { dependency } from '@lib/use-hash';
|
|
4
|
+
import { withMemo } from '@lib/with-memo';
|
|
5
5
|
|
|
6
6
|
export function withReplay<T extends Array<dependency>, U extends Observable<K>, K>(
|
|
7
7
|
fn: (...args: T) => U
|
package/src/with-memo.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isObservable, Observable, shareReplay } from 'rxjs';
|
|
2
2
|
import { v4 } from 'uuid';
|
|
3
3
|
|
|
4
|
-
import { asReadonly } from './as-readonly';
|
|
5
4
|
import { throwWithContext } from './module';
|
|
5
|
+
import { asReadonly } from './operators';
|
|
6
6
|
import { dependency } from './use-hash';
|
|
7
7
|
import { useMemo } from './use-memo';
|
|
8
8
|
|
package/dist/as-readonly.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"as-readonly.d.ts","sourceRoot":"","sources":["../src/as-readonly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,wBAAgB,UAAU,CAAC,CAAC,aACX,WAAW,CAAC,CAAC,6BAC7B"}
|
package/dist/as-readonly.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asReadonly = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
function asReadonly() {
|
|
6
|
-
return (input) => input.pipe((0, rxjs_1.map)(it => it));
|
|
7
|
-
}
|
|
8
|
-
exports.asReadonly = asReadonly;
|
package/dist/defined.d.ts
DELETED
package/dist/defined.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defined.d.ts","sourceRoot":"","sources":["../src/defined.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1C,wBAAgB,OAAO,CAAC,CAAC,kBACH,WAAW,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,sCAErD"}
|
package/dist/defined.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defined = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
function defined() {
|
|
6
|
-
return (observable) => observable.pipe((0, rxjs_1.filter)(it => it !== undefined && it !== null));
|
|
7
|
-
}
|
|
8
|
-
exports.defined = defined;
|
package/dist/errored.d.ts
DELETED
package/dist/errored.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errored.d.ts","sourceRoot":"","sources":["../src/errored.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,eAAwB,CAAC"}
|
package/dist/errored.js
DELETED
package/dist/exclude.d.ts
DELETED
package/dist/exclude.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../src/exclude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,MAAM,CAAC;AAE/C,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,gBAC3B,WAAW,CAAC,GAAG,CAAC,CAAC,+BAKtC"}
|
package/dist/exclude.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exclude = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
function exclude(s) {
|
|
6
|
-
return (observable) => observable.pipe((0, rxjs_1.filter)(it => it !== s), (0, rxjs_1.map)(it => it));
|
|
7
|
-
}
|
|
8
|
-
exports.exclude = exclude;
|
package/src/as-readonly.ts
DELETED
package/src/defined.ts
DELETED
package/src/errored.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const errored = Symbol.for('errored');
|
package/src/exclude.ts
DELETED