effect-app 4.0.0-beta.285 → 4.0.0-beta.287
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/Model/Repository/internal/internal.d.ts.map +1 -1
- package/dist/Model/Repository/internal/internal.js +2 -2
- package/dist/Model/query/new-kid-interpreter.d.ts.map +1 -1
- package/dist/Model/query/new-kid-interpreter.js +2 -2
- package/dist/RequestContext.d.ts +47 -117
- package/dist/RequestContext.d.ts.map +1 -1
- package/dist/RequestContext.js +3 -12
- package/dist/Schema/Class.d.ts +1 -1
- package/dist/Schema/Class.d.ts.map +1 -1
- package/dist/Schema/Class.js +2 -2
- package/dist/Schema/ext.d.ts +1 -1
- package/dist/Schema/ext.d.ts.map +1 -1
- package/dist/Schema/ext.js +1 -1
- package/dist/Schema/moreStrings.d.ts +1 -1
- package/dist/Schema/moreStrings.d.ts.map +1 -1
- package/dist/Schema/moreStrings.js +1 -1
- package/dist/Schema/numbers.d.ts +1 -1
- package/dist/Schema/numbers.d.ts.map +1 -1
- package/dist/Schema/schema.d.ts +1 -1
- package/dist/Schema/schema.d.ts.map +1 -1
- package/dist/Schema/schema.js +2 -2
- package/dist/Schema/strings.d.ts +1 -1
- package/dist/Schema/strings.d.ts.map +1 -1
- package/dist/Schema.d.ts +5 -10
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +3 -4
- package/dist/SchemaAST.d.ts +0 -21
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +1 -24
- package/dist/rpc/Invalidation.d.ts +2 -2
- package/package.json +2 -2
- package/src/Model/Repository/internal/internal.ts +1 -1
- package/src/Model/query/new-kid-interpreter.ts +1 -1
- package/src/RequestContext.ts +2 -49
- package/src/Schema/Class.ts +1 -1
- package/src/Schema/ext.ts +1 -1
- package/src/Schema/moreStrings.ts +1 -1
- package/src/Schema/numbers.ts +1 -1
- package/src/Schema/schema.ts +1 -1
- package/src/Schema/strings.ts +1 -1
- package/src/Schema.ts +6 -12
- package/src/SchemaAST.ts +0 -28
- package/test/special.test.ts +1 -1
|
@@ -1888,7 +1888,7 @@ export interface CommandRpc extends Rpc.Custom {
|
|
|
1888
1888
|
* Wraps the success schema with `CommandResponseWithMetaData` and the error
|
|
1889
1889
|
* schema with `CommandFailureWithMetaData`.
|
|
1890
1890
|
*/
|
|
1891
|
-
export declare const makeCommandRpc: <const Tag extends string, Payload extends S.Top | import("effect/Schema").Struct.Fields =
|
|
1891
|
+
export declare const makeCommandRpc: <const Tag extends string, Payload extends S.Top | import("effect/Schema").Struct.Fields = import("effect/Schema").Void, Success extends S.Top = import("effect/Schema").Void, Error extends S.Top = S.Never, const Stream extends boolean = false, Out extends Rpc.Custom.OutDefault = Rpc.Custom.Out<S.Struct<{
|
|
1892
1892
|
readonly payload: S.Top & Success;
|
|
1893
1893
|
readonly metadata: S.Struct<{
|
|
1894
1894
|
readonly invalidateQueries: S.$Array<S.$Array<S.Codec<S.Json, S.Json, never, never>> & {
|
|
@@ -2395,7 +2395,7 @@ export interface StreamRpc extends Rpc.Custom {
|
|
|
2395
2395
|
* Wraps the success schema with `StreamResponseChunk` and
|
|
2396
2396
|
* the error schema with `StreamFailureChunk`.
|
|
2397
2397
|
*/
|
|
2398
|
-
export declare const makeStreamRpc: <const Tag extends string, Payload extends S.Top | import("effect/Schema").Struct.Fields =
|
|
2398
|
+
export declare const makeStreamRpc: <const Tag extends string, Payload extends S.Top | import("effect/Schema").Struct.Fields = import("effect/Schema").Void, Success extends S.Top = import("effect/Schema").Void, Error extends S.Top = S.Never, const Stream extends boolean = false, Out extends Rpc.Custom.OutDefault = Rpc.Custom.Out<S.Union<readonly [S.Struct<{
|
|
2399
2399
|
readonly _tag: S.Literal<"value">;
|
|
2400
2400
|
readonly value: S.Top & Success;
|
|
2401
2401
|
}>, S.Struct<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-app",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.287",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"vitest": "^4.1.7"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"effect": "^4.0.0-beta.
|
|
24
|
+
"effect": "^4.0.0-beta.90"
|
|
25
25
|
},
|
|
26
26
|
"typesVersions": {
|
|
27
27
|
"*": {
|
|
@@ -7,7 +7,6 @@ import * as HashSet from "effect/HashSet"
|
|
|
7
7
|
import * as Pipeable from "effect/Pipeable"
|
|
8
8
|
import * as Ref from "effect/Ref"
|
|
9
9
|
import * as Result from "effect/Result"
|
|
10
|
-
import * as SchemaAST from "../../../SchemaAST.ts"
|
|
11
10
|
import type * as Scope from "effect/Scope"
|
|
12
11
|
import * as Unify from "effect/Unify"
|
|
13
12
|
import * as Array from "../../../Array.ts"
|
|
@@ -22,6 +21,7 @@ import { flatMapOption } from "../../../Effect.ts"
|
|
|
22
21
|
import * as Option from "../../../Option.ts"
|
|
23
22
|
import * as S from "../../../Schema.ts"
|
|
24
23
|
import { type Codec, NonNegativeInt } from "../../../Schema.ts"
|
|
24
|
+
import * as SchemaAST from "../../../SchemaAST.ts"
|
|
25
25
|
import { setupRequestContextFromCurrent } from "../../../setupRequest.ts"
|
|
26
26
|
import { type FilterArgs, getContextMap, type PersistenceModelType, type StoreConfig, storeId, StoreMaker } from "../../../Store.ts"
|
|
27
27
|
import type { FieldValues } from "../../filter/types.ts"
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
3
|
import { identity, pipe } from "effect/Function"
|
|
4
4
|
import * as Match from "effect/Match"
|
|
5
|
-
import * as SchemaAST from "../../SchemaAST.ts"
|
|
6
5
|
import * as Array from "../../Array.ts"
|
|
7
6
|
import { toNonEmptyArray } from "../../Array.ts"
|
|
8
7
|
import * as Option from "../../Option.ts"
|
|
9
8
|
import * as S from "../../Schema.ts"
|
|
9
|
+
import * as SchemaAST from "../../SchemaAST.ts"
|
|
10
10
|
import { dropUndefinedT } from "../../utils.ts"
|
|
11
11
|
import type { FilterResult } from "../filter/filterApi.ts"
|
|
12
12
|
import type { FieldValues } from "../filter/types.ts"
|
package/src/RequestContext.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type Locale = typeof Locale.Type
|
|
|
8
8
|
|
|
9
9
|
export class LocaleRef extends Context.Reference("Locale", { defaultValue: (): Locale => "en" }) {}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
export class RequestContext extends S.Opaque<RequestContext>()(S.Struct({
|
|
12
12
|
span: S.Struct({
|
|
13
13
|
traceId: S.String,
|
|
14
14
|
spanId: S.String,
|
|
@@ -20,20 +20,7 @@ const _RequestContext = S.Struct({
|
|
|
20
20
|
namespace: NonEmptyString255,
|
|
21
21
|
/** @deprecated */
|
|
22
22
|
userProfile: S.optional(S.Struct({ sub: UserProfileId })) //
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
// codegen:start {preset: modelFacade, className: _RequestContext, schema: S, base: true}
|
|
26
|
-
class __RequestContext extends S.OpaqueFacade<
|
|
27
|
-
RequestContext,
|
|
28
|
-
RequestContext.Encoded,
|
|
29
|
-
RequestContext.Make,
|
|
30
|
-
RequestContext.DecodingServices,
|
|
31
|
-
RequestContext.EncodingServices
|
|
32
|
-
>()(_RequestContext) {}
|
|
33
|
-
// codegen:end
|
|
34
|
-
|
|
35
|
-
// eslint-disable-next-line typescript/no-unsafe-declaration-merging
|
|
36
|
-
export class RequestContext extends __RequestContext {
|
|
23
|
+
})) {
|
|
37
24
|
static toMonitoring(this: void, self: RequestContext) {
|
|
38
25
|
return {
|
|
39
26
|
operationName: self.name,
|
|
@@ -59,37 +46,3 @@ export const spanAttributes = (ctx: Pick<RequestContext, "locale" | "namespace">
|
|
|
59
46
|
}
|
|
60
47
|
: {})
|
|
61
48
|
})
|
|
62
|
-
|
|
63
|
-
// codegen:start {preset: model, static: true, facade: true}
|
|
64
|
-
//
|
|
65
|
-
export interface RequestContext {
|
|
66
|
-
readonly span: { readonly traceId: string; readonly spanId: string; readonly sampled: boolean }
|
|
67
|
-
readonly name: S.NonEmptyString255
|
|
68
|
-
readonly locale: "en" | "de"
|
|
69
|
-
readonly namespace: S.NonEmptyString255
|
|
70
|
-
readonly sourceId?: undefined | S.NonEmptyString255
|
|
71
|
-
readonly userProfile?: undefined | { readonly sub: UserProfileId }
|
|
72
|
-
}
|
|
73
|
-
export namespace RequestContext {
|
|
74
|
-
export interface Encoded {
|
|
75
|
-
readonly span: { readonly traceId: string; readonly spanId: string; readonly sampled: boolean }
|
|
76
|
-
readonly name: string
|
|
77
|
-
readonly locale: "en" | "de"
|
|
78
|
-
readonly namespace: string
|
|
79
|
-
readonly sourceId?: undefined | string
|
|
80
|
-
readonly userProfile?: undefined | { readonly sub: string }
|
|
81
|
-
}
|
|
82
|
-
export interface Make {
|
|
83
|
-
readonly span: { readonly traceId: string; readonly spanId: string; readonly sampled: boolean }
|
|
84
|
-
readonly name: S.NonEmptyString255
|
|
85
|
-
readonly locale: "en" | "de"
|
|
86
|
-
readonly namespace: S.NonEmptyString255
|
|
87
|
-
readonly sourceId?: undefined | S.NonEmptyString255
|
|
88
|
-
readonly userProfile?: undefined | { readonly sub: UserProfileId }
|
|
89
|
-
}
|
|
90
|
-
export type DecodingServices = never
|
|
91
|
-
export type EncodingServices = never
|
|
92
|
-
}
|
|
93
|
-
//
|
|
94
|
-
// codegen:end
|
|
95
|
-
//
|
package/src/Schema/Class.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type * as Cause from "effect/Cause"
|
|
|
3
3
|
import * as Effect from "effect/Effect"
|
|
4
4
|
import * as Option from "effect/Option"
|
|
5
5
|
import * as S from "effect/Schema"
|
|
6
|
-
import * as SchemaAST from "../SchemaAST.ts"
|
|
7
6
|
import * as SchemaGetter from "effect/SchemaGetter"
|
|
8
7
|
import * as SchemaIssue from "effect/SchemaIssue"
|
|
9
8
|
import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
10
9
|
import type { Struct as EffectAppStruct } from "../Schema.ts"
|
|
10
|
+
import * as SchemaAST from "../SchemaAST.ts"
|
|
11
11
|
import { copyOrigin } from "../utils.ts"
|
|
12
12
|
import { concurrencyUnbounded } from "./ext.ts"
|
|
13
13
|
import * as SchemaParser from "./SchemaParser.ts"
|
package/src/Schema/ext.ts
CHANGED
|
@@ -37,11 +37,11 @@ import * as Function from "effect/Function"
|
|
|
37
37
|
import * as Option from "effect/Option"
|
|
38
38
|
import * as S from "effect/Schema"
|
|
39
39
|
import { isDateValid } from "effect/Schema"
|
|
40
|
-
import type * as SchemaAST from "../SchemaAST.ts"
|
|
41
40
|
import * as SchemaIssue from "effect/SchemaIssue"
|
|
42
41
|
import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
43
42
|
import { type NonEmptyReadonlyArray } from "../Array.ts"
|
|
44
43
|
import * as Context from "../Context.ts"
|
|
44
|
+
import type * as SchemaAST from "../SchemaAST.ts"
|
|
45
45
|
import { extendM, typedKeysOf } from "../utils.ts"
|
|
46
46
|
import { type AST } from "./schema.ts"
|
|
47
47
|
|
|
@@ -14,10 +14,10 @@ import type * as B from "effect/Brand"
|
|
|
14
14
|
import * as Effect from "effect/Effect"
|
|
15
15
|
import { pipe } from "effect/Function"
|
|
16
16
|
import * as S from "effect/Schema"
|
|
17
|
-
import type * as SchemaAST from "../SchemaAST.ts"
|
|
18
17
|
import type { Simplify } from "effect/Types"
|
|
19
18
|
import { customRandom, nanoid, urlAlphabet } from "nanoid"
|
|
20
19
|
import validator from "validator"
|
|
20
|
+
import type * as SchemaAST from "../SchemaAST.ts"
|
|
21
21
|
import { type BrandedSchema, fromBrand, nominal } from "./brand.ts"
|
|
22
22
|
import { withDefaultMake } from "./ext.ts"
|
|
23
23
|
import { type B as SchemaB } from "./schema.ts"
|
package/src/Schema/numbers.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
import { extendM } from "effect-app/utils"
|
|
12
12
|
import * as Effect from "effect/Effect"
|
|
13
13
|
import * as S from "effect/Schema"
|
|
14
|
-
import type * as SchemaAST from "../SchemaAST.ts"
|
|
15
14
|
import type { Simplify } from "effect/Types"
|
|
15
|
+
import type * as SchemaAST from "../SchemaAST.ts"
|
|
16
16
|
import { type BrandedSchema, fromBrand, nominal } from "./brand.ts"
|
|
17
17
|
import { withDefaultMake } from "./ext.ts"
|
|
18
18
|
import { type B } from "./schema.ts"
|
package/src/Schema/schema.ts
CHANGED
package/src/Schema/strings.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as B from "effect/Brand"
|
|
2
2
|
import * as S from "effect/Schema"
|
|
3
|
-
import type * as SchemaAST from "../SchemaAST.ts"
|
|
4
3
|
import type { Simplify } from "effect/Types"
|
|
4
|
+
import type * as SchemaAST from "../SchemaAST.ts"
|
|
5
5
|
import { type BrandedSchema, fromBrand, nominal } from "./brand.ts"
|
|
6
6
|
import { withDefaultMake } from "./ext.ts"
|
|
7
7
|
|
package/src/Schema.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as S from "effect/Schema"
|
|
2
|
-
import * as SchemaAST from "./SchemaAST.ts"
|
|
3
2
|
import { type Simplify } from "effect/Struct"
|
|
4
3
|
import type * as Tracer from "effect/Tracer"
|
|
5
4
|
import type { RequiredKeys } from "effect/Types"
|
|
@@ -9,6 +8,7 @@ import { Email as EmailT, type Email as EmailType } from "./Schema/email.ts"
|
|
|
9
8
|
import { concurrencyUnbounded, withDefaultMake, withDefaultParseOptions } from "./Schema/ext.ts"
|
|
10
9
|
import { PhoneNumber as PhoneNumberT, type PhoneNumber as PhoneNumberType } from "./Schema/phoneNumber.ts"
|
|
11
10
|
import { type AST } from "./Schema/schema.ts"
|
|
11
|
+
import * as SchemaAST from "./SchemaAST.ts"
|
|
12
12
|
import { copy, extendM, type StructuralCopyOrigin } from "./utils.ts"
|
|
13
13
|
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
@@ -135,20 +135,14 @@ export const decodeUnknownEffectConcurrently: typeof S.decodeUnknownEffect = wit
|
|
|
135
135
|
)
|
|
136
136
|
export * as SchemaParser from "./Schema/SchemaParser.ts"
|
|
137
137
|
|
|
138
|
-
export { Void as Void_ } from "effect/Schema"
|
|
139
|
-
|
|
140
138
|
/**
|
|
141
|
-
* Schema for a TypeScript `void` return value — the
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* present value** at runtime and discards it to `undefined`, while keeping the
|
|
146
|
-
* decoded/encoded type as `void` (effect-smol PR #2475). Use {@link Void_}
|
|
147
|
-
* (effect's original) or `S.Undefined` when the input must be exactly
|
|
148
|
-
* `undefined`.
|
|
139
|
+
* Schema for a TypeScript `void` return value — the canonical `Void` used
|
|
140
|
+
* across the app, including RPC success schemas. Accepts **any present value**
|
|
141
|
+
* at runtime and discards it to `undefined`, while keeping the decoded/encoded
|
|
142
|
+
* type as `void`. Use `S.Undefined` when the input must be exactly `undefined`.
|
|
149
143
|
*/
|
|
150
144
|
export interface Void extends S.Void {}
|
|
151
|
-
export const Void: Void = S.
|
|
145
|
+
export const Void: Void = S.Void
|
|
152
146
|
|
|
153
147
|
// ---------------------------------------------------------------------------
|
|
154
148
|
// Struct / NonEmptyArray / Record
|
package/src/SchemaAST.ts
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect"
|
|
2
|
-
import type * as Option from "effect/Option"
|
|
3
|
-
import { Void as BaseVoid } from "effect/SchemaAST"
|
|
4
|
-
|
|
5
1
|
export * from "effect/SchemaAST"
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* AST node for a TypeScript `void` return value — overrides effect's
|
|
9
|
-
* `SchemaAST.Void` parser with TypeScript `void` semantics (the effect-smol
|
|
10
|
-
* PR #2475 / `b7d46ab` implementation).
|
|
11
|
-
*
|
|
12
|
-
* Runtime parsing accepts **any present value** and discards it, producing
|
|
13
|
-
* `undefined` — matching a `void` return whose result callers never observe.
|
|
14
|
-
* The decoded/encoded TypeScript representation stays `void`.
|
|
15
|
-
*
|
|
16
|
-
* @see {@link void_} for the singleton instance.
|
|
17
|
-
*/
|
|
18
|
-
export class Void extends BaseVoid {
|
|
19
|
-
/** @internal — mirrors the PR's `fromAnyToConst(undefined)`. */
|
|
20
|
-
getParser() {
|
|
21
|
-
const succeed = Effect.succeedSome(undefined)
|
|
22
|
-
return (oinput: Option.Option<unknown>) => oinput._tag === "None" ? Effect.succeedNone : succeed
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const voidNode: Void = new Void()
|
|
27
|
-
|
|
28
|
-
/** Singleton {@link Void} AST node — overrides effect's `void` singleton. */
|
|
29
|
-
export { voidNode as void }
|
package/test/special.test.ts
CHANGED
|
@@ -469,7 +469,7 @@ describe("OpaqueFacade", () => {
|
|
|
469
469
|
})
|
|
470
470
|
|
|
471
471
|
it("keeps generated struct facades decodable with public statics", () => {
|
|
472
|
-
const input: RequestContext.Encoded = {
|
|
472
|
+
const input: typeof RequestContext.Encoded = {
|
|
473
473
|
span: { traceId: "trace", spanId: "span", sampled: true },
|
|
474
474
|
name: "operation",
|
|
475
475
|
locale: "en",
|