effect 3.14.0 → 3.14.2

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/src/Context.ts CHANGED
@@ -410,7 +410,7 @@ export const get: {
410
410
  * @since 2.0.0
411
411
  * @category getters
412
412
  */
413
- <Services, T extends ValidTagsById<Services>>(tag: T): (self: Context<Services>) => Tag.Service<T>
413
+ <Services, I extends Services, S>(tag: Tag<I, S>): (self: Context<Services>) => S
414
414
  /**
415
415
  * Get a service from the context that corresponds to the given tag.
416
416
  *
@@ -456,7 +456,7 @@ export const get: {
456
456
  * @since 2.0.0
457
457
  * @category getters
458
458
  */
459
- <Services, T extends ValidTagsById<Services>>(self: Context<Services>, tag: T): Tag.Service<T>
459
+ <Services, I extends Services, S>(self: Context<Services>, tag: Tag<I, S>): S
460
460
  } = internal.get
461
461
 
462
462
  /**
@@ -751,17 +751,16 @@ export const mergeAll: <T extends Array<unknown>>(
751
751
  *
752
752
  * @since 2.0.0
753
753
  */
754
- export const pick: <Services, S extends Array<ValidTagsById<Services>>>(
755
- ...tags: S
756
- ) => (self: Context<Services>) => Context<{ [k in keyof S]: Tag.Identifier<S[k]> }[number]> = internal.pick
754
+ export const pick: <Tags extends ReadonlyArray<Tag<any, any>>>(
755
+ ...tags: Tags
756
+ ) => <Services>(self: Context<Services>) => Context<Services & Tag.Identifier<Tags[number]>> = internal.pick
757
757
 
758
758
  /**
759
759
  * @since 2.0.0
760
760
  */
761
- export const omit: <Services, S extends Array<ValidTagsById<Services>>>(
762
- ...tags: S
763
- ) => (self: Context<Services>) => Context<Exclude<Services, { [k in keyof S]: Tag.Identifier<S[k]> }[keyof S]>> =
764
- internal.omit
761
+ export const omit: <Tags extends ReadonlyArray<Tag<any, any>>>(
762
+ ...tags: Tags
763
+ ) => <Services>(self: Context<Services>) => Context<Exclude<Services, Tag.Identifier<Tags[number]>>> = internal.omit
765
764
 
766
765
  /**
767
766
  * @example
package/src/Schema.ts CHANGED
@@ -195,10 +195,10 @@ const makeStandardFailureFromParseIssue = (
195
195
  export const standardSchemaV1 = <A, I>(
196
196
  schema: Schema<A, I, never>,
197
197
  overrideOptions?: AST.ParseOptions
198
- ): StandardSchemaV1<I, A> => {
198
+ ): StandardSchemaV1<I, A> & SchemaClass<A, I, never> => {
199
199
  const decodeUnknown = ParseResult.decodeUnknown(schema, { errors: "all" })
200
- return {
201
- "~standard": {
200
+ return class StandardSchemaV1Class extends make<A, I, never>(schema.ast) {
201
+ static "~standard" = {
202
202
  version: 1,
203
203
  vendor: "effect",
204
204
  validate(value) {
@@ -4583,6 +4583,7 @@ export declare namespace Annotations {
4583
4583
  readonly equivalence?: (..._: any) => Equivalence.Equivalence<A>
4584
4584
  }
4585
4585
 
4586
+ // TODO(4.0): replace `readonly [P]` with `readonly []`
4586
4587
  /**
4587
4588
  * @since 3.10.0
4588
4589
  */
package/src/SchemaAST.ts CHANGED
@@ -339,6 +339,12 @@ export const getAnnotation: {
339
339
  */
340
340
  export const getBrandAnnotation = getAnnotation<BrandAnnotation>(BrandAnnotationId)
341
341
 
342
+ /**
343
+ * @category annotations
344
+ * @since 3.14.2
345
+ */
346
+ export const getSchemaIdAnnotation = getAnnotation<SchemaIdAnnotation>(SchemaIdAnnotationId)
347
+
342
348
  /**
343
349
  * @category annotations
344
350
  * @since 3.10.0
package/src/index.ts CHANGED
@@ -408,6 +408,7 @@ export * as Layer from "./Layer.js"
408
408
 
409
409
  /**
410
410
  * @since 3.14.0
411
+ * @experimental
411
412
  */
412
413
  export * as LayerMap from "./LayerMap.js"
413
414
 
@@ -256,9 +256,9 @@ export const unsafeGet = dual<
256
256
  /** @internal */
257
257
  export const get: {
258
258
  <I, S>(tag: C.Reference<I, S>): <Services>(self: C.Context<Services>) => S
259
- <Services, T extends C.ValidTagsById<Services>>(tag: T): (self: C.Context<Services>) => C.Tag.Service<T>
259
+ <Services, I extends Services, S>(tag: C.Tag<I, S>): (self: C.Context<Services>) => S
260
260
  <Services, I, S>(self: C.Context<Services>, tag: C.Reference<I, S>): S
261
- <Services, T extends C.ValidTagsById<Services>>(self: C.Context<Services>, tag: T): C.Tag.Service<T>
261
+ <Services, I extends Services, S>(self: C.Context<Services>, tag: C.Tag<I, S>): S
262
262
  } = unsafeGet as any
263
263
 
264
264
  /** @internal */
@@ -310,9 +310,9 @@ export const mergeAll = <T extends Array<unknown>>(
310
310
 
311
311
  /** @internal */
312
312
  export const pick =
313
- <Services, S extends Array<C.ValidTagsById<Services>>>(...tags: S) =>
314
- (self: C.Context<Services>): C.Context<
315
- { [k in keyof S]: C.Tag.Identifier<S[k]> }[number]
313
+ <Tags extends ReadonlyArray<C.Tag<any, any>>>(...tags: Tags) =>
314
+ <Services>(self: C.Context<Services>): C.Context<
315
+ Services & C.Tag.Identifier<Tags[number]>
316
316
  > => {
317
317
  const tagSet = new Set<string>(tags.map((_) => _.key))
318
318
  const newEnv = new Map()
@@ -321,14 +321,14 @@ export const pick =
321
321
  newEnv.set(tag, s)
322
322
  }
323
323
  }
324
- return makeContext<{ [k in keyof S]: C.Tag.Identifier<S[k]> }[number]>(newEnv)
324
+ return makeContext(newEnv)
325
325
  }
326
326
 
327
327
  /** @internal */
328
328
  export const omit =
329
- <Services, S extends Array<C.ValidTagsById<Services>>>(...tags: S) =>
330
- (self: C.Context<Services>): C.Context<
331
- Exclude<Services, { [k in keyof S]: C.Tag.Identifier<S[k]> }[keyof S]>
329
+ <Tags extends ReadonlyArray<C.Tag<any, any>>>(...tags: Tags) =>
330
+ <Services>(self: C.Context<Services>): C.Context<
331
+ Exclude<Services, C.Tag.Identifier<Tags[number]>>
332
332
  > => {
333
333
  const newEnv = new Map(self.unsafeMap)
334
334
  for (const tag of tags) {
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.14.0"
1
+ let moduleVersion = "3.14.2"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4