@fncts/query 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/Cache/api.d.ts +28 -0
- package/Cache/definition.d.ts +15 -0
- package/Cache.d.ts +2 -0
- package/CompletedRequestMap.d.ts +17 -0
- package/DataSource/api.d.ts +38 -0
- package/DataSource/definition.d.ts +46 -0
- package/DataSource.d.ts +2 -0
- package/DataSourceAspect.d.ts +7 -0
- package/Described.d.ts +19 -0
- package/Query/api/bimap.d.ts +6 -0
- package/Query/api/catchAllCause.d.ts +12 -0
- package/Query/api/collectAll.d.ts +7 -0
- package/Query/api/collectAllBatched.d.ts +7 -0
- package/Query/api/collectAllConcurrent.d.ts +7 -0
- package/Query/api/defer.d.ts +7 -0
- package/Query/api/ensuring.d.ts +6 -0
- package/Query/api/environment.d.ts +47 -0
- package/Query/api/flatMap.d.ts +11 -0
- package/Query/api/foreach.d.ts +7 -0
- package/Query/api/foreachBatched.d.ts +7 -0
- package/Query/api/foreachConcurrent.d.ts +7 -0
- package/Query/api/fromRequest.d.ts +10 -0
- package/Query/api/map.d.ts +6 -0
- package/Query/api/mapDataSources.d.ts +7 -0
- package/Query/api/mapError.d.ts +6 -0
- package/Query/api/mapErrorCause.d.ts +7 -0
- package/Query/api/mapIO.d.ts +7 -0
- package/Query/api/match.d.ts +6 -0
- package/Query/api/matchCauseQuery.d.ts +7 -0
- package/Query/api/matchQuery.d.ts +6 -0
- package/Query/api/orHalt.d.ts +11 -0
- package/Query/api/race.d.ts +11 -0
- package/Query/api/run.d.ts +18 -0
- package/Query/api/timeout.d.ts +26 -0
- package/Query/api/zipWith.d.ts +7 -0
- package/Query/api/zipWithBatched.d.ts +6 -0
- package/Query/api/zipWithConcurrent.d.ts +6 -0
- package/Query/api.d.ts +66 -0
- package/Query/definition.d.ts +13 -0
- package/Query.d.ts +30 -0
- package/QueryFailure.d.ts +6 -0
- package/Request.d.ts +38 -0
- package/TestSpec.d.ts +6 -0
- package/_cjs/Cache/api.cjs +56 -0
- package/_cjs/Cache/api.cjs.map +1 -0
- package/_cjs/Cache/definition.cjs +13 -0
- package/_cjs/Cache/definition.cjs.map +1 -0
- package/_cjs/Cache.cjs +28 -0
- package/_cjs/Cache.cjs.map +1 -0
- package/_cjs/CompletedRequestMap.cjs +40 -0
- package/_cjs/CompletedRequestMap.cjs.map +1 -0
- package/_cjs/DataSource/api.cjs +111 -0
- package/_cjs/DataSource/api.cjs.map +1 -0
- package/_cjs/DataSource/definition.cjs +76 -0
- package/_cjs/DataSource/definition.cjs.map +1 -0
- package/_cjs/DataSource.cjs +28 -0
- package/_cjs/DataSource.cjs.map +1 -0
- package/_cjs/DataSourceAspect.cjs +17 -0
- package/_cjs/DataSourceAspect.cjs.map +1 -0
- package/_cjs/Described.cjs +32 -0
- package/_cjs/Described.cjs.map +1 -0
- package/_cjs/Query/api/bimap.cjs +19 -0
- package/_cjs/Query/api/bimap.cjs.map +1 -0
- package/_cjs/Query/api/catchAllCause.cjs +29 -0
- package/_cjs/Query/api/catchAllCause.cjs.map +1 -0
- package/_cjs/Query/api/collectAll.cjs +17 -0
- package/_cjs/Query/api/collectAll.cjs.map +1 -0
- package/_cjs/Query/api/collectAllBatched.cjs +17 -0
- package/_cjs/Query/api/collectAllBatched.cjs.map +1 -0
- package/_cjs/Query/api/collectAllConcurrent.cjs +17 -0
- package/_cjs/Query/api/collectAllConcurrent.cjs.map +1 -0
- package/_cjs/Query/api/defer.cjs +18 -0
- package/_cjs/Query/api/defer.cjs.map +1 -0
- package/_cjs/Query/api/ensuring.cjs +20 -0
- package/_cjs/Query/api/ensuring.cjs.map +1 -0
- package/_cjs/Query/api/environment.cjs +94 -0
- package/_cjs/Query/api/environment.cjs.map +1 -0
- package/_cjs/Query/api/flatMap.cjs +35 -0
- package/_cjs/Query/api/flatMap.cjs.map +1 -0
- package/_cjs/Query/api/foreach.cjs +26 -0
- package/_cjs/Query/api/foreach.cjs.map +1 -0
- package/_cjs/Query/api/foreachBatched.cjs +26 -0
- package/_cjs/Query/api/foreachBatched.cjs.map +1 -0
- package/_cjs/Query/api/foreachConcurrent.cjs +19 -0
- package/_cjs/Query/api/foreachConcurrent.cjs.map +1 -0
- package/_cjs/Query/api/fromRequest.cjs +38 -0
- package/_cjs/Query/api/fromRequest.cjs.map +1 -0
- package/_cjs/Query/api/map.cjs +21 -0
- package/_cjs/Query/api/map.cjs.map +1 -0
- package/_cjs/Query/api/mapDataSources.cjs +21 -0
- package/_cjs/Query/api/mapDataSources.cjs.map +1 -0
- package/_cjs/Query/api/mapError.cjs +19 -0
- package/_cjs/Query/api/mapError.cjs.map +1 -0
- package/_cjs/Query/api/mapErrorCause.cjs +19 -0
- package/_cjs/Query/api/mapErrorCause.cjs.map +1 -0
- package/_cjs/Query/api/mapIO.cjs +20 -0
- package/_cjs/Query/api/mapIO.cjs.map +1 -0
- package/_cjs/Query/api/match.cjs +20 -0
- package/_cjs/Query/api/match.cjs.map +1 -0
- package/_cjs/Query/api/matchCauseQuery.cjs +26 -0
- package/_cjs/Query/api/matchCauseQuery.cjs.map +1 -0
- package/_cjs/Query/api/matchQuery.cjs +21 -0
- package/_cjs/Query/api/matchQuery.cjs.map +1 -0
- package/_cjs/Query/api/orHalt.cjs +29 -0
- package/_cjs/Query/api/orHalt.cjs.map +1 -0
- package/_cjs/Query/api/race.cjs +41 -0
- package/_cjs/Query/api/race.cjs.map +1 -0
- package/_cjs/Query/api/run.cjs +49 -0
- package/_cjs/Query/api/run.cjs.map +1 -0
- package/_cjs/Query/api/timeout.cjs +71 -0
- package/_cjs/Query/api/timeout.cjs.map +1 -0
- package/_cjs/Query/api/zipWith.cjs +39 -0
- package/_cjs/Query/api/zipWith.cjs.map +1 -0
- package/_cjs/Query/api/zipWithBatched.cjs +39 -0
- package/_cjs/Query/api/zipWithBatched.cjs.map +1 -0
- package/_cjs/Query/api/zipWithConcurrent.cjs +39 -0
- package/_cjs/Query/api/zipWithConcurrent.cjs.map +1 -0
- package/_cjs/Query/api.cjs +99 -0
- package/_cjs/Query/api.cjs.map +1 -0
- package/_cjs/Query/definition.cjs +22 -0
- package/_cjs/Query/definition.cjs.map +1 -0
- package/_cjs/Query.cjs +336 -0
- package/_cjs/Query.cjs.map +1 -0
- package/_cjs/QueryFailure.cjs +15 -0
- package/_cjs/QueryFailure.cjs.map +1 -0
- package/_cjs/Request.cjs +54 -0
- package/_cjs/Request.cjs.map +1 -0
- package/_cjs/global.cjs +6 -0
- package/_cjs/global.cjs.map +1 -0
- package/_cjs/index.cjs +6 -0
- package/_cjs/index.cjs.map +1 -0
- package/_cjs/internal/BlockedRequest.cjs +30 -0
- package/_cjs/internal/BlockedRequest.cjs.map +1 -0
- package/_cjs/internal/BlockedRequests.cjs +367 -0
- package/_cjs/internal/BlockedRequests.cjs.map +1 -0
- package/_cjs/internal/Continue.cjs +292 -0
- package/_cjs/internal/Continue.cjs.map +1 -0
- package/_cjs/internal/Parallel.cjs +81 -0
- package/_cjs/internal/Parallel.cjs.map +1 -0
- package/_cjs/internal/Result.cjs +234 -0
- package/_cjs/internal/Result.cjs.map +1 -0
- package/_cjs/internal/Sequential.cjs +59 -0
- package/_cjs/internal/Sequential.cjs.map +1 -0
- package/_mjs/Cache/api.mjs +44 -0
- package/_mjs/Cache/api.mjs.map +1 -0
- package/_mjs/Cache/definition.mjs +6 -0
- package/_mjs/Cache/definition.mjs.map +1 -0
- package/_mjs/Cache.mjs +4 -0
- package/_mjs/Cache.mjs.map +1 -0
- package/_mjs/CompletedRequestMap.mjs +31 -0
- package/_mjs/CompletedRequestMap.mjs.map +1 -0
- package/_mjs/DataSource/api.mjs +98 -0
- package/_mjs/DataSource/api.mjs.map +1 -0
- package/_mjs/DataSource/definition.mjs +63 -0
- package/_mjs/DataSource/definition.mjs.map +1 -0
- package/_mjs/DataSource.mjs +4 -0
- package/_mjs/DataSource.mjs.map +1 -0
- package/_mjs/DataSourceAspect.mjs +9 -0
- package/_mjs/DataSourceAspect.mjs.map +1 -0
- package/_mjs/Described.mjs +24 -0
- package/_mjs/Described.mjs.map +1 -0
- package/_mjs/Query/api/bimap.mjs +11 -0
- package/_mjs/Query/api/bimap.mjs.map +1 -0
- package/_mjs/Query/api/catchAllCause.mjs +20 -0
- package/_mjs/Query/api/catchAllCause.mjs.map +1 -0
- package/_mjs/Query/api/collectAll.mjs +9 -0
- package/_mjs/Query/api/collectAll.mjs.map +1 -0
- package/_mjs/Query/api/collectAllBatched.mjs +9 -0
- package/_mjs/Query/api/collectAllBatched.mjs.map +1 -0
- package/_mjs/Query/api/collectAllConcurrent.mjs +9 -0
- package/_mjs/Query/api/collectAllConcurrent.mjs.map +1 -0
- package/_mjs/Query/api/defer.mjs +10 -0
- package/_mjs/Query/api/defer.mjs.map +1 -0
- package/_mjs/Query/api/ensuring.mjs +12 -0
- package/_mjs/Query/api/ensuring.mjs.map +1 -0
- package/_mjs/Query/api/environment.mjs +77 -0
- package/_mjs/Query/api/environment.mjs.map +1 -0
- package/_mjs/Query/api/flatMap.mjs +25 -0
- package/_mjs/Query/api/flatMap.mjs.map +1 -0
- package/_mjs/Query/api/foreach.mjs +18 -0
- package/_mjs/Query/api/foreach.mjs.map +1 -0
- package/_mjs/Query/api/foreachBatched.mjs +18 -0
- package/_mjs/Query/api/foreachBatched.mjs.map +1 -0
- package/_mjs/Query/api/foreachConcurrent.mjs +11 -0
- package/_mjs/Query/api/foreachConcurrent.mjs.map +1 -0
- package/_mjs/Query/api/fromRequest.mjs +30 -0
- package/_mjs/Query/api/fromRequest.mjs.map +1 -0
- package/_mjs/Query/api/map.mjs +13 -0
- package/_mjs/Query/api/map.mjs.map +1 -0
- package/_mjs/Query/api/mapDataSources.mjs +13 -0
- package/_mjs/Query/api/mapDataSources.mjs.map +1 -0
- package/_mjs/Query/api/mapError.mjs +11 -0
- package/_mjs/Query/api/mapError.mjs.map +1 -0
- package/_mjs/Query/api/mapErrorCause.mjs +11 -0
- package/_mjs/Query/api/mapErrorCause.mjs.map +1 -0
- package/_mjs/Query/api/mapIO.mjs +12 -0
- package/_mjs/Query/api/mapIO.mjs.map +1 -0
- package/_mjs/Query/api/match.mjs +12 -0
- package/_mjs/Query/api/match.mjs.map +1 -0
- package/_mjs/Query/api/matchCauseQuery.mjs +18 -0
- package/_mjs/Query/api/matchCauseQuery.mjs.map +1 -0
- package/_mjs/Query/api/matchQuery.mjs +13 -0
- package/_mjs/Query/api/matchQuery.mjs.map +1 -0
- package/_mjs/Query/api/orHalt.mjs +19 -0
- package/_mjs/Query/api/orHalt.mjs.map +1 -0
- package/_mjs/Query/api/race.mjs +33 -0
- package/_mjs/Query/api/race.mjs.map +1 -0
- package/_mjs/Query/api/run.mjs +38 -0
- package/_mjs/Query/api/run.mjs.map +1 -0
- package/_mjs/Query/api/timeout.mjs +59 -0
- package/_mjs/Query/api/timeout.mjs.map +1 -0
- package/_mjs/Query/api/zipWith.mjs +30 -0
- package/_mjs/Query/api/zipWith.mjs.map +1 -0
- package/_mjs/Query/api/zipWithBatched.mjs +31 -0
- package/_mjs/Query/api/zipWithBatched.mjs.map +1 -0
- package/_mjs/Query/api/zipWithConcurrent.mjs +31 -0
- package/_mjs/Query/api/zipWithConcurrent.mjs.map +1 -0
- package/_mjs/Query/api.mjs +77 -0
- package/_mjs/Query/api.mjs.map +1 -0
- package/_mjs/Query/definition.mjs +14 -0
- package/_mjs/Query/definition.mjs.map +1 -0
- package/_mjs/Query.mjs +34 -0
- package/_mjs/Query.mjs.map +1 -0
- package/_mjs/QueryFailure.mjs +8 -0
- package/_mjs/QueryFailure.mjs.map +1 -0
- package/_mjs/Request.mjs +43 -0
- package/_mjs/Request.mjs.map +1 -0
- package/_mjs/global.mjs +2 -0
- package/_mjs/global.mjs.map +1 -0
- package/_mjs/index.mjs +2 -0
- package/_mjs/index.mjs.map +1 -0
- package/_mjs/internal/BlockedRequest.mjs +21 -0
- package/_mjs/internal/BlockedRequest.mjs.map +1 -0
- package/_mjs/internal/BlockedRequests.mjs +341 -0
- package/_mjs/internal/BlockedRequests.mjs.map +1 -0
- package/_mjs/internal/Continue.mjs +262 -0
- package/_mjs/internal/Continue.mjs.map +1 -0
- package/_mjs/internal/Parallel.mjs +62 -0
- package/_mjs/internal/Parallel.mjs.map +1 -0
- package/_mjs/internal/Result.mjs +208 -0
- package/_mjs/internal/Result.mjs.map +1 -0
- package/_mjs/internal/Sequential.mjs +44 -0
- package/_mjs/internal/Sequential.mjs.map +1 -0
- package/_src/Cache/api.ts +49 -0
- package/_src/Cache/definition.ts +13 -0
- package/_src/Cache.ts +4 -0
- package/_src/CompletedRequestMap.ts +38 -0
- package/_src/DataSource/api.ts +97 -0
- package/_src/DataSource/definition.ts +77 -0
- package/_src/DataSource.ts +4 -0
- package/_src/DataSourceAspect.ts +7 -0
- package/_src/Described.ts +21 -0
- package/_src/Query/api/bimap.ts +11 -0
- package/_src/Query/api/catchAllCause.ts +17 -0
- package/_src/Query/api/collectAll.ts +6 -0
- package/_src/Query/api/collectAllBatched.ts +9 -0
- package/_src/Query/api/collectAllConcurrent.ts +6 -0
- package/_src/Query/api/defer.ts +6 -0
- package/_src/Query/api/ensuring.ts +19 -0
- package/_src/Query/api/environment.ts +82 -0
- package/_src/Query/api/flatMap.ts +26 -0
- package/_src/Query/api/foreach.ts +17 -0
- package/_src/Query/api/foreachBatched.ts +17 -0
- package/_src/Query/api/foreachConcurrent.ts +10 -0
- package/_src/Query/api/fromRequest.ts +49 -0
- package/_src/Query/api/map.ts +8 -0
- package/_src/Query/api/mapDataSources.ts +8 -0
- package/_src/Query/api/mapError.ts +8 -0
- package/_src/Query/api/mapErrorCause.ts +8 -0
- package/_src/Query/api/mapIO.ts +8 -0
- package/_src/Query/api/match.ts +11 -0
- package/_src/Query/api/matchCauseQuery.ts +21 -0
- package/_src/Query/api/matchQuery.ts +12 -0
- package/_src/Query/api/orHalt.ts +15 -0
- package/_src/Query/api/race.ts +34 -0
- package/_src/Query/api/run.ts +40 -0
- package/_src/Query/api/timeout.ts +58 -0
- package/_src/Query/api/zipWith.ts +44 -0
- package/_src/Query/api/zipWithBatched.ts +41 -0
- package/_src/Query/api/zipWithConcurrent.ts +45 -0
- package/_src/Query/api.ts +76 -0
- package/_src/Query/definition.ts +13 -0
- package/_src/Query.ts +35 -0
- package/_src/QueryFailure.ts +7 -0
- package/_src/Request.ts +52 -0
- package/_src/global.ts +45 -0
- package/_src/index.ts +3 -0
- package/_src/internal/BlockedRequest.ts +24 -0
- package/_src/internal/BlockedRequests.ts +331 -0
- package/_src/internal/Continue.ts +305 -0
- package/_src/internal/Parallel.ts +82 -0
- package/_src/internal/Result.ts +242 -0
- package/_src/internal/Sequential.ts +63 -0
- package/global.d.ts +45 -0
- package/index.d.ts +1 -0
- package/internal/BlockedRequest.d.ts +21 -0
- package/internal/BlockedRequests.d.ts +123 -0
- package/internal/Continue.d.ts +133 -0
- package/internal/Parallel.d.ts +56 -0
- package/internal/Result.d.ts +115 -0
- package/internal/Sequential.d.ts +40 -0
- package/package.json +22 -0
- package/runTests.d.ts +1 -0
package/Cache/api.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
|
|
2
|
+
import { FIO } from "@fncts/io/IO/definition";
|
|
3
|
+
import { Nothing } from "@fncts/base/data/Maybe/definition";
|
|
4
|
+
import { Left, Right } from "@fncts/base/data/Either";
|
|
5
|
+
import type { Either } from "@fncts/base/data/Either";
|
|
6
|
+
import type { Maybe } from "@fncts/base/data/Maybe";
|
|
7
|
+
import type { UIO } from "@fncts/io/IO";
|
|
8
|
+
import type { Request } from "@fncts/query/Request";
|
|
9
|
+
import { Ref } from "@fncts/io/Ref";
|
|
10
|
+
import { Cache } from "@fncts/query/Cache/definition";
|
|
11
|
+
/**
|
|
12
|
+
* @tsplus static fncts.query.CacheOps empty
|
|
13
|
+
* @tsplus location "@fncts/query/Cache/api"
|
|
14
|
+
*/
|
|
15
|
+
export declare function empty(__tsplusTrace?: string): UIO<Cache>;
|
|
16
|
+
export declare class Default extends Cache {
|
|
17
|
+
private readonly state;
|
|
18
|
+
constructor(state: Ref<HashMap<any, any>>);
|
|
19
|
+
get<E, A>(request: Request<E, A>, __tsplusTrace?: string | undefined): FIO<void, Ref<Maybe<Either<E, A>>>>;
|
|
20
|
+
lookup<E, A extends Request<E, B>, B>(request: A, __tsplusTrace?: string | undefined): UIO<Either<Ref<Maybe<Either<E, B>>>, Ref<Maybe<Either<E, B>>>>>;
|
|
21
|
+
put<E, A>(request: Request<E, A>, result: Ref<Maybe<Either<E, A>>>, __tsplusTrace?: string | undefined): UIO<void>;
|
|
22
|
+
remove<E, A>(request: Request<E, A>, __tsplusTrace?: string | undefined): UIO<void>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @tsplus static fncts.query.CacheOps unsafeMake
|
|
26
|
+
* @tsplus location "@fncts/query/Cache/api"
|
|
27
|
+
*/
|
|
28
|
+
export declare function unsafeMake(): Cache;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Request } from "@fncts/query/Request";
|
|
2
|
+
import { FIO, UIO } from "@fncts/io/IO/definition";
|
|
3
|
+
import { Ref } from "@fncts/io/Ref/definition";
|
|
4
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
5
|
+
import { Either } from "@fncts/base/data/Either/definition";
|
|
6
|
+
/**
|
|
7
|
+
* @tsplus type fncts.query.Cache
|
|
8
|
+
* @tsplus companion fncts.query.CacheOps
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class Cache {
|
|
11
|
+
abstract get<E, A>(request: Request<E, A>, __tsplusTrace?: string): FIO<void, Ref<Maybe<Either<E, A>>>>;
|
|
12
|
+
abstract lookup<E, A>(request: Request<E, A>, __tsplusTrace?: string): UIO<Either<Ref<Maybe<Either<E, A>>>, Ref<Maybe<Either<E, A>>>>>;
|
|
13
|
+
abstract put<E, A>(request: Request<E, A>, result: Ref<Maybe<Either<E, A>>>, __tsplusTrace?: string): UIO<void>;
|
|
14
|
+
abstract remove<E, A>(request: Request<E, A>, __tsplusTrace?: string): UIO<void>;
|
|
15
|
+
}
|
package/Cache.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
|
|
2
|
+
import { Either } from "@fncts/base/data/Either/definition";
|
|
3
|
+
import { Request } from "@fncts/query/Request";
|
|
4
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
5
|
+
import { Left, Right } from "@fncts/base/data/Either";
|
|
6
|
+
import { HashSet } from "@fncts/base/collection/immutable/HashSet/definition";
|
|
7
|
+
export declare class CompletedRequestMap {
|
|
8
|
+
private map;
|
|
9
|
+
constructor(map: HashMap<any, Either<any, any>>);
|
|
10
|
+
static empty(): CompletedRequestMap;
|
|
11
|
+
concat(that: CompletedRequestMap): CompletedRequestMap;
|
|
12
|
+
insert<E, A>(request: Request<E, A>, result: Either<E, A>): CompletedRequestMap;
|
|
13
|
+
insertMaybe<E, A>(request: Request<E, A>, result: Either<E, Maybe<A>>): CompletedRequestMap;
|
|
14
|
+
lookup<E, A>(request: Request<E, A>): Maybe<Either<E, A>>;
|
|
15
|
+
requests(): HashSet<Request<any, any>>;
|
|
16
|
+
contains(request: any): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
2
|
+
import { Request } from "@fncts/query/Request";
|
|
3
|
+
import type { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
4
|
+
import type { Described } from "@fncts/query/Described";
|
|
5
|
+
import { IO } from "@fncts/io/IO";
|
|
6
|
+
import { CompletedRequestMap } from "@fncts/query/CompletedRequestMap";
|
|
7
|
+
import { DataSource } from "@fncts/query/DataSource/definition";
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus pipeable fncts.query.DataSource contramap
|
|
10
|
+
* @tsplus location "@fncts/query/DataSource/api"
|
|
11
|
+
*/
|
|
12
|
+
export declare function contamap<A, B>(f: Described<(b: B) => A>): <R>(self: DataSource<R, A>) => DataSource<R, B>;
|
|
13
|
+
/**
|
|
14
|
+
* @tsplus pipeable fncts.query.DataSource contramapEnvironment
|
|
15
|
+
* @tsplus location "@fncts/query/DataSource/api"
|
|
16
|
+
*/
|
|
17
|
+
export declare function contramapEnvironment<R0, R>(f: Described<(_: Environment<R0>) => Environment<R>>, __tsplusTrace?: string): <A>(self: DataSource<R, A>) => DataSource<R0, A>;
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus static fncts.query.BatchedOps make
|
|
20
|
+
* @tsplus static fncts.query.DataSourceOps makeBatched
|
|
21
|
+
* @tsplus location "@fncts/query/DataSource/api"
|
|
22
|
+
*/
|
|
23
|
+
export declare function makeBatched<R, A>(name: string, f: (requests: Conc<A>) => IO<R, never, CompletedRequestMap>): DataSource<R, A>;
|
|
24
|
+
/**
|
|
25
|
+
* @tsplus static fncts.query.DataSourceOps make
|
|
26
|
+
* @tsplus location "@fncts/query/DataSource/api"
|
|
27
|
+
*/
|
|
28
|
+
export declare function make<R, A>(name: string, f: (requests: Conc<Conc<A>>) => IO<R, never, CompletedRequestMap>): DataSource<R, A>;
|
|
29
|
+
/**
|
|
30
|
+
* @tsplus static fncts.query.DataSourceOps fromFunction
|
|
31
|
+
* @tsplus location "@fncts/query/DataSource/api"
|
|
32
|
+
*/
|
|
33
|
+
export declare function fromFunction<A extends Request<never, B>, B>(name: string, f: (a: A) => B): DataSource<never, A>;
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus static fncts.query.DataSourceOps fromFunctionIO
|
|
36
|
+
* @tsplus location "@fncts/query/DataSource/api"
|
|
37
|
+
*/
|
|
38
|
+
export declare function fromFunctionIO<R, E, A extends Request<E, B>, B>(name: string, f: (a: A) => IO<R, E, B>): DataSource<R, A>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Hashable } from "@fncts/base/data/Hashable";
|
|
2
|
+
import { Equatable } from "@fncts/base/data/Equatable";
|
|
3
|
+
import { IllegalArgumentError } from "@fncts/base/data/exceptions";
|
|
4
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
5
|
+
import { IO } from "@fncts/io/IO";
|
|
6
|
+
import { CompletedRequestMap } from "@fncts/query/CompletedRequestMap";
|
|
7
|
+
export declare const DataSourceTypeId: unique symbol;
|
|
8
|
+
export type DataSourceTypeId = typeof DataSourceTypeId;
|
|
9
|
+
export declare const DataSourceVariance: unique symbol;
|
|
10
|
+
export type DataSourceVariance = typeof DataSourceVariance;
|
|
11
|
+
/**
|
|
12
|
+
* @tsplus type fncts.query.DataSource
|
|
13
|
+
* @tsplus companion fncts.query.DataSourceOps
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class DataSource<out R, in A> implements Hashable, Equatable {
|
|
16
|
+
readonly [DataSourceTypeId]: DataSourceTypeId;
|
|
17
|
+
[DataSourceVariance]: {
|
|
18
|
+
readonly _R: (_: never) => R;
|
|
19
|
+
readonly _A: (_: A) => void;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The data source's identifier.
|
|
23
|
+
*/
|
|
24
|
+
abstract readonly identifier: string;
|
|
25
|
+
/**
|
|
26
|
+
* Execute a collection of requests. The outer `Chunk` represents batches of
|
|
27
|
+
* requests that must be performed sequentially. The inner `Chunk` represents
|
|
28
|
+
* a batch of requests that can be performed in parallel.
|
|
29
|
+
*/
|
|
30
|
+
abstract runAll(requests: Conc<Conc<A>>, __tsplusTrace?: string): IO<R, never, CompletedRequestMap>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a data source that executes at most `n` requests in parallel.
|
|
33
|
+
*/
|
|
34
|
+
batchN(n: number): DataSource<R, A>;
|
|
35
|
+
get [Symbol.hash](): number;
|
|
36
|
+
[Symbol.equals](that: unknown): boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @tsplus type fncts.query.Batched
|
|
40
|
+
* @tsplus companion fncts.query.BatchedOps
|
|
41
|
+
*/
|
|
42
|
+
export declare abstract class Batched<R, A> extends DataSource<R, A> {
|
|
43
|
+
abstract run(requests: Conc<A>, __tsplusTrace?: string): IO<R, never, CompletedRequestMap>;
|
|
44
|
+
runAll(requests: Conc<Conc<A>>, __tsplusTrace?: string | undefined): IO<R, never, CompletedRequestMap>;
|
|
45
|
+
}
|
|
46
|
+
export declare function isDataSource(u: unknown): u is DataSource<unknown, unknown>;
|
package/DataSource.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataSource } from "@fncts/query/DataSource";
|
|
2
|
+
export declare const DataSourceAspectTypeId: unique symbol;
|
|
3
|
+
export type DataSourceAspectTypeId = typeof DataSourceAspectTypeId;
|
|
4
|
+
export declare abstract class DataSourceAspect<R> {
|
|
5
|
+
readonly [DataSourceAspectTypeId]: DataSourceAspectTypeId;
|
|
6
|
+
abstract apply<R1, A>(dataSource: DataSource<R1, A>): DataSource<R | R1, A>;
|
|
7
|
+
}
|
package/Described.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `Described<A>` is a value of type `A` along with a string description of
|
|
3
|
+
* that value. The description may be used to generate a hash associated with
|
|
4
|
+
* the value, so values that are equal should have the same description and
|
|
5
|
+
* values that are not equal should have different descriptions.
|
|
6
|
+
*
|
|
7
|
+
* @tsplus type fncts.query.Described
|
|
8
|
+
* @tsplus companion fncts.query.DescribedOps
|
|
9
|
+
*/
|
|
10
|
+
export declare class Described<A> {
|
|
11
|
+
readonly value: A;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
constructor(value: A, description: string);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @tsplus pipeable global described
|
|
17
|
+
* @tsplus location "@fncts/query/Described"
|
|
18
|
+
*/
|
|
19
|
+
export declare function described(description: string): <A>(value: A) => Described<A>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query bimap
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/bimap"
|
|
5
|
+
*/
|
|
6
|
+
export declare function bimap<E, A, E1, B>(failure: (e: E) => E1, success: (a: A) => B, __tsplusTrace?: string): <R>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E1, B>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus pipeable fncts.query.Query catchAllCause
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/catchAllCause"
|
|
6
|
+
*/
|
|
7
|
+
export declare function catchAllCause<E, R1, E1, B>(f: (cause: Cause<E>) => Query<R1, E1, B>, __tsplusTrace?: string): <R, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1, B | A>;
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus pipeable fncts.query.Query catchAll
|
|
10
|
+
* @tsplus location "@fncts/query/Query/api/catchAllCause"
|
|
11
|
+
*/
|
|
12
|
+
export declare function catchAll<E, R1, E1, B>(f: (e: E) => Query<R1, E1, B>, __tsplusTrace?: string): <R, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1, B | A>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps collectAll
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/collectAll"
|
|
6
|
+
*/
|
|
7
|
+
export declare function collectAll<R, E, A>(self: Iterable<Query<R, E, A>>, __tsplusTrace?: string): Query<R, E, Conc<A>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps collectAllBatched
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/collectAllBatched"
|
|
6
|
+
*/
|
|
7
|
+
export declare function collectAllBatched<R, E, A>(self: Iterable<Query<R, E, A>>, __tsplusTrace?: string): Query<R, E, Conc<A>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps collectAllConcurrent
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/collectAllConcurrent"
|
|
6
|
+
*/
|
|
7
|
+
export declare function collectAllConcurrent<R, E, A>(self: Iterable<Query<R, E, A>>, __tsplusTrace?: string): Query<R, E, Conc<A>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps defer
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/defer"
|
|
6
|
+
*/
|
|
7
|
+
export declare function defer<R, E, A>(query: Lazy<Query<R, E, A>>): Query<R, E, A>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query ensuring
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/ensuring"
|
|
5
|
+
*/
|
|
6
|
+
export declare function ensuring<R1>(finalizer: Query<R1, never, any>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E, A>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Environment } from "@fncts/base/data/Environment/definition";
|
|
3
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
4
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
5
|
+
import { Layer } from "@fncts/io/Layer";
|
|
6
|
+
import { Result } from "@fncts/query/internal/Result";
|
|
7
|
+
import { Described } from "@fncts/query/Described";
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus static fncts.query.QueryOps environment
|
|
10
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
11
|
+
*/
|
|
12
|
+
export declare function environment<R>(): Query<R, never, Environment<R>>;
|
|
13
|
+
/**
|
|
14
|
+
* @tsplus static fncts.query.QueryOps environmentWith
|
|
15
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
16
|
+
*/
|
|
17
|
+
export declare function environmentWith<R, A>(f: (environment: Environment<R>) => A): Query<R, never, A>;
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus static fncts.query.QueryOps environmentWithQuery
|
|
20
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
21
|
+
*/
|
|
22
|
+
export declare function environmentWithQuery<R0, R, E, A>(f: (environment: Environment<R0>) => Query<R, E, A>): Query<R0 | R, E, A>;
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus static fncts.query.QueryOps environmentWithIO
|
|
25
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
26
|
+
*/
|
|
27
|
+
export declare function environmentWithIO<R0, R, E, A>(f: (environment: Environment<R0>) => IO<R, E, A>): Query<R0 | R, E, A>;
|
|
28
|
+
/**
|
|
29
|
+
* @tsplus pipeable fncts.query.Query contramapEnvironment
|
|
30
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
31
|
+
*/
|
|
32
|
+
export declare function contramapEnvironment<R0, R>(f: Described<(_: Environment<R0>) => Environment<R>>, __tsplusTrace?: string): <E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R0, E, A>;
|
|
33
|
+
/**
|
|
34
|
+
* @tsplus pipeable fncts.query.Query provideEnvironment
|
|
35
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
36
|
+
*/
|
|
37
|
+
export declare function provideEnvironment<R>(environment: Described<Environment<R>>, __tsplusTrace?: string): <E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<never, E, A>;
|
|
38
|
+
/**
|
|
39
|
+
* @tsplus pipeable fncts.query.Query provideSomeEnvironment
|
|
40
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
41
|
+
*/
|
|
42
|
+
export declare function provideSomeEnvironment<R0>(environment: Described<Environment<R0>>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<Exclude<R, R0>, E, A>;
|
|
43
|
+
/**
|
|
44
|
+
* @tsplus pipeable fncts.query.Query provideLayer
|
|
45
|
+
* @tsplus location "@fncts/query/Query/api/environment"
|
|
46
|
+
*/
|
|
47
|
+
export declare function provideLayer<RIn, E1, ROut>(layer: Lazy<Described<Layer<RIn, E1, ROut>>>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<RIn | Exclude<R, ROut>, E1 | E, A>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query flatMap
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/flatMap"
|
|
5
|
+
*/
|
|
6
|
+
export declare function flatMap<A, R1, E1, B>(f: (a: A) => Query<R1, E1, B>, __tsplusTrace?: string): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1 | E, B>;
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus getter fncts.query.Query flatten
|
|
9
|
+
* @tsplus location "@fncts/query/Query/api/flatMap"
|
|
10
|
+
*/
|
|
11
|
+
export declare function flatten<R, E, R1, E1, A>(self: Query<R, E, Query<R1, E1, A>>, __tsplusTrace?: string): Query<R | R1, E | E1, A>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps foreach
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/foreach"
|
|
6
|
+
*/
|
|
7
|
+
export declare function foreach<A, R, E, B>(as: Iterable<A>, f: (a: A) => Query<R, E, B>, __tsplusTrace?: string): Query<R, E, Conc<B>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps foreachBatched
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/foreachBatched"
|
|
6
|
+
*/
|
|
7
|
+
export declare function foreachBatched<A, R, E, B>(as: Iterable<A>, f: (a: A) => Query<R, E, B>, __tsplusTrace?: string): Query<R, E, Conc<B>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus static fncts.query.QueryOps foreachConcurrent
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/foreachConcurrent"
|
|
6
|
+
*/
|
|
7
|
+
export declare function foreachConcurrent<A, R, E, B>(self: Iterable<A>, f: (a: A) => Query<R, E, B>, __tsplusTrace?: string): Query<R, E, Conc<B>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Request } from "@fncts/query/Request";
|
|
2
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
3
|
+
import { DataSource } from "@fncts/query/DataSource";
|
|
4
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
5
|
+
import { Either } from "@fncts/base/data/Either/definition";
|
|
6
|
+
/**
|
|
7
|
+
* @tsplus static fncts.query.QueryOps fromRequest
|
|
8
|
+
* @tsplus location "@fncts/query/Query/api/fromRequest"
|
|
9
|
+
*/
|
|
10
|
+
export declare function fromRequest<R, A extends Request<any, any>>(request0: Lazy<A>, dataSource0: Lazy<DataSource<R, A>>, __tsplusTrace?: string): Query<R, Request.ErrorOf<A>, Request.ValueOf<A>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query map
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/map"
|
|
5
|
+
*/
|
|
6
|
+
export declare function map<A, B>(f: (a: A) => B): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E, B>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataSourceAspect } from "@fncts/query/DataSourceAspect";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus pipeable fncts.query.Query mapDataSources
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/mapDataSources"
|
|
6
|
+
*/
|
|
7
|
+
export declare function mapDataSources<R1>(f: DataSourceAspect<R1>): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E, A>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query mapError
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/mapError"
|
|
5
|
+
*/
|
|
6
|
+
export declare function mapError<E, E1>(f: (e: E) => E1, __tsplusTrace?: string): <R, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E1, A>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus pipeable fncts.query.Query mapErrorCause
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/mapErrorCause"
|
|
6
|
+
*/
|
|
7
|
+
export declare function mapErrorCause<E, E1>(f: (cause: Cause<E>) => Cause<E1>, __tsplusTrace?: string): <R, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E1, A>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus pipeable fncts.query.Query mapIO
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/mapIO"
|
|
6
|
+
*/
|
|
7
|
+
export declare function mapIO<A, R1, E1, B>(f: (a: A) => IO<R1, E1, B>): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1 | E, B>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query match
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/match"
|
|
5
|
+
*/
|
|
6
|
+
export declare function match<E, A, B, C>(failure: (e: E) => B, success: (a: A) => C): <R>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, never, B | C>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus pipeable fncts.query.Query matchCauseQuery
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/matchCauseQuery"
|
|
6
|
+
*/
|
|
7
|
+
export declare function matchCauseQuery<E, A, R1, E1, B, R2, E2, C>(failure: (cause: Cause<E>) => Query<R1, E1, B>, success: (a: A) => Query<R2, E2, C>): <R>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R2 | R, E1 | E2, B | C>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query matchQuery
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/matchQuery"
|
|
5
|
+
*/
|
|
6
|
+
export declare function matchQuery<E, A, R1, E1, B, R2, E2, C>(failure: (e: E) => Query<R1, E1, B>, success: (a: A) => Query<R2, E2, C>, __tsplusTrace?: string): <R>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R2 | R, E1 | E2, B | C>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query orHaltWith
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/orHalt"
|
|
5
|
+
*/
|
|
6
|
+
export declare function orHaltWith<E>(f: (e: E) => unknown, __tsplusTrace?: string): <R, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, never, A>;
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus getter fncts.query.Query orHalt
|
|
9
|
+
* @tsplus location "@fncts/query/Query/api/orHalt"
|
|
10
|
+
*/
|
|
11
|
+
export declare function orHalt<R, E, A>(self: Query<R, E, A>, __tsplusTrace?: string): Query<R, never, A>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
4
|
+
import { Result } from "@fncts/query/internal/Result";
|
|
5
|
+
import { Exit } from "@fncts/base/data/Exit/definition";
|
|
6
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus pipeable fncts.query.Query race
|
|
9
|
+
* @tsplus location "@fncts/query/Query/api/race"
|
|
10
|
+
*/
|
|
11
|
+
export declare function race<R1, E1, A1>(that: Lazy<Query<R1, E1, A1>>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1 | E, A1 | A>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Cache } from "@fncts/query/Cache";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
4
|
+
/**
|
|
5
|
+
* @tsplus pipeable fncts.query.Query runCache
|
|
6
|
+
* @tsplus location "@fncts/query/Query/api/run"
|
|
7
|
+
*/
|
|
8
|
+
export declare function runCache(cache: Cache, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("@fncts/io/IO").IO<R, E, A>;
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus getter fncts.query.Query runLog
|
|
11
|
+
* @tsplus location "@fncts/query/Query/api/run"
|
|
12
|
+
*/
|
|
13
|
+
export declare function runLog<R, E, A>(self: Query<R, E, A>, __tsplusTrace?: string): IO<R, E, readonly [Cache, A]>;
|
|
14
|
+
/**
|
|
15
|
+
* @tsplus getter fncts.query.Query run
|
|
16
|
+
* @tsplus location "@fncts/query/Query/api/run"
|
|
17
|
+
*/
|
|
18
|
+
export declare function run<R, E, A>(self: Query<R, E, A>, __tsplusTrace?: string): IO<R, E, A>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
2
|
+
import { Duration } from "@fncts/base/data/Duration/definition";
|
|
3
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
4
|
+
import { Fiber } from "@fncts/io/Fiber/definition";
|
|
5
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
6
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus pipeable fncts.query.Query timeoutTo
|
|
9
|
+
* @tsplus location "@fncts/query/Query/api/timeout"
|
|
10
|
+
*/
|
|
11
|
+
export declare function timeoutTo<A, B, B1>(duration: Lazy<Duration>, b: Lazy<B>, f: (a: A) => B1, __tsplusTrace?: string): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E, B | B1>;
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus pipeable fncts.query.Query timeout
|
|
14
|
+
* @tsplus location "@fncts/query/Query/api/timeout"
|
|
15
|
+
*/
|
|
16
|
+
export declare function timeout(duration: Lazy<Duration>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E, import("@fncts/base/data/Maybe").Maybe<A>>;
|
|
17
|
+
/**
|
|
18
|
+
* @tsplus pipeable fncts.query.Query timeoutFail
|
|
19
|
+
* @tsplus location "@fncts/query/Query/api/timeout"
|
|
20
|
+
*/
|
|
21
|
+
export declare function timeoutFail<E1>(duration: Lazy<Duration>, e: Lazy<E1>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E1 | E, A>;
|
|
22
|
+
/**
|
|
23
|
+
* @tsplus pipeable fncts.query.Query timeoutFailCause
|
|
24
|
+
* @tsplus location "@fncts/query/Query/api/timeout"
|
|
25
|
+
*/
|
|
26
|
+
export declare function timeoutFailCause<E1>(duration: Lazy<Duration>, e: Lazy<Cause<E1>>, __tsplusTrace?: string): <R, E, A>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R, E1 | E, A>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
2
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
3
|
+
/**
|
|
4
|
+
* @tsplus pipeable fncts.query.Query zipWith
|
|
5
|
+
* @tsplus location "@fncts/query/Query/api/zipWith"
|
|
6
|
+
*/
|
|
7
|
+
export declare function zipWith<A, R1, E1, B, C>(that: Lazy<Query<R1, E1, B>>, f: (a: A, b: B) => C, __tsplusTrace?: string): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1 | E, C>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query zipWithBatched
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/zipWithBatched"
|
|
5
|
+
*/
|
|
6
|
+
export declare function zipWithBatched<A, R1, E1, B, C>(that: Query<R1, E1, B>, f: (a: A, b: B) => C, __tsplusTrace?: string): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1 | E, C>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
2
|
+
/**
|
|
3
|
+
* @tsplus pipeable fncts.query.Query zipWithConcurrent
|
|
4
|
+
* @tsplus location "@fncts/query/Query/api/zipWithConcurrent"
|
|
5
|
+
*/
|
|
6
|
+
export declare function zipWithConcurrent<A, R1, E1, B, C>(that: Query<R1, E1, B>, f: (a: A, b: B) => C, __tsplusTrace?: string): <R, E>(self: import("../definition").Query<R, E, A>) => import("../definition").Query<R1 | R, E1 | E, C>;
|
package/Query/api.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FiberRef } from "@fncts/io/FiberRef/definition";
|
|
2
|
+
import { Cache } from "@fncts/query/Cache";
|
|
3
|
+
import { Lazy } from "@fncts/base/data/function/definition";
|
|
4
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
5
|
+
import { Query } from "@fncts/query/Query/definition";
|
|
6
|
+
import { Cause } from "@fncts/base/data/Cause/definition";
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus static fncts.query.QueryOps cachingEnabled
|
|
9
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
10
|
+
*/
|
|
11
|
+
export declare const cachingEnabled: FiberRef<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus static fncts.query.QueryOps currentCache
|
|
14
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
15
|
+
*/
|
|
16
|
+
export declare const currentCache: FiberRef<Cache>;
|
|
17
|
+
/**
|
|
18
|
+
* @tsplus static fncts.query.QueryOps fromIO
|
|
19
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
20
|
+
*/
|
|
21
|
+
export declare function fromIO<R, E, A>(io: Lazy<IO<R, E, A>>): Query<R, E, A>;
|
|
22
|
+
/**
|
|
23
|
+
* @tsplus static fncts.query.QueryOps failCause
|
|
24
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
25
|
+
*/
|
|
26
|
+
export declare function failCause<E>(cause: Lazy<Cause<E>>, __tsplusTrace?: string): Query<never, E, never>;
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus static fncts.query.QueryOps failCauseNow
|
|
29
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
30
|
+
*/
|
|
31
|
+
export declare function failCauseNow<E>(cause: Cause<E>, __tsplusTrace?: string): Query<never, E, never>;
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus static fncts.query.QueryOps fail
|
|
34
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
35
|
+
*/
|
|
36
|
+
export declare function fail<E>(e: Lazy<E>, __tsplusTrace?: string): Query<never, E, never>;
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus static fncts.query.QueryOps failNow
|
|
39
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
40
|
+
*/
|
|
41
|
+
export declare function failNow<E>(e: E, __tsplusTrace?: string): Query<never, E, never>;
|
|
42
|
+
/**
|
|
43
|
+
* @tsplus static fncts.query.QueryOps halt
|
|
44
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
45
|
+
*/
|
|
46
|
+
export declare function halt(t: Lazy<unknown>, __tsplusTrace?: string): Query<never, never, never>;
|
|
47
|
+
/**
|
|
48
|
+
* @tsplus static fncts.query.QueryOps haltNow
|
|
49
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
50
|
+
*/
|
|
51
|
+
export declare function haltNow(t: unknown, __tsplusTrace?: string): Query<never, never, never>;
|
|
52
|
+
/**
|
|
53
|
+
* @tsplus static fncts.query.QueryOps succeed
|
|
54
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
55
|
+
*/
|
|
56
|
+
export declare function succeed<A>(value: Lazy<A>): Query<never, never, A>;
|
|
57
|
+
/**
|
|
58
|
+
* @tsplus static fncts.query.QueryOps succeedNow
|
|
59
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
60
|
+
*/
|
|
61
|
+
export declare function succeedNow<A>(value: A): Query<never, never, A>;
|
|
62
|
+
/**
|
|
63
|
+
* @tsplus static fncts.query.QueryOps unit
|
|
64
|
+
* @tsplus location "@fncts/query/Query/api"
|
|
65
|
+
*/
|
|
66
|
+
export declare const unit: Query<never, never, void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IO } from "@fncts/io/IO/definition";
|
|
2
|
+
import type { Result } from "@fncts/query/internal/Result";
|
|
3
|
+
export declare const QueryTypeId: unique symbol;
|
|
4
|
+
export type QueryTypeId = typeof QueryTypeId;
|
|
5
|
+
/**
|
|
6
|
+
* @tsplus type fncts.query.Query
|
|
7
|
+
* @tsplus companion fncts.query.QueryOps
|
|
8
|
+
*/
|
|
9
|
+
export declare class Query<R, E, A> {
|
|
10
|
+
readonly step: IO<R, never, Result<R, E, A>>;
|
|
11
|
+
readonly [QueryTypeId]: QueryTypeId;
|
|
12
|
+
constructor(step: IO<R, never, Result<R, E, A>>);
|
|
13
|
+
}
|