@effect-app/infra 4.0.0-beta.230 → 4.0.0-beta.232
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/CHANGELOG.md +18 -0
- package/dist/MainFiberSet.d.ts +1 -1
- package/dist/MainFiberSet.d.ts.map +1 -1
- package/dist/MainFiberSet.js +4 -4
- package/dist/Model/Repository/validation.d.ts +2 -2
- package/dist/RequestContext.d.ts +8 -8
- package/dist/RequestFiberSet.d.ts +1 -1
- package/dist/RequestFiberSet.d.ts.map +1 -1
- package/dist/RequestFiberSet.js +5 -5
- package/dist/Store/ContextMapContainer.js +2 -2
- package/dist/Store/Cosmos.js +2 -2
- package/dist/Store/Disk.js +2 -2
- package/dist/Store/Memory.js +2 -2
- package/dist/Store/SQL/Pg.js +2 -2
- package/dist/Store/SQL.js +4 -4
- package/dist/adapters/SQL/Model.d.ts +7 -7
- package/dist/adapters/cosmos-client.d.ts +1 -1
- package/dist/adapters/cosmos-client.d.ts.map +1 -1
- package/dist/adapters/cosmos-client.js +2 -2
- package/dist/api/ContextProvider.d.ts +3 -4
- package/dist/api/ContextProvider.d.ts.map +1 -1
- package/dist/api/ContextProvider.js +1 -1
- package/dist/api/layerUtils.d.ts +6 -2
- package/dist/api/layerUtils.d.ts.map +1 -1
- package/dist/api/routing.d.ts +11 -12
- package/dist/api/routing.d.ts.map +1 -1
- package/dist/api/routing.js +1 -1
- package/dist/api/setupRequest.js +5 -5
- package/package.json +5 -5
- package/src/MainFiberSet.ts +3 -4
- package/src/RequestFiberSet.ts +4 -5
- package/src/Store/ContextMapContainer.ts +1 -1
- package/src/Store/Cosmos.ts +1 -1
- package/src/Store/Disk.ts +1 -1
- package/src/Store/Memory.ts +1 -1
- package/src/Store/SQL/Pg.ts +1 -1
- package/src/Store/SQL.ts +3 -3
- package/src/adapters/cosmos-client.ts +1 -1
- package/src/api/ContextProvider.ts +2 -3
- package/src/api/layerUtils.ts +1 -1
- package/src/api/routing.ts +12 -15
- package/src/api/setupRequest.ts +4 -4
- package/test/dist/fixtures.d.ts +1 -1
package/src/api/routing.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { type GetEffectContext, type GetEffectError, type RpcContextMap } from "
|
|
|
13
13
|
import * as S from "effect-app/Schema"
|
|
14
14
|
import { type TypeTestId } from "effect-app/TypeTest"
|
|
15
15
|
import { typedKeysOf, typedValuesOf } from "effect-app/utils"
|
|
16
|
-
import { type Yieldable } from "effect/Effect"
|
|
17
16
|
import * as Predicate from "effect/Predicate"
|
|
18
17
|
import * as Ref from "effect/Ref"
|
|
19
18
|
import type * as Scope from "effect/Scope"
|
|
@@ -269,8 +268,7 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
269
268
|
> = (
|
|
270
269
|
req: S.Schema.Type<Action>
|
|
271
270
|
) => Generator<
|
|
272
|
-
|
|
273
|
-
any,
|
|
271
|
+
Effect.Effect<
|
|
274
272
|
any,
|
|
275
273
|
S.Schema.Type<GetFailure<Action>> | S.SchemaError,
|
|
276
274
|
// the actual implementation of the handler may just require the dynamic context provided by the middleware
|
|
@@ -384,13 +382,13 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
384
382
|
? Impl[K]["raw"] extends (...args: any[]) => Effect.Effect<any, any, infer R> ? R
|
|
385
383
|
: Impl[K]["raw"] extends (...args: any[]) => Stream.Stream<any, any, infer R> ? R
|
|
386
384
|
: Impl[K]["raw"] extends (...args: any[]) => Generator<
|
|
387
|
-
|
|
385
|
+
Effect.Effect<any, any, infer R>
|
|
388
386
|
> ? R
|
|
389
387
|
: never
|
|
390
388
|
: Impl[K] extends (...args: any[]) => Effect.Effect<any, any, infer R> ? R
|
|
391
389
|
: Impl[K] extends (...args: any[]) => Stream.Stream<any, any, infer R> ? R
|
|
392
390
|
: Impl[K] extends (...args: any[]) => Generator<
|
|
393
|
-
|
|
391
|
+
Effect.Effect<any, any, infer R>
|
|
394
392
|
> ? R
|
|
395
393
|
: never,
|
|
396
394
|
| SafeGetEffectContext<ResourceRequestContextMap, Resource[K]["config"]>
|
|
@@ -419,7 +417,7 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
419
417
|
match: any
|
|
420
418
|
) =>
|
|
421
419
|
| Effect.Effect<THandlers, MakeE, MakeR>
|
|
422
|
-
| Generator<
|
|
420
|
+
| Generator<Effect.Effect<any, MakeE, MakeR>, THandlers>
|
|
423
421
|
) => {
|
|
424
422
|
const dependenciesL = (dependencies ? Layer.mergeAll(...dependencies as any) : Layer.empty) as Layer.Layer<
|
|
425
423
|
LayerUtils.GetLayersSuccess<MakeDependencies>,
|
|
@@ -648,8 +646,7 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
648
646
|
const Make extends {
|
|
649
647
|
dependencies?: ReadonlyArray<Layer.Any>
|
|
650
648
|
effect: (match: typeof router3) => Generator<
|
|
651
|
-
|
|
652
|
-
any,
|
|
649
|
+
Effect.Effect<
|
|
653
650
|
any,
|
|
654
651
|
any,
|
|
655
652
|
any
|
|
@@ -684,7 +681,7 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
684
681
|
dependencies?: ReadonlyArray<Layer.Any>
|
|
685
682
|
// v4: generators yield Yieldable with asEffect()
|
|
686
683
|
effect: (match: typeof router3) => Generator<
|
|
687
|
-
|
|
684
|
+
Effect.Effect<any, any, any>,
|
|
688
685
|
{ [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> }
|
|
689
686
|
>
|
|
690
687
|
}
|
|
@@ -744,17 +741,17 @@ export type MakeDeps<Make> = Make extends { readonly dependencies: ReadonlyArray
|
|
|
744
741
|
export type MakeErrors<Make> = /*Make extends { readonly effect: (_: any) => Effect.Effect<any, infer E, any> } ? E
|
|
745
742
|
: Make extends { readonly effect: (_: any) => Effect.Effect<any, never, any> } ? never
|
|
746
743
|
: */
|
|
747
|
-
// v4: generators yield
|
|
748
|
-
Make extends { readonly effect: (_: any) => Generator<
|
|
749
|
-
: Make extends { readonly effect: (_: any) => Generator<
|
|
744
|
+
// v4: generators yield Effect values
|
|
745
|
+
Make extends { readonly effect: (_: any) => Generator<Effect.Effect<any, never, any>, any> } ? never
|
|
746
|
+
: Make extends { readonly effect: (_: any) => Generator<Effect.Effect<any, infer E, any>, any> } ? E
|
|
750
747
|
: never
|
|
751
748
|
|
|
752
749
|
export type MakeContext<Make> = /*Make extends { readonly effect: (_: any) => Effect.Effect<any, any, infer R> } ? R
|
|
753
750
|
: Make extends { readonly effect: (_: any) => Effect.Effect<any, any, never> } ? never
|
|
754
751
|
: */
|
|
755
|
-
// v4: generators yield
|
|
756
|
-
Make extends { readonly effect: (_: any) => Generator<
|
|
757
|
-
: Make extends { readonly effect: (_: any) => Generator<
|
|
752
|
+
// v4: generators yield Effect values
|
|
753
|
+
Make extends { readonly effect: (_: any) => Generator<Effect.Effect<any, any, never>, any> } ? never
|
|
754
|
+
: Make extends { readonly effect: (_: any) => Generator<Effect.Effect<any, any, infer R>, any> } ? R
|
|
758
755
|
: never
|
|
759
756
|
|
|
760
757
|
export type MakeHandlers<Make, _Handlers extends Record<string, any>> = /*Make extends
|
package/src/api/setupRequest.ts
CHANGED
|
@@ -19,8 +19,8 @@ const withSqlTransaction = <R, E, A>(self: Effect.Effect<A, E, R>): Effect.Effec
|
|
|
19
19
|
export const getRequestContext = Effect
|
|
20
20
|
.all({
|
|
21
21
|
span: Effect.currentSpan.pipe(Effect.orDie),
|
|
22
|
-
locale: LocaleRef
|
|
23
|
-
namespace: storeId
|
|
22
|
+
locale: LocaleRef,
|
|
23
|
+
namespace: storeId
|
|
24
24
|
})
|
|
25
25
|
.pipe(
|
|
26
26
|
Effect.map(({ locale, namespace, span }) =>
|
|
@@ -34,8 +34,8 @@ export const getRequestContext = Effect
|
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
export const getRC = Effect.all({
|
|
37
|
-
locale: LocaleRef
|
|
38
|
-
namespace: storeId
|
|
37
|
+
locale: LocaleRef,
|
|
38
|
+
namespace: storeId
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
const withRequestSpan = (name = "request", options?: Tracer.SpanOptions) => <R, E, A>(f: Effect.Effect<A, E, R>) =>
|
package/test/dist/fixtures.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare const UserProfile_base: S.EnhancedClass<UserProfile, import("effect/Sche
|
|
|
9
9
|
id: S.String;
|
|
10
10
|
roles: S.$Array<S.String> & {
|
|
11
11
|
withConstructorDefault: S.withConstructorDefault<S.$Array<S.String>>;
|
|
12
|
-
withDecodingDefaultType: S.withDecodingDefaultType<S.$Array<S.String
|
|
12
|
+
withDecodingDefaultType: S.withDecodingDefaultType<S.$Array<S.String>, never>;
|
|
13
13
|
};
|
|
14
14
|
}>, {}> & Context.Opaque<UserProfile, UserProfile>;
|
|
15
15
|
export declare class UserProfile extends UserProfile_base {
|