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.
Files changed (95) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/Model/filter/types/path/eager.d.ts +1 -29
  3. package/dist/Model/filter/types/path/eager.d.ts.map +1 -1
  4. package/dist/Model/filter/types/path/eager.js +9 -10
  5. package/dist/Model/filter/types.d.ts +4 -4
  6. package/dist/RequestContext.d.ts +121 -4
  7. package/dist/RequestContext.d.ts.map +1 -1
  8. package/dist/RequestContext.js +7 -2
  9. package/dist/Schema/Class.d.ts +93 -1
  10. package/dist/Schema/Class.d.ts.map +1 -1
  11. package/dist/Schema/Class.js +25 -3
  12. package/dist/Schema/SpecialOpenApi.js +1 -1
  13. package/dist/Schema.d.ts +2 -2
  14. package/dist/Schema.d.ts.map +1 -1
  15. package/dist/Schema.js +2 -2
  16. package/dist/client/errors.d.ts +1 -1
  17. package/dist/client/errors.d.ts.map +1 -1
  18. package/dist/client/errors.js +2 -2
  19. package/dist/client.d.ts +5 -5
  20. package/dist/rpc/Invalidation.js +3 -3
  21. package/dist/utils.d.ts +6 -6
  22. package/dist/utils.d.ts.map +1 -1
  23. package/dist/utils.js +15 -11
  24. package/package.json +3 -3
  25. package/src/Array.ts +2 -2
  26. package/src/Chunk.ts +3 -3
  27. package/src/Config/SecretURL.ts +1 -1
  28. package/src/Config/internal/configSecretURL.ts +1 -1
  29. package/src/Config.ts +1 -1
  30. package/src/Effect.ts +3 -3
  31. package/src/Emailer.ts +4 -4
  32. package/src/Inputify.type.ts +1 -1
  33. package/src/Layer.ts +2 -2
  34. package/src/Model/Repository/Registry.ts +3 -3
  35. package/src/Model/Repository/ext.ts +11 -11
  36. package/src/Model/Repository/internal/internal.ts +16 -16
  37. package/src/Model/Repository/legacy.ts +4 -4
  38. package/src/Model/Repository/makeRepo.ts +11 -11
  39. package/src/Model/Repository/service.ts +9 -9
  40. package/src/Model/Repository/validation.ts +2 -2
  41. package/src/Model/Repository.ts +6 -6
  42. package/src/Model/dsl.ts +4 -4
  43. package/src/Model/filter/filterApi.ts +1 -1
  44. package/src/Model/filter/types/errors.ts +3 -3
  45. package/src/Model/filter/types/fields.ts +2 -2
  46. package/src/Model/filter/types/path/common.ts +1 -1
  47. package/src/Model/filter/types/path/eager.ts +11 -9
  48. package/src/Model/filter/types/path/index.ts +2 -2
  49. package/src/Model/filter/types/validator.ts +3 -3
  50. package/src/Model/query/dsl.ts +6 -6
  51. package/src/Model/query/new-kid-interpreter.ts +9 -9
  52. package/src/Model/query.ts +2 -2
  53. package/src/Model.ts +4 -4
  54. package/src/NonEmptySet.ts +3 -3
  55. package/src/Option.ts +1 -1
  56. package/src/Pure.ts +2 -2
  57. package/src/QueueMaker.ts +3 -3
  58. package/src/RequestContext.ts +43 -10
  59. package/src/Schema/Class.ts +247 -5
  60. package/src/Schema/SchemaParser.ts +1 -1
  61. package/src/Schema/SpecialOpenApi.ts +2 -2
  62. package/src/Schema/email.ts +2 -2
  63. package/src/Schema/ext.ts +4 -4
  64. package/src/Schema/moreStrings.ts +4 -4
  65. package/src/Schema/numbers.ts +3 -3
  66. package/src/Schema/phoneNumber.ts +4 -4
  67. package/src/Schema/strings.ts +2 -2
  68. package/src/Schema.ts +23 -23
  69. package/src/Set.ts +1 -1
  70. package/src/Store.ts +11 -11
  71. package/src/_ext/Array.ts +1 -1
  72. package/src/client/InvalidationKeys.ts +3 -3
  73. package/src/client/apiClientFactory.ts +9 -9
  74. package/src/client/clientFor.ts +3 -3
  75. package/src/client/errors.ts +7 -2
  76. package/src/client/makeClient.ts +4 -4
  77. package/src/http/Request.ts +2 -2
  78. package/src/http.ts +1 -1
  79. package/src/ids.ts +2 -2
  80. package/src/index.ts +19 -19
  81. package/src/middleware.ts +1 -1
  82. package/src/rpc/Invalidation.ts +7 -7
  83. package/src/rpc/MiddlewareMaker.ts +6 -6
  84. package/src/rpc/RpcContextMap.ts +2 -2
  85. package/src/rpc/RpcMiddleware.ts +2 -2
  86. package/src/rpc.ts +4 -4
  87. package/src/runtime.ts +4 -4
  88. package/src/setupRequest.ts +6 -6
  89. package/src/toast.ts +4 -4
  90. package/src/transform.ts +1 -1
  91. package/src/utils/logger.ts +1 -1
  92. package/src/utils.ts +23 -19
  93. package/src/validation.ts +2 -2
  94. package/src/withToast.ts +7 -7
  95. 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.js"
6
- import type { DatabaseError, OptimisticConcurrencyException } from "./client/errors.js"
7
- import * as Context from "./Context.js"
8
- import * as Effect from "./Effect.js"
9
- import * as Layer from "./Layer.js"
10
- import type { FilterResult } from "./Model/filter/filterApi.js"
11
- import type { FieldValues } from "./Model/filter/types.js"
12
- import type { FieldPath } from "./Model/filter/types/path/index.js"
13
- import type { AggregateIrExpression, ComputedProjectionIrExpression, RawQuery } from "./Model/query.js"
14
- import type * as Option from "./Option.js"
15
- import { NonEmptyString255 } from "./Schema.js"
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.js"
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.js"
3
- import * as Effect from "../Effect.js"
4
- import type { InvalidationKey } from "../rpc/Invalidation.js"
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.js"
12
- import * as Context from "../Context.js"
13
- import * as Effect from "../Effect.js"
14
- import { HttpClient, HttpClientRequest } from "../http.js"
15
- import { Invalidation } from "../rpc.js"
16
- import type * as S from "../Schema.js"
17
- import { typedKeysOf, typedValuesOf } from "../utils.js"
18
- import type { Client, ClientForOptions, ExtractModuleName, RequestsAny } from "./clientFor.js"
19
- import { InvalidationKeysFromServer } from "./InvalidationKeys.js"
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
@@ -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.js"
9
- import type * as S from "../Schema.js"
10
- import { type Req } from "./apiClientFactory.js"
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,
@@ -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.js"
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
- constructor(readonly originalCause: Cause.Cause<E>, readonly _tag: string) {
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)
@@ -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.js"
4
- import * as S from "../Schema.js"
5
- import { AST } from "../Schema.js"
6
- import type { ClientForOptions } from "./clientFor.js"
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.
@@ -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.js"
4
- import { HttpClient, HttpClientError, HttpClientRequest, HttpHeaders } from "./internal/lib.js"
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.js"
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.js"
6
- import { extendM } from "./utils.js"
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.js"
2
+ import "./builtin.ts"
3
3
 
4
- export * as Fnc from "./Function.js"
5
- export * as Utils from "./utils.js"
4
+ export * as Fnc from "./Function.ts"
5
+ export * as Utils from "./utils.ts"
6
6
 
7
- export * as Array from "./Array.js"
8
- export * as Config from "./Config.js"
9
- export * as ConfigProvider from "./ConfigProvider.js"
10
- export * as Context from "./Context.js"
11
- export * as Effect from "./Effect.js"
12
- export * as Layer from "./Layer.js"
13
- export * as Model from "./Model.js"
14
- export * as NonEmptySet from "./NonEmptySet.js"
15
- export * as Set from "./Set.js"
16
- export * as Store from "./Store.js"
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.js"
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.js"
22
+ export type * as Types from "./Types.ts"
23
23
 
24
- export * as SecretURL from "./Config/SecretURL.js"
25
- export * as RpcX from "./rpc.js"
26
- export * as S from "./Schema.js"
27
- export { copy } from "./utils.js"
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.js"
3
+ import { RpcMiddleware } from "./rpc.ts"
4
4
 
5
5
  export class DevMode extends Context.Reference("DevMode", { defaultValue: () => false }) {}
6
6
 
@@ -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.js"
4
- import * as Context from "../Context.js"
5
- import * as Effect from "../Effect.js"
6
- import * as S from "../Schema.js"
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.js" // separate module to avoid circular deps
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.js"
164
- * import * as UserRsc from "../User/queries.js"
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.js"
11
- import { PreludeLogger } from "../logger.js"
12
- import { type TypeTestId } from "../TypeTest.js"
13
- import { type GetContextConfig, type RequestContextMapTagAny, type RpcContextMap } from "./RpcContextMap.js"
14
- import { type AddMiddleware, type AnyDynamic, type RpcDynamic, type RpcMiddlewareV4, type TagClassAny } from "./RpcMiddleware.js"
15
- import * as RpcMiddlewareX from "./RpcMiddleware.js"
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?
@@ -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.js"
8
- import { type RpcDynamic } from "./RpcMiddleware.js"
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
 
@@ -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.js"
12
- import { type GetEffectContext, type RpcContextMap } from "./RpcContextMap.js"
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.js"
2
- export * as MiddlewareMaker from "./rpc/MiddlewareMaker.js"
3
- export * as RpcContextMap from "./rpc/RpcContextMap.js"
4
- export * as RpcMiddleware from "./rpc/RpcMiddleware.js"
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.js"
6
- import { type Context } from "./Context.js"
7
- import * as Effect from "./Effect.js"
8
- import * as Layer from "./Layer.js"
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(
@@ -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.js"
4
- import * as Layer from "./Layer.js"
5
- import * as Option from "./Option.js"
6
- import { LocaleRef, RequestContext, spanAttributes } from "./RequestContext.js"
7
- import { NonEmptyString255 } from "./Schema.js"
8
- import { ContextMapContainer, storeId } from "./Store.js"
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.js"
2
- import { accessEffectFn } from "./Context.js"
3
- import * as Effect from "./Effect.js"
4
- import * as Option from "./Option.js"
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.js"
5
+ import type * as SET from "./Set.ts"
6
6
 
7
7
  // type SomeObject = {
8
8
  // 0: Option.Option<string>
@@ -3,7 +3,7 @@
3
3
 
4
4
  import * as Effect from "effect/Effect"
5
5
  import type * as LogLevel from "effect/LogLevel"
6
- import * as Context from "../Context.js"
6
+ import * as Context from "../Context.ts"
7
7
 
8
8
  type Levels = "info" | "debug" | "warn" | "error"
9
9
 
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.js"
14
- import type { DeepMutable, Equals, Mutable } from "./Types.js"
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 = <any> Object.getOwnPropertyDescriptor(target, key)
239
+ descriptor = Object.getOwnPropertyDescriptor(target, key)
240
240
  if (!descriptor) {
241
- const e = new Error("@LazyGetter is unable to determine the property descriptor")
242
- ;(<any> e).$target = target
243
- ;(<any> e).$key = key
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 = <Function> desc.get
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, <any> args)
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: IArguments = <any> null
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
- // eslint-disable-next-line prefer-rest-params
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 = (<NewDescriptor> targetOrDesc).key
370
+ prop = newDescriptor.key
370
371
  desc = Object.assign(
371
372
  {},
372
- (<NewDescriptor> targetOrDesc).descriptor
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
- // eslint-disable-next-line prefer-spread
417
- const ret: any = decorator.apply(null, <any> args)
418
- Object.defineProperty(on, prop, isLegacy ? ret : ret.descriptor || ret)
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.js"
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.js"
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.js"
4
- import * as Effect from "./Effect.js"
5
- import * as Layer from "./Layer.js"
6
- import type * as Option from "./Option.js"
7
- import * as S from "./Schema.js"
8
- import { CurrentToastId, Toast, type ToastId } from "./toast.js"
9
- import { wrapEffect } from "./utils.js"
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
@@ -34,6 +34,7 @@
34
34
  "moduleResolution": "Node16",
35
35
  "noErrorTruncation": true,
36
36
  "forceConsistentCasingInFileNames": true,
37
+ "erasableSyntaxOnly": true,
37
38
  "rewriteRelativeImportExtensions": true,
38
39
  "allowImportingTsExtensions": true,
39
40
  "types": [