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/dist/cjs/Arbitrary.js +595 -426
- package/dist/cjs/Arbitrary.js.map +1 -1
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Schema.js +3 -3
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +7 -2
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/internal/context.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Arbitrary.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +4 -8
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +1 -1
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts +5 -0
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/Arbitrary.js +593 -423
- package/dist/esm/Arbitrary.js.map +1 -1
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Schema.js +3 -3
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +5 -0
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/context.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Arbitrary.ts +799 -477
- package/src/Context.ts +8 -9
- package/src/Schema.ts +4 -3
- package/src/SchemaAST.ts +6 -0
- package/src/index.ts +1 -0
- package/src/internal/context.ts +9 -9
- package/src/internal/version.ts +1 -1
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,
|
|
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,
|
|
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: <
|
|
755
|
-
...tags:
|
|
756
|
-
) => (self: Context<Services>) => Context<
|
|
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: <
|
|
762
|
-
...tags:
|
|
763
|
-
) => (self: Context<Services>) => Context<Exclude<Services,
|
|
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
package/src/internal/context.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
-
<
|
|
314
|
-
(self: C.Context<Services>): C.Context<
|
|
315
|
-
|
|
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
|
|
324
|
+
return makeContext(newEnv)
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
/** @internal */
|
|
328
328
|
export const omit =
|
|
329
|
-
<
|
|
330
|
-
(self: C.Context<Services>): C.Context<
|
|
331
|
-
Exclude<Services,
|
|
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) {
|
package/src/internal/version.ts
CHANGED