@dxos/effect 0.8.1-staging.9eaf14f → 0.8.2-main.10c050d

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.
@@ -1,11 +1,11 @@
1
- import { SchemaAST as AST, Schema as S } from 'effect';
1
+ import { SchemaAST, Schema } from 'effect';
2
2
  import { type JsonPath, type JsonProp } from './jsonPath';
3
3
  export type SimpleType = 'object' | 'string' | 'number' | 'boolean' | 'enum' | 'literal';
4
4
  /**
5
5
  * Get the base type; e.g., traverse through refinements.
6
6
  */
7
- export declare const getSimpleType: (node: AST.AST) => SimpleType | undefined;
8
- export declare const isSimpleType: (node: AST.AST) => boolean;
7
+ export declare const getSimpleType: (node: SchemaAST.AST) => SimpleType | undefined;
8
+ export declare const isSimpleType: (node: SchemaAST.AST) => boolean;
9
9
  export declare namespace SimpleType {
10
10
  /**
11
11
  * Returns the default empty value for a given SimpleType.
@@ -25,8 +25,8 @@ export declare enum VisitResult {
25
25
  EXIT = 2
26
26
  }
27
27
  export type Path = (string | number)[];
28
- export type TestFn = (node: AST.AST, path: Path, depth: number) => VisitResult | boolean | undefined;
29
- export type VisitorFn = (node: AST.AST, path: Path, depth: number) => void;
28
+ export type TestFn = (node: SchemaAST.AST, path: Path, depth: number) => VisitResult | boolean | undefined;
29
+ export type VisitorFn = (node: SchemaAST.AST, path: Path, depth: number) => void;
30
30
  /**
31
31
  * Visit leaf nodes.
32
32
  * Refs:
@@ -34,52 +34,52 @@ export type VisitorFn = (node: AST.AST, path: Path, depth: number) => void;
34
34
  * - https://github.com/syntax-tree/unist-util-is?tab=readme-ov-file#test
35
35
  */
36
36
  export declare const visit: {
37
- (node: AST.AST, visitor: VisitorFn): void;
38
- (node: AST.AST, test: TestFn, visitor: VisitorFn): void;
37
+ (node: SchemaAST.AST, visitor: VisitorFn): void;
38
+ (node: SchemaAST.AST, test: TestFn, visitor: VisitorFn): void;
39
39
  };
40
40
  /**
41
41
  * Recursively descend into AST to find first node that passes the test.
42
42
  */
43
- export declare const findNode: (node: AST.AST, test: (node: AST.AST) => boolean) => AST.AST | undefined;
43
+ export declare const findNode: (node: SchemaAST.AST, test: (node: SchemaAST.AST) => boolean) => SchemaAST.AST | undefined;
44
44
  /**
45
45
  * Get the AST node for the given property (dot-path).
46
46
  */
47
- export declare const findProperty: (schema: S.Schema.AnyNoContext, path: JsonPath | JsonProp) => AST.AST | undefined;
47
+ export declare const findProperty: (schema: Schema.Schema.AnyNoContext, path: JsonPath | JsonProp) => SchemaAST.AST | undefined;
48
48
  /**
49
49
  * Get annotation or return undefined.
50
50
  * @param annotationId
51
51
  * @param noDefault If true, then return undefined for effect library defined values.
52
52
  */
53
- export declare const getAnnotation: <T>(annotationId: symbol, noDefault?: boolean) => (node: AST.AST) => T | undefined;
53
+ export declare const getAnnotation: <T>(annotationId: symbol, noDefault?: boolean) => (node: SchemaAST.AST) => T | undefined;
54
54
  /**
55
55
  * Recursively descend into AST to find first matching annotations.
56
56
  * Optionally skips default annotations for basic types (e.g., 'a string').
57
57
  */
58
- export declare const findAnnotation: <T>(node: AST.AST, annotationId: symbol, noDefault?: boolean) => T | undefined;
58
+ export declare const findAnnotation: <T>(node: SchemaAST.AST, annotationId: symbol, noDefault?: boolean) => T | undefined;
59
59
  /**
60
- * Effect S.optional creates a union type with undefined as the second type.
60
+ * Effect Schema.optional creates a union type with undefined as the second type.
61
61
  */
62
- export declare const isOption: (node: AST.AST) => boolean;
62
+ export declare const isOption: (node: SchemaAST.AST) => boolean;
63
63
  /**
64
64
  * Determines if the node is a union of literal types.
65
65
  */
66
- export declare const isLiteralUnion: (node: AST.AST) => boolean;
66
+ export declare const isLiteralUnion: (node: SchemaAST.AST) => boolean;
67
67
  /**
68
68
  * Determines if the node is a discriminated union.
69
69
  */
70
- export declare const isDiscriminatedUnion: (node: AST.AST) => boolean;
70
+ export declare const isDiscriminatedUnion: (node: SchemaAST.AST) => boolean;
71
71
  /**
72
72
  * Get the discriminating properties for the given union type.
73
73
  */
74
- export declare const getDiscriminatingProps: (node: AST.AST) => string[] | undefined;
74
+ export declare const getDiscriminatingProps: (node: SchemaAST.AST) => string[] | undefined;
75
75
  /**
76
76
  * Get the discriminated type for the given value.
77
77
  */
78
- export declare const getDiscriminatedType: (node: AST.AST, value?: Record<string, any>) => AST.AST | undefined;
78
+ export declare const getDiscriminatedType: (node: SchemaAST.AST, value?: Record<string, any>) => SchemaAST.AST | undefined;
79
79
  /**
80
80
  * Maps AST nodes.
81
- * The user is responsible for recursively calling {@link mapAst} on the AST.
81
+ * The user is responsible for recursively calling {@link mapAst} on the SchemaAST.
82
82
  * NOTE: Will evaluate suspended ASTs.
83
83
  */
84
- export declare const mapAst: (ast: AST.AST, f: (ast: AST.AST, key: keyof any | undefined) => AST.AST) => AST.AST;
84
+ export declare const mapAst: (ast: SchemaAST.AST, f: (ast: SchemaAST.AST, key: keyof any | undefined) => SchemaAST.AST) => SchemaAST.AST;
85
85
  //# sourceMappingURL=ast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/ast.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,SAAS,IAAI,GAAG,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAKrE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAS1D,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,aAAa,SAAU,GAAG,CAAC,GAAG,KAAG,UAAU,GAAG,SAsB1D,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,GAAG,CAAC,GAAG,KAAG,OAAgC,CAAC;AAE9E,yBAAiB,UAAU,CAAC;IAC1B;;;OAGG;IACI,MAAM,eAAe,SAAU,UAAU,KAAG,GAkBlD,CAAC;CACH;AAMD,oB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SAAS,CAAC,GAAG,KAAG,CAAC,GAAG,SAS1B,CAAC;AAEJ;;;GAGG;AAEH,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,EAAE,cAAc,MAAM,EAAE,mBAAgB,KAAG,CAAC,GAAG,SAiBnG,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,SAAS,CAAC,GAAG,KAAG,OAE9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,CAAC,GAAG,KAAG,OAEpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,CAAC,GAAG,KAAG,OAE1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,SAAS,CAAC,GAAG,KAAG,MAAM,EAAE,GAAG,SAgBvE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,SAAS,CAAC,GAAG,EACnB,QAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,KAC9B,SAAS,CAAC,GAAG,GAAG,SA2ClB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,GACjB,KAAK,SAAS,CAAC,GAAG,EAClB,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,SAAS,KAAK,SAAS,CAAC,GAAG,KACnE,SAAS,CAAC,GAqCZ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Schema as S } from 'effect';
1
+ import { Schema } from 'effect';
2
2
  export type JsonProp = string & {
3
3
  __JsonPath: true;
4
4
  __JsonProp: true;
@@ -9,8 +9,8 @@ export type JsonPath = string & {
9
9
  /**
10
10
  * https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html
11
11
  */
12
- export declare const JsonPath: S.Schema<JsonPath>;
13
- export declare const JsonProp: S.Schema<JsonProp>;
12
+ export declare const JsonPath: Schema.Schema<JsonPath>;
13
+ export declare const JsonProp: Schema.Schema<JsonProp>;
14
14
  export declare const isJsonPath: (value: unknown) => value is JsonPath;
15
15
  /**
16
16
  * Creates a JsonPath from an array of path segments.
@@ -1 +1 @@
1
- {"version":3,"file":"jsonPath.d.ts","sourceRoot":"","sources":["../../../src/jsonPath.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAMrC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC;AACvE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC;AAKrD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAkD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1F,eAAO,MAAM,QAAQ,EAA0D,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAElG,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,QAEpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,SAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAG,QAa1D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,eAAgB,MAAM,KAAG,QAK7D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,MAAM,EAUpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,WAAY,GAAG,QAAQ,QAAQ,KAAG,GAGtD,CAAC"}
1
+ {"version":3,"file":"jsonPath.d.ts","sourceRoot":"","sources":["../../../src/jsonPath.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAKxC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC;AACvE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC;AAKrD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAGR,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACrC,eAAO,MAAM,QAAQ,EAAoE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEjH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAEpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAG,QAa1D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,YAAY,MAAM,KAAG,QAK7D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,QAAQ,KAAG,MAAM,EAUpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,MAAM,QAAQ,KAAG,GAGtD,CAAC"}
@@ -1,16 +1,16 @@
1
- import { SchemaAST as AST, type Schema as S, Option } from 'effect';
1
+ import { SchemaAST, type Schema, Option } from 'effect';
2
2
  type ParamKeyAnnotationValue = {
3
3
  key: string;
4
4
  };
5
- export declare const getParamKeyAnnotation: (annotated: AST.Annotated) => Option.Option<ParamKeyAnnotationValue>;
6
- export declare const ParamKeyAnnotation: (value: ParamKeyAnnotationValue) => <S extends S.Annotable.All>(self: S) => S.Annotable.Self<S>;
5
+ export declare const getParamKeyAnnotation: (annotated: SchemaAST.Annotated) => Option.Option<ParamKeyAnnotationValue>;
6
+ export declare const ParamKeyAnnotation: (value: ParamKeyAnnotationValue) => <S extends Schema.Annotable.All>(self: S) => Schema.Annotable.Self<S>;
7
7
  /**
8
8
  * HTTP params parser.
9
9
  * Supports custom key serialization.
10
10
  */
11
11
  export declare class UrlParser<T extends Record<string, any>> {
12
12
  private readonly _schema;
13
- constructor(_schema: S.Struct<T>);
13
+ constructor(_schema: Schema.Struct<T>);
14
14
  /**
15
15
  * Parse URL params.
16
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,IAAI,GAAG,EAAE,KAAK,MAAM,IAAI,CAAC,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAM1E,KAAK,uBAAuB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,eAAO,MAAM,qBAAqB,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,uBAAuB,CACrC,CAAC;AAEnE,eAAO,MAAM,kBAAkB,UACrB,uBAAuB,MAC9B,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CACH,CAAC;AAExD;;;GAGG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC;IAsBtB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,GAAG;CAoBrC"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAM9D,KAAK,uBAAuB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,eAAO,MAAM,qBAAqB,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,uBAAuB,CACrC,CAAC;AAEzE,eAAO,MAAM,kBAAkB,GAC5B,OAAO,uBAAuB,MAC9B,CAAC,SAAS,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,KAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CACb,CAAC;AAExD;;;GAGG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAEtD;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC;IAsBtB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,GAAG;CAoBrC"}
@@ -1 +1 @@
1
- {"version":"5.7.3"}
1
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/effect",
3
- "version": "0.8.1-staging.9eaf14f",
3
+ "version": "0.8.2-main.10c050d",
4
4
  "description": "Effect utils.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -24,13 +24,13 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "jsonpath-plus": "10.2.0",
27
- "@dxos/invariant": "0.8.1-staging.9eaf14f",
28
- "@dxos/node-std": "0.8.1-staging.9eaf14f",
29
- "@dxos/util": "0.8.1-staging.9eaf14f"
27
+ "@dxos/invariant": "0.8.2-main.10c050d",
28
+ "@dxos/node-std": "0.8.2-main.10c050d",
29
+ "@dxos/util": "0.8.2-main.10c050d"
30
30
  },
31
31
  "devDependencies": {
32
- "effect": "3.13.3",
33
- "@dxos/log": "0.8.1-staging.9eaf14f"
32
+ "effect": "3.14.21",
33
+ "@dxos/log": "0.8.2-main.10c050d"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "effect": "^3.13.3"
package/src/ast.test.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { SchemaAST as AST, Schema as S } from 'effect';
5
+ import { SchemaAST, Schema } from 'effect';
6
6
  import { describe, test } from 'vitest';
7
7
 
8
8
  import { invariant } from '@dxos/invariant';
@@ -21,8 +21,8 @@ import {
21
21
  } from './ast';
22
22
  import { type JsonPath, type JsonProp } from './jsonPath';
23
23
 
24
- const ZipCode = S.String.pipe(
25
- S.pattern(/^\d{5}$/, {
24
+ const ZipCode = Schema.String.pipe(
25
+ Schema.pattern(/^\d{5}$/, {
26
26
  typeId: Symbol.for('@example/schema/ZipCode'),
27
27
  identifier: 'ZipCode',
28
28
  title: 'ZIP code',
@@ -30,24 +30,24 @@ const ZipCode = S.String.pipe(
30
30
  }),
31
31
  );
32
32
 
33
- const LatLng = S.Struct({
34
- lat: S.Number,
35
- lng: S.Number,
33
+ const LatLng = Schema.Struct({
34
+ lat: Schema.Number,
35
+ lng: Schema.Number,
36
36
  });
37
37
 
38
- const Contact = S.Struct({
39
- name: S.String,
40
- address: S.Struct({
38
+ const Contact = Schema.Struct({
39
+ name: Schema.String,
40
+ address: Schema.Struct({
41
41
  zip: ZipCode,
42
- location: S.optional(LatLng),
42
+ location: Schema.optional(LatLng),
43
43
  }),
44
44
  });
45
45
 
46
- const getTitle = getAnnotation(AST.TitleAnnotationId);
46
+ const getTitle = getAnnotation(SchemaAST.TitleAnnotationId);
47
47
 
48
48
  describe('AST', () => {
49
49
  test('validation', ({ expect }) => {
50
- const validate = S.validateSync(ZipCode);
50
+ const validate = Schema.validateSync(ZipCode);
51
51
  validate('11205');
52
52
 
53
53
  expect(() => validate(null)).to.throw();
@@ -57,9 +57,9 @@ describe('AST', () => {
57
57
  });
58
58
 
59
59
  test('findNode', ({ expect }) => {
60
- const TestSchema = S.Struct({
61
- name: S.optional(S.String),
62
- }).pipe(S.mutable);
60
+ const TestSchema = Schema.Struct({
61
+ name: Schema.optional(Schema.String),
62
+ }).pipe(Schema.mutable);
63
63
 
64
64
  const prop = findProperty(TestSchema, 'name' as JsonProp);
65
65
  invariant(prop);
@@ -82,7 +82,7 @@ describe('AST', () => {
82
82
  {
83
83
  const prop = findProperty(Contact, 'address.location.lat' as JsonPath);
84
84
  invariant(prop);
85
- expect(AST.isNumberKeyword(prop)).to.be.true;
85
+ expect(SchemaAST.isNumberKeyword(prop)).to.be.true;
86
86
  }
87
87
  {
88
88
  const prop = findProperty(Contact, 'address.city' as JsonPath);
@@ -91,33 +91,30 @@ describe('AST', () => {
91
91
  });
92
92
 
93
93
  test('findAnnotation', ({ expect }) => {
94
- const TestSchema = S.NonEmptyString.pipe(S.pattern(/^\d{5}$/)).annotations({
95
- [AST.TitleAnnotationId]: 'original title',
94
+ const TestSchema = Schema.NonEmptyString.pipe(Schema.pattern(/^\d{5}$/)).annotations({
95
+ title: 'original title',
96
96
  });
97
97
 
98
- const ContactSchema = S.Struct({
99
- p1: TestSchema.annotations({ [AST.TitleAnnotationId]: 'new title' }),
100
- p2: TestSchema.annotations({ [AST.TitleAnnotationId]: 'new title' }).pipe(S.optional),
101
- p3: S.optional(TestSchema.annotations({ [AST.TitleAnnotationId]: 'new title' })),
98
+ const ContactSchema = Schema.Struct({
99
+ p1: TestSchema.annotations({ title: 'new title' }),
100
+ p2: TestSchema.annotations({ title: 'new title' }).pipe(Schema.optional),
101
+ p3: Schema.optional(TestSchema.annotations({ title: 'new title' })),
102
102
  });
103
103
 
104
104
  for (const p of ['p1', 'p2', 'p3']) {
105
105
  const prop = findProperty(ContactSchema, p as JsonPath);
106
106
  invariant(prop);
107
- const value = findAnnotation(prop, AST.TitleAnnotationId);
107
+ const value = findAnnotation(prop, SchemaAST.TitleAnnotationId);
108
108
  expect(value, `invalid title for ${p}`).to.eq('new title');
109
109
  }
110
110
  });
111
111
 
112
112
  test('findAnnotation skips defaults', ({ expect }) => {
113
- const annotation = findAnnotation(
114
- S.String.annotations({ [AST.TitleAnnotationId]: 'test' }).ast,
115
- AST.TitleAnnotationId,
116
- );
113
+ const annotation = findAnnotation(Schema.String.annotations({ title: 'test' }).ast, SchemaAST.TitleAnnotationId);
117
114
  expect(annotation).to.eq('test');
118
115
 
119
- const annotationIds = [AST.TitleAnnotationId, AST.DescriptionAnnotationId];
120
- const schemas = [S.Object, S.String, S.Number, S.Boolean];
116
+ const annotationIds = [SchemaAST.TitleAnnotationId, SchemaAST.DescriptionAnnotationId];
117
+ const schemas = [Schema.Object, Schema.String, Schema.Number, Schema.Boolean];
121
118
  for (const schema of schemas) {
122
119
  for (const annotationId of annotationIds) {
123
120
  const annotation = findAnnotation(schema.ast, annotationId);
@@ -127,12 +124,12 @@ describe('AST', () => {
127
124
  });
128
125
 
129
126
  test('visit', ({ expect }) => {
130
- const TestSchema = S.Struct({
131
- name: S.NonEmptyString,
132
- emails: S.optional(S.mutable(S.Array(S.String))),
133
- address: S.optional(
134
- S.Struct({
135
- zip: S.String,
127
+ const TestSchema = Schema.Struct({
128
+ name: Schema.NonEmptyString,
129
+ emails: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),
130
+ address: Schema.optional(
131
+ Schema.Struct({
132
+ zip: Schema.String,
136
133
  }),
137
134
  ),
138
135
  });
@@ -142,12 +139,12 @@ describe('AST', () => {
142
139
  });
143
140
 
144
141
  test('discriminated unions', ({ expect }) => {
145
- const TestUnionSchema = S.Union(
146
- S.Struct({ kind: S.Literal('a'), label: S.String }),
147
- S.Struct({ kind: S.Literal('b'), count: S.Number, active: S.Boolean }),
142
+ const TestUnionSchema = Schema.Union(
143
+ Schema.Struct({ kind: Schema.Literal('a'), label: Schema.String }),
144
+ Schema.Struct({ kind: Schema.Literal('b'), count: Schema.Number, active: Schema.Boolean }),
148
145
  );
149
146
 
150
- type TestUnionType = S.Schema.Type<typeof TestUnionSchema>;
147
+ type TestUnionType = Schema.Schema.Type<typeof TestUnionSchema>;
151
148
 
152
149
  {
153
150
  expect(isOption(TestUnionSchema.ast)).to.be.false;
@@ -158,7 +155,7 @@ describe('AST', () => {
158
155
  }
159
156
 
160
157
  {
161
- invariant(AST.isUnion(TestUnionSchema.ast));
158
+ invariant(SchemaAST.isUnion(TestUnionSchema.ast));
162
159
  const [a, b] = TestUnionSchema.ast.types;
163
160
 
164
161
  const obj1: TestUnionType = {
@@ -175,8 +172,8 @@ describe('AST', () => {
175
172
  expect(getDiscriminatedType(TestUnionSchema.ast, obj1)?.toJSON()).to.deep.eq(a.toJSON());
176
173
  expect(getDiscriminatedType(TestUnionSchema.ast, obj2)?.toJSON()).to.deep.eq(b.toJSON());
177
174
  expect(getDiscriminatedType(TestUnionSchema.ast)?.toJSON()).to.deep.eq(
178
- S.Struct({
179
- kind: S.Literal('a', 'b'),
175
+ Schema.Struct({
176
+ kind: Schema.Literal('a', 'b'),
180
177
  }).ast.toJSON(),
181
178
  );
182
179
  }