@effect/query
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -34,4 +34,11 @@ /** | ||
/** | ||
* The context tag for a `CompletedRequestMap`. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export declare const CompletedRequestMap: Context.Tag<CompletedRequestMap, CompletedRequestMap>; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare namespace CompletedRequestMap { | ||
@@ -47,9 +54,2 @@ /** | ||
/** | ||
* The context tag for a `CompletedRequestMap`. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export declare const Tag: Context.Tag<CompletedRequestMap>; | ||
/** | ||
* An empty completed requests map. | ||
@@ -56,0 +56,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.setOption = exports.set = exports.requests = exports.make = exports.has = exports.get = exports.empty = exports.combine = exports.Tag = exports.CompletedRequestMapTypeId = void 0; | ||
exports.setOption = exports.set = exports.requests = exports.make = exports.has = exports.get = exports.empty = exports.combine = exports.CompletedRequestMapTypeId = exports.CompletedRequestMap = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/query/internal_effect_untraced/completedRequestMap")); | ||
@@ -23,3 +23,3 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
exports.CompletedRequestMapTypeId = CompletedRequestMapTypeId; | ||
const Tag = internal.Tag; | ||
const CompletedRequestMap = internal.CompletedRequestMap; | ||
/** | ||
@@ -31,3 +31,3 @@ * An empty completed requests map. | ||
*/ | ||
exports.Tag = Tag; | ||
exports.CompletedRequestMap = CompletedRequestMap; | ||
const empty = internal.empty; | ||
@@ -34,0 +34,0 @@ /** |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.unsafeMake = exports.set = exports.remove = exports.lookup = exports.get = exports.empty = exports.CacheTypeId = void 0; | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Debug")); | ||
var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either")); | ||
@@ -12,3 +13,2 @@ var _Function = /*#__PURE__*/require("@effect/data/Function"); | ||
var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Option")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Debug")); | ||
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect")); | ||
@@ -15,0 +15,0 @@ var Ref = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Ref")); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.setOption = exports.set = exports.requests = exports.make = exports.has = exports.get = exports.empty = exports.combine = exports.Tag = exports.CompletedRequestMapTypeId = void 0; | ||
exports.setOption = exports.set = exports.requests = exports.make = exports.has = exports.get = exports.empty = exports.combine = exports.CompletedRequestMapTypeId = exports.CompletedRequestMap = void 0; | ||
var Context = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Context")); | ||
@@ -31,5 +31,5 @@ var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either")); | ||
/** @internal */ | ||
const Tag = /*#__PURE__*/Context.Tag(); | ||
const CompletedRequestMap = /*#__PURE__*/Context.Tag(); | ||
/** @internal */ | ||
exports.Tag = Tag; | ||
exports.CompletedRequestMap = CompletedRequestMap; | ||
const empty = () => new CompletedRequestMapImpl(MutableRef.make(HashMap.empty())); | ||
@@ -36,0 +36,0 @@ /** @internal */ |
@@ -8,2 +8,3 @@ "use strict"; | ||
var Chunk = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Chunk")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Debug")); | ||
var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either")); | ||
@@ -13,3 +14,2 @@ var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Equal")); | ||
var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Cause")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Debug")); | ||
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect")); | ||
@@ -49,3 +49,3 @@ var completedRequestMap = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/query/internal_effect_untraced/completedRequestMap")); | ||
const map = completedRequestMap.empty(); | ||
return Effect.as(Effect.provideService(completedRequestMap.Tag, map)(restore(runAll)(requests)), map); | ||
return Effect.as(Effect.provideService(completedRequestMap.CompletedRequestMap, map)(restore(runAll)(requests)), map); | ||
}))); | ||
@@ -60,3 +60,3 @@ /** @internal */ | ||
const innerMap = completedRequestMap.empty(); | ||
return Effect.map(() => completedRequestMap.combine(outerMap, innerMap))(Effect.provideService(completedRequestMap.Tag, innerMap)(restore(run)(newRequests))); | ||
return Effect.map(() => completedRequestMap.combine(outerMap, innerMap))(Effect.provideService(completedRequestMap.CompletedRequestMap, innerMap)(restore(run)(newRequests))); | ||
}))); | ||
@@ -86,3 +86,3 @@ /** @internal */ | ||
exports.eitherWith = eitherWith; | ||
const fromFunction = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.serviceWith(completedRequestMap.Tag, map => Chunk.forEach(request => completedRequestMap.set(map, request, | ||
const fromFunction = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.map(completedRequestMap.CompletedRequestMap, map => Chunk.forEach(request => completedRequestMap.set(map, request, | ||
// @ts-expect-error | ||
@@ -95,3 +95,3 @@ Either.right(restore(f)(request))))(requests)))); | ||
exports.fromFunctionBatched = fromFunctionBatched; | ||
const fromFunctionBatchedEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.serviceWith(completedRequestMap.Tag, map => Effect.map(Chunk.forEach(([k, v]) => completedRequestMap.set(map, k, v)))(Effect.match(restore(f)(requests), e => Chunk.map(k => [k, Either.left(e)])(requests), bs => Chunk.zip(Chunk.map(Either.right)(bs))(requests)))))); | ||
const fromFunctionBatchedEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.flatMap(completedRequestMap.CompletedRequestMap, map => Effect.map(Chunk.forEach(([k, v]) => completedRequestMap.set(map, k, v)))(Effect.match(restore(f)(requests), e => Chunk.map(k => [k, Either.left(e)])(requests), bs => Chunk.zip(Chunk.map(Either.right)(bs))(requests)))))); | ||
/** @internal */ | ||
@@ -102,3 +102,3 @@ exports.fromFunctionBatchedEffect = fromFunctionBatchedEffect; | ||
exports.fromFunctionBatchedOption = fromFunctionBatchedOption; | ||
const fromFunctionBatchedOptionEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.serviceWithEffect(completedRequestMap.Tag, map => Effect.map(Effect.match(restore(f)(requests), e => Chunk.map(k => [k, Either.left(e)])(requests), bs => Chunk.zip(Chunk.map(Either.right)(bs))(requests)), Chunk.forEach(([k, v]) => completedRequestMap.setOption(map, k, v)))))); | ||
const fromFunctionBatchedOptionEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.flatMap(completedRequestMap.CompletedRequestMap, map => Effect.map(Effect.match(restore(f)(requests), e => Chunk.map(k => [k, Either.left(e)])(requests), bs => Chunk.zip(Chunk.map(Either.right)(bs))(requests)), Chunk.forEach(([k, v]) => completedRequestMap.setOption(map, k, v)))))); | ||
/** @internal */ | ||
@@ -109,6 +109,6 @@ exports.fromFunctionBatchedOptionEffect = fromFunctionBatchedOptionEffect; | ||
exports.fromFunctionBatchedWith = fromFunctionBatchedWith; | ||
const fromFunctionBatchedWithEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f, g) => makeBatched(name, requests => Effect.serviceWithEffect(completedRequestMap.Tag, map => Effect.map(Effect.match(restore(f)(requests), e => Chunk.map(k => [k, Either.left(e)])(requests), bs => Chunk.map(b => [restore(g)(b), Either.right(b)])(bs)), Chunk.forEach(([k, v]) => completedRequestMap.set(map, k, v)))))); | ||
const fromFunctionBatchedWithEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f, g) => makeBatched(name, requests => Effect.flatMap(completedRequestMap.CompletedRequestMap, map => Effect.map(Effect.match(restore(f)(requests), e => Chunk.map(k => [k, Either.left(e)])(requests), bs => Chunk.map(b => [restore(g)(b), Either.right(b)])(bs)), Chunk.forEach(([k, v]) => completedRequestMap.set(map, k, v)))))); | ||
/** @internal */ | ||
exports.fromFunctionBatchedWithEffect = fromFunctionBatchedWithEffect; | ||
const fromFunctionEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.serviceWithEffect(completedRequestMap.Tag, map => Effect.map(Effect.forEachPar(requests, a => Effect.map(Effect.either(restore(f)(a)), e => [a, e])), Chunk.forEach(([k, v]) => completedRequestMap.set(map, k, v)))))); | ||
const fromFunctionEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.flatMap(completedRequestMap.CompletedRequestMap, map => Effect.map(Effect.forEachPar(requests, a => Effect.map(Effect.either(restore(f)(a)), e => [a, e])), Chunk.forEach(([k, v]) => completedRequestMap.set(map, k, v)))))); | ||
/** @internal */ | ||
@@ -119,3 +119,3 @@ exports.fromFunctionEffect = fromFunctionEffect; | ||
exports.fromFunctionOption = fromFunctionOption; | ||
const fromFunctionOptionEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.serviceWithEffect(completedRequestMap.Tag, map => Effect.map(Effect.forEachPar(requests, a => Effect.map(Effect.either(restore(f)(a)), e => [a, e])), Chunk.forEach(([k, v]) => completedRequestMap.setOption(map, k, v)))))); | ||
const fromFunctionOptionEffect = /*#__PURE__*/Debug.untracedMethod(restore => (name, f) => makeBatched(name, requests => Effect.flatMap(completedRequestMap.CompletedRequestMap, map => Effect.map(Effect.forEachPar(requests, a => Effect.map(Effect.either(restore(f)(a)), e => [a, e])), Chunk.forEach(([k, v]) => completedRequestMap.setOption(map, k, v)))))); | ||
/** @internal */ | ||
@@ -122,0 +122,0 @@ exports.fromFunctionOptionEffect = fromFunctionOptionEffect; |
@@ -6,5 +6,6 @@ "use strict"; | ||
}); | ||
exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zipBatchedRight = exports.zipBatchedLeft = exports.zipBatched = exports.zip = exports.unwrap = exports.unsandbox = exports.unright = exports.unrefineWith = exports.unrefine = exports.unoption = exports.unleft = exports.unit = exports.uncached = exports.timeoutTo = exports.timeoutFailCause = exports.timeoutFail = exports.timeout = exports.timed = exports.sync = exports.suspend = exports.summarized = exports.succeedSome = exports.succeedNone = exports.succeed = exports.someOrFail = exports.someOrElseEffect = exports.someOrElse = exports.some = exports.serviceWithQuery = exports.serviceWithEffect = exports.serviceWith = exports.service = exports.sandboxWith = exports.sandbox = exports.runLog = exports.runCache = exports.run = exports.right = exports.refineOrDieWith = exports.refineOrDie = exports.race = exports.provideSomeLayer = exports.provideLayer = exports.provideContext = exports.partitionQueryPar = exports.partitionQuery = exports.orDieWith = exports.orDie = exports.optional = exports.never = exports.maxBatchSize = exports.matchQuery = exports.matchCauseQuery = exports.match = exports.mapErrorCause = exports.mapError = exports.mapEffect = exports.mapDataSources = exports.mapBoth = exports.map = exports.left = exports.isQuery = exports.fromRequestUncached = exports.fromRequest = exports.fromOption = exports.fromEither = exports.fromEffect = exports.forEachPar = exports.forEachBatched = exports.forEach = exports.flatten = exports.flatMap = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.ensuring = exports.either = exports.dieSync = exports.die = exports.contramapContext = exports.contextWithQuery = exports.contextWithEffect = exports.contextWith = exports.context = exports.collectAllPar = exports.collectAllBatched = exports.collectAll = exports.catchAllCause = exports.catchAll = exports.cached = exports.asUnit = exports.asSomeError = exports.as = exports.around = exports.absolve = exports.QueryTypeId = void 0; | ||
exports.zipWithPar = exports.zipWithBatchedContinuation = exports.zipWithBatched = exports.zipWith = exports.zipRight = exports.zipParRight = void 0; | ||
exports.zipWithBatched = exports.zipWith = exports.zipRight = exports.zipParRight = exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zipBatchedRight = exports.zipBatchedLeft = exports.zipBatched = exports.zip = exports.unwrap = exports.unsandbox = exports.unright = exports.unrefineWith = exports.unrefine = exports.unoption = exports.unleft = exports.unit = exports.uncached = exports.timeoutTo = exports.timeoutFailCause = exports.timeoutFail = exports.timeout = exports.timed = exports.sync = exports.suspend = exports.summarized = exports.succeedSome = exports.succeedNone = exports.succeed = exports.someOrFail = exports.someOrElseEffect = exports.someOrElse = exports.some = exports.sandboxWith = exports.sandbox = exports.runLog = exports.runCache = exports.run = exports.right = exports.refineOrDieWith = exports.refineOrDie = exports.race = exports.provideSomeLayer = exports.provideLayer = exports.provideContext = exports.partitionQueryPar = exports.partitionQuery = exports.orDieWith = exports.orDie = exports.optional = exports.never = exports.maxBatchSize = exports.matchQuery = exports.matchCauseQuery = exports.match = exports.mapErrorCause = exports.mapError = exports.mapEffect = exports.mapDataSources = exports.mapBoth = exports.map = exports.left = exports.isQuery = exports.fromRequestUncached = exports.fromRequest = exports.fromOption = exports.fromEither = exports.fromEffect = exports.forEachPar = exports.forEachBatched = exports.forEach = exports.flatten = exports.flatMap = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.ensuring = exports.either = exports.dieSync = exports.die = exports.contramapContext = exports.contextWithQuery = exports.contextWithEffect = exports.contextWith = exports.context = exports.collectAllPar = exports.collectAllBatched = exports.collectAll = exports.catchAllCause = exports.catchAll = exports.cached = exports.asUnit = exports.asSomeError = exports.as = exports.around = exports.absolve = exports.QueryTypeId = void 0; | ||
exports.zipWithPar = exports.zipWithBatchedContinuation = void 0; | ||
var Chunk = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Chunk")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Debug")); | ||
var Duration = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Duration")); | ||
@@ -20,3 +21,2 @@ var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either")); | ||
var Clock = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Clock")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Debug")); | ||
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect")); | ||
@@ -398,14 +398,2 @@ var Exit = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Exit")); | ||
exports.sandboxWith = sandboxWith; | ||
const service = /*#__PURE__*/Debug.methodWithTrace(trace => tag => fromEffect(Effect.service(tag).traced(trace))); | ||
/** @internal */ | ||
exports.service = service; | ||
const serviceWith = /*#__PURE__*/Debug.untracedMethod(restore => (tag, f) => map(service(tag), restore(f))); | ||
/** @internal */ | ||
exports.serviceWith = serviceWith; | ||
const serviceWithEffect = /*#__PURE__*/Debug.untracedMethod(restore => (tag, f) => mapEffect(service(tag), restore(f))); | ||
/** @internal */ | ||
exports.serviceWithEffect = serviceWithEffect; | ||
const serviceWithQuery = /*#__PURE__*/Debug.untracedMethod(restore => (tag, f) => flatMap(service(tag), restore(f))); | ||
/** @internal */ | ||
exports.serviceWithQuery = serviceWithQuery; | ||
const some = /*#__PURE__*/Debug.untracedMethod(() => self => matchQuery(self, e => fail(Option.some(e)), Option.match(() => fail(Option.none()), succeed))); | ||
@@ -412,0 +400,0 @@ /** @internal */ |
@@ -8,4 +8,4 @@ "use strict"; | ||
var Data = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Data")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Debug")); | ||
var Either = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Either")); | ||
var Debug = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Debug")); | ||
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect")); | ||
@@ -46,3 +46,3 @@ var completedRequestMap = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/query/internal_effect_untraced/completedRequestMap")); | ||
exports.tagged = tagged; | ||
const complete = /*#__PURE__*/Debug.dualWithTrace(2, trace => (self, result) => Effect.serviceWith(completedRequestMap.Tag, map => completedRequestMap.set(map, self, result)).traced(trace)); | ||
const complete = /*#__PURE__*/Debug.dualWithTrace(2, trace => (self, result) => Effect.map(completedRequestMap.CompletedRequestMap, map => completedRequestMap.set(map, self, result)).traced(trace)); | ||
/** @internal */ | ||
@@ -49,0 +49,0 @@ exports.complete = complete; |
{ | ||
"name": "@effect/query", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -10,4 +10,4 @@ "repository": { | ||
"dependencies": { | ||
"@effect/data": "~0.5.0", | ||
"@effect/io": "~0.10.0" | ||
"@effect/data": "~0.7.4", | ||
"@effect/io": "~0.15.1" | ||
}, | ||
@@ -14,0 +14,0 @@ "publishConfig": { |
@@ -6,2 +6,3 @@ /** | ||
import type * as Context from "@effect/data/Context"; | ||
import type * as Debug from "@effect/data/Debug"; | ||
import type * as Duration from "@effect/data/Duration"; | ||
@@ -12,4 +13,3 @@ import type * as Either from "@effect/data/Either"; | ||
import type * as Cause from "@effect/io/Cause"; | ||
import type * as Debug from "@effect/io/Debug"; | ||
import * as Effect from "@effect/io/Effect"; | ||
import type * as Effect from "@effect/io/Effect"; | ||
import type * as Layer from "@effect/io/Layer"; | ||
@@ -697,30 +697,2 @@ import type * as Cache from "@effect/query/Cache"; | ||
/** | ||
* Extracts the specified service from the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export declare const service: <T>(tag: Context.Tag<T>) => Query<T, never, T>; | ||
/** | ||
* Accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export declare const serviceWith: <T extends Context.Tag<any>, A>(tag: T, f: (a: Context.Tag.Service<T>) => A) => Query<Context.Tag.Service<T>, never, A>; | ||
/** | ||
* Effectfully accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export declare const serviceWithEffect: <T extends Context.Tag<any>, R, E, A>(tag: T, f: (a: Context.Tag.Service<T>) => Effect.Effect<R, E, A>) => Query<R | Context.Tag.Service<T>, E, A>; | ||
/** | ||
* Effectfully accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export declare const serviceWithQuery: <T extends Context.Tag<any>, R, E, A>(tag: T, f: (a: Context.Tag.Service<T>) => Query<R, E, A>) => Query<R | Context.Tag.Service<T>, E, A>; | ||
/** | ||
* Extracts a `Some` value into the value channel while moving the `None` into | ||
@@ -727,0 +699,0 @@ * the error channel for easier composition |
38
Query.js
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zipBatchedRight = exports.zipBatchedLeft = exports.zipBatched = exports.zip = exports.unwrap = exports.unsandbox = exports.unright = exports.unrefineWith = exports.unrefine = exports.unoption = exports.unleft = exports.unit = exports.uncached = exports.timeoutTo = exports.timeoutFailCause = exports.timeoutFail = exports.timeout = exports.timed = exports.sync = exports.suspend = exports.summarized = exports.succeedSome = exports.succeedNone = exports.succeed = exports.someOrFail = exports.someOrElseEffect = exports.someOrElse = exports.some = exports.serviceWithQuery = exports.serviceWithEffect = exports.serviceWith = exports.service = exports.sandboxWith = exports.sandbox = exports.runLog = exports.runCache = exports.run = exports.right = exports.refineOrDieWith = exports.refineOrDie = exports.race = exports.provideSomeLayer = exports.provideLayer = exports.provideContext = exports.partitionQueryPar = exports.partitionQuery = exports.orDieWith = exports.orDie = exports.optional = exports.never = exports.maxBatchSize = exports.matchQuery = exports.matchCauseQuery = exports.match = exports.mapErrorCause = exports.mapError = exports.mapEffect = exports.mapDataSources = exports.mapBoth = exports.map = exports.left = exports.isQuery = exports.fromRequestUncached = exports.fromRequest = exports.fromOption = exports.fromEither = exports.fromEffect = exports.forEachPar = exports.forEachBatched = exports.forEach = exports.flatten = exports.flatMap = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.ensuring = exports.either = exports.dieSync = exports.die = exports.contramapContext = exports.contextWithQuery = exports.contextWithEffect = exports.contextWith = exports.context = exports.collectAllPar = exports.collectAllBatched = exports.collectAll = exports.catchAllCause = exports.catchAll = exports.cached = exports.asUnit = exports.asSomeError = exports.as = exports.around = exports.absolve = exports.QueryTypeId = void 0; | ||
exports.zipWithPar = exports.zipWithBatched = exports.zipWith = exports.zipRight = exports.zipParRight = void 0; | ||
exports.zipWithBatched = exports.zipWith = exports.zipRight = exports.zipParRight = exports.zipParLeft = exports.zipPar = exports.zipLeft = exports.zipBatchedRight = exports.zipBatchedLeft = exports.zipBatched = exports.zip = exports.unwrap = exports.unsandbox = exports.unright = exports.unrefineWith = exports.unrefine = exports.unoption = exports.unleft = exports.unit = exports.uncached = exports.timeoutTo = exports.timeoutFailCause = exports.timeoutFail = exports.timeout = exports.timed = exports.sync = exports.suspend = exports.summarized = exports.succeedSome = exports.succeedNone = exports.succeed = exports.someOrFail = exports.someOrElseEffect = exports.someOrElse = exports.some = exports.sandboxWith = exports.sandbox = exports.runLog = exports.runCache = exports.run = exports.right = exports.refineOrDieWith = exports.refineOrDie = exports.race = exports.provideSomeLayer = exports.provideLayer = exports.provideContext = exports.partitionQueryPar = exports.partitionQuery = exports.orDieWith = exports.orDie = exports.optional = exports.never = exports.maxBatchSize = exports.matchQuery = exports.matchCauseQuery = exports.match = exports.mapErrorCause = exports.mapError = exports.mapEffect = exports.mapDataSources = exports.mapBoth = exports.map = exports.left = exports.isQuery = exports.fromRequestUncached = exports.fromRequest = exports.fromOption = exports.fromEither = exports.fromEffect = exports.forEachPar = exports.forEachBatched = exports.forEach = exports.flatten = exports.flatMap = exports.failSync = exports.failCauseSync = exports.failCause = exports.fail = exports.ensuring = exports.either = exports.dieSync = exports.die = exports.contramapContext = exports.contextWithQuery = exports.contextWithEffect = exports.contextWith = exports.context = exports.collectAllPar = exports.collectAllBatched = exports.collectAll = exports.catchAllCause = exports.catchAll = exports.cached = exports.asUnit = exports.asSomeError = exports.as = exports.around = exports.absolve = exports.QueryTypeId = void 0; | ||
exports.zipWithPar = void 0; | ||
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/query/internal_effect_untraced/query")); | ||
@@ -595,34 +595,2 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
/** | ||
* Extracts the specified service from the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
exports.sandboxWith = sandboxWith; | ||
const service = internal.service; | ||
/** | ||
* Accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
exports.service = service; | ||
const serviceWith = internal.serviceWith; | ||
/** | ||
* Effectfully accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
exports.serviceWith = serviceWith; | ||
const serviceWithEffect = internal.serviceWithEffect; | ||
/** | ||
* Effectfully accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
exports.serviceWithEffect = serviceWithEffect; | ||
const serviceWithQuery = internal.serviceWithQuery; | ||
/** | ||
* Extracts a `Some` value into the value channel while moving the `None` into | ||
@@ -636,3 +604,3 @@ * the error channel for easier composition | ||
*/ | ||
exports.serviceWithQuery = serviceWithQuery; | ||
exports.sandboxWith = sandboxWith; | ||
const some = internal.some; | ||
@@ -639,0 +607,0 @@ /** |
@@ -48,4 +48,12 @@ /** | ||
/** | ||
* The context tag for a `CompletedRequestMap`. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export const CompletedRequestMap: Context.Tag<CompletedRequestMap, CompletedRequestMap> = internal.CompletedRequestMap | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare namespace CompletedRequestMap { | ||
@@ -62,10 +70,2 @@ /** | ||
/** | ||
* The context tag for a `CompletedRequestMap`. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export const Tag: Context.Tag<CompletedRequestMap> = internal.Tag | ||
/** | ||
* An empty completed requests map. | ||
@@ -72,0 +72,0 @@ * |
@@ -0,1 +1,2 @@ | ||
import * as Debug from "@effect/data/Debug" | ||
import * as Either from "@effect/data/Either" | ||
@@ -5,3 +6,2 @@ import { constVoid, pipe } from "@effect/data/Function" | ||
import * as Option from "@effect/data/Option" | ||
import * as Debug from "@effect/io/Debug" | ||
import * as Effect from "@effect/io/Effect" | ||
@@ -8,0 +8,0 @@ import * as Ref from "@effect/io/Ref" |
@@ -8,3 +8,3 @@ import * as Context from "@effect/data/Context" | ||
import * as Option from "@effect/data/Option" | ||
import type * as CompletedRequestMap from "@effect/query/CompletedRequestMap" | ||
import type * as CRM from "@effect/query/CompletedRequestMap" | ||
import type * as Request from "@effect/query/Request" | ||
@@ -16,9 +16,9 @@ | ||
/** @internal */ | ||
export const CompletedRequestMapTypeId: CompletedRequestMap.CompletedRequestMapTypeId = Symbol.for( | ||
export const CompletedRequestMapTypeId: CRM.CompletedRequestMapTypeId = Symbol.for( | ||
CompletedRequestMapSymbolKey | ||
) as CompletedRequestMap.CompletedRequestMapTypeId | ||
) as CRM.CompletedRequestMapTypeId | ||
/** @internal */ | ||
class CompletedRequestMapImpl implements CompletedRequestMap.CompletedRequestMap { | ||
readonly [CompletedRequestMapTypeId]: CompletedRequestMap.CompletedRequestMapTypeId = CompletedRequestMapTypeId | ||
class CompletedRequestMapImpl implements CRM.CompletedRequestMap { | ||
readonly [CompletedRequestMapTypeId]: CRM.CompletedRequestMapTypeId = CompletedRequestMapTypeId | ||
constructor( | ||
@@ -35,7 +35,6 @@ readonly map: MutableRef.MutableRef< | ||
/** @internal */ | ||
export const Tag: Context.Tag<CompletedRequestMap.CompletedRequestMap> = Context.Tag() | ||
export const CompletedRequestMap: Context.Tag<CRM.CompletedRequestMap, CRM.CompletedRequestMap> = Context.Tag() | ||
/** @internal */ | ||
export const empty = (): CompletedRequestMap.CompletedRequestMap => | ||
new CompletedRequestMapImpl(MutableRef.make(HashMap.empty())) | ||
export const empty = (): CRM.CompletedRequestMap => new CompletedRequestMapImpl(MutableRef.make(HashMap.empty())) | ||
@@ -46,4 +45,3 @@ /** @internal */ | ||
result: Either.Either<E, A> | ||
): CompletedRequestMap.CompletedRequestMap => | ||
new CompletedRequestMapImpl(MutableRef.make(HashMap.make([request, result]))) | ||
): CRM.CompletedRequestMap => new CompletedRequestMapImpl(MutableRef.make(HashMap.make([request, result]))) | ||
@@ -53,10 +51,10 @@ /** @internal */ | ||
( | ||
that: CompletedRequestMap.CompletedRequestMap | ||
that: CRM.CompletedRequestMap | ||
) => ( | ||
self: CompletedRequestMap.CompletedRequestMap | ||
) => CompletedRequestMap.CompletedRequestMap, | ||
self: CRM.CompletedRequestMap | ||
) => CRM.CompletedRequestMap, | ||
( | ||
self: CompletedRequestMap.CompletedRequestMap, | ||
that: CompletedRequestMap.CompletedRequestMap | ||
) => CompletedRequestMap.CompletedRequestMap | ||
self: CRM.CompletedRequestMap, | ||
that: CRM.CompletedRequestMap | ||
) => CRM.CompletedRequestMap | ||
>(2, (self, that) => { | ||
@@ -73,10 +71,10 @@ const selfMap = MutableRef.get(self.map) | ||
) => ( | ||
self: CompletedRequestMap.CompletedRequestMap | ||
self: CRM.CompletedRequestMap | ||
) => Option.Option<Request.Request.Result<A>>, | ||
<A extends Request.Request<any, any>>( | ||
self: CompletedRequestMap.CompletedRequestMap, | ||
self: CRM.CompletedRequestMap, | ||
request: A | ||
) => Option.Option<Request.Request.Result<A>> | ||
>(2, <A extends Request.Request<any, any>>( | ||
self: CompletedRequestMap.CompletedRequestMap, | ||
self: CRM.CompletedRequestMap, | ||
request: A | ||
@@ -87,4 +85,4 @@ ) => HashMap.get(MutableRef.get(self.map), request) as any) | ||
export const has = dual< | ||
<A extends Request.Request<any, any>>(request: A) => (self: CompletedRequestMap.CompletedRequestMap) => boolean, | ||
<A extends Request.Request<any, any>>(self: CompletedRequestMap.CompletedRequestMap, request: A) => boolean | ||
<A extends Request.Request<any, any>>(request: A) => (self: CRM.CompletedRequestMap) => boolean, | ||
<A extends Request.Request<any, any>>(self: CRM.CompletedRequestMap, request: A) => boolean | ||
>(2, (self, request) => HashMap.has(MutableRef.get(self.map), request)) | ||
@@ -94,3 +92,3 @@ | ||
export const requests = ( | ||
self: CompletedRequestMap.CompletedRequestMap | ||
self: CRM.CompletedRequestMap | ||
): HashSet.HashSet<Request.Request<unknown, unknown>> => HashMap.keySet(MutableRef.get(self.map)) | ||
@@ -103,5 +101,5 @@ | ||
result: Request.Request.Result<A> | ||
) => (self: CompletedRequestMap.CompletedRequestMap) => void, | ||
) => (self: CRM.CompletedRequestMap) => void, | ||
<A extends Request.Request<any, any>>( | ||
self: CompletedRequestMap.CompletedRequestMap, | ||
self: CRM.CompletedRequestMap, | ||
request: A, | ||
@@ -130,5 +128,5 @@ result: Request.Request.Result<A> | ||
result: Request.Request.OptionalResult<A> | ||
) => (self: CompletedRequestMap.CompletedRequestMap) => void, | ||
) => (self: CRM.CompletedRequestMap) => void, | ||
<A extends Request.Request<any, any>>( | ||
self: CompletedRequestMap.CompletedRequestMap, | ||
self: CRM.CompletedRequestMap, | ||
request: A, | ||
@@ -135,0 +133,0 @@ result: Request.Request.OptionalResult<A> |
import * as Chunk from "@effect/data/Chunk" | ||
import type * as Context from "@effect/data/Context" | ||
import * as Debug from "@effect/data/Debug" | ||
import * as Either from "@effect/data/Either" | ||
@@ -9,3 +10,2 @@ import * as Equal from "@effect/data/Equal" | ||
import * as Cause from "@effect/io/Cause" | ||
import * as Debug from "@effect/io/Debug" | ||
import * as Effect from "@effect/io/Effect" | ||
@@ -61,3 +61,6 @@ import type * as CompletedRequestMap from "@effect/query/CompletedRequestMap" | ||
const map = completedRequestMap.empty() | ||
return Effect.as(Effect.provideService(completedRequestMap.Tag, map)(restore(runAll)(requests)), map) | ||
return Effect.as( | ||
Effect.provideService(completedRequestMap.CompletedRequestMap, map)(restore(runAll)(requests)), | ||
map | ||
) | ||
})) | ||
@@ -82,3 +85,3 @@ ) | ||
restore(run)(newRequests), | ||
Effect.provideService(completedRequestMap.Tag, innerMap), | ||
Effect.provideService(completedRequestMap.CompletedRequestMap, innerMap), | ||
Effect.map(() => completedRequestMap.combine(outerMap, innerMap)) | ||
@@ -260,3 +263,3 @@ ) | ||
makeBatched(name, (requests) => | ||
Effect.serviceWith(completedRequestMap.Tag, (map) => | ||
Effect.map(completedRequestMap.CompletedRequestMap, (map) => | ||
pipe( | ||
@@ -290,3 +293,3 @@ requests, | ||
makeBatched(name, (requests) => | ||
Effect.serviceWith(completedRequestMap.Tag, (map) => | ||
Effect.flatMap(completedRequestMap.CompletedRequestMap, (map) => | ||
pipe( | ||
@@ -325,3 +328,3 @@ Effect.match( | ||
(requests) => | ||
Effect.serviceWithEffect(completedRequestMap.Tag, (map) => | ||
Effect.flatMap(completedRequestMap.CompletedRequestMap, (map) => | ||
Effect.map( | ||
@@ -370,3 +373,3 @@ Effect.match( | ||
makeBatched(name, (requests) => | ||
Effect.serviceWithEffect(completedRequestMap.Tag, (map) => | ||
Effect.flatMap(completedRequestMap.CompletedRequestMap, (map) => | ||
Effect.map( | ||
@@ -399,3 +402,3 @@ Effect.match( | ||
makeBatched(name, (requests) => | ||
Effect.serviceWithEffect(completedRequestMap.Tag, (map) => | ||
Effect.flatMap(completedRequestMap.CompletedRequestMap, (map) => | ||
Effect.map( | ||
@@ -426,3 +429,3 @@ Effect.forEachPar(requests, (a) => | ||
makeBatched(name, (requests) => | ||
Effect.serviceWithEffect(completedRequestMap.Tag, (map) => | ||
Effect.flatMap(completedRequestMap.CompletedRequestMap, (map) => | ||
Effect.map( | ||
@@ -429,0 +432,0 @@ Effect.forEachPar( |
import * as Data from "@effect/data/Data" | ||
import * as Debug from "@effect/data/Debug" | ||
import * as Either from "@effect/data/Either" | ||
import * as Debug from "@effect/io/Debug" | ||
import * as Effect from "@effect/io/Effect" | ||
@@ -59,4 +59,4 @@ import type * as CompletedRequestMap from "@effect/query/CompletedRequestMap" | ||
(self, result) => | ||
Effect.serviceWith( | ||
completedRequestMap.Tag, | ||
Effect.map( | ||
completedRequestMap.CompletedRequestMap, | ||
(map) => completedRequestMap.set(map, self, result) | ||
@@ -63,0 +63,0 @@ ).traced(trace)) |
@@ -6,2 +6,3 @@ /** | ||
import type * as Context from "@effect/data/Context" | ||
import type * as Debug from "@effect/data/Debug" | ||
import type * as Duration from "@effect/data/Duration" | ||
@@ -12,4 +13,3 @@ import type * as Either from "@effect/data/Either" | ||
import type * as Cause from "@effect/io/Cause" | ||
import type * as Debug from "@effect/io/Debug" | ||
import * as Effect from "@effect/io/Effect" | ||
import type * as Effect from "@effect/io/Effect" | ||
import type * as Layer from "@effect/io/Layer" | ||
@@ -466,3 +466,2 @@ import type * as Cache from "@effect/query/Cache" | ||
/** | ||
@@ -848,43 +847,2 @@ * This function returns `true` if the specified value is an `Query` value, | ||
/** | ||
* Extracts the specified service from the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export const service: <T>(tag: Context.Tag<T>) => Query<T, never, T> = internal.service | ||
/** | ||
* Accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export const serviceWith: <T extends Context.Tag<any>, A>( | ||
tag: T, | ||
f: (a: Context.Tag.Service<T>) => A | ||
) => Query<Context.Tag.Service<T>, never, A> = internal.serviceWith | ||
/** | ||
* Effectfully accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export const serviceWithEffect: <T extends Context.Tag<any>, R, E, A>( | ||
tag: T, | ||
f: (a: Context.Tag.Service<T>) => Effect.Effect<R, E, A> | ||
) => Query<R | Context.Tag.Service<T>, E, A> = internal.serviceWithEffect | ||
/** | ||
* Effectfully accesses the specified service in the context of the query. | ||
* | ||
* @since 1.0.0 | ||
* @category context | ||
*/ | ||
export const serviceWithQuery: <T extends Context.Tag<any>, R, E, A>( | ||
tag: T, | ||
f: (a: Context.Tag.Service<T>) => Query<R, E, A> | ||
) => Query<R | Context.Tag.Service<T>, E, A> = internal.serviceWithQuery | ||
/** | ||
* Extracts a `Some` value into the value channel while moving the `None` into | ||
@@ -891,0 +849,0 @@ * the error channel for easier composition |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
821585
14056
+ Added@effect/data@0.7.4(transitive)
+ Added@effect/io@0.15.3(transitive)
- Removed@effect/data@0.5.1(transitive)
- Removed@effect/io@0.10.0(transitive)
Updated@effect/data@~0.7.4
Updated@effect/io@~0.15.1