effect-app 4.0.0-beta.220 → 4.0.0-beta.222
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 +8 -0
- package/dist/Array.d.ts +3 -2
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +4 -4
- package/dist/Config/SecretURL.d.ts +4 -2
- package/dist/Config/SecretURL.d.ts.map +1 -1
- package/dist/Config/SecretURL.js +2 -5
- package/dist/Config/internal/configSecretURL.d.ts +1 -1
- package/dist/Config/internal/configSecretURL.d.ts.map +1 -1
- package/dist/Config/internal/configSecretURL.js +2 -2
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/ConfigProvider.js +1 -1
- package/dist/Context.d.ts +5 -2
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +2 -2
- package/dist/Effect.d.ts +4 -2
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +4 -2
- package/dist/Layer.d.ts +6 -2
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +3 -2
- package/dist/NonEmptySet.d.ts +4 -2
- package/dist/NonEmptySet.d.ts.map +1 -1
- package/dist/NonEmptySet.js +2 -2
- package/dist/Option.d.ts +2 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +3 -1
- package/dist/Pure.d.ts +4 -2
- package/dist/Pure.d.ts.map +1 -1
- package/dist/Pure.js +5 -2
- package/dist/Schema/Class.d.ts +4 -4
- package/dist/Schema/Class.d.ts.map +1 -1
- package/dist/Schema/Class.js +8 -6
- package/dist/Schema/SpecialJsonSchema.d.ts +3 -2
- package/dist/Schema/SpecialJsonSchema.d.ts.map +1 -1
- package/dist/Schema/SpecialJsonSchema.js +2 -6
- package/dist/Schema/brand.d.ts +2 -2
- package/dist/Schema/brand.d.ts.map +1 -1
- package/dist/Schema/brand.js +3 -1
- package/dist/Schema/ext.d.ts +4 -32
- package/dist/Schema/ext.d.ts.map +1 -1
- package/dist/Schema/ext.js +8 -2
- package/dist/Schema/moreStrings.d.ts +1 -1
- package/dist/Schema/moreStrings.d.ts.map +1 -1
- package/dist/Schema/moreStrings.js +3 -12
- package/dist/Schema/numbers.js +2 -2
- package/dist/Schema.d.ts +4 -3
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2 -2
- package/dist/Set.d.ts +5 -2
- package/dist/Set.d.ts.map +1 -1
- package/dist/Set.js +3 -2
- package/dist/_ext/Array.d.ts +2 -2
- package/dist/_ext/Array.d.ts.map +1 -1
- package/dist/_ext/Array.js +4 -2
- package/dist/_ext/misc.d.ts +5 -2
- package/dist/_ext/misc.d.ts.map +1 -1
- package/dist/_ext/misc.js +4 -2
- package/dist/_ext/ord.ext.d.ts +3 -2
- package/dist/_ext/ord.ext.d.ts.map +1 -1
- package/dist/_ext/ord.ext.js +2 -2
- package/dist/client/makeClient.d.ts +1 -1
- package/dist/client/makeClient.d.ts.map +1 -1
- package/dist/client/makeClient.js +2 -2
- package/dist/http/Request.js +2 -2
- package/dist/ids.d.ts +1 -1
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +2 -2
- package/dist/rpc/Invalidation.d.ts +1 -1
- package/dist/rpc/Invalidation.js +1 -1
- package/dist/rpc/MiddlewareMaker.d.ts +8 -5
- package/dist/rpc/MiddlewareMaker.d.ts.map +1 -1
- package/dist/rpc/MiddlewareMaker.js +5 -4
- package/dist/rpc/RpcContextMap.d.ts +2 -2
- package/dist/rpc/RpcContextMap.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.d.ts +11 -8
- package/dist/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/rpc/RpcMiddleware.js +1 -1
- package/dist/transform.d.ts +2 -2
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +2 -3
- package/dist/utils/effectify.d.ts +2 -2
- package/dist/utils/effectify.d.ts.map +1 -1
- package/dist/utils/effectify.js +2 -2
- package/dist/utils/logLevel.d.ts +2 -2
- package/dist/utils/logLevel.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +3 -2
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +2 -2
- package/dist/utils.d.ts +5 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +8 -3
- package/package.json +1 -1
- package/src/Array.ts +3 -3
- package/src/Config/SecretURL.ts +3 -1
- package/src/Config/internal/configSecretURL.ts +1 -1
- package/src/ConfigProvider.ts +1 -1
- package/src/Context.ts +4 -1
- package/src/Effect.ts +3 -1
- package/src/Layer.ts +5 -1
- package/src/NonEmptySet.ts +3 -1
- package/src/Option.ts +2 -0
- package/src/Pure.ts +4 -1
- package/src/Schema/Class.ts +9 -5
- package/src/Schema/SpecialJsonSchema.ts +3 -1
- package/src/Schema/brand.ts +1 -1
- package/src/Schema/ext.ts +8 -1
- package/src/Schema/moreStrings.ts +2 -1
- package/src/Schema/numbers.ts +1 -1
- package/src/Schema.ts +3 -2
- package/src/Set.ts +5 -1
- package/src/_ext/Array.ts +3 -1
- package/src/_ext/misc.ts +4 -1
- package/src/_ext/ord.ext.ts +2 -1
- package/src/client/makeClient.ts +1 -1
- package/src/http/Request.ts +1 -1
- package/src/ids.ts +1 -1
- package/src/middleware.ts +1 -1
- package/src/rpc/Invalidation.ts +1 -1
- package/src/rpc/MiddlewareMaker.ts +19 -16
- package/src/rpc/RpcContextMap.ts +1 -1
- package/src/rpc/RpcMiddleware.ts +10 -8
- package/src/transform.ts +1 -1
- package/src/utils/effectify.ts +1 -1
- package/src/utils/logLevel.ts +1 -1
- package/src/utils/logger.ts +2 -1
- package/src/utils.ts +7 -2
- package/test/dist/rpc.test.d.ts.map +1 -1
- package/test/moreStrings.test.ts +1 -1
- package/test/rpc.test.ts +2 -1
- package/test/schema.test.ts +2 -1
- package/test/secretURL.test.ts +4 -1
- package/test/special.test.ts +4 -1
- package/test/utils.test.ts +1 -1
package/src/Schema/Class.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import
|
|
2
|
+
import type * as Cause from "effect/Cause"
|
|
3
|
+
import * as Effect from "effect/Effect"
|
|
4
|
+
import * as Option from "effect/Option"
|
|
3
5
|
import * as S from "effect/Schema"
|
|
6
|
+
import * as SchemaAST from "effect/SchemaAST"
|
|
7
|
+
import * as SchemaIssue from "effect/SchemaIssue"
|
|
4
8
|
import { copyOrigin } from "../utils.js"
|
|
5
9
|
import { concurrencyUnbounded } from "./ext.js"
|
|
6
10
|
import * as SchemaParser from "./SchemaParser.js"
|
|
@@ -49,11 +53,11 @@ export type Class<Self, S extends S.Top & { readonly fields: S.Struct.Fields },
|
|
|
49
53
|
*/
|
|
50
54
|
function makeRelaxedDeclaration(
|
|
51
55
|
ast: SchemaAST.Declaration,
|
|
52
|
-
fields:
|
|
56
|
+
fields: S.Struct.Fields,
|
|
53
57
|
cls: any
|
|
54
58
|
): SchemaAST.Declaration {
|
|
55
59
|
const parseOptions = ast.annotations?.["parseOptions"] as SchemaAST.ParseOptions | undefined
|
|
56
|
-
const structSchema =
|
|
60
|
+
const structSchema = S.Struct(fields)
|
|
57
61
|
const annotatedStruct = parseOptions ? S.toType(structSchema).annotate({ parseOptions }) : S.toType(structSchema)
|
|
58
62
|
const decodeStruct = SchemaParser.decodeUnknownEffect(annotatedStruct)
|
|
59
63
|
|
|
@@ -86,7 +90,7 @@ function makeRelaxedDeclaration(
|
|
|
86
90
|
*
|
|
87
91
|
* @example
|
|
88
92
|
* ```ts
|
|
89
|
-
* import
|
|
93
|
+
* import * as Schema from "effect/Schema"
|
|
90
94
|
* import { Class } from "./Class.js"
|
|
91
95
|
*
|
|
92
96
|
* class A extends Class<A>("A")({ a: Schema.String }) {}
|
|
@@ -155,7 +159,7 @@ export const Class: <Self = never, Encoded = ExtendedSchemaNoEncoded, Brand = {}
|
|
|
155
159
|
*
|
|
156
160
|
* @example
|
|
157
161
|
* ```ts
|
|
158
|
-
* import
|
|
162
|
+
* import * as Schema from "effect/Schema"
|
|
159
163
|
* import { TaggedClass } from "./Class.js"
|
|
160
164
|
*
|
|
161
165
|
* class Circle extends TaggedClass<Circle>()("Circle", {
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* SpecialJsonSchema — A variant of Schema.toJsonSchemaDocument that
|
|
3
3
|
* post-processes the output (e.g. flattens simple allOf).
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import type * as JsonSchema from "effect/JsonSchema"
|
|
6
|
+
import type * as Schema from "effect/Schema"
|
|
7
|
+
import * as SchemaRepresentation from "effect/SchemaRepresentation"
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Converts a schema to a JSON Schema Document (draft-2020-12), with
|
package/src/Schema/brand.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
|
-
import type { Option } from "effect"
|
|
4
3
|
import * as B from "effect/Brand"
|
|
4
|
+
import type * as Option from "effect/Option"
|
|
5
5
|
import type * as Result from "effect/Result"
|
|
6
6
|
import * as S from "effect/Schema"
|
|
7
7
|
|
package/src/Schema/ext.ts
CHANGED
|
@@ -30,9 +30,16 @@
|
|
|
30
30
|
* is gated on an explicit version marker) over shoving missing fields under
|
|
31
31
|
* the rug with a decode-time default.
|
|
32
32
|
*/
|
|
33
|
-
import
|
|
33
|
+
import * as Config from "effect/Config"
|
|
34
|
+
import * as Effect from "effect/Effect"
|
|
35
|
+
import { pipe } from "effect/Function"
|
|
36
|
+
import * as Function from "effect/Function"
|
|
37
|
+
import * as Option from "effect/Option"
|
|
34
38
|
import * as S from "effect/Schema"
|
|
35
39
|
import { isDateValid } from "effect/Schema"
|
|
40
|
+
import type * as SchemaAST from "effect/SchemaAST"
|
|
41
|
+
import * as SchemaIssue from "effect/SchemaIssue"
|
|
42
|
+
import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
36
43
|
import { type NonEmptyReadonlyArray } from "../Array.js"
|
|
37
44
|
import * as Context from "../Context.js"
|
|
38
45
|
import { extendM, typedKeysOf } from "../utils.js"
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* For persisted data, prefer an explicit, preferably versioned migration
|
|
9
9
|
* over decode-time fallbacks. See `./ext.ts` for the full policy note.
|
|
10
10
|
*/
|
|
11
|
-
import { Effect, pipe } from "effect"
|
|
12
11
|
import type { Refinement } from "effect-app/Function"
|
|
13
12
|
import { extendM } from "effect-app/utils"
|
|
13
|
+
import * as Effect from "effect/Effect"
|
|
14
|
+
import { pipe } from "effect/Function"
|
|
14
15
|
import * as S from "effect/Schema"
|
|
15
16
|
import type { Simplify } from "effect/Types"
|
|
16
17
|
import { customRandom, nanoid, urlAlphabet } from "nanoid"
|
package/src/Schema/numbers.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* For persisted data, prefer an explicit, preferably versioned migration
|
|
9
9
|
* over decode-time fallbacks. See `./ext.ts` for the full policy note.
|
|
10
10
|
*/
|
|
11
|
-
import { Effect } from "effect"
|
|
12
11
|
import { extendM } from "effect-app/utils"
|
|
12
|
+
import * as Effect from "effect/Effect"
|
|
13
13
|
import * as S from "effect/Schema"
|
|
14
14
|
import type { Simplify } from "effect/Types"
|
|
15
15
|
import { fromBrand, nominal } from "./brand.js"
|
package/src/Schema.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SchemaAST, type Tracer } from "effect"
|
|
2
1
|
import * as S from "effect/Schema"
|
|
2
|
+
import * as SchemaAST from "effect/SchemaAST"
|
|
3
3
|
import { type Simplify } from "effect/Struct"
|
|
4
|
+
import type * as Tracer from "effect/Tracer"
|
|
4
5
|
import type { RequiredKeys } from "effect/Types"
|
|
5
6
|
import type { NonEmptyReadonlyArray } from "./Array.js"
|
|
6
7
|
import { fakerArb } from "./faker.js"
|
|
@@ -220,7 +221,7 @@ export interface Struct<Fields extends S.Struct.Fields> extends
|
|
|
220
221
|
* **Example** (Reusing fields across structs)
|
|
221
222
|
*
|
|
222
223
|
* ```ts
|
|
223
|
-
* import
|
|
224
|
+
* import * as Schema from "effect/Schema"
|
|
224
225
|
*
|
|
225
226
|
* const Timestamped = Schema.Struct({
|
|
226
227
|
* createdAt: Schema.Date,
|
package/src/Set.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// ets_tracing: off
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as Array from "effect/Array"
|
|
4
|
+
import type * as Equivalence from "effect/Equivalence"
|
|
5
|
+
import * as Option from "effect/Option"
|
|
6
|
+
import type * as Order from "effect/Order"
|
|
4
7
|
import { not } from "effect/Predicate"
|
|
8
|
+
import type * as Result from "effect/Result"
|
|
5
9
|
import { identity, pipe, type Predicate, type Refinement, tuple } from "./Function.js"
|
|
6
10
|
|
|
7
11
|
export function find_<A, B extends A>(
|
package/src/_ext/Array.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Chunk from "effect-app/Chunk"
|
|
2
|
+
import * as Effect from "effect-app/Effect"
|
|
3
|
+
import * as Equal from "effect/Equal"
|
|
2
4
|
import { NotFoundError } from "../client/errors.js"
|
|
3
5
|
|
|
4
6
|
function getFirstBy<A, Type extends string>(
|
package/src/_ext/misc.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Effect, Option, Result, type Scope } from "effect"
|
|
2
1
|
import type { LazyArg } from "effect-app/Function"
|
|
2
|
+
import * as Effect from "effect/Effect"
|
|
3
|
+
import * as Option from "effect/Option"
|
|
4
|
+
import * as Result from "effect/Result"
|
|
5
|
+
import type * as Scope from "effect/Scope"
|
|
3
6
|
|
|
4
7
|
export type _R<T extends Effect.Effect<any, any, any>> = [T] extends [
|
|
5
8
|
Effect.Effect<any, any, infer R>
|
package/src/_ext/ord.ext.ts
CHANGED
package/src/client/makeClient.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SchemaTransformation } from "effect"
|
|
2
1
|
import type * as Exit from "effect/Exit"
|
|
2
|
+
import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
3
3
|
import { type GetContextConfig, type RpcContextMap } from "../rpc/RpcContextMap.js"
|
|
4
4
|
import * as S from "../Schema.js"
|
|
5
5
|
import { AST } from "../Schema.js"
|
package/src/http/Request.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Option from "effect/Option"
|
|
2
2
|
import type { HttpClientResponse } from "effect/unstable/http/HttpClientResponse"
|
|
3
3
|
import * as Effect from "../Effect.js"
|
|
4
4
|
import { HttpClient, HttpClientError, HttpClientRequest, HttpHeaders } from "./internal/lib.js"
|
package/src/ids.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Effect } from "effect"
|
|
2
1
|
import { brandedStringId, type Codec, NonEmptyString255, StringId, type StringIdBrand, withDefaultMake } from "effect-app/Schema"
|
|
3
2
|
import type { B } from "effect-app/Schema/schema"
|
|
3
|
+
import * as Effect from "effect/Effect"
|
|
4
4
|
import type { Simplify } from "effect/Types"
|
|
5
5
|
import { S } from "./index.js"
|
|
6
6
|
import { extendM } from "./utils.js"
|
package/src/middleware.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import
|
|
2
|
+
import * as Context from "effect-app/Context"
|
|
3
3
|
import { RpcMiddleware } from "./rpc.js"
|
|
4
4
|
|
|
5
5
|
export class DevMode extends Context.Reference("DevMode", { defaultValue: () => false }) {}
|
package/src/rpc/Invalidation.ts
CHANGED
|
@@ -131,7 +131,7 @@ export interface InvalidationSetService {
|
|
|
131
131
|
*
|
|
132
132
|
* ```ts
|
|
133
133
|
* import { makeQueryKey } from "effect-app/client"
|
|
134
|
-
* import
|
|
134
|
+
* import * as Effect from "effect/Effect"
|
|
135
135
|
* import { Invalidation } from "effect-app/rpc"
|
|
136
136
|
* import * as CartRsc from "../Cart/queries.js"
|
|
137
137
|
* import * as UserRsc from "../User/queries.js"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { Effect, Layer, type Schema, Schema as S, type Scope } from "effect"
|
|
3
2
|
import { type NonEmptyArray, type NonEmptyReadonlyArray } from "effect/Array"
|
|
3
|
+
import * as Effect from "effect/Effect"
|
|
4
|
+
import * as Layer from "effect/Layer"
|
|
5
|
+
import * as S from "effect/Schema"
|
|
6
|
+
import type * as Scope from "effect/Scope"
|
|
4
7
|
import { type Simplify } from "effect/Types"
|
|
5
8
|
import { Rpc, type RpcGroup, type RpcSchema } from "effect/unstable/rpc"
|
|
6
9
|
import { type HandlersFrom } from "effect/unstable/rpc/RpcGroup"
|
|
@@ -167,9 +170,9 @@ export interface BuildingMiddleware<
|
|
|
167
170
|
> {
|
|
168
171
|
rpc: <
|
|
169
172
|
const Tag extends string,
|
|
170
|
-
Payload extends
|
|
171
|
-
Success extends
|
|
172
|
-
Error extends
|
|
173
|
+
Payload extends S.Top | S.Struct.Fields = typeof S.Void,
|
|
174
|
+
Success extends S.Top = typeof S.Void,
|
|
175
|
+
Error extends S.Top = typeof S.Never,
|
|
173
176
|
const Stream extends boolean = false,
|
|
174
177
|
Config extends GetContextConfig<RequestContextMap> = {}
|
|
175
178
|
>(tag: Tag, options?: {
|
|
@@ -178,16 +181,16 @@ export interface BuildingMiddleware<
|
|
|
178
181
|
readonly error?: Error
|
|
179
182
|
readonly stream?: Stream
|
|
180
183
|
readonly config?: Config
|
|
181
|
-
readonly primaryKey?: [Payload] extends [
|
|
182
|
-
payload: Payload extends
|
|
184
|
+
readonly primaryKey?: [Payload] extends [S.Struct.Fields] ? ((
|
|
185
|
+
payload: Payload extends S.Struct.Fields ? Simplify<S.Struct<Payload>["Type"]> : Payload["Type"]
|
|
183
186
|
) => string)
|
|
184
187
|
: never
|
|
185
188
|
}) =>
|
|
186
189
|
& Rpc.Rpc<
|
|
187
190
|
Tag,
|
|
188
|
-
Payload extends
|
|
191
|
+
Payload extends S.Struct.Fields ? S.Struct<Payload> : Payload,
|
|
189
192
|
Stream extends true ? RpcSchema.Stream<Success, Error> : Success,
|
|
190
|
-
Stream extends true ? typeof
|
|
193
|
+
Stream extends true ? typeof S.Never : Error
|
|
191
194
|
>
|
|
192
195
|
& { readonly config: Config }
|
|
193
196
|
|
|
@@ -313,7 +316,7 @@ const makeMiddlewareBasic = <Self>() =>
|
|
|
313
316
|
// the rcm config entry pointed at by the middleware's `dynamic.key` (if any).
|
|
314
317
|
// Reason: middlewares declared with `dynamic: RequestContextMap.get("foo")`
|
|
315
318
|
// don't set a static `error` field — at runtime their `.error` defaults to
|
|
316
|
-
// `
|
|
319
|
+
// `S.Never`. Without pulling from rcm, the composite middleware's
|
|
317
320
|
// `.error` collapses to `Never`, and `Rpc.exitSchema` (which walks
|
|
318
321
|
// `rpc.middlewares[*].error` to build the wire failure union) can't decode
|
|
319
322
|
// the actual middleware-thrown error type. Critical for stream rpcs whose
|
|
@@ -396,9 +399,9 @@ export const Tag = <Self>() =>
|
|
|
396
399
|
// rpc with config
|
|
397
400
|
rpc: <
|
|
398
401
|
const Tag extends string,
|
|
399
|
-
Payload extends
|
|
400
|
-
Success extends
|
|
401
|
-
Error extends
|
|
402
|
+
Payload extends S.Top | S.Struct.Fields = typeof S.Void,
|
|
403
|
+
Success extends S.Top = typeof S.Void,
|
|
404
|
+
Error extends S.Top = typeof S.Never,
|
|
402
405
|
const Stream extends boolean = false,
|
|
403
406
|
Config extends GetContextConfig<RequestContextMap["config"]> = {}
|
|
404
407
|
>(tag: Tag, options?: {
|
|
@@ -407,17 +410,17 @@ export const Tag = <Self>() =>
|
|
|
407
410
|
readonly error?: Error
|
|
408
411
|
readonly stream?: Stream
|
|
409
412
|
readonly config?: Config
|
|
410
|
-
readonly primaryKey?: [Payload] extends [
|
|
411
|
-
payload: Payload extends
|
|
413
|
+
readonly primaryKey?: [Payload] extends [S.Struct.Fields] ? ((
|
|
414
|
+
payload: Payload extends S.Struct.Fields ? Simplify<S.Struct<Payload>["Type"]> : Payload["Type"]
|
|
412
415
|
) => string)
|
|
413
416
|
: never
|
|
414
417
|
}):
|
|
415
418
|
& Rpc.Rpc<
|
|
416
419
|
Tag,
|
|
417
|
-
Payload extends
|
|
420
|
+
Payload extends S.Struct.Fields ? S.Struct<Payload> : Payload,
|
|
418
421
|
// TODO: enhance `Error`. type based on middleware config.
|
|
419
422
|
Stream extends true ? RpcSchema.Stream<Success, Error> : Success,
|
|
420
|
-
Stream extends true ? typeof
|
|
423
|
+
Stream extends true ? typeof S.Never : Error
|
|
421
424
|
>
|
|
422
425
|
& { config: Config } =>
|
|
423
426
|
{
|
package/src/rpc/RpcContextMap.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as S from "effect/Schema"
|
|
6
6
|
import { type AnyWithProps } from "effect/unstable/rpc/Rpc"
|
|
7
7
|
import * as Context from "../Context.js"
|
|
8
8
|
import { type RpcDynamic } from "./RpcMiddleware.js"
|
package/src/rpc/RpcMiddleware.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import { type Effect, type Schema, type Schema as S, type Scope, type Stream } from "effect"
|
|
5
4
|
import { type NonEmptyReadonlyArray } from "effect/Array"
|
|
5
|
+
import type * as Effect from "effect/Effect"
|
|
6
|
+
import type * as S from "effect/Schema"
|
|
7
|
+
import type * as Scope from "effect/Scope"
|
|
8
|
+
import type * as Stream from "effect/Stream"
|
|
6
9
|
import { type Rpc, RpcMiddleware } from "effect/unstable/rpc"
|
|
7
10
|
import { type TypeId } from "effect/unstable/rpc/RpcMiddleware"
|
|
8
11
|
import type * as Context from "../Context.js"
|
|
@@ -12,7 +15,7 @@ export type RpcMiddlewareV4<Provides, E, Requires> = RpcMiddleware.RpcMiddleware
|
|
|
12
15
|
|
|
13
16
|
export type RpcOptionsOriginal = {
|
|
14
17
|
readonly optional?: boolean
|
|
15
|
-
readonly error?:
|
|
18
|
+
readonly error?: S.Top
|
|
16
19
|
readonly requiredForClient?: boolean
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -40,7 +43,7 @@ export interface TagClassAny extends RpcMiddleware.AnyService {
|
|
|
40
43
|
readonly optional: boolean
|
|
41
44
|
readonly provides: any
|
|
42
45
|
readonly requires: any
|
|
43
|
-
readonly error:
|
|
46
|
+
readonly error: S.Top
|
|
44
47
|
readonly dynamic?: RpcDynamic<any, any> | undefined
|
|
45
48
|
readonly dependsOn?: NonEmptyReadonlyArray<AnyDynamic> | undefined
|
|
46
49
|
}
|
|
@@ -50,18 +53,17 @@ export declare namespace TagClass {
|
|
|
50
53
|
* @since 1.0.0
|
|
51
54
|
* @category models
|
|
52
55
|
*/
|
|
53
|
-
export type FailureSchema<Options> = Options extends { readonly error:
|
|
56
|
+
export type FailureSchema<Options> = Options extends { readonly error: S.Top; readonly optional?: false }
|
|
54
57
|
? Options["error"]
|
|
55
58
|
// actually not, the Failure depends on Dynamic Middleware Configuration!
|
|
56
59
|
// : Options extends { readonly dynamic: RpcDynamic<any, infer A> } ? A["error"]
|
|
57
|
-
: typeof
|
|
60
|
+
: typeof S.Never
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
63
|
* @since 1.0.0
|
|
61
64
|
* @category models
|
|
62
65
|
*/
|
|
63
|
-
export type Failure<Options> = Options extends { readonly error:
|
|
64
|
-
? _A
|
|
66
|
+
export type Failure<Options> = Options extends { readonly error: S.Codec<infer _A>; readonly optional?: false } ? _A
|
|
65
67
|
// actually not, the Failure depends on Dynamic Middleware Configuration!
|
|
66
68
|
: Options extends { readonly dynamic: RpcDynamic<any, infer A> } ? S.Schema.Type<A["error"]>
|
|
67
69
|
: never
|
|
@@ -70,7 +72,7 @@ export declare namespace TagClass {
|
|
|
70
72
|
* @since 1.0.0
|
|
71
73
|
* @category models
|
|
72
74
|
*/
|
|
73
|
-
export type FailureContext<Options> =
|
|
75
|
+
export type FailureContext<Options> = S.Codec.DecodingServices<FailureSchema<Options>>
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* @since 1.0.0
|
package/src/transform.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { Option } from "effect"
|
|
3
2
|
import type { NonEmptyReadonlyArray } from "effect/Array"
|
|
3
|
+
import * as Option from "effect/Option"
|
|
4
4
|
import type { Misc, Union } from "ts-toolbelt"
|
|
5
5
|
import type * as SET from "./Set.js"
|
|
6
6
|
|
package/src/utils/effectify.ts
CHANGED
package/src/utils/logLevel.ts
CHANGED
package/src/utils/logger.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import * as Effect from "effect/Effect"
|
|
5
|
+
import type * as LogLevel from "effect/LogLevel"
|
|
5
6
|
import * as Context from "../Context.js"
|
|
6
7
|
|
|
7
8
|
type Levels = "info" | "debug" | "warn" | "error"
|
package/src/utils.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
|
4
|
-
import
|
|
4
|
+
import * as Cause from "effect/Cause"
|
|
5
|
+
import * as Effect from "effect/Effect"
|
|
6
|
+
import * as Exit from "effect/Exit"
|
|
7
|
+
import * as Fiber from "effect/Fiber"
|
|
5
8
|
import { dual } from "effect/Function"
|
|
9
|
+
import * as Option from "effect/Option"
|
|
6
10
|
import { isFunction } from "effect/Predicate"
|
|
11
|
+
import * as Record from "effect/Record"
|
|
7
12
|
import * as Result from "effect/Result"
|
|
8
13
|
import { identity, pipe } from "./Function.js"
|
|
9
14
|
import type { DeepMutable, Equals, Mutable } from "./Types.js"
|
|
@@ -874,7 +879,7 @@ const genConstructor = (function*() {}).constructor
|
|
|
874
879
|
/**
|
|
875
880
|
* @example
|
|
876
881
|
* ```ts
|
|
877
|
-
* import
|
|
882
|
+
* import * as Utils from "effect/Utils"
|
|
878
883
|
*
|
|
879
884
|
* function* generatorFn() {
|
|
880
885
|
* yield 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.test.d.ts","sourceRoot":"","sources":["../rpc.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc.test.d.ts","sourceRoot":"","sources":["../rpc.test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAErF,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,qBAAa,iBAAkB,SAAQ,sBAIrC;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAI0B,KAAK;;;;AAKpC,qBAAa,KAAM,SAAQ,UAQzB;CAAG"}
|
package/test/moreStrings.test.ts
CHANGED
package/test/rpc.test.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as Effect from "effect/Effect"
|
|
2
|
+
import type * as Option from "effect/Option"
|
|
2
3
|
import { expect, test } from "vitest"
|
|
3
4
|
import { makeRpcClient, NotLoggedInError, UnauthorizedError } from "../src/client.js"
|
|
4
5
|
import { ForceVoid } from "../src/client/makeClient.js"
|
package/test/schema.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// import { generateFromArbitrary } from "@effect-app/infra/test"
|
|
2
|
-
import
|
|
2
|
+
import * as Array from "effect-app/Array"
|
|
3
|
+
import * as S from "effect-app/Schema"
|
|
3
4
|
import { specialJsonSchemaDocument } from "effect-app/Schema/SpecialJsonSchema"
|
|
4
5
|
import { describe, expect, expectTypeOf, test } from "vitest"
|
|
5
6
|
|
package/test/secretURL.test.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Chunk from "effect/Chunk"
|
|
2
|
+
import * as Config from "effect/Config"
|
|
3
|
+
import * as ConfigProvider from "effect/ConfigProvider"
|
|
4
|
+
import * as Effect from "effect/Effect"
|
|
2
5
|
import { describe, expect, test } from "vitest"
|
|
3
6
|
import { fromChunk, fromString, isSecretURL, make, secretURL, unsafeWipe, value } from "../src/Config/SecretURL.js"
|
|
4
7
|
|
package/test/special.test.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Option, Predicate, Schema, SchemaGetter } from "effect"
|
|
2
1
|
import { InvalidStateError, LoginError, NotFoundError, NotLoggedInError, OptimisticConcurrencyException, ServiceUnavailableError, UnauthorizedError, ValidationError } from "effect-app/client/errors"
|
|
3
2
|
import * as AppSchema from "effect-app/Schema"
|
|
4
3
|
import { Class } from "effect-app/Schema/Class"
|
|
5
4
|
import { flattenNestedAnyOf, flattenSimpleAllOf, specialJsonSchemaDocument } from "effect-app/Schema/SpecialJsonSchema"
|
|
6
5
|
import { deduplicateOpenApiSchemas } from "effect-app/Schema/SpecialOpenApi"
|
|
6
|
+
import * as Option from "effect/Option"
|
|
7
|
+
import * as Predicate from "effect/Predicate"
|
|
8
|
+
import * as Schema from "effect/Schema"
|
|
7
9
|
import * as S from "effect/Schema"
|
|
10
|
+
import * as SchemaGetter from "effect/SchemaGetter"
|
|
8
11
|
import { describe, expect, it } from "vitest"
|
|
9
12
|
|
|
10
13
|
describe("Class", () => {
|
package/test/utils.test.ts
CHANGED