@effect-app/infra 4.0.0-beta.32 → 4.0.0-beta.34
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 +16 -0
- package/dist/Model/query/new-kid-interpreter.d.ts +1 -1
- package/dist/QueueMaker/SQLQueue.d.ts +2 -2
- package/dist/QueueMaker/SQLQueue.js +1 -1
- package/examples/query.ts +28 -24
- package/package.json +5 -5
- package/src/QueueMaker/SQLQueue.ts +1 -1
- package/test/controller.test.ts +1 -1
- package/test/query.test.ts +2 -2
- package/test/rawQuery.test.ts +17 -15
- package/tsconfig.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @effect-app/infra
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8c645d5: update to latest effect
|
|
8
|
+
- Updated dependencies [8c645d5]
|
|
9
|
+
- effect-app@4.0.0-beta.34
|
|
10
|
+
|
|
11
|
+
## 4.0.0-beta.33
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 4b95009: use Finite instead of Number
|
|
16
|
+
- Updated dependencies [4b95009]
|
|
17
|
+
- effect-app@4.0.0-beta.33
|
|
18
|
+
|
|
3
19
|
## 4.0.0-beta.32
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -21,7 +21,7 @@ export declare const toFilter: <TFieldValues extends FieldValues, A, R, TFieldVa
|
|
|
21
21
|
key: import("../filter/types/path/eager.js").Path<TFieldValues>;
|
|
22
22
|
direction: "ASC" | "DESC";
|
|
23
23
|
}[]];
|
|
24
|
-
ttype: "one" | "
|
|
24
|
+
ttype: "one" | "count" | "many";
|
|
25
25
|
mode: "project" | "collect" | "transform";
|
|
26
26
|
filter: FilterResult[];
|
|
27
27
|
};
|
|
@@ -2,8 +2,8 @@ import { type QueueBase } from "@effect-app/infra/QueueMaker/service";
|
|
|
2
2
|
import { Effect, S } from "effect-app";
|
|
3
3
|
import type { NonEmptyString255 } from "effect-app/Schema";
|
|
4
4
|
import { SqlClient } from "effect/unstable/sql";
|
|
5
|
-
export declare const QueueId: S.brand<import("effect/Schema").
|
|
6
|
-
withDefault: S.withConstructorDefault<import("effect/Schema").
|
|
5
|
+
export declare const QueueId: S.brand<import("effect/Schema").Finite & {
|
|
6
|
+
withDefault: S.withConstructorDefault<import("effect/Schema").Finite & S.WithoutConstructorDefault>;
|
|
7
7
|
}, "QueueId">;
|
|
8
8
|
export type QueueId = typeof QueueId.Type;
|
|
9
9
|
export declare function makeSQLQueue<Evt extends {
|
|
@@ -7,7 +7,7 @@ import { pretty } from "effect-app/utils";
|
|
|
7
7
|
import { SqlClient } from "effect/unstable/sql";
|
|
8
8
|
import { SQLModel } from "../adapters/SQL.js";
|
|
9
9
|
import { InfraLogger } from "../logger.js";
|
|
10
|
-
export const QueueId = S.
|
|
10
|
+
export const QueueId = S.Finite.pipe(S.brand("QueueId"));
|
|
11
11
|
// TODO: let the model track and Auto Generate versionColumn on every update instead
|
|
12
12
|
export function makeSQLQueue(queueName, queueDrainName, schema, drainSchema) {
|
|
13
13
|
return Effect.gen(function* () {
|
package/examples/query.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { expectTypeOf } from "@effect/vitest"
|
|
2
|
+
import { Effect, Layer, ManagedRuntime, S } from "effect-app"
|
|
2
3
|
import { makeRepo } from "../src/Model.js"
|
|
3
|
-
import { and, make, one, or, order, page, project, QueryWhere, where } from "../src/Model/query.js"
|
|
4
|
+
import { and, make, one, or, order, page, project, type QueryWhere, where } from "../src/Model/query.js"
|
|
4
5
|
import { MemoryStoreLive } from "../src/Store/Memory.js"
|
|
5
|
-
import { expectTypeOf } from "@effect/vitest"
|
|
6
6
|
|
|
7
7
|
const str = S.Struct({ _tag: S.Literal("string"), value: S.String })
|
|
8
|
-
const num = S.Struct({ _tag: S.Literal("number"), value: S.
|
|
8
|
+
const num = S.Struct({ _tag: S.Literal("number"), value: S.Finite })
|
|
9
9
|
const someUnion = S.Union(str, num)
|
|
10
10
|
|
|
11
11
|
export class Something extends S.TaggedClass<Something>()("Something", {
|
|
@@ -100,31 +100,35 @@ const rt = ManagedRuntime.make(SomethingRepo.Test)
|
|
|
100
100
|
rt.runFork(program)
|
|
101
101
|
|
|
102
102
|
const test1 = make<Union.Encoded>().pipe(
|
|
103
|
-
where("union._tag", "string")
|
|
103
|
+
where("union._tag", "string")
|
|
104
104
|
)
|
|
105
105
|
|
|
106
|
-
expectTypeOf(test1).toEqualTypeOf<
|
|
107
|
-
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
106
|
+
expectTypeOf(test1).toEqualTypeOf<
|
|
107
|
+
QueryWhere<Union.Encoded, {
|
|
108
|
+
readonly _tag: "Something"
|
|
109
|
+
readonly id: string
|
|
110
|
+
readonly displayName: string
|
|
111
|
+
readonly n: string
|
|
111
112
|
readonly union: {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
113
|
+
readonly _tag: "string"
|
|
114
|
+
readonly value: string
|
|
115
|
+
}
|
|
116
|
+
}>
|
|
117
|
+
>()
|
|
116
118
|
|
|
117
119
|
const testneq1 = make<Union.Encoded>().pipe(
|
|
118
|
-
where("union._tag", "neq", "string")
|
|
120
|
+
where("union._tag", "neq", "string")
|
|
119
121
|
)
|
|
120
122
|
|
|
121
|
-
expectTypeOf(testneq1).toEqualTypeOf<
|
|
122
|
-
|
|
123
|
-
readonly
|
|
124
|
-
readonly
|
|
125
|
-
readonly
|
|
123
|
+
expectTypeOf(testneq1).toEqualTypeOf<
|
|
124
|
+
QueryWhere<Union.Encoded, {
|
|
125
|
+
readonly _tag: "Something"
|
|
126
|
+
readonly id: string
|
|
127
|
+
readonly displayName: string
|
|
128
|
+
readonly n: string
|
|
126
129
|
readonly union: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
130
|
+
readonly _tag: "number"
|
|
131
|
+
readonly value: number
|
|
132
|
+
}
|
|
133
|
+
}>
|
|
134
|
+
>()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/infra",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"proper-lockfile": "^4.1.2",
|
|
14
14
|
"pure-rand": "7.0.1",
|
|
15
15
|
"query-string": "^9.3.1",
|
|
16
|
-
"effect-app": "4.0.0-beta.
|
|
16
|
+
"effect-app": "4.0.0-beta.34"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@azure/cosmos": "^4.9.1",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"redis": "^3.1.2",
|
|
33
33
|
"redlock": "^4.2.0",
|
|
34
34
|
"strip-ansi": "^7.2.0",
|
|
35
|
-
"typescript": "~
|
|
35
|
+
"typescript": "~6.0.2",
|
|
36
36
|
"vitest": "^4.0.18",
|
|
37
37
|
"@effect-app/eslint-shared-config": "0.5.7-beta.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@azure/cosmos": "^4.9.1",
|
|
41
41
|
"@azure/service-bus": "^7.9.5",
|
|
42
|
-
"@effect/vitest": "^4.0.0-beta.
|
|
42
|
+
"@effect/vitest": "^4.0.0-beta.40",
|
|
43
43
|
"@sendgrid/helpers": "^8.0.0",
|
|
44
44
|
"@sendgrid/mail": "^8.1.6",
|
|
45
45
|
"@sentry/node": "10.42.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"jwt-decode": "^4.0.0",
|
|
48
48
|
"redis": "^3.1.2",
|
|
49
49
|
"redlock": "^4.2.0",
|
|
50
|
-
"effect": "^4.0.0-beta.
|
|
50
|
+
"effect": "^4.0.0-beta.40",
|
|
51
51
|
"express": "^5.2.1"
|
|
52
52
|
},
|
|
53
53
|
"typesVersions": {
|
|
@@ -9,7 +9,7 @@ import { SqlClient } from "effect/unstable/sql"
|
|
|
9
9
|
import { SQLModel } from "../adapters/SQL.js"
|
|
10
10
|
import { InfraLogger } from "../logger.js"
|
|
11
11
|
|
|
12
|
-
export const QueueId = S.
|
|
12
|
+
export const QueueId = S.Finite.pipe(S.brand("QueueId"))
|
|
13
13
|
export type QueueId = typeof QueueId.Type
|
|
14
14
|
|
|
15
15
|
// TODO: let the model track and Auto Generate versionColumn on every update instead
|
package/test/controller.test.ts
CHANGED
|
@@ -233,7 +233,7 @@ export class GetSomething extends Req<GetSomething>()("GetSomething", {
|
|
|
233
233
|
|
|
234
234
|
export class GetSomething2 extends Req<GetSomething2>()("GetSomething2", {
|
|
235
235
|
id: S.String
|
|
236
|
-
}, { success: S.
|
|
236
|
+
}, { success: S.FiniteFromString }) {}
|
|
237
237
|
|
|
238
238
|
const Something = { Eff, Gen, DoSomething, GetSomething, GetSomething2, meta: { moduleName: "Something" as const } }
|
|
239
239
|
|
package/test/query.test.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { memFilter, MemoryStoreLive } from "../src/Store/Memory.js"
|
|
|
11
11
|
import { SomeService } from "./fixtures.js"
|
|
12
12
|
|
|
13
13
|
const str = S.Struct({ _tag: S.Literal("string"), value: S.String })
|
|
14
|
-
const num = S.Struct({ _tag: S.Literal("number"), value: S.
|
|
14
|
+
const num = S.Struct({ _tag: S.Literal("number"), value: S.Finite })
|
|
15
15
|
const someUnion = S.Union([str, num])
|
|
16
16
|
|
|
17
17
|
export class Something extends S.Class<Something>("Something")({
|
|
@@ -672,7 +672,7 @@ it("remove null from one constituent of a tagged union", () =>
|
|
|
672
672
|
|
|
673
673
|
class BB extends S.Class<BB>("BB")({
|
|
674
674
|
id: S.Literal("BB"),
|
|
675
|
-
b: S.NullOr(S.
|
|
675
|
+
b: S.NullOr(S.Finite)
|
|
676
676
|
}) {}
|
|
677
677
|
|
|
678
678
|
type Union = AA | BB
|
package/test/rawQuery.test.ts
CHANGED
|
@@ -24,7 +24,7 @@ class Something extends S.Class<Something>("Something")({
|
|
|
24
24
|
id: S.String,
|
|
25
25
|
name: S.String,
|
|
26
26
|
description: S.String,
|
|
27
|
-
items: S.Array(S.Struct({ id: S.String, value: S.
|
|
27
|
+
items: S.Array(S.Struct({ id: S.String, value: S.Finite, description: S.String }))
|
|
28
28
|
}) {}
|
|
29
29
|
|
|
30
30
|
const items = [
|
|
@@ -83,21 +83,23 @@ class SomethingRepo extends ServiceMap.Service<SomethingRepo>()(
|
|
|
83
83
|
.layer
|
|
84
84
|
.pipe(
|
|
85
85
|
Layer.provide(
|
|
86
|
-
Effect
|
|
87
|
-
|
|
88
|
-
Config.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
Effect
|
|
87
|
+
.gen(function*() {
|
|
88
|
+
const url = yield* Config.redacted("STORAGE_URL").pipe(
|
|
89
|
+
Config.withDefault(
|
|
90
|
+
Redacted.make(
|
|
91
|
+
// the emulator doesn't implement array projections :/ so you need an actual cloud instance!
|
|
92
|
+
"AccountEndpoint=http://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
|
|
93
|
+
)
|
|
92
94
|
)
|
|
93
95
|
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
return CosmosStoreLayer({
|
|
97
|
+
dbName: "test",
|
|
98
|
+
prefix: "",
|
|
99
|
+
url
|
|
100
|
+
})
|
|
99
101
|
})
|
|
100
|
-
|
|
102
|
+
.pipe(Layer.unwrap)
|
|
101
103
|
)
|
|
102
104
|
)
|
|
103
105
|
}
|
|
@@ -107,7 +109,7 @@ describe("select first-level array fields", () => {
|
|
|
107
109
|
.gen(function*() {
|
|
108
110
|
const repo = yield* SomethingRepo
|
|
109
111
|
|
|
110
|
-
const projected = S.Struct({ name: S.String, items: S.Array(S.Struct({ id: S.String, value: S.
|
|
112
|
+
const projected = S.Struct({ name: S.String, items: S.Array(S.Struct({ id: S.String, value: S.Finite })) })
|
|
111
113
|
|
|
112
114
|
// ok crazy lol, "value" is a reserved word in CosmosDB, so we have to use t["value"] as a field name instead of t.value
|
|
113
115
|
const items = yield* repo.queryRaw(projected, {
|
|
@@ -159,7 +161,7 @@ describe("select first-level array fields", () => {
|
|
|
159
161
|
.pipe(Effect.provide(SomethingRepo.Test), rt.runPromise))
|
|
160
162
|
})
|
|
161
163
|
|
|
162
|
-
const projected = S.Struct({ name: S.String, items: S.Array(S.Struct({ id: S.String, value: S.
|
|
164
|
+
const projected = S.Struct({ name: S.String, items: S.Array(S.Struct({ id: S.String, value: S.Finite })) })
|
|
163
165
|
|
|
164
166
|
const expected = [
|
|
165
167
|
{
|