effect-app 4.0.0-beta.266 → 4.0.0-beta.268

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 (91) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/Model/Repository/Registry.d.ts +5 -4
  3. package/dist/Model/Repository/Registry.d.ts.map +1 -1
  4. package/dist/Model/Repository/Registry.js +1 -1
  5. package/dist/Model/Repository/ext.d.ts +3 -3
  6. package/dist/Model/Repository/legacy.d.ts +6 -6
  7. package/dist/Model/Repository/legacy.d.ts.map +1 -1
  8. package/dist/Model/Repository/service.d.ts +30 -30
  9. package/dist/Model/Repository/service.d.ts.map +1 -1
  10. package/dist/Model/filter/types.d.ts +4 -4
  11. package/dist/Schema/Class.js +2 -2
  12. package/dist/Schema/SpecialOpenApi.js +1 -1
  13. package/dist/Store.d.ts +11 -11
  14. package/dist/Store.d.ts.map +1 -1
  15. package/dist/client/errors.d.ts +35 -4
  16. package/dist/client/errors.d.ts.map +1 -1
  17. package/dist/client/errors.js +32 -2
  18. package/dist/client.d.ts +5 -5
  19. package/dist/rpc/Invalidation.js +3 -3
  20. package/dist/utils.d.ts +5 -5
  21. package/package.json +3 -3
  22. package/src/Array.ts +2 -2
  23. package/src/Chunk.ts +3 -3
  24. package/src/Config/SecretURL.ts +1 -1
  25. package/src/Config/internal/configSecretURL.ts +1 -1
  26. package/src/Config.ts +1 -1
  27. package/src/Effect.ts +3 -3
  28. package/src/Emailer.ts +4 -4
  29. package/src/Inputify.type.ts +1 -1
  30. package/src/Layer.ts +2 -2
  31. package/src/Model/Repository/Registry.ts +5 -4
  32. package/src/Model/Repository/ext.ts +11 -11
  33. package/src/Model/Repository/internal/internal.ts +16 -16
  34. package/src/Model/Repository/legacy.ts +8 -8
  35. package/src/Model/Repository/makeRepo.ts +11 -11
  36. package/src/Model/Repository/service.ts +47 -37
  37. package/src/Model/Repository/validation.ts +2 -2
  38. package/src/Model/Repository.ts +6 -6
  39. package/src/Model/dsl.ts +4 -4
  40. package/src/Model/filter/filterApi.ts +1 -1
  41. package/src/Model/filter/types/errors.ts +3 -3
  42. package/src/Model/filter/types/fields.ts +2 -2
  43. package/src/Model/filter/types/path/common.ts +1 -1
  44. package/src/Model/filter/types/path/eager.ts +3 -3
  45. package/src/Model/filter/types/path/index.ts +2 -2
  46. package/src/Model/filter/types/validator.ts +3 -3
  47. package/src/Model/query/dsl.ts +6 -6
  48. package/src/Model/query/new-kid-interpreter.ts +9 -9
  49. package/src/Model/query.ts +2 -2
  50. package/src/Model.ts +4 -4
  51. package/src/NonEmptySet.ts +3 -3
  52. package/src/Option.ts +1 -1
  53. package/src/Pure.ts +2 -2
  54. package/src/QueueMaker.ts +3 -3
  55. package/src/RequestContext.ts +4 -4
  56. package/src/Schema/Class.ts +5 -5
  57. package/src/Schema/SchemaParser.ts +1 -1
  58. package/src/Schema/SpecialOpenApi.ts +2 -2
  59. package/src/Schema/email.ts +2 -2
  60. package/src/Schema/ext.ts +4 -4
  61. package/src/Schema/moreStrings.ts +4 -4
  62. package/src/Schema/numbers.ts +3 -3
  63. package/src/Schema/phoneNumber.ts +4 -4
  64. package/src/Schema/strings.ts +2 -2
  65. package/src/Schema.ts +23 -23
  66. package/src/Set.ts +1 -1
  67. package/src/Store.ts +20 -20
  68. package/src/_ext/Array.ts +1 -1
  69. package/src/client/InvalidationKeys.ts +3 -3
  70. package/src/client/apiClientFactory.ts +9 -9
  71. package/src/client/clientFor.ts +3 -3
  72. package/src/client/errors.ts +42 -2
  73. package/src/client/makeClient.ts +4 -4
  74. package/src/http/Request.ts +2 -2
  75. package/src/http.ts +1 -1
  76. package/src/ids.ts +2 -2
  77. package/src/index.ts +19 -19
  78. package/src/middleware.ts +1 -1
  79. package/src/rpc/Invalidation.ts +7 -7
  80. package/src/rpc/MiddlewareMaker.ts +6 -6
  81. package/src/rpc/RpcContextMap.ts +2 -2
  82. package/src/rpc/RpcMiddleware.ts +2 -2
  83. package/src/rpc.ts +4 -4
  84. package/src/runtime.ts +4 -4
  85. package/src/setupRequest.ts +6 -6
  86. package/src/toast.ts +4 -4
  87. package/src/transform.ts +1 -1
  88. package/src/utils/logger.ts +1 -1
  89. package/src/utils.ts +2 -2
  90. package/src/validation.ts +2 -2
  91. package/src/withToast.ts +7 -7
@@ -13,9 +13,9 @@ import * as Effect from "effect/Effect"
13
13
  import * as S from "effect/Schema"
14
14
  import type * as SchemaAST from "effect/SchemaAST"
15
15
  import type { Simplify } from "effect/Types"
16
- import { type BrandedSchema, fromBrand, nominal } from "./brand.js"
17
- import { withDefaultMake } from "./ext.js"
18
- import { type B } from "./schema.js"
16
+ import { type BrandedSchema, fromBrand, nominal } from "./brand.ts"
17
+ import { withDefaultMake } from "./ext.ts"
18
+ import { type B } from "./schema.ts"
19
19
 
20
20
  export interface PositiveIntBrand
21
21
  extends Simplify<B.Brand<"PositiveInt"> & NonNegativeIntBrand & PositiveNumberBrand>
@@ -2,10 +2,10 @@ import type { Refinement } from "effect-app/Function"
2
2
  import { isValidPhone } from "effect-app/validation"
3
3
  import * as S from "effect/Schema"
4
4
  import type { Simplify } from "effect/Types"
5
- import { withDefaultMake } from "./ext.js"
6
- import { Numbers } from "./FastCheck.js"
7
- import type { B } from "./schema.js"
8
- import type { NonEmptyStringBrand } from "./strings.js"
5
+ import { withDefaultMake } from "./ext.ts"
6
+ import { Numbers } from "./FastCheck.ts"
7
+ import type { B } from "./schema.ts"
8
+ import type { NonEmptyStringBrand } from "./strings.ts"
9
9
 
10
10
  export interface PhoneNumberBrand extends Simplify<B.Brand<"PhoneNumber"> & NonEmptyStringBrand> {}
11
11
  export type PhoneNumber = string & PhoneNumberBrand
@@ -2,8 +2,8 @@ import type * as B from "effect/Brand"
2
2
  import * as S from "effect/Schema"
3
3
  import type * as SchemaAST from "effect/SchemaAST"
4
4
  import type { Simplify } from "effect/Types"
5
- import { type BrandedSchema, fromBrand, nominal } from "./brand.js"
6
- import { withDefaultMake } from "./ext.js"
5
+ import { type BrandedSchema, fromBrand, nominal } from "./brand.ts"
6
+ import { withDefaultMake } from "./ext.ts"
7
7
 
8
8
  export type NonEmptyStringBrand = B.Brand<"NonEmptyString">
9
9
  export type NonEmptyString = string & NonEmptyStringBrand
package/src/Schema.ts CHANGED
@@ -3,13 +3,13 @@ import * as SchemaAST from "effect/SchemaAST"
3
3
  import { type Simplify } from "effect/Struct"
4
4
  import type * as Tracer from "effect/Tracer"
5
5
  import type { RequiredKeys } from "effect/Types"
6
- import type { NonEmptyReadonlyArray } from "./Array.js"
7
- import { fakerArb } from "./faker.js"
8
- import { Email as EmailT, type Email as EmailType } from "./Schema/email.js"
9
- import { concurrencyUnbounded, withDefaultMake, withDefaultParseOptions } from "./Schema/ext.js"
10
- import { PhoneNumber as PhoneNumberT, type PhoneNumber as PhoneNumberType } from "./Schema/phoneNumber.js"
11
- import { type AST } from "./Schema/schema.js"
12
- import { copy, extendM, type StructuralCopyOrigin } from "./utils.js"
6
+ import type { NonEmptyReadonlyArray } from "./Array.ts"
7
+ import { fakerArb } from "./faker.ts"
8
+ import { Email as EmailT, type Email as EmailType } from "./Schema/email.ts"
9
+ import { concurrencyUnbounded, withDefaultMake, withDefaultParseOptions } from "./Schema/ext.ts"
10
+ import { PhoneNumber as PhoneNumberT, type PhoneNumber as PhoneNumberType } from "./Schema/phoneNumber.ts"
11
+ import { type AST } from "./Schema/schema.ts"
12
+ import { copy, extendM, type StructuralCopyOrigin } from "./utils.ts"
13
13
 
14
14
  // ---------------------------------------------------------------------------
15
15
  // Default helpers — re-exported from effect/Schema
@@ -109,23 +109,23 @@ export { withDecodingDefaultTypeKey } from "effect/Schema"
109
109
 
110
110
  export * from "effect/Schema"
111
111
 
112
- export * from "./Schema/Class.js"
113
- export { Class, ErrorClass, Opaque, TaggedClass, TaggedErrorClass } from "./Schema/Class.js"
112
+ export * from "./Schema/Class.ts"
113
+ export { Class, ErrorClass, Opaque, TaggedClass, TaggedErrorClass } from "./Schema/Class.ts"
114
114
 
115
- export { fromBrand, nominal } from "./Schema/brand.js"
116
- export { Array, Boolean, Date, DateFromString, DateValid, Finite, Literals, NullOr, Number, ReadonlyMap, ReadonlySet } from "./Schema/ext.js"
117
- export { Int, NonNegativeInt } from "./Schema/numbers.js"
115
+ export { fromBrand, nominal } from "./Schema/brand.ts"
116
+ export { Array, Boolean, Date, DateFromString, DateValid, Finite, Literals, NullOr, Number, ReadonlyMap, ReadonlySet } from "./Schema/ext.ts"
117
+ export { Int, NonNegativeInt } from "./Schema/numbers.ts"
118
118
 
119
- export * from "./Schema/email.js"
120
- export * from "./Schema/ext.js"
121
- export * from "./Schema/moreStrings.js"
122
- export * from "./Schema/numbers.js"
123
- export * from "./Schema/phoneNumber.js"
124
- export * from "./Schema/schema.js"
125
- export * from "./Schema/SpecialJsonSchema.js"
126
- export * from "./Schema/SpecialOpenApi.js"
127
- export * from "./Schema/strings.js"
128
- export { NonEmptyString } from "./Schema/strings.js"
119
+ export * from "./Schema/email.ts"
120
+ export * from "./Schema/ext.ts"
121
+ export * from "./Schema/moreStrings.ts"
122
+ export * from "./Schema/numbers.ts"
123
+ export * from "./Schema/phoneNumber.ts"
124
+ export * from "./Schema/schema.ts"
125
+ export * from "./Schema/SpecialJsonSchema.ts"
126
+ export * from "./Schema/SpecialOpenApi.ts"
127
+ export * from "./Schema/strings.ts"
128
+ export { NonEmptyString } from "./Schema/strings.ts"
129
129
 
130
130
  export * as SchemaIssue from "effect/SchemaIssue"
131
131
 
@@ -133,7 +133,7 @@ export const decodeEffectConcurrently: typeof S.decodeEffect = withDefaultParseO
133
133
  export const decodeUnknownEffectConcurrently: typeof S.decodeUnknownEffect = withDefaultParseOptions(
134
134
  S.decodeUnknownEffect
135
135
  )
136
- export * as SchemaParser from "./Schema/SchemaParser.js"
136
+ export * as SchemaParser from "./Schema/SchemaParser.ts"
137
137
 
138
138
  export { Void as Void_ } from "effect/Schema"
139
139
 
package/src/Set.ts CHANGED
@@ -6,7 +6,7 @@ import * as Option from "effect/Option"
6
6
  import type * as Order from "effect/Order"
7
7
  import { not } from "effect/Predicate"
8
8
  import type * as Result from "effect/Result"
9
- import { identity, pipe, type Predicate, type Refinement, tuple } from "./Function.js"
9
+ import { identity, pipe, type Predicate, type Refinement, tuple } from "./Function.ts"
10
10
 
11
11
  export function find_<A, B extends A>(
12
12
  as: ReadonlySet<A>,
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 { 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,
@@ -99,30 +99,30 @@ export interface FilterArgs<Encoded extends FieldValues, U extends keyof Encoded
99
99
 
100
100
  export type FilterFunc<Encoded extends FieldValues> = <U extends keyof Encoded = never>(
101
101
  args: FilterArgs<Encoded, U>
102
- ) => Effect.Effect<(U extends undefined ? Encoded : Pick<Encoded, U>)[]>
102
+ ) => Effect.Effect<(U extends undefined ? Encoded : Pick<Encoded, U>)[], DatabaseError>
103
103
 
104
104
  export interface Store<
105
105
  IdKey extends keyof Encoded,
106
106
  Encoded extends FieldValues,
107
107
  PM extends PersistenceModelType<Encoded> = PersistenceModelType<Encoded>
108
108
  > {
109
- all: Effect.Effect<PM[]>
109
+ all: Effect.Effect<PM[], DatabaseError>
110
110
  filter: FilterFunc<Encoded>
111
- find: (id: Encoded[IdKey]) => Effect.Effect<Option.Option<PM>>
112
- set: (e: PM) => Effect.Effect<PM, OptimisticConcurrencyException>
111
+ find: (id: Encoded[IdKey]) => Effect.Effect<Option.Option<PM>, DatabaseError>
112
+ set: (e: PM) => Effect.Effect<PM, OptimisticConcurrencyException | DatabaseError>
113
113
  batchSet: (
114
114
  items: NonEmptyReadonlyArray<PM>
115
- ) => Effect.Effect<NonEmptyReadonlyArray<PM>, OptimisticConcurrencyException>
115
+ ) => Effect.Effect<NonEmptyReadonlyArray<PM>, OptimisticConcurrencyException | DatabaseError>
116
116
  bulkSet: (
117
117
  items: NonEmptyReadonlyArray<PM>
118
- ) => Effect.Effect<NonEmptyReadonlyArray<PM>, OptimisticConcurrencyException>
119
- batchRemove: (ids: NonEmptyReadonlyArray<Encoded[IdKey]>, partitionKey?: string) => Effect.Effect<void>
120
- queryRaw: <Out>(query: RawQuery<Encoded, Out>) => Effect.Effect<readonly Out[]>
118
+ ) => Effect.Effect<NonEmptyReadonlyArray<PM>, OptimisticConcurrencyException | DatabaseError>
119
+ batchRemove: (ids: NonEmptyReadonlyArray<Encoded[IdKey]>, partitionKey?: string) => Effect.Effect<void, DatabaseError>
120
+ queryRaw: <Out>(query: RawQuery<Encoded, Out>) => Effect.Effect<readonly Out[], DatabaseError>
121
121
  /**
122
122
  * Explicitly seed a namespace. Primary is seeded eagerly on initialization.
123
123
  * Non-primary namespaces must be seeded explicitly before use.
124
124
  */
125
- seedNamespace: (namespace: string) => Effect.Effect<void>
125
+ seedNamespace: (namespace: string) => Effect.Effect<void, DatabaseError>
126
126
  }
127
127
 
128
128
  export class StoreMaker extends Context.Opaque<StoreMaker, {
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 {
@@ -157,6 +157,45 @@ export class OptimisticConcurrencyException extends TaggedErrorClass<OptimisticC
157
157
  }
158
158
  }
159
159
 
160
+ /**
161
+ * Raised by a store adapter when a database operation fails for an
162
+ * infrastructure reason (request timeout, throttle, 5xx, dropped socket, or any
163
+ * non-conflict error). Distinct from `OptimisticConcurrencyException`, which is
164
+ * an expected etag conflict.
165
+ *
166
+ * `transient` is set by the adapter for failures worth retrying (timeout /
167
+ * throttle / 5xx / network). `cause` is the underlying adapter error, carried
168
+ * through a `Defect` schema so it serializes (an `Error` encodes to
169
+ * `{ name, message, cause }`) instead of breaking JSON encoding of the channel.
170
+ *
171
+ * Treated by the api/client/FE machinery like an unexpected (500-class) error.
172
+ */
173
+ export class DatabaseError extends TaggedErrorClass<DatabaseError>()(
174
+ "DatabaseError",
175
+ {
176
+ message: S.String,
177
+ transient: S.Boolean,
178
+ cause: S.optional(S.Defect())
179
+ }
180
+ ) {
181
+ constructor(
182
+ args: { message?: string; transient?: boolean; cause?: unknown },
183
+ disableValidation?: boolean
184
+ ) {
185
+ super(
186
+ {
187
+ message: args.message ?? "Database operation failed",
188
+ transient: args.transient ?? false,
189
+ cause: args.cause
190
+ },
191
+ disableValidation as any
192
+ )
193
+ }
194
+ override toString() {
195
+ return `DatabaseError: ${this.message}`
196
+ }
197
+ }
198
+
160
199
  const MutationOnlyErrors = [
161
200
  InvalidStateError,
162
201
  OptimisticConcurrencyException
@@ -168,7 +207,8 @@ const GeneralErrors = [
168
207
  LoginError,
169
208
  UnauthorizedError,
170
209
  ValidationError,
171
- ServiceUnavailableError
210
+ ServiceUnavailableError,
211
+ DatabaseError
172
212
  ] as const
173
213
 
174
214
  export const SupportedErrors = S.Union([
@@ -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"
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)