@effect-app/infra 4.0.0-beta.32 → 4.0.0-beta.33

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @effect-app/infra
2
2
 
3
+ ## 4.0.0-beta.33
4
+
5
+ ### Patch Changes
6
+
7
+ - 4b95009: use Finite instead of Number
8
+ - Updated dependencies [4b95009]
9
+ - effect-app@4.0.0-beta.33
10
+
3
11
  ## 4.0.0-beta.32
4
12
 
5
13
  ### Patch Changes
@@ -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").Number & {
6
- withDefault: S.withConstructorDefault<import("effect/Schema").Number & S.WithoutConstructorDefault>;
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.Number.pipe(S.brand("QueueId"));
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 { Effect, Layer, ManagedRuntime, S, Schema } from "effect-app"
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.Number })
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<QueryWhere<Union.Encoded, {
107
- readonly _tag: "Something";
108
- readonly id: string;
109
- readonly displayName: string;
110
- readonly n: string;
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
- readonly _tag: "string";
113
- readonly value: string;
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<QueryWhere<Union.Encoded, {
122
- readonly _tag: "Something";
123
- readonly id: string;
124
- readonly displayName: string;
125
- readonly n: string;
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
- readonly _tag: "number";
128
- readonly value: number;
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.32",
3
+ "version": "4.0.0-beta.33",
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.32"
16
+ "effect-app": "4.0.0-beta.33"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@azure/cosmos": "^4.9.1",
@@ -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.Number.pipe(S.brand("QueueId"))
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
@@ -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.NumberFromString }) {}
236
+ }, { success: S.FiniteFromString }) {}
237
237
 
238
238
  const Something = { Eff, Gen, DoSomething, GetSomething, GetSomething2, meta: { moduleName: "Something" as const } }
239
239
 
@@ -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.Number })
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.Number)
675
+ b: S.NullOr(S.Finite)
676
676
  }) {}
677
677
 
678
678
  type Union = AA | BB
@@ -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.Number, description: S.String }))
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.gen(function*() {
87
- const url = yield* Config.redacted("STORAGE_URL").pipe(
88
- Config.withDefault(
89
- Redacted.make(
90
- // the emulator doesn't implement array projections :/ so you need an actual cloud instance!
91
- "AccountEndpoint=http://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
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
- return CosmosStoreLayer({
96
- dbName: "test",
97
- prefix: "",
98
- url
96
+ return CosmosStoreLayer({
97
+ dbName: "test",
98
+ prefix: "",
99
+ url
100
+ })
99
101
  })
100
- }).pipe(Layer.unwrap)
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.Number })) })
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.Number })) })
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
  {