effect-app 3.6.0 → 3.7.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 +12 -0
- package/dist/Schema/Class.d.ts +2 -19
- package/dist/Schema/Class.d.ts.map +1 -1
- package/dist/Schema/Class.js +1 -1
- package/dist/client/apiClientFactory.d.ts +1 -1
- package/package.json +4 -4
- package/src/Schema/Class.ts +6 -89
package/CHANGELOG.md
CHANGED
package/dist/Schema/Class.d.ts
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import { type Effect, type ParseResult, type Types } from "effect";
|
|
2
1
|
import type { Schema, Struct } from "effect/Schema";
|
|
3
2
|
import * as S from "effect/Schema";
|
|
4
|
-
import type { ParseOptions } from "effect/SchemaAST";
|
|
5
3
|
import type { Simplify } from "effect/Types";
|
|
6
|
-
import type { AST } from "./schema.js";
|
|
7
4
|
type ClassAnnotations<Self, A> = S.Annotations.Schema<Self> | readonly [
|
|
8
5
|
S.Annotations.Schema<Self> | undefined,
|
|
9
|
-
S.Annotations.Schema<Self
|
|
6
|
+
(S.Annotations.Schema<Self> | undefined)?,
|
|
10
7
|
S.Annotations.Schema<A>?
|
|
11
8
|
];
|
|
12
|
-
|
|
13
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
14
|
-
}[keyof T];
|
|
15
|
-
export interface EnhancedClass<Self, Fields extends Struct.Fields, I, R, C, Inherited, Proto> extends Schema<Self, I, R>, PropsExtensions<Fields> {
|
|
16
|
-
new (props: RequiredKeys<C> extends never ? void | Simplify<C> : Simplify<C>, disableValidation?: boolean): Struct.Type<Fields> & Omit<Inherited, keyof Fields> & Proto;
|
|
17
|
-
readonly fields: Simplify<Fields>;
|
|
18
|
-
readonly extend: <Extended = never>(identifier: string) => <NewFields extends Struct.Fields>(newFieldsOr: NewFields | HasFields<NewFields>, annotations?: ClassAnnotations<Extended, Struct.Type<Fields & NewFields>>) => [Extended] extends [never] ? MissingSelfGeneric<"Base.extend"> : EnhancedClass<Extended, Fields & NewFields, Simplify<I & Struct.Encoded<NewFields>>, R | Struct.Context<NewFields>, Simplify<C & S.Struct.Constructor<NewFields>>, Self, Proto>;
|
|
19
|
-
readonly transformOrFail: <Transformed = never>(identifier: string) => <NewFields extends Struct.Fields, R2, R3>(fields: NewFields, options: {
|
|
20
|
-
readonly decode: (input: Types.Simplify<Struct.Type<Fields>>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<Types.Simplify<Struct.Type<Fields & NewFields>>, ParseResult.ParseIssue, R2>;
|
|
21
|
-
readonly encode: (input: Types.Simplify<Struct.Type<Fields & NewFields>>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<Struct.Type<Fields>, ParseResult.ParseIssue, R3>;
|
|
22
|
-
}, annotations?: ClassAnnotations<Transformed, Struct.Type<Fields & NewFields>>) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transform"> : EnhancedClass<Transformed, Fields & NewFields, I, R | Struct.Context<NewFields> | R2 | R3, C & Struct.Constructor<NewFields>, Self, Proto>;
|
|
23
|
-
readonly transformOrFailFrom: <Transformed = never>(identifier: string) => <NewFields extends Struct.Fields, R2, R3>(fields: NewFields, options: {
|
|
24
|
-
readonly decode: (input: Types.Simplify<I>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<Types.Simplify<I & Struct.Encoded<NewFields>>, ParseResult.ParseIssue, R2>;
|
|
25
|
-
readonly encode: (input: Types.Simplify<I & Struct.Encoded<NewFields>>, options: ParseOptions, ast: AST.Transformation) => Effect.Effect<I, ParseResult.ParseIssue, R3>;
|
|
26
|
-
}, annotations?: ClassAnnotations<Transformed, Struct.Type<Fields & NewFields>>) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transformFrom"> : EnhancedClass<Transformed, Fields & NewFields, I, R | Struct.Context<NewFields> | R2 | R3, Simplify<C & S.Struct.Constructor<NewFields>>, Self, Proto>;
|
|
9
|
+
export interface EnhancedClass<Self, Fields extends Struct.Fields, I, R, C, Inherited, Proto> extends S.Class<Self, Fields, I, R, C, Inherited, Proto>, /* Reason for enhancement */ PropsExtensions<Fields> {
|
|
27
10
|
}
|
|
28
11
|
type MissingSelfGeneric<Usage extends string, Params extends string = ""> = `Missing \`Self\` generic - use \`class Self extends ${Usage}<Self>()(${Params}{ ... })\``;
|
|
29
12
|
export interface PropsExtensions<Fields> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../src/Schema/Class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../src/Schema/Class.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,CAAC,MAAM,eAAe,CAAA;AAClC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,KAAK,gBAAgB,CAAC,IAAI,EAAE,CAAC,IACzB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAC1B,SAAS;IAET,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS;IAEtC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IAEzC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACzB,CAAA;AAEH,MAAM,WAAW,aAAa,CAAC,IAAI,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,CAC1F,SAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,4BAA4B,CAAC,eAAe,CAAC,MAAM,CAAC;CAE/G;A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,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EACtC,EAAE,EACF,EAAE,CACY,CAAA;AAEhB,MAAM,WAAW,mBAAmB,CAAC,IAAI,EAAE,GAAG,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CACnG,SACE,aAAa,CACX,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EACtB,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACxC,EAAE,EACF,EAAE,CACH;IAEH,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAA;CACnB;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,IAAI,EAAE,QAAQ,EAC/C,UAAU,CAAC,EAAE,MAAM,KAChB,CAAC,GAAG,SAAS,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,MAAM,CAAC,MAAM,EACtD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,EACpC,WAAW,CAAC,EAAE,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KACtD,mBAAmB,CACtB,IAAI,EACJ,GAAG,EACH;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,EACtC,QAAQ,CACY,CAAA"}
|
package/dist/Schema/Class.js
CHANGED
|
@@ -47,4 +47,4 @@ export const TaggedClass = (identifier) => (tag, fields, annotations) => {
|
|
|
47
47
|
};
|
|
48
48
|
export const ExtendedClass = Class;
|
|
49
49
|
export const ExtendedTaggedClass = TaggedClass;
|
|
50
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ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sSUFBSSxDQUFDLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQTtLQUNsRixDQUFBO0FBQ1YsQ0FBQyxDQUFBO0FBRUgsTUFBTSxDQUFDLE1BQU0sYUFBYSxHQVd0QixLQUFZLENBQUE7QUFpQmhCLE1BQU0sQ0FBQyxNQUFNLG1CQUFtQixHQVc1QixXQUFrQixDQUFBIn0=
|
|
@@ -58,7 +58,7 @@ declare const ApiClientFactory_base: (abstract new (service: (requestLevelLayers
|
|
|
58
58
|
toLayerScoped: <E, R>(eff: Effect.Effect<Omit<ApiClientFactory, keyof Context.TagClassShape<any, any>>, E, R>) => Layer.Layer<ApiClientFactory, E, Exclude<R, import("effect/Scope").Scope>>;
|
|
59
59
|
of: (service: Omit<ApiClientFactory, keyof Context.TagClassShape<any, any>>) => ApiClientFactory;
|
|
60
60
|
} & Context.Tag<ApiClientFactory, ApiClientFactory> & {} & {
|
|
61
|
-
use: <X>(body: (_: (requestLevelLayers: Layer.Layer<never, never, never>, options?: ClientForOptions) => <M extends Requests>(models: M) => Effect.Effect<import("./clientFor.js").RequestHandlers<never, never, Omit<M, "meta">, M["meta"]["moduleName"]>, never, never>) => X) => X extends Effect.Effect<infer A, infer E, infer R> ? Effect.Effect<A, E,
|
|
61
|
+
use: <X>(body: (_: (requestLevelLayers: Layer.Layer<never, never, never>, options?: ClientForOptions) => <M extends Requests>(models: M) => Effect.Effect<import("./clientFor.js").RequestHandlers<never, never, Omit<M, "meta">, M["meta"]["moduleName"]>, never, never>) => X) => X extends Effect.Effect<infer A, infer E, infer R> ? Effect.Effect<A, E, R | ApiClientFactory> : Effect.Effect<X, never, ApiClientFactory>;
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* Used to create clients for resource modules.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-app",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@faker-js/faker": "^8.4.1",
|
|
20
|
-
"@types/node": "~24.
|
|
21
|
-
"@types/uuid": "^
|
|
20
|
+
"@types/node": "~24.5.1",
|
|
21
|
+
"@types/uuid": "^11.0.0",
|
|
22
22
|
"@types/validator": "^13.15.3",
|
|
23
23
|
"fast-check": "~4.3.0",
|
|
24
24
|
"typescript": "~5.9.2",
|
|
25
25
|
"vitest": "^3.2.4",
|
|
26
|
-
"@effect-app/eslint-shared-config": "0.
|
|
26
|
+
"@effect-app/eslint-shared-config": "0.2.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@effect/platform": "^0.90.9",
|
package/src/Schema/Class.ts
CHANGED
|
@@ -1,106 +1,23 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import {
|
|
2
|
+
import { pipe, Struct as Struct2 } from "effect"
|
|
3
3
|
import type { Schema, Struct } from "effect/Schema"
|
|
4
4
|
import * as S from "effect/Schema"
|
|
5
|
-
import type { ParseOptions } from "effect/SchemaAST"
|
|
6
5
|
import type { Simplify } from "effect/Types"
|
|
7
|
-
import type { AST } from "./schema.js"
|
|
8
6
|
|
|
9
7
|
type ClassAnnotations<Self, A> =
|
|
10
8
|
| S.Annotations.Schema<Self>
|
|
11
9
|
| readonly [
|
|
10
|
+
// Annotations for the "to" schema
|
|
12
11
|
S.Annotations.Schema<Self> | undefined,
|
|
13
|
-
|
|
12
|
+
// Annotations for the "transformation schema
|
|
13
|
+
(S.Annotations.Schema<Self> | undefined)?,
|
|
14
|
+
// Annotations for the "from" schema
|
|
14
15
|
S.Annotations.Schema<A>?
|
|
15
16
|
]
|
|
16
17
|
|
|
17
|
-
type RequiredKeys<T> = {
|
|
18
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? never : K
|
|
19
|
-
}[keyof T]
|
|
20
|
-
|
|
21
18
|
export interface EnhancedClass<Self, Fields extends Struct.Fields, I, R, C, Inherited, Proto>
|
|
22
|
-
extends
|
|
19
|
+
extends S.Class<Self, Fields, I, R, C, Inherited, Proto>, /* Reason for enhancement */ PropsExtensions<Fields>
|
|
23
20
|
{
|
|
24
|
-
new(
|
|
25
|
-
props: RequiredKeys<C> extends never ? void | Simplify<C> : Simplify<C>,
|
|
26
|
-
disableValidation?: boolean
|
|
27
|
-
): Struct.Type<Fields> & Omit<Inherited, keyof Fields> & Proto
|
|
28
|
-
|
|
29
|
-
readonly fields: Simplify<Fields>
|
|
30
|
-
|
|
31
|
-
readonly extend: <Extended = never>(identifier: string) => <NewFields extends Struct.Fields>(
|
|
32
|
-
newFieldsOr: NewFields | HasFields<NewFields>,
|
|
33
|
-
annotations?: ClassAnnotations<Extended, Struct.Type<Fields & NewFields>>
|
|
34
|
-
) => [Extended] extends [never] ? MissingSelfGeneric<"Base.extend">
|
|
35
|
-
: EnhancedClass<
|
|
36
|
-
Extended,
|
|
37
|
-
Fields & NewFields,
|
|
38
|
-
Simplify<I & Struct.Encoded<NewFields>>,
|
|
39
|
-
R | Struct.Context<NewFields>,
|
|
40
|
-
Simplify<C & S.Struct.Constructor<NewFields>>,
|
|
41
|
-
Self,
|
|
42
|
-
Proto
|
|
43
|
-
>
|
|
44
|
-
|
|
45
|
-
readonly transformOrFail: <Transformed = never>(identifier: string) => <
|
|
46
|
-
NewFields extends Struct.Fields,
|
|
47
|
-
R2,
|
|
48
|
-
R3
|
|
49
|
-
>(
|
|
50
|
-
fields: NewFields,
|
|
51
|
-
options: {
|
|
52
|
-
readonly decode: (
|
|
53
|
-
input: Types.Simplify<Struct.Type<Fields>>,
|
|
54
|
-
options: ParseOptions,
|
|
55
|
-
ast: AST.Transformation
|
|
56
|
-
) => Effect.Effect<Types.Simplify<Struct.Type<Fields & NewFields>>, ParseResult.ParseIssue, R2>
|
|
57
|
-
readonly encode: (
|
|
58
|
-
input: Types.Simplify<Struct.Type<Fields & NewFields>>,
|
|
59
|
-
options: ParseOptions,
|
|
60
|
-
ast: AST.Transformation
|
|
61
|
-
) => Effect.Effect<Struct.Type<Fields>, ParseResult.ParseIssue, R3>
|
|
62
|
-
},
|
|
63
|
-
annotations?: ClassAnnotations<Transformed, Struct.Type<Fields & NewFields>>
|
|
64
|
-
) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transform">
|
|
65
|
-
: EnhancedClass<
|
|
66
|
-
Transformed,
|
|
67
|
-
Fields & NewFields,
|
|
68
|
-
I,
|
|
69
|
-
R | Struct.Context<NewFields> | R2 | R3,
|
|
70
|
-
C & Struct.Constructor<NewFields>,
|
|
71
|
-
Self,
|
|
72
|
-
Proto
|
|
73
|
-
>
|
|
74
|
-
|
|
75
|
-
readonly transformOrFailFrom: <Transformed = never>(identifier: string) => <
|
|
76
|
-
NewFields extends Struct.Fields,
|
|
77
|
-
R2,
|
|
78
|
-
R3
|
|
79
|
-
>(
|
|
80
|
-
fields: NewFields,
|
|
81
|
-
options: {
|
|
82
|
-
readonly decode: (
|
|
83
|
-
input: Types.Simplify<I>,
|
|
84
|
-
options: ParseOptions,
|
|
85
|
-
ast: AST.Transformation
|
|
86
|
-
) => Effect.Effect<Types.Simplify<I & Struct.Encoded<NewFields>>, ParseResult.ParseIssue, R2>
|
|
87
|
-
readonly encode: (
|
|
88
|
-
input: Types.Simplify<I & Struct.Encoded<NewFields>>,
|
|
89
|
-
options: ParseOptions,
|
|
90
|
-
ast: AST.Transformation
|
|
91
|
-
) => Effect.Effect<I, ParseResult.ParseIssue, R3>
|
|
92
|
-
},
|
|
93
|
-
annotations?: ClassAnnotations<Transformed, Struct.Type<Fields & NewFields>>
|
|
94
|
-
) => [Transformed] extends [never] ? MissingSelfGeneric<"Base.transformFrom">
|
|
95
|
-
: EnhancedClass<
|
|
96
|
-
Transformed,
|
|
97
|
-
Fields & NewFields,
|
|
98
|
-
I,
|
|
99
|
-
R | Struct.Context<NewFields> | R2 | R3,
|
|
100
|
-
Simplify<C & S.Struct.Constructor<NewFields>>,
|
|
101
|
-
Self,
|
|
102
|
-
Proto
|
|
103
|
-
>
|
|
104
21
|
}
|
|
105
22
|
type MissingSelfGeneric<Usage extends string, Params extends string = ""> =
|
|
106
23
|
`Missing \`Self\` generic - use \`class Self extends ${Usage}<Self>()(${Params}{ ... })\``
|