@effect-app/infra 0.193.5 → 0.193.7
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 +12 -0
- package/_cjs/api/express/schema/jwt.cjs +0 -4
- package/_cjs/api/express/schema/jwt.cjs.map +1 -1
- package/_cjs/services/QueueMaker/memQueue.cjs +1 -1
- package/_cjs/services/QueueMaker/memQueue.cjs.map +1 -1
- package/_cjs/services/QueueMaker/sbqueue.cjs +1 -1
- package/_cjs/services/QueueMaker/sbqueue.cjs.map +1 -1
- package/_cjs/services/RepositoryBase.cjs +59 -58
- package/_cjs/services/RepositoryBase.cjs.map +1 -1
- package/_cjs/test.arbs.cjs +3 -3
- package/_cjs/test.arbs.cjs.map +1 -1
- package/dist/api/express/schema/jwt.d.ts.map +1 -1
- package/dist/api/express/schema/jwt.js +1 -4
- package/dist/services/QueueMaker/memQueue.d.ts +1 -1
- package/dist/services/QueueMaker/memQueue.d.ts.map +1 -1
- package/dist/services/QueueMaker/memQueue.js +2 -2
- package/dist/services/QueueMaker/sbqueue.d.ts +1 -1
- package/dist/services/QueueMaker/sbqueue.d.ts.map +1 -1
- package/dist/services/QueueMaker/sbqueue.js +2 -2
- package/dist/services/QueueMaker/service.d.ts +2 -2
- package/dist/services/Repository/dsl.d.ts +3 -3
- package/dist/services/Repository/dsl.d.ts.map +1 -1
- package/dist/services/Repository/ext.d.ts +2 -2
- package/dist/services/Repository/ext.d.ts.map +1 -1
- package/dist/services/RepositoryBase.d.ts +35 -33
- package/dist/services/RepositoryBase.d.ts.map +1 -1
- package/dist/services/RepositoryBase.js +64 -59
- package/dist/services/simpledb/cosmosdb.d.ts +2 -2
- package/dist/services/simpledb/diskdb.d.ts +2 -2
- package/dist/services/simpledb/memdb.d.ts +2 -2
- package/dist/services/simpledb/redisdb.d.ts +2 -2
- package/dist/services/simpledb/simpledb.d.ts +2 -2
- package/dist/test.arbs.d.ts.map +1 -1
- package/dist/test.arbs.js +2 -2
- package/package.json +2 -2
- package/src/api/express/schema/jwt.ts +1 -1
- package/src/services/QueueMaker/memQueue.ts +1 -1
- package/src/services/QueueMaker/sbqueue.ts +1 -1
- package/src/services/Repository/dsl.ts +1 -1
- package/src/services/RepositoryBase.ts +29 -8
- package/src/test.arbs.ts +1 -1
|
@@ -20,8 +20,8 @@ import type {} from "effect/Hash"
|
|
|
20
20
|
import { flatMapOption } from "@effect-app/core/Effect"
|
|
21
21
|
import type { Opt } from "@effect-app/core/Option"
|
|
22
22
|
import { makeFilters } from "@effect-app/infra/filter"
|
|
23
|
-
import { S } from "effect-app"
|
|
24
|
-
import type
|
|
23
|
+
import { Effect, S } from "effect-app"
|
|
24
|
+
import { type FixEnv, runTerm } from "effect-app/Pure"
|
|
25
25
|
import { type InvalidStateError, NotFoundError, type OptimisticConcurrencyException } from "../errors.js"
|
|
26
26
|
import { ContextMapContainer } from "./Store/ContextMapContainer.js"
|
|
27
27
|
import * as Q from "./Store/filterApi/query.js"
|
|
@@ -408,8 +408,30 @@ export class RepositoryBaseC3<
|
|
|
408
408
|
(items: Iterable<S1>) => saveManyWithPure_(this, items, pure)
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
byIdAndSaveWithPure(
|
|
412
|
-
|
|
411
|
+
byIdAndSaveWithPure(
|
|
412
|
+
id: T["id"]
|
|
413
|
+
): <R, A, E, S2 extends T>(
|
|
414
|
+
pure: Effect<A, E, FixEnv<R, Evt, T, S2>>
|
|
415
|
+
) => Effect<
|
|
416
|
+
A,
|
|
417
|
+
InvalidStateError | OptimisticConcurrencyException | NotFoundError<ItemType> | E,
|
|
418
|
+
Exclude<R, {
|
|
419
|
+
env: PureEnv<Evt, T, S2>
|
|
420
|
+
}>
|
|
421
|
+
>
|
|
422
|
+
byIdAndSaveWithPure<R, A, E, S2 extends T>(
|
|
423
|
+
id: T["id"],
|
|
424
|
+
pure: Effect<A, E, FixEnv<R, Evt, T, S2>>
|
|
425
|
+
): Effect<
|
|
426
|
+
A,
|
|
427
|
+
InvalidStateError | OptimisticConcurrencyException | NotFoundError<ItemType> | E,
|
|
428
|
+
Exclude<R, {
|
|
429
|
+
env: PureEnv<Evt, T, S2>
|
|
430
|
+
}>
|
|
431
|
+
>
|
|
432
|
+
byIdAndSaveWithPure<R, A, E, S2 extends T>(id: T["id"], pure?: Effect<A, E, FixEnv<R, Evt, T, S2>>) {
|
|
433
|
+
if (pure) return get(this, id).flatMap((item) => saveWithPure_(this, item, pure))
|
|
434
|
+
return (pure: Effect<A, E, FixEnv<R, Evt, T, S2>>) =>
|
|
413
435
|
get(this, id).flatMap((item) => saveWithPure_(this, item, pure))
|
|
414
436
|
}
|
|
415
437
|
|
|
@@ -435,7 +457,7 @@ export class RepositoryBaseC3<
|
|
|
435
457
|
) {
|
|
436
458
|
return saveAllWithEffectInt(
|
|
437
459
|
this,
|
|
438
|
-
|
|
460
|
+
runTerm(pure, [...items])
|
|
439
461
|
)
|
|
440
462
|
}
|
|
441
463
|
|
|
@@ -451,8 +473,7 @@ export class RepositoryBaseC3<
|
|
|
451
473
|
) {
|
|
452
474
|
return saveAllWithEffectInt(
|
|
453
475
|
this,
|
|
454
|
-
pure
|
|
455
|
-
.runTerm(item)
|
|
476
|
+
runTerm(pure, item)
|
|
456
477
|
.map(([item, events, a]) => [[item], events, a])
|
|
457
478
|
)
|
|
458
479
|
}
|
|
@@ -516,7 +537,7 @@ export class RepositoryBaseC3<
|
|
|
516
537
|
.forEachEffect((batch) =>
|
|
517
538
|
saveAllWithEffectInt(
|
|
518
539
|
this,
|
|
519
|
-
|
|
540
|
+
runTerm(pure, batch)
|
|
520
541
|
)
|
|
521
542
|
)
|
|
522
543
|
}
|
package/src/test.arbs.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Do not import to frontend
|
|
2
2
|
|
|
3
|
+
import { faker } from "@faker-js/faker"
|
|
3
4
|
import { setFaker } from "effect-app/faker"
|
|
4
5
|
import type { A } from "effect-app/schema"
|
|
5
|
-
import { faker } from "@faker-js/faker"
|
|
6
6
|
import { Random } from "fast-check"
|
|
7
7
|
import * as fc from "fast-check"
|
|
8
8
|
import * as rand from "pure-rand"
|