effect-app 4.0.0-beta.267 → 4.0.0-beta.269
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 +30 -0
- package/dist/Model/filter/types/path/eager.d.ts +1 -29
- package/dist/Model/filter/types/path/eager.d.ts.map +1 -1
- package/dist/Model/filter/types/path/eager.js +9 -10
- package/dist/Model/filter/types.d.ts +4 -4
- package/dist/RequestContext.d.ts +121 -4
- package/dist/RequestContext.d.ts.map +1 -1
- package/dist/RequestContext.js +7 -2
- package/dist/Schema/Class.d.ts +93 -1
- package/dist/Schema/Class.d.ts.map +1 -1
- package/dist/Schema/Class.js +25 -3
- package/dist/Schema/SpecialOpenApi.js +1 -1
- package/dist/Schema.d.ts +2 -2
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2 -2
- package/dist/client/errors.d.ts +1 -1
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js +2 -2
- package/dist/client.d.ts +5 -5
- package/dist/rpc/Invalidation.js +3 -3
- package/dist/utils.d.ts +6 -6
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +15 -11
- package/package.json +3 -3
- package/src/Array.ts +2 -2
- package/src/Chunk.ts +3 -3
- package/src/Config/SecretURL.ts +1 -1
- package/src/Config/internal/configSecretURL.ts +1 -1
- package/src/Config.ts +1 -1
- package/src/Effect.ts +3 -3
- package/src/Emailer.ts +4 -4
- package/src/Inputify.type.ts +1 -1
- package/src/Layer.ts +2 -2
- package/src/Model/Repository/Registry.ts +3 -3
- package/src/Model/Repository/ext.ts +11 -11
- package/src/Model/Repository/internal/internal.ts +16 -16
- package/src/Model/Repository/legacy.ts +4 -4
- package/src/Model/Repository/makeRepo.ts +11 -11
- package/src/Model/Repository/service.ts +9 -9
- package/src/Model/Repository/validation.ts +2 -2
- package/src/Model/Repository.ts +6 -6
- package/src/Model/dsl.ts +4 -4
- package/src/Model/filter/filterApi.ts +1 -1
- package/src/Model/filter/types/errors.ts +3 -3
- package/src/Model/filter/types/fields.ts +2 -2
- package/src/Model/filter/types/path/common.ts +1 -1
- package/src/Model/filter/types/path/eager.ts +11 -9
- package/src/Model/filter/types/path/index.ts +2 -2
- package/src/Model/filter/types/validator.ts +3 -3
- package/src/Model/query/dsl.ts +6 -6
- package/src/Model/query/new-kid-interpreter.ts +9 -9
- package/src/Model/query.ts +2 -2
- package/src/Model.ts +4 -4
- package/src/NonEmptySet.ts +3 -3
- package/src/Option.ts +1 -1
- package/src/Pure.ts +2 -2
- package/src/QueueMaker.ts +3 -3
- package/src/RequestContext.ts +43 -10
- package/src/Schema/Class.ts +247 -5
- package/src/Schema/SchemaParser.ts +1 -1
- package/src/Schema/SpecialOpenApi.ts +2 -2
- package/src/Schema/email.ts +2 -2
- package/src/Schema/ext.ts +4 -4
- package/src/Schema/moreStrings.ts +4 -4
- package/src/Schema/numbers.ts +3 -3
- package/src/Schema/phoneNumber.ts +4 -4
- package/src/Schema/strings.ts +2 -2
- package/src/Schema.ts +23 -23
- package/src/Set.ts +1 -1
- package/src/Store.ts +11 -11
- package/src/_ext/Array.ts +1 -1
- package/src/client/InvalidationKeys.ts +3 -3
- package/src/client/apiClientFactory.ts +9 -9
- package/src/client/clientFor.ts +3 -3
- package/src/client/errors.ts +7 -2
- package/src/client/makeClient.ts +4 -4
- package/src/http/Request.ts +2 -2
- package/src/http.ts +1 -1
- package/src/ids.ts +2 -2
- package/src/index.ts +19 -19
- package/src/middleware.ts +1 -1
- package/src/rpc/Invalidation.ts +7 -7
- package/src/rpc/MiddlewareMaker.ts +6 -6
- package/src/rpc/RpcContextMap.ts +2 -2
- package/src/rpc/RpcMiddleware.ts +2 -2
- package/src/rpc.ts +4 -4
- package/src/runtime.ts +4 -4
- package/src/setupRequest.ts +6 -6
- package/src/toast.ts +4 -4
- package/src/transform.ts +1 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils.ts +23 -19
- package/src/validation.ts +2 -2
- package/src/withToast.ts +7 -7
- package/tsconfig.json +1 -0
package/src/Store.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import * as Data from "effect/Data"
|
|
3
3
|
import type * as Redacted from "effect/Redacted"
|
|
4
4
|
import * as Semaphore from "effect/Semaphore"
|
|
5
|
-
import type { NonEmptyReadonlyArray } from "./Array.
|
|
6
|
-
import type { DatabaseError, OptimisticConcurrencyException } from "./client/errors.
|
|
7
|
-
import * as Context from "./Context.
|
|
8
|
-
import * as Effect from "./Effect.
|
|
9
|
-
import * as Layer from "./Layer.
|
|
10
|
-
import type { FilterResult } from "./Model/filter/filterApi.
|
|
11
|
-
import type { FieldValues } from "./Model/filter/types.
|
|
12
|
-
import type { FieldPath } from "./Model/filter/types/path/index.
|
|
13
|
-
import type { AggregateIrExpression, ComputedProjectionIrExpression, RawQuery } from "./Model/query.
|
|
14
|
-
import type * as Option from "./Option.
|
|
15
|
-
import { NonEmptyString255 } from "./Schema.
|
|
5
|
+
import type { NonEmptyReadonlyArray } from "./Array.ts"
|
|
6
|
+
import type { DatabaseError, OptimisticConcurrencyException } from "./client/errors.ts"
|
|
7
|
+
import * as Context from "./Context.ts"
|
|
8
|
+
import * as Effect from "./Effect.ts"
|
|
9
|
+
import * as Layer from "./Layer.ts"
|
|
10
|
+
import type { FilterResult } from "./Model/filter/filterApi.ts"
|
|
11
|
+
import type { FieldValues } from "./Model/filter/types.ts"
|
|
12
|
+
import type { FieldPath } from "./Model/filter/types/path/index.ts"
|
|
13
|
+
import type { AggregateIrExpression, ComputedProjectionIrExpression, RawQuery } from "./Model/query.ts"
|
|
14
|
+
import type * as Option from "./Option.ts"
|
|
15
|
+
import { NonEmptyString255 } from "./Schema.ts"
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Adapter-neutral unique-key definition for stores that support unique indexes,
|
package/src/_ext/Array.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Chunk from "effect-app/Chunk"
|
|
2
2
|
import * as Effect from "effect-app/Effect"
|
|
3
3
|
import * as Equal from "effect/Equal"
|
|
4
|
-
import { NotFoundError } from "../client/errors.
|
|
4
|
+
import { NotFoundError } from "../client/errors.ts"
|
|
5
5
|
|
|
6
6
|
function getFirstBy<A, Type extends string>(
|
|
7
7
|
a: Iterable<A>,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Ref from "effect/Ref"
|
|
2
|
-
import * as Context from "../Context.
|
|
3
|
-
import * as Effect from "../Effect.
|
|
4
|
-
import type { InvalidationKey } from "../rpc/Invalidation.
|
|
2
|
+
import * as Context from "../Context.ts"
|
|
3
|
+
import * as Effect from "../Effect.ts"
|
|
4
|
+
import type { InvalidationKey } from "../rpc/Invalidation.ts"
|
|
5
5
|
|
|
6
6
|
export type { InvalidationKey }
|
|
7
7
|
/** Shape of the per-mutation service that accumulates server-provided invalidation keys. */
|
|
@@ -8,15 +8,15 @@ import * as Schema from "effect/Schema"
|
|
|
8
8
|
import * as Stream from "effect/Stream"
|
|
9
9
|
import * as Struct from "effect/Struct"
|
|
10
10
|
import { Rpc, RpcClient, RpcGroup, RpcSerialization } from "effect/unstable/rpc"
|
|
11
|
-
import * as Config from "../Config.
|
|
12
|
-
import * as Context from "../Context.
|
|
13
|
-
import * as Effect from "../Effect.
|
|
14
|
-
import { HttpClient, HttpClientRequest } from "../http.
|
|
15
|
-
import { Invalidation } from "../rpc.
|
|
16
|
-
import type * as S from "../Schema.
|
|
17
|
-
import { typedKeysOf, typedValuesOf } from "../utils.
|
|
18
|
-
import type { Client, ClientForOptions, ExtractModuleName, RequestsAny } from "./clientFor.
|
|
19
|
-
import { InvalidationKeysFromServer } from "./InvalidationKeys.
|
|
11
|
+
import * as Config from "../Config.ts"
|
|
12
|
+
import * as Context from "../Context.ts"
|
|
13
|
+
import * as Effect from "../Effect.ts"
|
|
14
|
+
import { HttpClient, HttpClientRequest } from "../http.ts"
|
|
15
|
+
import { Invalidation } from "../rpc.ts"
|
|
16
|
+
import type * as S from "../Schema.ts"
|
|
17
|
+
import { typedKeysOf, typedValuesOf } from "../utils.ts"
|
|
18
|
+
import type { Client, ClientForOptions, ExtractModuleName, RequestsAny } from "./clientFor.ts"
|
|
19
|
+
import { InvalidationKeysFromServer } from "./InvalidationKeys.ts"
|
|
20
20
|
|
|
21
21
|
export interface ApiConfig {
|
|
22
22
|
url: string
|
package/src/client/clientFor.ts
CHANGED
|
@@ -5,9 +5,9 @@ import * as Record from "effect/Record"
|
|
|
5
5
|
import type * as Stream from "effect/Stream"
|
|
6
6
|
import type { Path } from "path-parser"
|
|
7
7
|
import qs from "query-string"
|
|
8
|
-
import type * as Effect from "../Effect.
|
|
9
|
-
import type * as S from "../Schema.
|
|
10
|
-
import { type Req } from "./apiClientFactory.
|
|
8
|
+
import type * as Effect from "../Effect.ts"
|
|
9
|
+
import type * as S from "../Schema.ts"
|
|
10
|
+
import { type Req } from "./apiClientFactory.ts"
|
|
11
11
|
|
|
12
12
|
export function makePathWithQuery(
|
|
13
13
|
path: Path,
|
package/src/client/errors.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @effect-diagnostics overriddenSchemaConstructor:skip-file */
|
|
2
2
|
import { TaggedErrorClass } from "effect-app/Schema"
|
|
3
3
|
import * as Cause from "effect/Cause"
|
|
4
|
-
import * as S from "../Schema.
|
|
4
|
+
import * as S from "../Schema.ts"
|
|
5
5
|
|
|
6
6
|
export const tryToJson = (error: unknown) => {
|
|
7
7
|
try {
|
|
@@ -243,11 +243,16 @@ export const silenceError = (e: Record<PropertyKey, any>) => {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
export class CauseException<E> extends Error {
|
|
246
|
-
|
|
246
|
+
readonly originalCause: Cause.Cause<E>
|
|
247
|
+
readonly _tag: string
|
|
248
|
+
|
|
249
|
+
constructor(originalCause: Cause.Cause<E>, _tag: string) {
|
|
247
250
|
const limit = Error.stackTraceLimit
|
|
248
251
|
Error.stackTraceLimit = 0
|
|
249
252
|
super()
|
|
250
253
|
Error.stackTraceLimit = limit
|
|
254
|
+
this.originalCause = originalCause
|
|
255
|
+
this._tag = _tag
|
|
251
256
|
this.cause = Cause.squash(originalCause)
|
|
252
257
|
// v4: makeFiberFailure removed — use Cause.prettyErrors instead
|
|
253
258
|
const errors = Cause.prettyErrors(originalCause)
|
package/src/client/makeClient.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as Exit from "effect/Exit"
|
|
2
2
|
import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
3
|
-
import { type GetContextConfig, type RpcContextMap } from "../rpc/RpcContextMap.
|
|
4
|
-
import * as S from "../Schema.
|
|
5
|
-
import { AST } from "../Schema.
|
|
6
|
-
import type { ClientForOptions } from "./clientFor.
|
|
3
|
+
import { type GetContextConfig, type RpcContextMap } from "../rpc/RpcContextMap.ts"
|
|
4
|
+
import * as S from "../Schema.ts"
|
|
5
|
+
import { AST } from "../Schema.ts"
|
|
6
|
+
import type { ClientForOptions } from "./clientFor.ts"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Minimal structural shape for an rpc-client middleware tag.
|
package/src/http/Request.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Option from "effect/Option"
|
|
2
2
|
import type { HttpClientResponse } from "effect/unstable/http/HttpClientResponse"
|
|
3
|
-
import * as Effect from "../Effect.
|
|
4
|
-
import { HttpClient, HttpClientError, HttpClientRequest, HttpHeaders } from "./internal/lib.
|
|
3
|
+
import * as Effect from "../Effect.ts"
|
|
4
|
+
import { HttpClient, HttpClientError, HttpClientRequest, HttpHeaders } from "./internal/lib.ts"
|
|
5
5
|
|
|
6
6
|
export interface ResponseWithBody<A> extends Pick<HttpClientResponse, "headers" | "status" | "remoteAddress"> {
|
|
7
7
|
readonly body: A
|
package/src/http.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./http/internal/lib.
|
|
1
|
+
export * from "./http/internal/lib.ts"
|
package/src/ids.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { brandedStringId, type Codec, NonEmptyString255, StringId, type StringId
|
|
|
2
2
|
import type { B } from "effect-app/Schema/schema"
|
|
3
3
|
import * as Effect from "effect/Effect"
|
|
4
4
|
import type { Simplify } from "effect/Types"
|
|
5
|
-
import * as S from "./Schema.
|
|
6
|
-
import { extendM } from "./utils.
|
|
5
|
+
import * as S from "./Schema.ts"
|
|
6
|
+
import { extendM } from "./utils.ts"
|
|
7
7
|
|
|
8
8
|
export interface RequestIdBrand extends StringIdBrand {
|
|
9
9
|
readonly RequestId: unique symbol
|
package/src/index.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-unassigned-import
|
|
2
|
-
import "./builtin.
|
|
2
|
+
import "./builtin.ts"
|
|
3
3
|
|
|
4
|
-
export * as Fnc from "./Function.
|
|
5
|
-
export * as Utils from "./utils.
|
|
4
|
+
export * as Fnc from "./Function.ts"
|
|
5
|
+
export * as Utils from "./utils.ts"
|
|
6
6
|
|
|
7
|
-
export * as Array from "./Array.
|
|
8
|
-
export * as Config from "./Config.
|
|
9
|
-
export * as ConfigProvider from "./ConfigProvider.
|
|
10
|
-
export * as Context from "./Context.
|
|
11
|
-
export * as Effect from "./Effect.
|
|
12
|
-
export * as Layer from "./Layer.
|
|
13
|
-
export * as Model from "./Model.
|
|
14
|
-
export * as NonEmptySet from "./NonEmptySet.
|
|
15
|
-
export * as Set from "./Set.
|
|
16
|
-
export * as Store from "./Store.
|
|
7
|
+
export * as Array from "./Array.ts"
|
|
8
|
+
export * as Config from "./Config.ts"
|
|
9
|
+
export * as ConfigProvider from "./ConfigProvider.ts"
|
|
10
|
+
export * as Context from "./Context.ts"
|
|
11
|
+
export * as Effect from "./Effect.ts"
|
|
12
|
+
export * as Layer from "./Layer.ts"
|
|
13
|
+
export * as Model from "./Model.ts"
|
|
14
|
+
export * as NonEmptySet from "./NonEmptySet.ts"
|
|
15
|
+
export * as Set from "./Set.ts"
|
|
16
|
+
export * as Store from "./Store.ts"
|
|
17
17
|
|
|
18
|
-
export { type NonEmptyArray, type NonEmptyReadonlyArray } from "./Array.
|
|
18
|
+
export { type NonEmptyArray, type NonEmptyReadonlyArray } from "./Array.ts"
|
|
19
19
|
|
|
20
20
|
export * from "effect"
|
|
21
21
|
|
|
22
|
-
export type * as Types from "./Types.
|
|
22
|
+
export type * as Types from "./Types.ts"
|
|
23
23
|
|
|
24
|
-
export * as SecretURL from "./Config/SecretURL.
|
|
25
|
-
export * as RpcX from "./rpc.
|
|
26
|
-
export * as S from "./Schema.
|
|
27
|
-
export { copy } from "./utils.
|
|
24
|
+
export * as SecretURL from "./Config/SecretURL.ts"
|
|
25
|
+
export * as RpcX from "./rpc.ts"
|
|
26
|
+
export * as S from "./Schema.ts"
|
|
27
|
+
export { copy } from "./utils.ts"
|
package/src/middleware.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import * as Context from "effect-app/Context"
|
|
3
|
-
import { RpcMiddleware } from "./rpc.
|
|
3
|
+
import { RpcMiddleware } from "./rpc.ts"
|
|
4
4
|
|
|
5
5
|
export class DevMode extends Context.Reference("DevMode", { defaultValue: () => false }) {}
|
|
6
6
|
|
package/src/rpc/Invalidation.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as Ref from "effect/Ref"
|
|
2
2
|
import { Rpc } from "effect/unstable/rpc"
|
|
3
|
-
import { type ClientForOptions, makeQueryKey } from "../client/clientFor.
|
|
4
|
-
import * as Context from "../Context.
|
|
5
|
-
import * as Effect from "../Effect.
|
|
6
|
-
import * as S from "../Schema.
|
|
3
|
+
import { type ClientForOptions, makeQueryKey } from "../client/clientFor.ts"
|
|
4
|
+
import * as Context from "../Context.ts"
|
|
5
|
+
import * as Effect from "../Effect.ts"
|
|
6
|
+
import * as S from "../Schema.ts"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Shorthand for a handler-derived invalidation key.
|
|
@@ -111,7 +111,7 @@ export type StreamFailureChunk<E> = { readonly _tag: "error"; readonly error: E;
|
|
|
111
111
|
* ```ts
|
|
112
112
|
* import { makeQueryKey } from "effect-app/client"
|
|
113
113
|
* import { Invalidation } from "effect-app/rpc"
|
|
114
|
-
* import * as UserRsc from "../User/index.
|
|
114
|
+
* import * as UserRsc from "../User/index.ts" // separate module to avoid circular deps
|
|
115
115
|
*
|
|
116
116
|
* class UpdateProfile extends Rpc.make("UpdateProfile", { ... })
|
|
117
117
|
* .annotate(Invalidation.Invalidates, [makeQueryKey(UserRsc.GetMe), makeQueryKey(UserRsc.GetProfile)]) {}
|
|
@@ -160,8 +160,8 @@ export interface InvalidationSetService {
|
|
|
160
160
|
* ```ts
|
|
161
161
|
* import * as Effect from "effect/Effect"
|
|
162
162
|
* import { Invalidation } from "effect-app/rpc"
|
|
163
|
-
* import * as CartRsc from "../Cart/queries.
|
|
164
|
-
* import * as UserRsc from "../User/queries.
|
|
163
|
+
* import * as CartRsc from "../Cart/queries.ts"
|
|
164
|
+
* import * as UserRsc from "../User/queries.ts"
|
|
165
165
|
*
|
|
166
166
|
* const handler = Effect.fnUntraced(function*(req: UpdateCartRequest) {
|
|
167
167
|
* const cart = yield* CartRepo.save(req.cart)
|
|
@@ -7,12 +7,12 @@ import type * as Scope from "effect/Scope"
|
|
|
7
7
|
import { type Simplify } from "effect/Types"
|
|
8
8
|
import { Rpc, type RpcGroup, type RpcSchema } from "effect/unstable/rpc"
|
|
9
9
|
import { type HandlersFrom } from "effect/unstable/rpc/RpcGroup"
|
|
10
|
-
import * as Context from "../Context.
|
|
11
|
-
import { PreludeLogger } from "../logger.
|
|
12
|
-
import { type TypeTestId } from "../TypeTest.
|
|
13
|
-
import { type GetContextConfig, type RequestContextMapTagAny, type RpcContextMap } from "./RpcContextMap.
|
|
14
|
-
import { type AddMiddleware, type AnyDynamic, type RpcDynamic, type RpcMiddlewareV4, type TagClassAny } from "./RpcMiddleware.
|
|
15
|
-
import * as RpcMiddlewareX from "./RpcMiddleware.
|
|
10
|
+
import * as Context from "../Context.ts"
|
|
11
|
+
import { PreludeLogger } from "../logger.ts"
|
|
12
|
+
import { type TypeTestId } from "../TypeTest.ts"
|
|
13
|
+
import { type GetContextConfig, type RequestContextMapTagAny, type RpcContextMap } from "./RpcContextMap.ts"
|
|
14
|
+
import { type AddMiddleware, type AnyDynamic, type RpcDynamic, type RpcMiddlewareV4, type TagClassAny } from "./RpcMiddleware.ts"
|
|
15
|
+
import * as RpcMiddlewareX from "./RpcMiddleware.ts"
|
|
16
16
|
|
|
17
17
|
// adapter for effect/rpc v3 middleware provides. (in effect-smol (v4), it's just a Service Identifier, no tags.)
|
|
18
18
|
// hm?
|
package/src/rpc/RpcContextMap.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as S from "effect/Schema"
|
|
6
6
|
import { type AnyWithProps } from "effect/unstable/rpc/Rpc"
|
|
7
|
-
import * as Context from "../Context.
|
|
8
|
-
import { type RpcDynamic } from "./RpcMiddleware.
|
|
7
|
+
import * as Context from "../Context.ts"
|
|
8
|
+
import { type RpcDynamic } from "./RpcMiddleware.ts"
|
|
9
9
|
|
|
10
10
|
type Values<T extends Record<any, any>> = T[keyof T]
|
|
11
11
|
|
package/src/rpc/RpcMiddleware.ts
CHANGED
|
@@ -8,8 +8,8 @@ import type * as Scope from "effect/Scope"
|
|
|
8
8
|
import type * as Stream from "effect/Stream"
|
|
9
9
|
import { type Rpc, RpcMiddleware } from "effect/unstable/rpc"
|
|
10
10
|
import { type TypeId } from "effect/unstable/rpc/RpcMiddleware"
|
|
11
|
-
import type * as Context from "../Context.
|
|
12
|
-
import { type GetEffectContext, type RpcContextMap } from "./RpcContextMap.
|
|
11
|
+
import type * as Context from "../Context.ts"
|
|
12
|
+
import { type GetEffectContext, type RpcContextMap } from "./RpcContextMap.ts"
|
|
13
13
|
|
|
14
14
|
export type RpcMiddlewareV4<Provides, E, Requires> = RpcMiddleware.RpcMiddleware<Provides, E, Requires>
|
|
15
15
|
|
package/src/rpc.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as Invalidation from "./rpc/Invalidation.
|
|
2
|
-
export * as MiddlewareMaker from "./rpc/MiddlewareMaker.
|
|
3
|
-
export * as RpcContextMap from "./rpc/RpcContextMap.
|
|
4
|
-
export * as RpcMiddleware from "./rpc/RpcMiddleware.
|
|
1
|
+
export * as Invalidation from "./rpc/Invalidation.ts"
|
|
2
|
+
export * as MiddlewareMaker from "./rpc/MiddlewareMaker.ts"
|
|
3
|
+
export * as RpcContextMap from "./rpc/RpcContextMap.ts"
|
|
4
|
+
export * as RpcMiddleware from "./rpc/RpcMiddleware.ts"
|
package/src/runtime.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as Exit from "effect/Exit"
|
|
|
2
2
|
import { flow } from "effect/Function"
|
|
3
3
|
import * as Logger from "effect/Logger"
|
|
4
4
|
import * as ManagedRuntime from "effect/ManagedRuntime"
|
|
5
|
-
import { CauseException } from "./client/errors.
|
|
6
|
-
import { type Context } from "./Context.
|
|
7
|
-
import * as Effect from "./Effect.
|
|
8
|
-
import * as Layer from "./Layer.
|
|
5
|
+
import { CauseException } from "./client/errors.ts"
|
|
6
|
+
import { type Context } from "./Context.ts"
|
|
7
|
+
import * as Effect from "./Effect.ts"
|
|
8
|
+
import * as Layer from "./Layer.ts"
|
|
9
9
|
|
|
10
10
|
export const makeAppRuntime = Effect.fnUntraced(function*<A, E>(layer: Layer.Layer<A, E>) {
|
|
11
11
|
const l = layer.pipe(
|
package/src/setupRequest.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as Tracer from "effect/Tracer"
|
|
2
2
|
import { SqlClient } from "effect/unstable/sql"
|
|
3
|
-
import * as Effect from "./Effect.
|
|
4
|
-
import * as Layer from "./Layer.
|
|
5
|
-
import * as Option from "./Option.
|
|
6
|
-
import { LocaleRef, RequestContext, spanAttributes } from "./RequestContext.
|
|
7
|
-
import { NonEmptyString255 } from "./Schema.
|
|
8
|
-
import { ContextMapContainer, storeId } from "./Store.
|
|
3
|
+
import * as Effect from "./Effect.ts"
|
|
4
|
+
import * as Layer from "./Layer.ts"
|
|
5
|
+
import * as Option from "./Option.ts"
|
|
6
|
+
import { LocaleRef, RequestContext, spanAttributes } from "./RequestContext.ts"
|
|
7
|
+
import { NonEmptyString255 } from "./Schema.ts"
|
|
8
|
+
import { ContextMapContainer, storeId } from "./Store.ts"
|
|
9
9
|
|
|
10
10
|
const withSqlTransaction = <R, E, A>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
11
11
|
Effect.serviceOption(SqlClient.SqlClient).pipe(
|
package/src/toast.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as Context from "./Context.
|
|
2
|
-
import { accessEffectFn } from "./Context.
|
|
3
|
-
import * as Effect from "./Effect.
|
|
4
|
-
import * as Option from "./Option.
|
|
1
|
+
import * as Context from "./Context.ts"
|
|
2
|
+
import { accessEffectFn } from "./Context.ts"
|
|
3
|
+
import * as Effect from "./Effect.ts"
|
|
4
|
+
import * as Option from "./Option.ts"
|
|
5
5
|
|
|
6
6
|
export type ToastId = string | number
|
|
7
7
|
export type ToastOpts = { id?: ToastId; timeout?: number; groupId?: string; requestId?: string }
|
package/src/transform.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { NonEmptyReadonlyArray } from "effect/Array"
|
|
3
3
|
import * as Option from "effect/Option"
|
|
4
4
|
import type { Misc, Union } from "ts-toolbelt"
|
|
5
|
-
import type * as SET from "./Set.
|
|
5
|
+
import type * as SET from "./Set.ts"
|
|
6
6
|
|
|
7
7
|
// type SomeObject = {
|
|
8
8
|
// 0: Option.Option<string>
|
package/src/utils/logger.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -10,8 +10,8 @@ import * as Option from "effect/Option"
|
|
|
10
10
|
import { isFunction } from "effect/Predicate"
|
|
11
11
|
import * as Record from "effect/Record"
|
|
12
12
|
import * as Result from "effect/Result"
|
|
13
|
-
import { identity, pipe } from "./Function.
|
|
14
|
-
import type { DeepMutable, Equals, Mutable } from "./Types.
|
|
13
|
+
import { identity, pipe } from "./Function.ts"
|
|
14
|
+
import type { DeepMutable, Equals, Mutable } from "./Types.ts"
|
|
15
15
|
|
|
16
16
|
// codegen:start {preset: barrel, include: ./utils/*.ts, nodir: false }
|
|
17
17
|
export * from "./utils/effectify.ts"
|
|
@@ -228,7 +228,7 @@ function decorateNew(
|
|
|
228
228
|
function decorateLegacy(
|
|
229
229
|
target: any,
|
|
230
230
|
key: PropertyKey,
|
|
231
|
-
descriptor: PropertyDescriptor,
|
|
231
|
+
descriptor: PropertyDescriptor | undefined,
|
|
232
232
|
setProto: boolean,
|
|
233
233
|
makeNonConfigurable: boolean,
|
|
234
234
|
// tslint:enable:bool-param-default
|
|
@@ -236,11 +236,12 @@ function decorateLegacy(
|
|
|
236
236
|
): PropertyDescriptor {
|
|
237
237
|
/* istanbul ignore if */
|
|
238
238
|
if (!descriptor) {
|
|
239
|
-
descriptor =
|
|
239
|
+
descriptor = Object.getOwnPropertyDescriptor(target, key)
|
|
240
240
|
if (!descriptor) {
|
|
241
|
-
const e = new Error("@LazyGetter is unable to determine the property descriptor")
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
const e = Object.assign(new Error("@LazyGetter is unable to determine the property descriptor"), {
|
|
242
|
+
$key: key,
|
|
243
|
+
$target: target
|
|
244
|
+
})
|
|
244
245
|
throw e
|
|
245
246
|
}
|
|
246
247
|
}
|
|
@@ -295,7 +296,7 @@ function defaultFilter(): boolean {
|
|
|
295
296
|
|
|
296
297
|
function validateAndExtractMethodFromDescriptor(desc: PropertyDescriptor): Function {
|
|
297
298
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
298
|
-
const originalMethod =
|
|
299
|
+
const originalMethod = desc.get
|
|
299
300
|
|
|
300
301
|
if (!originalMethod) {
|
|
301
302
|
throw new Error("@LazyGetter can only decorate getters!")
|
|
@@ -318,7 +319,7 @@ function getterCommon( // tslint:disable-line:parameters-max-number
|
|
|
318
319
|
makeNonConfigurable: boolean,
|
|
319
320
|
resultSelector: ResultSelectorFn
|
|
320
321
|
): any {
|
|
321
|
-
const value = originalMethod.apply(thisArg,
|
|
322
|
+
const value = originalMethod.apply(thisArg, args)
|
|
322
323
|
|
|
323
324
|
if (resultSelector(value)) {
|
|
324
325
|
const newDescriptor: PropertyDescriptor = {
|
|
@@ -353,23 +354,23 @@ export function LazyGetter(
|
|
|
353
354
|
): MethodDecorator & ResettableDescriptor {
|
|
354
355
|
let desc: PropertyDescriptor
|
|
355
356
|
let prop: PropertyKey
|
|
356
|
-
let args:
|
|
357
|
+
let args: [targetOrDesc: any, key: PropertyKey | undefined, descriptor: PropertyDescriptor | undefined] | undefined
|
|
357
358
|
let isLegacy: boolean
|
|
358
359
|
|
|
359
360
|
function decorator(
|
|
360
361
|
targetOrDesc: any,
|
|
361
|
-
key: PropertyKey,
|
|
362
|
-
descriptor: PropertyDescriptor
|
|
362
|
+
key: PropertyKey | undefined,
|
|
363
|
+
descriptor: PropertyDescriptor | undefined
|
|
363
364
|
): DecoratorReturn {
|
|
364
|
-
|
|
365
|
-
args = arguments
|
|
365
|
+
args = [targetOrDesc, key, descriptor]
|
|
366
366
|
if (key === undefined) {
|
|
367
367
|
if (typeof desc === "undefined") {
|
|
368
|
+
const newDescriptor = targetOrDesc as NewDescriptor
|
|
368
369
|
isLegacy = false
|
|
369
|
-
prop =
|
|
370
|
+
prop = newDescriptor.key
|
|
370
371
|
desc = Object.assign(
|
|
371
372
|
{},
|
|
372
|
-
|
|
373
|
+
newDescriptor.descriptor
|
|
373
374
|
/* istanbul ignore next */ || targetOrDesc
|
|
374
375
|
)
|
|
375
376
|
}
|
|
@@ -411,11 +412,14 @@ export function LazyGetter(
|
|
|
411
412
|
"Unable to restore descriptor. Did you remember to apply your decorator to a method?"
|
|
412
413
|
)
|
|
413
414
|
}
|
|
415
|
+
if (!args) {
|
|
416
|
+
throw new Error("Unable to restore descriptor before applying the decorator.")
|
|
417
|
+
}
|
|
414
418
|
// Restore descriptor to its original state
|
|
415
419
|
Object.defineProperty(on, prop, desc)
|
|
416
|
-
|
|
417
|
-
const ret:
|
|
418
|
-
Object.defineProperty(on, prop,
|
|
420
|
+
const ret = decorator.apply(null, args)
|
|
421
|
+
const restoredDescriptor = isLegacy ? ret : "descriptor" in ret && ret.descriptor ? ret.descriptor : ret
|
|
422
|
+
Object.defineProperty(on, prop, restoredDescriptor)
|
|
419
423
|
}
|
|
420
424
|
|
|
421
425
|
return decorator
|
package/src/validation.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Predicate } from "./Function.
|
|
1
|
+
import type { Predicate } from "./Function.ts"
|
|
2
2
|
|
|
3
3
|
export const all_ = <T>(v: T, ...a: Predicate<T>[]) => !a.some((x) => !x(v))
|
|
4
4
|
export const all = <T>(...a: Predicate<T>[]) => (v: T) => all_(v, ...a)
|
|
@@ -15,4 +15,4 @@ export const min = (min: number) => {
|
|
|
15
15
|
return (v: { length: number }) => f(v.length)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export * from "./validation/validators.
|
|
18
|
+
export * from "./validation/validators.ts"
|
package/src/withToast.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Cause from "effect/Cause"
|
|
2
2
|
import * as Fiber from "effect/Fiber"
|
|
3
|
-
import * as Context from "./Context.
|
|
4
|
-
import * as Effect from "./Effect.
|
|
5
|
-
import * as Layer from "./Layer.
|
|
6
|
-
import type * as Option from "./Option.
|
|
7
|
-
import * as S from "./Schema.
|
|
8
|
-
import { CurrentToastId, Toast, type ToastId } from "./toast.
|
|
9
|
-
import { wrapEffect } from "./utils.
|
|
3
|
+
import * as Context from "./Context.ts"
|
|
4
|
+
import * as Effect from "./Effect.ts"
|
|
5
|
+
import * as Layer from "./Layer.ts"
|
|
6
|
+
import type * as Option from "./Option.ts"
|
|
7
|
+
import * as S from "./Schema.ts"
|
|
8
|
+
import { CurrentToastId, Toast, type ToastId } from "./toast.ts"
|
|
9
|
+
import { wrapEffect } from "./utils.ts"
|
|
10
10
|
|
|
11
11
|
export interface ToastOptions<A, E, Args extends ReadonlyArray<unknown>, WaiR, SucR, ErrR> {
|
|
12
12
|
stableToastId?: undefined | string | ((...args: Args) => string | undefined)
|
package/tsconfig.json
CHANGED