@effect-app/infra 2.92.2 → 2.93.0
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 +17 -0
- package/dist/MainFiberSet.d.ts +1 -1
- package/dist/Model/Repository/internal/internal.d.ts.map +1 -1
- package/dist/Model/Repository/internal/internal.js +38 -37
- package/dist/Operations.d.ts +1 -1
- package/dist/QueueMaker/sbqueue.d.ts +5 -6
- package/dist/QueueMaker/sbqueue.d.ts.map +1 -1
- package/dist/QueueMaker/sbqueue.js +18 -22
- package/dist/RequestFiberSet.d.ts +1 -1
- package/dist/Store/service.d.ts +1 -1
- package/dist/adapters/ServiceBus.d.ts +57 -17
- package/dist/adapters/ServiceBus.d.ts.map +1 -1
- package/dist/adapters/ServiceBus.js +75 -61
- package/dist/adapters/memQueue.d.ts +1 -1
- package/dist/api/routing/middleware/middleware-api.d.ts +2 -1
- package/dist/api/routing/middleware/middleware-api.d.ts.map +1 -1
- package/dist/api/routing/middleware/middleware-api.js +1 -1
- package/dist/api/routing/middleware.d.ts +0 -1
- package/dist/api/routing/middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware.js +1 -2
- package/dist/api/routing.d.ts +8 -9
- package/dist/api/routing.d.ts.map +1 -1
- package/dist/api/routing.js +18 -10
- package/package.json +2 -6
- package/src/Model/Repository/internal/internal.ts +45 -41
- package/src/QueueMaker/sbqueue.ts +33 -46
- package/src/adapters/ServiceBus.ts +141 -93
- package/src/api/routing/middleware/middleware-api.ts +2 -1
- package/src/api/routing/middleware.ts +0 -1
- package/src/api/routing.ts +46 -233
- package/test/controller.test.ts +12 -8
- package/test/dist/controller.test.d.ts.map +1 -1
- package/test/dist/fixtures.d.ts +3 -3
- package/dist/api/routing/middleware/dynamic-middleware.d.ts +0 -2
- package/dist/api/routing/middleware/dynamic-middleware.d.ts.map +0 -1
- package/dist/api/routing/middleware/dynamic-middleware.js +0 -2
- package/src/api/routing/middleware/dynamic-middleware.ts +0 -0
package/src/api/routing.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
import { Rpc, RpcGroup, RpcServer } from "@effect/rpc"
|
|
5
|
+
import { Rpc, RpcGroup, type RpcSerialization, RpcServer } from "@effect/rpc"
|
|
6
6
|
import { type Array, Effect, Layer, type NonEmptyReadonlyArray, Predicate, S, Schema, type Scope } from "effect-app"
|
|
7
7
|
import type { GetEffectContext, GetEffectError, RPCContextMap } from "effect-app/client/req"
|
|
8
8
|
import { type HttpHeaders, HttpRouter } from "effect-app/http"
|
|
@@ -15,6 +15,14 @@ import { DevMode, type RouterMiddleware } from "./routing/middleware.js"
|
|
|
15
15
|
|
|
16
16
|
export * from "./routing/middleware.js"
|
|
17
17
|
|
|
18
|
+
// Nice way to underline types that are only there for type testing, not for production use
|
|
19
|
+
// sadly with unique symbols we get weird issues in app projects.
|
|
20
|
+
// api/src/X/PackList.Controllers.ts:21:1 - error TS4082: Default export of the module has or is using private name 'TypeTestId'
|
|
21
|
+
// export const TypeTestId: unique symbol = Symbol.for("@effect/infra/type-test")
|
|
22
|
+
// export type TypeTestId = typeof TypeTestId
|
|
23
|
+
export const TypeTestId = "@effect-app/infra/type-test" as const
|
|
24
|
+
export type TypeTestId = typeof TypeTestId
|
|
25
|
+
|
|
18
26
|
// it's the result of extending S.Req setting success, config
|
|
19
27
|
// it's a schema plus some metadata
|
|
20
28
|
export type AnyRequestModule = S.Schema.Any & {
|
|
@@ -91,11 +99,6 @@ type FilterRequestModules<T> = {
|
|
|
91
99
|
[K in keyof T as T[K] extends AnyRequestModule ? K : never]: T[K]
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
export const RouterSymbol = Symbol()
|
|
95
|
-
export interface RouterShape<Resource> {
|
|
96
|
-
[RouterSymbol]: Resource
|
|
97
|
-
}
|
|
98
|
-
|
|
99
102
|
type RPCRouteR<
|
|
100
103
|
T extends [any, (req: any, headers: HttpHeaders.Headers) => Effect<any, any, any>]
|
|
101
104
|
> = T extends [
|
|
@@ -352,7 +355,12 @@ export const makeRouter = <
|
|
|
352
355
|
match: any
|
|
353
356
|
) => Effect<THandlers, MakeE, MakeR> | Generator<YieldWrap<Effect<any, MakeE, MakeR>>, THandlers, any>
|
|
354
357
|
) => {
|
|
355
|
-
|
|
358
|
+
const dependenciesL = Layer.mergeAll(...dependencies as any) as Layer.Layer<
|
|
359
|
+
LayerUtils.GetLayersSuccess<MakeDependencies>,
|
|
360
|
+
LayerUtils.GetLayersError<MakeDependencies>,
|
|
361
|
+
LayerUtils.GetLayersContext<MakeDependencies>
|
|
362
|
+
>
|
|
363
|
+
|
|
356
364
|
const layer = Effect
|
|
357
365
|
.gen(function*() {
|
|
358
366
|
const finalMake = ((make as any)[Symbol.toStringTag] === "GeneratorFunction"
|
|
@@ -410,28 +418,29 @@ export const makeRouter = <
|
|
|
410
418
|
const rpcs = RpcGroup
|
|
411
419
|
.make(
|
|
412
420
|
...typedValuesOf(mapped).map(([resource]) => {
|
|
413
|
-
return Rpc
|
|
421
|
+
return Rpc
|
|
422
|
+
.fromTaggedRequest(resource)
|
|
423
|
+
.annotate(middleware.requestContext, resource.config ?? {})
|
|
414
424
|
})
|
|
415
425
|
)
|
|
416
426
|
.prefix(`${meta.moduleName}.`)
|
|
417
427
|
.middleware(middleware as any)
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
return acc
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
>
|
|
428
|
+
|
|
429
|
+
const rpc = rpcs
|
|
430
|
+
.toLayer(Effect.gen(function*() {
|
|
431
|
+
return typedValuesOf(mapped).reduce((acc, [resource, handler]) => {
|
|
432
|
+
acc[`${meta.moduleName}.${resource._tag}`] = handler
|
|
433
|
+
return acc
|
|
434
|
+
}, {} as Record<string, any>) as any // TODO
|
|
435
|
+
})) as unknown as Layer<
|
|
436
|
+
{ [K in keyof RequestModules]: Rpc.Handler<K> },
|
|
437
|
+
MakeE,
|
|
438
|
+
RPCRouteR<typeof mapped[keyof typeof mapped]>
|
|
439
|
+
>
|
|
431
440
|
|
|
432
441
|
return RpcServer
|
|
433
442
|
.layer(rpcs, { spanPrefix: "RpcServer." + meta.moduleName })
|
|
434
|
-
.pipe(Layer.provide(
|
|
443
|
+
.pipe(Layer.provide(rpc))
|
|
435
444
|
.pipe(
|
|
436
445
|
Layer.provideMerge(
|
|
437
446
|
RpcServer.layerProtocolHttp(
|
|
@@ -442,24 +451,13 @@ export const makeRouter = <
|
|
|
442
451
|
})
|
|
443
452
|
.pipe(Layer.unwrapEffect)
|
|
444
453
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
Layer.provide(Layer.succeed(DevMode, devMode))
|
|
453
|
-
)
|
|
454
|
-
) as (Layer.Layer<
|
|
455
|
-
Router,
|
|
456
|
-
| LayerUtils.GetLayersError<MakeDependencies>
|
|
457
|
-
| MakeE
|
|
458
|
-
| Layer.Error<typeof middleware.Default>,
|
|
459
|
-
| LayerUtils.GetLayersContext<MakeDependencies>
|
|
460
|
-
| Layer.Context<typeof middleware.Default>
|
|
461
|
-
| Exclude<MakeR, LayerUtils.GetLayersSuccess<MakeDependencies>>
|
|
462
|
-
>)
|
|
454
|
+
const routes = layer.pipe(
|
|
455
|
+
Layer.provide([
|
|
456
|
+
dependenciesL,
|
|
457
|
+
middleware.Default
|
|
458
|
+
]),
|
|
459
|
+
Layer.provide(Layer.succeed(DevMode, devMode))
|
|
460
|
+
)
|
|
463
461
|
|
|
464
462
|
// Effect.Effect<HttpRouter.HttpRouter<unknown, HttpRouter.HttpRouter.DefaultServices>, never, UserRouter>
|
|
465
463
|
|
|
@@ -494,7 +492,7 @@ export const makeRouter = <
|
|
|
494
492
|
moduleName: ModuleName
|
|
495
493
|
|
|
496
494
|
routes: Layer.Layer<
|
|
497
|
-
|
|
495
|
+
never,
|
|
498
496
|
| MakeErrors<Make>
|
|
499
497
|
| Service.MakeDepsE<Make>
|
|
500
498
|
| Layer.Error<typeof middleware.Default>,
|
|
@@ -504,169 +502,12 @@ export const makeRouter = <
|
|
|
504
502
|
MakeContext<Make>,
|
|
505
503
|
MakeDepsOut<Make>
|
|
506
504
|
>
|
|
505
|
+
| RpcSerialization.RpcSerialization
|
|
507
506
|
>
|
|
508
507
|
|
|
509
508
|
// just for type testing purposes
|
|
510
|
-
|
|
509
|
+
[TypeTestId]: Make
|
|
511
510
|
}
|
|
512
|
-
// <
|
|
513
|
-
// const Make extends {
|
|
514
|
-
// dependencies?: Array<Layer.Layer.Any>
|
|
515
|
-
// effect: (match: typeof router3) => Effect<
|
|
516
|
-
// { [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> },
|
|
517
|
-
// any,
|
|
518
|
-
// any
|
|
519
|
-
// >
|
|
520
|
-
// /** @deprecated */
|
|
521
|
-
// readonly ಠ_ಠ: never
|
|
522
|
-
// }
|
|
523
|
-
// >(
|
|
524
|
-
// make: Make
|
|
525
|
-
// ): {
|
|
526
|
-
// moduleName: ModuleName
|
|
527
|
-
|
|
528
|
-
// routes: Layer.Layer<
|
|
529
|
-
// RouterShape<Resource>,
|
|
530
|
-
// | MakeErrors<Make>
|
|
531
|
-
// | Service.MakeDepsE<Make>
|
|
532
|
-
// | Layer.Error<typeof middleware.Default>,
|
|
533
|
-
// | Service.MakeDepsIn<Make>
|
|
534
|
-
// | Layer.Context<typeof middleware.Default>
|
|
535
|
-
// | Exclude<
|
|
536
|
-
// MakeContext<Make>,
|
|
537
|
-
// MakeDepsOut<Make>
|
|
538
|
-
// >
|
|
539
|
-
// >
|
|
540
|
-
|
|
541
|
-
// // just for type testing purposes
|
|
542
|
-
// make: Make
|
|
543
|
-
// }
|
|
544
|
-
// <
|
|
545
|
-
// const Make extends {
|
|
546
|
-
// dependencies?: Array<Layer.Layer.Any>
|
|
547
|
-
// effect: (match: typeof router3) => Effect<
|
|
548
|
-
// { [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> },
|
|
549
|
-
// any,
|
|
550
|
-
// any
|
|
551
|
-
// >
|
|
552
|
-
// /** @deprecated */
|
|
553
|
-
// readonly ಠ_ಠ: never
|
|
554
|
-
// }
|
|
555
|
-
// >(
|
|
556
|
-
// make: Make
|
|
557
|
-
// ): {
|
|
558
|
-
// moduleName: ModuleName
|
|
559
|
-
|
|
560
|
-
// routes: Layer.Layer<
|
|
561
|
-
// RouterShape<Resource>,
|
|
562
|
-
// | MakeErrors<Make>
|
|
563
|
-
// | Service.MakeDepsE<Make>
|
|
564
|
-
// | Layer.Error<typeof middleware.Default>,
|
|
565
|
-
// | Service.MakeDepsIn<Make>
|
|
566
|
-
// | Layer.Context<typeof middleware.Default>
|
|
567
|
-
// | Exclude<
|
|
568
|
-
// MakeContext<Make>,
|
|
569
|
-
// MakeDepsOut<Make>
|
|
570
|
-
// >
|
|
571
|
-
// >
|
|
572
|
-
|
|
573
|
-
// // just for type testing purposes
|
|
574
|
-
// make: Make
|
|
575
|
-
// }
|
|
576
|
-
// <
|
|
577
|
-
// const Make extends {
|
|
578
|
-
// dependencies?: Array<Layer.Layer.Any>
|
|
579
|
-
// effect: (match: typeof router3) => Effect<
|
|
580
|
-
// { [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> },
|
|
581
|
-
// any,
|
|
582
|
-
// any
|
|
583
|
-
// >
|
|
584
|
-
// /** @deprecated */
|
|
585
|
-
// readonly ಠ_ಠ: never
|
|
586
|
-
// }
|
|
587
|
-
// >(
|
|
588
|
-
// make: Make
|
|
589
|
-
// ): {
|
|
590
|
-
// moduleName: ModuleName
|
|
591
|
-
|
|
592
|
-
// routes: Layer.Layer<
|
|
593
|
-
// RouterShape<Resource>,
|
|
594
|
-
// | MakeErrors<Make>
|
|
595
|
-
// | Service.MakeDepsE<Make>
|
|
596
|
-
// | Layer.Error<typeof middleware.Default>,
|
|
597
|
-
// | Service.MakeDepsIn<Make>
|
|
598
|
-
// | Layer.Context<typeof middleware.Default>
|
|
599
|
-
// | Exclude<
|
|
600
|
-
// MakeContext<Make>,
|
|
601
|
-
// MakeDepsOut<Make>
|
|
602
|
-
// >
|
|
603
|
-
// >
|
|
604
|
-
|
|
605
|
-
// // just for type testing purposes
|
|
606
|
-
// make: Make
|
|
607
|
-
// }
|
|
608
|
-
// <
|
|
609
|
-
// const Make extends {
|
|
610
|
-
// dependencies?: Array<Layer.Layer.Any>
|
|
611
|
-
// effect: (match: typeof router3) => Effect<
|
|
612
|
-
// { [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> },
|
|
613
|
-
// any,
|
|
614
|
-
// any
|
|
615
|
-
// >
|
|
616
|
-
// /** @deprecated */
|
|
617
|
-
// readonly ಠ_ಠ: never
|
|
618
|
-
// }
|
|
619
|
-
// >(
|
|
620
|
-
// make: Make
|
|
621
|
-
// ): {
|
|
622
|
-
// moduleName: ModuleName
|
|
623
|
-
|
|
624
|
-
// routes: Layer.Layer<
|
|
625
|
-
// RouterShape<Resource>,
|
|
626
|
-
// | MakeErrors<Make>
|
|
627
|
-
// | Service.MakeDepsE<Make>
|
|
628
|
-
// | Layer.Error<typeof middleware.Default>,
|
|
629
|
-
// | Service.MakeDepsIn<Make>
|
|
630
|
-
// | Layer.Context<typeof middleware.Default>
|
|
631
|
-
// | Exclude<
|
|
632
|
-
// MakeContext<Make>,
|
|
633
|
-
// MakeDepsOut<Make>
|
|
634
|
-
// >
|
|
635
|
-
// >
|
|
636
|
-
|
|
637
|
-
// // just for type testing purposes
|
|
638
|
-
// make: Make
|
|
639
|
-
// }
|
|
640
|
-
// <
|
|
641
|
-
// const Make extends {
|
|
642
|
-
// dependencies?: Array<Layer.Layer.Any>
|
|
643
|
-
// effect: (match: typeof router3) => Effect<
|
|
644
|
-
// { [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> },
|
|
645
|
-
// any,
|
|
646
|
-
// any
|
|
647
|
-
// >
|
|
648
|
-
// }
|
|
649
|
-
// >(
|
|
650
|
-
// make: Make
|
|
651
|
-
// ): {
|
|
652
|
-
// moduleName: ModuleName
|
|
653
|
-
|
|
654
|
-
// routes: Layer.Layer<
|
|
655
|
-
// RouterShape<Resource>,
|
|
656
|
-
// | MakeErrors<Make>
|
|
657
|
-
// | Service.MakeDepsE<Make>
|
|
658
|
-
// | Layer.Error<typeof middleware.Default>,
|
|
659
|
-
// | Service.MakeDepsIn<Make>
|
|
660
|
-
// | Layer.Context<typeof middleware.Default>
|
|
661
|
-
// | Exclude<
|
|
662
|
-
// MakeContext<Make>,
|
|
663
|
-
// MakeDepsOut<Make>
|
|
664
|
-
// >
|
|
665
|
-
// >
|
|
666
|
-
|
|
667
|
-
// // just for type testing purposes
|
|
668
|
-
// make: Make
|
|
669
|
-
// }
|
|
670
511
|
<
|
|
671
512
|
const Make extends {
|
|
672
513
|
dependencies?: Array<Layer.Layer.Any>
|
|
@@ -688,7 +529,7 @@ export const makeRouter = <
|
|
|
688
529
|
moduleName: ModuleName
|
|
689
530
|
|
|
690
531
|
routes: Layer.Layer<
|
|
691
|
-
|
|
532
|
+
never,
|
|
692
533
|
| MakeErrors<Make>
|
|
693
534
|
| Service.MakeDepsE<Make>
|
|
694
535
|
| Layer.Error<typeof middleware.Default>,
|
|
@@ -698,39 +539,12 @@ export const makeRouter = <
|
|
|
698
539
|
MakeContext<Make>,
|
|
699
540
|
MakeDepsOut<Make>
|
|
700
541
|
>
|
|
542
|
+
| RpcSerialization.RpcSerialization
|
|
701
543
|
>
|
|
702
544
|
|
|
703
545
|
// just for type testing purposes
|
|
704
|
-
|
|
546
|
+
readonly [TypeTestId]: Make
|
|
705
547
|
}
|
|
706
|
-
// <
|
|
707
|
-
// const Make extends {
|
|
708
|
-
// dependencies: [
|
|
709
|
-
// ...Make["dependencies"],
|
|
710
|
-
// ...Exclude<Effect.Context<ReturnType<Make["effect"]>>, MakeDepsOut<Make>> extends never ? []
|
|
711
|
-
// : [Layer.Layer<Exclude<Effect.Context<ReturnType<Make["effect"]>>, MakeDepsOut<Make>>, never, never>]
|
|
712
|
-
// ]
|
|
713
|
-
// effect: (match: typeof router3) => Effect<
|
|
714
|
-
// { [K in keyof FilterRequestModules<Resource>]: AnyHandler<Resource[K]> },
|
|
715
|
-
// any,
|
|
716
|
-
// any
|
|
717
|
-
// >
|
|
718
|
-
// }
|
|
719
|
-
// >(
|
|
720
|
-
// make: Make
|
|
721
|
-
// ): {
|
|
722
|
-
// moduleName: ModuleName
|
|
723
|
-
// Router: HttpRouter.HttpRouter.TagClass<
|
|
724
|
-
// RouterShape<Resource>,
|
|
725
|
-
// `${ModuleName}Router`,
|
|
726
|
-
// never,
|
|
727
|
-
// never
|
|
728
|
-
// >
|
|
729
|
-
// routes: any
|
|
730
|
-
|
|
731
|
-
// // just for type testing purposes
|
|
732
|
-
// make: Make
|
|
733
|
-
// }
|
|
734
548
|
} =
|
|
735
549
|
((make: { dependencies: any; effect: any }) =>
|
|
736
550
|
Object.assign(makeRoutes(make.dependencies, make.effect), { make })) as any
|
|
@@ -741,8 +555,7 @@ export const makeRouter = <
|
|
|
741
555
|
function matchAll<
|
|
742
556
|
T extends {
|
|
743
557
|
[key: string]: {
|
|
744
|
-
|
|
745
|
-
routes: Layer.Layer<any, any, any>
|
|
558
|
+
routes: Layer.Layer<never, any, any>
|
|
746
559
|
moduleName: string
|
|
747
560
|
}
|
|
748
561
|
}
|
|
@@ -755,7 +568,7 @@ export const makeRouter = <
|
|
|
755
568
|
never,
|
|
756
569
|
Layer.Layer.Error<typeof handlers[keyof typeof handlers]["routes"]>,
|
|
757
570
|
Layer.Layer.Context<typeof handlers[keyof typeof handlers]["routes"]>
|
|
758
|
-
>
|
|
571
|
+
>
|
|
759
572
|
}
|
|
760
573
|
|
|
761
574
|
return {
|
package/test/controller.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
|
-
import { type MakeContext, type MakeErrors, makeRouter } from "@effect-app/infra/api/routing"
|
|
3
|
+
import { type MakeContext, type MakeErrors, makeRouter, TypeTestId } from "@effect-app/infra/api/routing"
|
|
4
|
+
import { type RpcSerialization } from "@effect/rpc"
|
|
4
5
|
import { expect, expectTypeOf, it } from "@effect/vitest"
|
|
5
6
|
import { Context, Effect, Layer, S, Scope } from "effect-app"
|
|
6
7
|
import { InvalidStateError, makeRpcClient, NotLoggedInError, UnauthorizedError } from "effect-app/client"
|
|
@@ -132,8 +133,7 @@ const middlewareTrisWip = makeMiddleware<RequestContextMap>(RequestContextMap)
|
|
|
132
133
|
MyContextProvider,
|
|
133
134
|
RequireRoles,
|
|
134
135
|
Test
|
|
135
|
-
)
|
|
136
|
-
.missing
|
|
136
|
+
)[TypeTestId]
|
|
137
137
|
|
|
138
138
|
expectTypeOf(middlewareTrisWip).toEqualTypeOf<{
|
|
139
139
|
missingDynamicMiddlewares: "allowAnonymous"
|
|
@@ -312,10 +312,12 @@ it("sorts based on requirements", () => {
|
|
|
312
312
|
|
|
313
313
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
314
314
|
const matched = matchAll({ router })
|
|
315
|
-
expectTypeOf({} as Layer.Context<typeof matched>).toEqualTypeOf<
|
|
315
|
+
expectTypeOf({} as Layer.Context<typeof matched>).toEqualTypeOf<
|
|
316
|
+
RpcSerialization.RpcSerialization | SomeService | "str"
|
|
317
|
+
>()
|
|
316
318
|
|
|
317
|
-
type makeContext = MakeContext<typeof router
|
|
318
|
-
expectTypeOf({} as MakeErrors<typeof router
|
|
319
|
+
type makeContext = MakeContext<typeof router[TypeTestId]>
|
|
320
|
+
expectTypeOf({} as MakeErrors<typeof router[TypeTestId]>).toEqualTypeOf<InvalidStateError>()
|
|
319
321
|
expectTypeOf({} as makeContext).toEqualTypeOf<
|
|
320
322
|
SomethingService | SomethingRepo | SomethingService2
|
|
321
323
|
>()
|
|
@@ -368,7 +370,9 @@ const router2 = r2.Router(Something)({
|
|
|
368
370
|
|
|
369
371
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
370
372
|
const matched2 = matchAll({ router: router2 })
|
|
371
|
-
expectTypeOf({} as Layer.Context<typeof matched2>).toEqualTypeOf<
|
|
373
|
+
expectTypeOf({} as Layer.Context<typeof matched2>).toEqualTypeOf<
|
|
374
|
+
RpcSerialization.RpcSerialization | SomeService | "str"
|
|
375
|
+
>()
|
|
372
376
|
|
|
373
|
-
type makeContext2 = MakeContext<typeof router2
|
|
377
|
+
type makeContext2 = MakeContext<typeof router2[TypeTestId]>
|
|
374
378
|
expectTypeOf({} as makeContext2).toEqualTypeOf<never>()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../controller.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../controller.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAA0B,MAAM,+BAA+B,CAAA;AACzG,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAW,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAE7D,OAAO,EAA6C,UAAU,EAAO,MAAM,kCAAkC,CAAA;AAE7G,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;;;;;;AAgEhI,cAAM,kBAAmB,SAAQ,uBAU/B;CAAG;;;;;;AAML,qBAAa,eAAgB,SAAQ,oBAYnC;CACD;AA0DD,eAAO,MAAM,WAAW;;;;;;YAIM,CAAA;AAE9B,MAAM,MAAM,aAAa,GAAG;IAC1B,yCAAyC;IACzC,cAAc,CAAC,EAAE,IAAI,CAAA;IACrB,iEAAiE;IACjE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC/B,CAAA;AACD,eAAO,MAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI/B,CAAA;;;;;;;;;;AAEF,qBAAa,GAAI,SAAQ,QAA0C;CAAG;;;;;;;;;;AACtE,qBAAa,GAAI,SAAQ,QAA0C;CAAG;;;;;;;;;;;;AAEtE,qBAAa,WAAY,SAAQ,gBAEV;CAAG;;;;;;;;;;;;AAgB1B,qBAAa,YAAa,SAAQ,iBAET;CAAG;;;;;;;;;;;;AAE5B,qBAAa,aAAc,SAAQ,kBAEA;CAAG;;;;;AAItC,qBAAa,gBAAiB,SAAQ,qBAKpC;CAAG;;;;;AASL,qBAAa,aAAc,SAAQ,kBAOjC;CAAG;;;;;AAEL,qBAAa,iBAAkB,SAAQ,sBAKrC;CAAG;AAEL,eAAO,MAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAE,QAAQ;;;;;yHAAiC,CAAA;AAEhE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAgC,CAAA"}
|
package/test/dist/fixtures.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare const Some_base: (abstract new (service: {
|
|
|
28
28
|
};
|
|
29
29
|
toLayerScoped: {
|
|
30
30
|
(): import("effect/Layer").Layer<Some, never, never>;
|
|
31
|
-
<E_1, R_2>(eff: Effect.Effect<Context.TagClassShape<any, any
|
|
31
|
+
<E_1, R_2>(eff: Effect.Effect<Omit<Some, keyof Context.TagClassShape<any, any>>, E_1, R_2>): import("effect/Layer").Layer<Some, E_1, Exclude<R_2, Scope.Scope>>;
|
|
32
32
|
};
|
|
33
33
|
of: (service: Context.TagClassShape<any, any>) => Some;
|
|
34
34
|
make: Effect.Effect<Some, never, never>;
|
|
@@ -54,7 +54,7 @@ declare const SomeElse_base: (abstract new (service: {
|
|
|
54
54
|
};
|
|
55
55
|
toLayerScoped: {
|
|
56
56
|
(): import("effect/Layer").Layer<SomeElse, never, never>;
|
|
57
|
-
<E_1, R_2>(eff: Effect.Effect<Context.TagClassShape<any, any
|
|
57
|
+
<E_1, R_2>(eff: Effect.Effect<Omit<SomeElse, keyof Context.TagClassShape<any, any>>, E_1, R_2>): import("effect/Layer").Layer<SomeElse, E_1, Exclude<R_2, Scope.Scope>>;
|
|
58
58
|
};
|
|
59
59
|
of: (service: Context.TagClassShape<any, any>) => SomeElse;
|
|
60
60
|
make: Effect.Effect<SomeElse, never, never>;
|
|
@@ -80,7 +80,7 @@ declare const SomeService_base: (abstract new (service: {
|
|
|
80
80
|
};
|
|
81
81
|
toLayerScoped: {
|
|
82
82
|
(): import("effect/Layer").Layer<SomeService, never, never>;
|
|
83
|
-
<E_1, R_2>(eff: Effect.Effect<Context.TagClassShape<any, any
|
|
83
|
+
<E_1, R_2>(eff: Effect.Effect<Omit<SomeService, keyof Context.TagClassShape<any, any>>, E_1, R_2>): import("effect/Layer").Layer<SomeService, E_1, Exclude<R_2, Scope.Scope>>;
|
|
84
84
|
};
|
|
85
85
|
of: (service: Context.TagClassShape<any, any>) => SomeService;
|
|
86
86
|
make: Effect.Effect<SomeService, never, never>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-middleware.d.ts","sourceRoot":"","sources":["../../../../src/api/routing/middleware/dynamic-middleware.ts"],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1taWRkbGV3YXJlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2FwaS9yb3V0aW5nL21pZGRsZXdhcmUvZHluYW1pYy1taWRkbGV3YXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
|
File without changes
|