@effect-app/infra 2.8.1 → 2.9.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 +19 -0
- package/_cjs/CUPS.cjs +2 -3
- package/_cjs/CUPS.cjs.map +1 -1
- package/_cjs/Model/Repository/makeRepo.cjs +4 -1
- package/_cjs/Model/Repository/makeRepo.cjs.map +1 -1
- package/dist/CUPS.d.ts +4 -5
- package/dist/CUPS.d.ts.map +1 -1
- package/dist/CUPS.js +4 -5
- package/dist/Model/Repository/legacy.d.ts +18 -0
- package/dist/Model/Repository/legacy.d.ts.map +1 -1
- package/dist/Model/Repository/makeRepo.d.ts.map +1 -1
- package/dist/Model/Repository/makeRepo.js +6 -3
- package/dist/Model/Repository/service.d.ts +18 -0
- package/dist/Model/Repository/service.d.ts.map +1 -1
- package/examples/query.ts +18 -5
- package/package.json +2 -2
- package/src/CUPS.ts +4 -5
- package/src/Model/Repository/makeRepo.ts +5 -2
- package/src/Model/Repository/service.ts +453 -1
- package/test/dist/query.test.d.ts.map +1 -1
- package/test/query.test.ts +10 -10
package/test/query.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
import { Context, Effect,
|
|
3
|
+
import { Context, Effect, Layer, Option, pipe, S, Struct } from "effect-app"
|
|
4
4
|
import { inspect } from "util"
|
|
5
5
|
import { expect, expectTypeOf, it } from "vitest"
|
|
6
6
|
import { setupRequestContextFromCurrent } from "../src/api/setupRequest.js"
|
|
@@ -115,7 +115,7 @@ it("works with repo", () =>
|
|
|
115
115
|
const q1 = yield* somethingRepo.query(() => q)
|
|
116
116
|
// same as above, but with the `flow` helper
|
|
117
117
|
const q2 = yield* somethingRepo
|
|
118
|
-
.query(
|
|
118
|
+
.query(
|
|
119
119
|
where("displayName", "Verona"),
|
|
120
120
|
or(
|
|
121
121
|
where("displayName", "Riley"),
|
|
@@ -130,7 +130,7 @@ it("works with repo", () =>
|
|
|
130
130
|
(_) => Effect.andThen(SomeService, _)
|
|
131
131
|
)
|
|
132
132
|
)
|
|
133
|
-
)
|
|
133
|
+
)
|
|
134
134
|
|
|
135
135
|
expect(q1).toEqual(items.slice(0, 2).toReversed().map(Struct.pick("id", "displayName")))
|
|
136
136
|
expect(q2).toEqual(items.slice(0, 2).toReversed().map(Struct.pick("displayName")))
|
|
@@ -145,7 +145,7 @@ it("collect", () =>
|
|
|
145
145
|
|
|
146
146
|
expect(
|
|
147
147
|
yield* somethingRepo
|
|
148
|
-
.query(
|
|
148
|
+
.query(
|
|
149
149
|
where("displayName", "Riley"), // TODO: work with To type translation, so Date?
|
|
150
150
|
// one,
|
|
151
151
|
project(
|
|
@@ -160,13 +160,13 @@ it("collect", () =>
|
|
|
160
160
|
),
|
|
161
161
|
"collect"
|
|
162
162
|
)
|
|
163
|
-
)
|
|
163
|
+
)
|
|
164
164
|
)
|
|
165
165
|
.toEqual(["Riley-2020-01-01T00:00:00.000Z"])
|
|
166
166
|
|
|
167
167
|
expect(
|
|
168
168
|
yield* somethingRepo
|
|
169
|
-
.query(
|
|
169
|
+
.query(
|
|
170
170
|
where("union._tag", "string"),
|
|
171
171
|
one,
|
|
172
172
|
project(
|
|
@@ -181,7 +181,7 @@ it("collect", () =>
|
|
|
181
181
|
),
|
|
182
182
|
"collect"
|
|
183
183
|
)
|
|
184
|
-
)
|
|
184
|
+
)
|
|
185
185
|
)
|
|
186
186
|
.toEqual("hi")
|
|
187
187
|
})
|
|
@@ -221,8 +221,8 @@ it(
|
|
|
221
221
|
Effect
|
|
222
222
|
.gen(function*() {
|
|
223
223
|
const repo = yield* makeRepo("test", TestUnion, {})
|
|
224
|
-
const result = (yield* repo.query(
|
|
225
|
-
const result2 = (yield* repo.query(
|
|
224
|
+
const result = (yield* repo.query(where("id", "123"), and("_tag", "animal"))) satisfies readonly Animal[]
|
|
225
|
+
const result2 = (yield* repo.query(where("_tag", "animal"))) satisfies readonly Animal[]
|
|
226
226
|
|
|
227
227
|
expect(result).toEqual([])
|
|
228
228
|
expect(result2).toEqual([])
|
|
@@ -429,7 +429,7 @@ it(
|
|
|
429
429
|
{}
|
|
430
430
|
)
|
|
431
431
|
|
|
432
|
-
const result = yield* repo.query(
|
|
432
|
+
const result = yield* repo.query(where("id", "123"), project(schema))
|
|
433
433
|
|
|
434
434
|
expect(result).toEqual([])
|
|
435
435
|
})
|