@dxos/echo 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe
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/lib/browser/chunk-BIDAASFK.mjs +3727 -0
- package/dist/lib/browser/chunk-BIDAASFK.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs +410 -0
- package/dist/lib/browser/chunk-ZDLCWGEW.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs +585 -0
- package/dist/lib/browser/chunk-ZFRJKT4A.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -5
- package/dist/lib/browser/internal/index.mjs +336 -0
- package/dist/lib/browser/internal/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/query/index.mjs +13 -0
- package/dist/lib/browser/query/index.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +231 -34
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs +3727 -0
- package/dist/lib/node-esm/chunk-3SVRRCUU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs +585 -0
- package/dist/lib/node-esm/chunk-CGDHRZWH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs +410 -0
- package/dist/lib/node-esm/chunk-HWS6VBQC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +10 -5
- package/dist/lib/node-esm/internal/index.mjs +336 -0
- package/dist/lib/node-esm/internal/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/query/index.mjs +13 -0
- package/dist/lib/node-esm/query/index.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +231 -34
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/Obj.d.ts +26 -7
- package/dist/types/src/Obj.d.ts.map +1 -1
- package/dist/types/src/Ref.d.ts +1 -1
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +5 -4
- package/dist/types/src/Relation.d.ts.map +1 -1
- package/dist/types/src/Tag.d.ts +17 -0
- package/dist/types/src/Tag.d.ts.map +1 -0
- package/dist/types/src/Type.d.ts +16 -17
- package/dist/types/src/Type.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +14 -18
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/ast/annotation-helper.d.ts +8 -0
- package/dist/types/src/internal/ast/annotation-helper.d.ts.map +1 -0
- package/dist/types/src/internal/ast/annotations.d.ts +131 -0
- package/dist/types/src/internal/ast/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/ast/annotations.test.d.ts +2 -0
- package/dist/types/src/internal/ast/annotations.test.d.ts.map +1 -0
- package/dist/types/src/internal/ast/entity-kind.d.ts +10 -0
- package/dist/types/src/internal/ast/entity-kind.d.ts.map +1 -0
- package/dist/types/src/internal/ast/index.d.ts +5 -0
- package/dist/types/src/internal/ast/index.d.ts.map +1 -0
- package/dist/types/src/internal/ast/types.d.ts +6 -0
- package/dist/types/src/internal/ast/types.d.ts.map +1 -0
- package/dist/types/src/internal/formats/date.d.ts +63 -0
- package/dist/types/src/internal/formats/date.d.ts.map +1 -0
- package/dist/types/src/internal/formats/date.test.d.ts +2 -0
- package/dist/types/src/internal/formats/date.test.d.ts.map +1 -0
- package/dist/types/src/internal/formats/format.d.ts +30 -0
- package/dist/types/src/internal/formats/format.d.ts.map +1 -0
- package/dist/types/src/internal/formats/format.test.d.ts +2 -0
- package/dist/types/src/internal/formats/format.test.d.ts.map +1 -0
- package/dist/types/src/internal/formats/index.d.ts +8 -0
- package/dist/types/src/internal/formats/index.d.ts.map +1 -0
- package/dist/types/src/internal/formats/number.d.ts +31 -0
- package/dist/types/src/internal/formats/number.d.ts.map +1 -0
- package/dist/types/src/internal/formats/object.d.ts +35 -0
- package/dist/types/src/internal/formats/object.d.ts.map +1 -0
- package/dist/types/src/internal/formats/select.d.ts +11 -0
- package/dist/types/src/internal/formats/select.d.ts.map +1 -0
- package/dist/types/src/internal/formats/string.d.ts +38 -0
- package/dist/types/src/internal/formats/string.d.ts.map +1 -0
- package/dist/types/src/internal/formats/types.d.ts +68 -0
- package/dist/types/src/internal/formats/types.d.ts.map +1 -0
- package/dist/types/src/internal/index.d.ts +15 -0
- package/dist/types/src/internal/index.d.ts.map +1 -0
- package/dist/types/src/internal/json/annotations.d.ts +19 -0
- package/dist/types/src/internal/json/annotations.d.ts.map +1 -0
- package/dist/types/src/internal/json/effect-schema.test.d.ts +2 -0
- package/dist/types/src/internal/json/effect-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/json/index.d.ts +2 -0
- package/dist/types/src/internal/json/index.d.ts.map +1 -0
- package/dist/types/src/internal/json/json-schema.d.ts +28 -0
- package/dist/types/src/internal/json/json-schema.d.ts.map +1 -0
- package/dist/types/src/internal/json/json-schema.test.d.ts +2 -0
- package/dist/types/src/internal/json/json-schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/index.d.ts +3 -0
- package/dist/types/src/internal/json-schema/index.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts +7 -0
- package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +1 -0
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts +250 -0
- package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -0
- package/dist/types/src/internal/object/accessors.d.ts +37 -0
- package/dist/types/src/internal/object/accessors.d.ts.map +1 -0
- package/dist/types/src/internal/object/common.d.ts +18 -0
- package/dist/types/src/internal/object/common.d.ts.map +1 -0
- package/dist/types/src/internal/object/create.d.ts +40 -0
- package/dist/types/src/internal/object/create.d.ts.map +1 -0
- package/dist/types/src/internal/object/create.test.d.ts +2 -0
- package/dist/types/src/internal/object/create.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/deleted.d.ts +6 -0
- package/dist/types/src/internal/object/deleted.d.ts.map +1 -0
- package/dist/types/src/internal/object/entity.d.ts +33 -0
- package/dist/types/src/internal/object/entity.d.ts.map +1 -0
- package/dist/types/src/internal/object/expando.d.ts +14 -0
- package/dist/types/src/internal/object/expando.d.ts.map +1 -0
- package/dist/types/src/internal/object/ids.d.ts +6 -0
- package/dist/types/src/internal/object/ids.d.ts.map +1 -0
- package/dist/types/src/internal/object/index.d.ts +16 -0
- package/dist/types/src/internal/object/index.d.ts.map +1 -0
- package/dist/types/src/internal/object/inspect.d.ts +2 -0
- package/dist/types/src/internal/object/inspect.d.ts.map +1 -0
- package/dist/types/src/internal/object/json-serializer.d.ts +32 -0
- package/dist/types/src/internal/object/json-serializer.d.ts.map +1 -0
- package/dist/types/src/internal/object/json-serializer.test.d.ts +2 -0
- package/dist/types/src/internal/object/json-serializer.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/meta.d.ts +31 -0
- package/dist/types/src/internal/object/meta.d.ts.map +1 -0
- package/dist/types/src/internal/object/model.d.ts +117 -0
- package/dist/types/src/internal/object/model.d.ts.map +1 -0
- package/dist/types/src/internal/object/relation.d.ts +17 -0
- package/dist/types/src/internal/object/relation.d.ts.map +1 -0
- package/dist/types/src/internal/object/schema-validator.d.ts +15 -0
- package/dist/types/src/internal/object/schema-validator.d.ts.map +1 -0
- package/dist/types/src/internal/object/schema-validator.test.d.ts +2 -0
- package/dist/types/src/internal/object/schema-validator.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/typed-object.d.ts +31 -0
- package/dist/types/src/internal/object/typed-object.d.ts.map +1 -0
- package/dist/types/src/internal/object/typed-object.test.d.ts +2 -0
- package/dist/types/src/internal/object/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/object/typename.d.ts +15 -0
- package/dist/types/src/internal/object/typename.d.ts.map +1 -0
- package/dist/types/src/internal/object/version.d.ts +14 -0
- package/dist/types/src/internal/object/version.d.ts.map +1 -0
- package/dist/types/src/internal/projection/compose.d.ts +6 -0
- package/dist/types/src/internal/projection/compose.d.ts.map +1 -0
- package/dist/types/src/internal/projection/compose.test.d.ts +2 -0
- package/dist/types/src/internal/projection/compose.test.d.ts.map +1 -0
- package/dist/types/src/internal/projection/index.d.ts +2 -0
- package/dist/types/src/internal/projection/index.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/handler.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/reactive-object.d.ts +15 -0
- package/dist/types/src/internal/proxy/reactive-object.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/schema.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/schema.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/typed-handler.d.ts +44 -0
- package/dist/types/src/internal/proxy/typed-handler.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +1 -0
- package/dist/types/src/internal/proxy/typed-object.test.d.ts +2 -0
- package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +1 -0
- package/dist/types/src/internal/query/index.d.ts +2 -0
- package/dist/types/src/internal/query/index.d.ts.map +1 -0
- package/dist/types/src/internal/query/query.d.ts +17 -0
- package/dist/types/src/internal/query/query.d.ts.map +1 -0
- package/dist/types/src/internal/ref/index.d.ts +3 -0
- package/dist/types/src/internal/ref/index.d.ts.map +1 -0
- package/dist/types/src/internal/ref/ref-array.d.ts +21 -0
- package/dist/types/src/internal/ref/ref-array.d.ts.map +1 -0
- package/dist/types/src/internal/ref/ref.d.ts +206 -0
- package/dist/types/src/internal/ref/ref.d.ts.map +1 -0
- package/dist/types/src/internal/ref/ref.test.d.ts +2 -0
- package/dist/types/src/internal/ref/ref.test.d.ts.map +1 -0
- package/dist/types/src/internal/schema/echo-schema.d.ts +168 -0
- package/dist/types/src/internal/schema/echo-schema.d.ts.map +1 -0
- package/dist/types/src/internal/schema/index.d.ts +7 -0
- package/dist/types/src/internal/schema/index.d.ts.map +1 -0
- package/dist/types/src/internal/schema/manipulation.d.ts +10 -0
- package/dist/types/src/internal/schema/manipulation.d.ts.map +1 -0
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +18 -0
- package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +1 -0
- package/dist/types/src/internal/schema/snapshot.d.ts +6 -0
- package/dist/types/src/internal/schema/snapshot.d.ts.map +1 -0
- package/dist/types/src/internal/schema/stored-schema.d.ts +13 -0
- package/dist/types/src/internal/schema/stored-schema.d.ts.map +1 -0
- package/dist/types/src/internal/testing/index.d.ts +3 -0
- package/dist/types/src/internal/testing/index.d.ts.map +1 -0
- package/dist/types/src/internal/testing/types.d.ts +381 -0
- package/dist/types/src/internal/testing/types.d.ts.map +1 -0
- package/dist/types/src/internal/testing/utils.d.ts +10 -0
- package/dist/types/src/internal/testing/utils.d.ts.map +1 -0
- package/dist/types/src/internal/types/index.d.ts +3 -0
- package/dist/types/src/internal/types/index.d.ts.map +1 -0
- package/dist/types/src/internal/types/types.d.ts +79 -0
- package/dist/types/src/internal/types/types.d.ts.map +1 -0
- package/dist/types/src/internal/types/types.test.d.ts +2 -0
- package/dist/types/src/internal/types/types.test.d.ts.map +1 -0
- package/dist/types/src/internal/types/util.d.ts +5 -0
- package/dist/types/src/internal/types/util.d.ts.map +1 -0
- package/dist/types/src/query/index.d.ts +1 -1
- package/dist/types/src/query/index.d.ts.map +1 -1
- package/dist/types/src/query/{dsl.d.ts → query.d.ts} +28 -23
- package/dist/types/src/query/query.d.ts.map +1 -0
- package/dist/types/src/query/query.test.d.ts +2 -0
- package/dist/types/src/query/query.test.d.ts.map +1 -0
- package/dist/types/src/testing/echo-schema.d.ts +7 -0
- package/dist/types/src/testing/echo-schema.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/types.d.ts +170 -55
- package/dist/types/src/testing/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -18
- package/src/Obj.ts +98 -14
- package/src/Ref.ts +1 -2
- package/src/Relation.ts +15 -5
- package/src/Tag.ts +39 -0
- package/src/Type.ts +29 -30
- package/src/index.ts +3 -2
- package/src/internal/ast/annotation-helper.ts +22 -0
- package/src/internal/ast/annotations.test.ts +98 -0
- package/src/internal/ast/annotations.ts +226 -0
- package/src/internal/ast/entity-kind.ts +15 -0
- package/src/internal/ast/index.ts +8 -0
- package/src/internal/ast/types.ts +17 -0
- package/src/internal/formats/date.test.ts +56 -0
- package/src/internal/formats/date.ts +217 -0
- package/src/internal/formats/format.test.ts +77 -0
- package/src/internal/formats/format.ts +52 -0
- package/src/internal/formats/index.ts +12 -0
- package/src/internal/formats/number.ts +89 -0
- package/src/internal/formats/object.ts +80 -0
- package/src/internal/formats/select.ts +16 -0
- package/src/internal/formats/string.ts +76 -0
- package/src/internal/formats/types.ts +175 -0
- package/src/internal/index.ts +22 -0
- package/src/internal/json/annotations.ts +50 -0
- package/src/internal/json/effect-schema.test.ts +143 -0
- package/src/internal/json/index.ts +5 -0
- package/src/internal/json/json-schema.test.ts +849 -0
- package/src/internal/json/json-schema.ts +519 -0
- package/src/internal/json-schema/index.ts +6 -0
- package/src/internal/json-schema/json-schema-normalize.ts +109 -0
- package/src/internal/json-schema/json-schema-type.ts +403 -0
- package/src/internal/object/accessors.ts +153 -0
- package/src/internal/object/common.ts +76 -0
- package/src/internal/object/create.test.ts +118 -0
- package/src/internal/object/create.ts +96 -0
- package/src/internal/object/deleted.ts +19 -0
- package/src/internal/object/entity.ts +248 -0
- package/src/internal/object/expando.ts +21 -0
- package/src/internal/object/ids.ts +12 -0
- package/src/internal/object/index.ts +19 -0
- package/src/internal/object/inspect.ts +48 -0
- package/src/internal/object/json-serializer.test.ts +99 -0
- package/src/internal/object/json-serializer.ts +225 -0
- package/src/internal/object/meta.ts +61 -0
- package/src/internal/object/model.ts +170 -0
- package/src/internal/object/relation.ts +24 -0
- package/src/internal/object/schema-validator.test.ts +186 -0
- package/src/internal/object/schema-validator.ts +241 -0
- package/src/internal/object/typed-object.test.ts +34 -0
- package/src/internal/object/typed-object.ts +88 -0
- package/src/internal/object/typename.ts +61 -0
- package/src/internal/object/version.ts +22 -0
- package/src/internal/projection/compose.test.ts +43 -0
- package/src/internal/projection/compose.ts +36 -0
- package/src/internal/projection/index.ts +5 -0
- package/src/internal/proxy/handler.test.ts +163 -0
- package/src/internal/proxy/reactive-object.ts +108 -0
- package/src/internal/proxy/schema.test.ts +136 -0
- package/src/internal/proxy/typed-handler.test.ts +102 -0
- package/src/internal/proxy/typed-handler.ts +228 -0
- package/src/internal/proxy/typed-object.test.ts +100 -0
- package/src/internal/query/index.ts +5 -0
- package/src/internal/query/query.ts +23 -0
- package/src/internal/ref/index.ts +6 -0
- package/src/internal/ref/ref-array.ts +39 -0
- package/src/internal/ref/ref.test.ts +100 -0
- package/src/internal/ref/ref.ts +521 -0
- package/src/internal/schema/echo-schema.ts +383 -0
- package/src/internal/schema/index.ts +10 -0
- package/src/internal/schema/manipulation.ts +92 -0
- package/src/internal/schema/runtime-schema-registry.ts +78 -0
- package/src/internal/schema/snapshot.ts +25 -0
- package/src/internal/schema/stored-schema.ts +26 -0
- package/src/internal/testing/index.ts +6 -0
- package/src/internal/testing/types.ts +144 -0
- package/src/internal/testing/utils.ts +54 -0
- package/src/internal/types/index.ts +6 -0
- package/src/internal/types/types.test.ts +48 -0
- package/src/internal/types/types.ts +176 -0
- package/src/internal/types/util.ts +9 -0
- package/src/query/index.ts +2 -1
- package/src/query/query.test.ts +401 -0
- package/src/query/{dsl.ts → query.ts} +82 -45
- package/src/test/api.test.ts +9 -9
- package/src/testing/echo-schema.ts +39 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/types.ts +40 -23
- package/dist/lib/browser/chunk-EIXXFUN5.mjs +0 -839
- package/dist/lib/browser/chunk-EIXXFUN5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TCY7IVTS.mjs +0 -839
- package/dist/lib/node-esm/chunk-TCY7IVTS.mjs.map +0 -7
- package/dist/types/src/experimental/database.d.ts +0 -8
- package/dist/types/src/experimental/database.d.ts.map +0 -1
- package/dist/types/src/experimental/index.d.ts +0 -1
- package/dist/types/src/experimental/index.d.ts.map +0 -1
- package/dist/types/src/experimental/queue.d.ts +0 -8
- package/dist/types/src/experimental/queue.d.ts.map +0 -1
- package/dist/types/src/experimental/space.d.ts +0 -8
- package/dist/types/src/experimental/space.d.ts.map +0 -1
- package/dist/types/src/query/dsl.d.ts.map +0 -1
- package/dist/types/src/query/dsl.test.d.ts +0 -2
- package/dist/types/src/query/dsl.test.d.ts.map +0 -1
- package/src/experimental/database.ts +0 -11
- package/src/experimental/index.ts +0 -7
- package/src/experimental/queue.ts +0 -11
- package/src/experimental/space.ts +0 -11
- package/src/query/dsl.test.ts +0 -362
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import type * as EffectArray from 'effect/Array';
|
|
6
|
+
import * as Match from 'effect/Match';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
import type * as Types from 'effect/Types';
|
|
8
9
|
|
|
9
10
|
import { raise } from '@dxos/debug';
|
|
10
11
|
import { type ForeignKey, type QueryAST } from '@dxos/echo-protocol';
|
|
11
|
-
import { getTypeReference } from '@dxos/echo-schema';
|
|
12
12
|
import { assertArgument } from '@dxos/invariant';
|
|
13
13
|
import { DXN, ObjectId } from '@dxos/keys';
|
|
14
14
|
|
|
15
|
+
import { getTypeReference } from '../internal';
|
|
16
|
+
import type * as Obj from '../Obj';
|
|
15
17
|
import * as Ref from '../Ref';
|
|
16
18
|
import type * as Type from '../Type';
|
|
17
19
|
|
|
@@ -86,7 +88,7 @@ export interface Query<T> {
|
|
|
86
88
|
// TODO(dmaretskyi): any way to enforce `Ref.Target<Schema.Schema.Type<S>[key]> == T`?
|
|
87
89
|
// TODO(dmaretskyi): Ability to go through arrays of references.
|
|
88
90
|
referencedBy<S extends Schema.Schema.All>(
|
|
89
|
-
target: S,
|
|
91
|
+
target: S | string,
|
|
90
92
|
key: RefPropKey<Schema.Schema.Type<S>>,
|
|
91
93
|
): Query<Schema.Schema.Type<S>>;
|
|
92
94
|
|
|
@@ -97,7 +99,7 @@ export interface Query<T> {
|
|
|
97
99
|
* @param predicates - Predicates to filter the relation objects.
|
|
98
100
|
*/
|
|
99
101
|
sourceOf<S extends Schema.Schema.All>(
|
|
100
|
-
relation: S,
|
|
102
|
+
relation: S | string,
|
|
101
103
|
predicates?: Filter.Props<Schema.Schema.Type<S>>,
|
|
102
104
|
): Query<Schema.Schema.Type<S>>;
|
|
103
105
|
|
|
@@ -108,7 +110,7 @@ export interface Query<T> {
|
|
|
108
110
|
* @param predicates - Predicates to filter the relation objects.
|
|
109
111
|
*/
|
|
110
112
|
targetOf<S extends Schema.Schema.All>(
|
|
111
|
-
relation: S,
|
|
113
|
+
relation: S | string,
|
|
112
114
|
predicates?: Filter.Props<Schema.Schema.Type<S>>,
|
|
113
115
|
): Query<Schema.Schema.Type<S>>;
|
|
114
116
|
|
|
@@ -130,7 +132,7 @@ export interface Query<T> {
|
|
|
130
132
|
* @param order - Order to sort the results.
|
|
131
133
|
* @returns Query for the ordered results.
|
|
132
134
|
*/
|
|
133
|
-
orderBy(...order: NonEmptyArray<Order<T>>): Query<T>;
|
|
135
|
+
orderBy(...order: EffectArray.NonEmptyArray<Order<T>>): Query<T>;
|
|
134
136
|
|
|
135
137
|
/**
|
|
136
138
|
* Add options to a query.
|
|
@@ -160,7 +162,7 @@ interface QueryAPI {
|
|
|
160
162
|
* Shorthand for: `Query.select(Filter.type(schema, predicates))`.
|
|
161
163
|
*/
|
|
162
164
|
type<S extends Schema.Schema.All>(
|
|
163
|
-
schema: S,
|
|
165
|
+
schema: S | string,
|
|
164
166
|
predicates?: Filter.Props<Schema.Schema.Type<S>>,
|
|
165
167
|
): Query<Schema.Schema.Type<S>>;
|
|
166
168
|
|
|
@@ -194,7 +196,7 @@ export declare namespace Query {
|
|
|
194
196
|
|
|
195
197
|
export interface Filter<T> {
|
|
196
198
|
// TODO(dmaretskyi): See new effect-schema approach to variance.
|
|
197
|
-
'~Filter': { value: T };
|
|
199
|
+
'~Filter': { value: Types.Contravariant<T> };
|
|
198
200
|
|
|
199
201
|
ast: QueryAST.Filter;
|
|
200
202
|
}
|
|
@@ -204,48 +206,56 @@ type Intersection<Types extends readonly unknown[]> = Types extends [infer First
|
|
|
204
206
|
: unknown;
|
|
205
207
|
|
|
206
208
|
interface FilterAPI {
|
|
207
|
-
is(value: unknown): value is Filter
|
|
209
|
+
is(value: unknown): value is Filter.Any;
|
|
210
|
+
|
|
211
|
+
/** Construct a filter from an ast. */
|
|
212
|
+
fromAst(ast: QueryAST.Filter): Filter<Obj.Any>;
|
|
208
213
|
|
|
209
214
|
/**
|
|
210
215
|
* Filter that matches all objects.
|
|
211
216
|
*/
|
|
212
|
-
|
|
217
|
+
// TODO(dmaretskyi): `Obj.Any` would be more type-safe, but causes annoying errors in existing code
|
|
218
|
+
everything(): Filter<Obj.AnyProps>;
|
|
213
219
|
|
|
214
220
|
/**
|
|
215
221
|
* Filter that matches no objects.
|
|
216
222
|
*/
|
|
223
|
+
// TODO(dmaretskyi): Filter<never>?
|
|
217
224
|
nothing(): Filter<any>;
|
|
218
225
|
|
|
219
226
|
/**
|
|
220
227
|
* Filter by object IDs.
|
|
221
228
|
*/
|
|
222
229
|
// TODO(dmaretskyi): Rename to `Filter.id`.
|
|
223
|
-
ids(...id: ObjectId[]): Filter<
|
|
230
|
+
ids(...id: ObjectId[]): Filter<Obj.AnyProps>;
|
|
224
231
|
|
|
225
232
|
/**
|
|
226
233
|
* Filter by type.
|
|
227
234
|
*/
|
|
228
235
|
type<S extends Schema.Schema.All>(
|
|
229
|
-
schema: S,
|
|
236
|
+
schema: S | string,
|
|
230
237
|
props?: Filter.Props<Schema.Schema.Type<S>>,
|
|
231
238
|
): Filter<Schema.Schema.Type<S>>;
|
|
232
239
|
|
|
233
240
|
/**
|
|
234
241
|
* Filter by non-qualified typename.
|
|
235
242
|
*/
|
|
236
|
-
typename(typename: string): Filter<
|
|
243
|
+
typename(typename: string): Filter<Obj.AnyProps>;
|
|
237
244
|
|
|
238
245
|
/**
|
|
239
246
|
* Filter by fully qualified type DXN.
|
|
240
247
|
*/
|
|
241
|
-
typeDXN(dxn: DXN): Filter<
|
|
248
|
+
typeDXN(dxn: DXN): Filter<Obj.AnyProps>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Filter by tag.
|
|
252
|
+
*/
|
|
253
|
+
tag(tag: string): Filter<Obj.Any>;
|
|
242
254
|
|
|
243
255
|
/**
|
|
244
256
|
* Filter by properties.
|
|
245
|
-
*
|
|
246
|
-
* INTERNAL API: Do not use.
|
|
247
257
|
*/
|
|
248
|
-
|
|
258
|
+
props<T>(props: Filter.Props<T>): Filter<T>;
|
|
249
259
|
|
|
250
260
|
/**
|
|
251
261
|
* Full-text or vector search.
|
|
@@ -306,14 +316,14 @@ interface FilterAPI {
|
|
|
306
316
|
* Predicate for an array property to contain the provided value.
|
|
307
317
|
* @param value - Value to check against.
|
|
308
318
|
*/
|
|
309
|
-
contains<T>(value: T): Filter<T[]>;
|
|
319
|
+
contains<T>(value: T): Filter<readonly T[] | undefined>;
|
|
310
320
|
|
|
311
321
|
/**
|
|
312
322
|
* Predicate for property to be in the provided range.
|
|
313
323
|
* @param from - Start of the range (inclusive).
|
|
314
324
|
* @param to - End of the range (exclusive).
|
|
315
325
|
*/
|
|
316
|
-
between<T>(from: T, to: T): Filter<
|
|
326
|
+
between<T>(from: T, to: T): Filter<unknown>;
|
|
317
327
|
|
|
318
328
|
/**
|
|
319
329
|
* Negate the filter.
|
|
@@ -343,11 +353,12 @@ export declare namespace Filter {
|
|
|
343
353
|
|
|
344
354
|
type Type<F extends Any> = F extends Filter<infer T> ? T : never;
|
|
345
355
|
|
|
346
|
-
type And<FS extends readonly Any[]> = Simplify<Intersection<{ [K in keyof FS]: Type<FS[K]> }>>;
|
|
356
|
+
type And<FS extends readonly Any[]> = Schema.Simplify<Intersection<{ [K in keyof FS]: Type<FS[K]> }>>;
|
|
347
357
|
|
|
348
|
-
type Or<FS extends readonly Any[]> = Simplify<{ [K in keyof FS]: Type<FS[K]> }[number]>;
|
|
358
|
+
type Or<FS extends readonly Any[]> = Schema.Simplify<{ [K in keyof FS]: Type<FS[K]> }[number]>;
|
|
349
359
|
}
|
|
350
360
|
|
|
361
|
+
// TODO(dmaretskyi): Separate object instead of statics for better devex with type errors.
|
|
351
362
|
class FilterClass implements Filter<any> {
|
|
352
363
|
private static variance: Filter<any>['~Filter'] = {} as Filter<any>['~Filter'];
|
|
353
364
|
|
|
@@ -355,6 +366,10 @@ class FilterClass implements Filter<any> {
|
|
|
355
366
|
return typeof value === 'object' && value !== null && '~Filter' in value;
|
|
356
367
|
}
|
|
357
368
|
|
|
369
|
+
static fromAst(ast: QueryAST.Filter): Filter<any> {
|
|
370
|
+
return new FilterClass(ast);
|
|
371
|
+
}
|
|
372
|
+
|
|
358
373
|
static everything(): FilterClass {
|
|
359
374
|
return new FilterClass({
|
|
360
375
|
type: 'object',
|
|
@@ -402,10 +417,10 @@ class FilterClass implements Filter<any> {
|
|
|
402
417
|
}
|
|
403
418
|
|
|
404
419
|
static type<S extends Schema.Schema.All>(
|
|
405
|
-
schema: S,
|
|
420
|
+
schema: S | string,
|
|
406
421
|
props?: Filter.Props<Schema.Schema.Type<S>>,
|
|
407
422
|
): Filter<Schema.Schema.Type<S>> {
|
|
408
|
-
const dxn =
|
|
423
|
+
const dxn = getTypeDXNFromSpecifier(schema);
|
|
409
424
|
return new FilterClass({
|
|
410
425
|
type: 'object',
|
|
411
426
|
typename: dxn.toString(),
|
|
@@ -430,10 +445,14 @@ class FilterClass implements Filter<any> {
|
|
|
430
445
|
});
|
|
431
446
|
}
|
|
432
447
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
448
|
+
static tag(tag: string): Filter<any> {
|
|
449
|
+
return new FilterClass({
|
|
450
|
+
type: 'tag',
|
|
451
|
+
tag,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
static props<T>(props: Filter.Props<T>): Filter<T> {
|
|
437
456
|
return new FilterClass({
|
|
438
457
|
type: 'object',
|
|
439
458
|
typename: null,
|
|
@@ -449,8 +468,11 @@ class FilterClass implements Filter<any> {
|
|
|
449
468
|
});
|
|
450
469
|
}
|
|
451
470
|
|
|
452
|
-
static foreignKeys<S extends Schema.Schema.All>(
|
|
453
|
-
|
|
471
|
+
static foreignKeys<S extends Schema.Schema.All>(
|
|
472
|
+
schema: S | string,
|
|
473
|
+
keys: ForeignKey[],
|
|
474
|
+
): Filter<Schema.Schema.Type<S>> {
|
|
475
|
+
const dxn = getTypeDXNFromSpecifier(schema);
|
|
454
476
|
return new FilterClass({
|
|
455
477
|
type: 'object',
|
|
456
478
|
typename: dxn.toString(),
|
|
@@ -518,14 +540,14 @@ class FilterClass implements Filter<any> {
|
|
|
518
540
|
});
|
|
519
541
|
}
|
|
520
542
|
|
|
521
|
-
static contains<T>(value: T): Filter<T[]> {
|
|
543
|
+
static contains<T>(value: T): Filter<readonly T[] | undefined> {
|
|
522
544
|
return new FilterClass({
|
|
523
545
|
type: 'contains',
|
|
524
546
|
value,
|
|
525
547
|
});
|
|
526
548
|
}
|
|
527
549
|
|
|
528
|
-
static between<T>(from: T, to: T): Filter<
|
|
550
|
+
static between<T>(from: T, to: T): Filter<unknown> {
|
|
529
551
|
return new FilterClass({
|
|
530
552
|
type: 'range',
|
|
531
553
|
from,
|
|
@@ -615,6 +637,7 @@ const processPredicate = (predicate: any): QueryAST.Filter => {
|
|
|
615
637
|
);
|
|
616
638
|
};
|
|
617
639
|
|
|
640
|
+
// TODO(dmaretskyi): Separate object instead of statics for better devex with type errors.
|
|
618
641
|
class QueryClass implements Query<any> {
|
|
619
642
|
private static variance: Query<any>['~Query'] = {} as Query<any>['~Query'];
|
|
620
643
|
|
|
@@ -633,7 +656,7 @@ class QueryClass implements Query<any> {
|
|
|
633
656
|
});
|
|
634
657
|
}
|
|
635
658
|
|
|
636
|
-
static type(schema: Schema.Schema.All, predicates?: Filter.Props<unknown>): Query<any> {
|
|
659
|
+
static type(schema: Schema.Schema.All | string, predicates?: Filter.Props<unknown>): Query<any> {
|
|
637
660
|
return new QueryClass({
|
|
638
661
|
type: 'select',
|
|
639
662
|
filter: FilterClass.type(schema, predicates).ast,
|
|
@@ -664,7 +687,7 @@ class QueryClass implements Query<any> {
|
|
|
664
687
|
|
|
665
688
|
'~Query' = QueryClass.variance;
|
|
666
689
|
|
|
667
|
-
select(filter: Filter
|
|
690
|
+
select(filter: Filter.Any | Filter.Props<any>): Query.Any {
|
|
668
691
|
if (Filter.is(filter)) {
|
|
669
692
|
return new QueryClass({
|
|
670
693
|
type: 'filter',
|
|
@@ -675,12 +698,12 @@ class QueryClass implements Query<any> {
|
|
|
675
698
|
return new QueryClass({
|
|
676
699
|
type: 'filter',
|
|
677
700
|
selection: this.ast,
|
|
678
|
-
filter: FilterClass.
|
|
701
|
+
filter: FilterClass.props(filter).ast,
|
|
679
702
|
});
|
|
680
703
|
}
|
|
681
704
|
}
|
|
682
705
|
|
|
683
|
-
reference(key: string): Query
|
|
706
|
+
reference(key: string): Query.Any {
|
|
684
707
|
return new QueryClass({
|
|
685
708
|
type: 'reference-traversal',
|
|
686
709
|
anchor: this.ast,
|
|
@@ -688,8 +711,8 @@ class QueryClass implements Query<any> {
|
|
|
688
711
|
});
|
|
689
712
|
}
|
|
690
713
|
|
|
691
|
-
referencedBy(target: Schema.Schema.All, key: string): Query
|
|
692
|
-
const dxn =
|
|
714
|
+
referencedBy(target: Schema.Schema.All | string, key: string): Query.Any {
|
|
715
|
+
const dxn = getTypeDXNFromSpecifier(target);
|
|
693
716
|
return new QueryClass({
|
|
694
717
|
type: 'incoming-references',
|
|
695
718
|
anchor: this.ast,
|
|
@@ -698,7 +721,7 @@ class QueryClass implements Query<any> {
|
|
|
698
721
|
});
|
|
699
722
|
}
|
|
700
723
|
|
|
701
|
-
sourceOf(relation: Schema.Schema.All, predicates?: Filter.Props<unknown> | undefined): Query
|
|
724
|
+
sourceOf(relation: Schema.Schema.All | string, predicates?: Filter.Props<unknown> | undefined): Query.Any {
|
|
702
725
|
return new QueryClass({
|
|
703
726
|
type: 'relation',
|
|
704
727
|
anchor: this.ast,
|
|
@@ -707,7 +730,7 @@ class QueryClass implements Query<any> {
|
|
|
707
730
|
});
|
|
708
731
|
}
|
|
709
732
|
|
|
710
|
-
targetOf(relation: Schema.Schema.All, predicates?: Filter.Props<unknown> | undefined): Query
|
|
733
|
+
targetOf(relation: Schema.Schema.All | string, predicates?: Filter.Props<unknown> | undefined): Query.Any {
|
|
711
734
|
return new QueryClass({
|
|
712
735
|
type: 'relation',
|
|
713
736
|
anchor: this.ast,
|
|
@@ -716,7 +739,7 @@ class QueryClass implements Query<any> {
|
|
|
716
739
|
});
|
|
717
740
|
}
|
|
718
741
|
|
|
719
|
-
source(): Query
|
|
742
|
+
source(): Query.Any {
|
|
720
743
|
return new QueryClass({
|
|
721
744
|
type: 'relation-traversal',
|
|
722
745
|
anchor: this.ast,
|
|
@@ -724,7 +747,7 @@ class QueryClass implements Query<any> {
|
|
|
724
747
|
});
|
|
725
748
|
}
|
|
726
749
|
|
|
727
|
-
target(): Query
|
|
750
|
+
target(): Query.Any {
|
|
728
751
|
return new QueryClass({
|
|
729
752
|
type: 'relation-traversal',
|
|
730
753
|
anchor: this.ast,
|
|
@@ -732,7 +755,7 @@ class QueryClass implements Query<any> {
|
|
|
732
755
|
});
|
|
733
756
|
}
|
|
734
757
|
|
|
735
|
-
orderBy(...order: Order<any>[]): Query
|
|
758
|
+
orderBy(...order: Order<any>[]): Query.Any {
|
|
736
759
|
return new QueryClass({
|
|
737
760
|
type: 'order',
|
|
738
761
|
query: this.ast,
|
|
@@ -740,7 +763,7 @@ class QueryClass implements Query<any> {
|
|
|
740
763
|
});
|
|
741
764
|
}
|
|
742
765
|
|
|
743
|
-
options(options: QueryAST.QueryOptions): Query
|
|
766
|
+
options(options: QueryAST.QueryOptions): Query.Any {
|
|
744
767
|
return new QueryClass({
|
|
745
768
|
type: 'options',
|
|
746
769
|
query: this.ast,
|
|
@@ -750,3 +773,17 @@ class QueryClass implements Query<any> {
|
|
|
750
773
|
}
|
|
751
774
|
|
|
752
775
|
export const Query: QueryAPI = QueryClass;
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* @param input schema or a typename string
|
|
779
|
+
* @return type DXN
|
|
780
|
+
*/
|
|
781
|
+
const getTypeDXNFromSpecifier = (input: Schema.Schema.All | string): DXN => {
|
|
782
|
+
if (Schema.isSchema(input)) {
|
|
783
|
+
return getTypeReference(input)?.toDXN() ?? raise(new TypeError('Schema has no DXN'));
|
|
784
|
+
} else {
|
|
785
|
+
assertArgument(typeof input === 'string', 'input');
|
|
786
|
+
assertArgument(!input.startsWith('dxn:'), 'input');
|
|
787
|
+
return DXN.fromTypename(input);
|
|
788
|
+
}
|
|
789
|
+
};
|
package/src/test/api.test.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
|
-
import { FormatAnnotation, FormatEnum } from '@dxos/echo
|
|
9
|
+
import { FormatAnnotation, FormatEnum } from '@dxos/echo/internal';
|
|
10
10
|
|
|
11
11
|
import { type Live, Obj, Ref, Relation, Type } from '../index';
|
|
12
12
|
|
|
@@ -159,21 +159,21 @@ describe('Experimental API review', () => {
|
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
test.skip('type narrowing', () => {
|
|
162
|
-
const
|
|
162
|
+
const any: Obj.Any | Relation.Any = null as any;
|
|
163
163
|
|
|
164
164
|
{
|
|
165
|
-
if (Obj.isObject(
|
|
166
|
-
|
|
165
|
+
if (Obj.isObject(any)) {
|
|
166
|
+
any;
|
|
167
167
|
} else {
|
|
168
|
-
|
|
168
|
+
any;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
{
|
|
173
|
-
if (Relation.isRelation(
|
|
174
|
-
|
|
173
|
+
if (Relation.isRelation(any)) {
|
|
174
|
+
any;
|
|
175
175
|
} else {
|
|
176
|
-
|
|
176
|
+
any;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { effect } from '@preact/signals-core';
|
|
6
|
+
import type * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { registerSignalsRuntime } from '@dxos/echo-signals';
|
|
9
|
+
import { assertArgument } from '@dxos/invariant';
|
|
10
|
+
|
|
11
|
+
import { EchoSchema, StoredSchema, getSchemaTypename, live, toJsonSchema } from '../internal';
|
|
12
|
+
|
|
13
|
+
// NOTE: Registration is done here is this is the module that calls out to `effect`.
|
|
14
|
+
registerSignalsRuntime();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a reactive mutable schema that updates when the JSON schema is updated.
|
|
18
|
+
*/
|
|
19
|
+
// TODO(dmaretskyi): Should be replaced by registration of typed object.
|
|
20
|
+
export const createEchoSchema = (schema: Schema.Schema.AnyNoContext): EchoSchema => {
|
|
21
|
+
const typename = getSchemaTypename(schema);
|
|
22
|
+
assertArgument(typename, 'typename', 'Schema does not have a typename.');
|
|
23
|
+
|
|
24
|
+
const echoSchema = new EchoSchema(
|
|
25
|
+
live(StoredSchema, {
|
|
26
|
+
typename,
|
|
27
|
+
version: '0.1.0',
|
|
28
|
+
jsonSchema: toJsonSchema(schema),
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// TODO(burdon): Unsubscribe is never called.
|
|
33
|
+
effect(() => {
|
|
34
|
+
const _ = echoSchema.jsonSchema;
|
|
35
|
+
echoSchema._invalidate();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return echoSchema;
|
|
39
|
+
};
|
package/src/testing/index.ts
CHANGED
package/src/testing/types.ts
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Type } from '..';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
12
|
+
// TOOD(burdon): Reconcile with @dxos/schema.
|
|
10
13
|
export namespace Testing {
|
|
11
|
-
const
|
|
14
|
+
export const Person = Schema.Struct({
|
|
12
15
|
name: Schema.String,
|
|
13
16
|
username: Schema.String,
|
|
14
17
|
email: Schema.String,
|
|
@@ -25,17 +28,17 @@ export namespace Testing {
|
|
|
25
28
|
}).pipe(
|
|
26
29
|
Schema.partial,
|
|
27
30
|
Type.Obj({
|
|
28
|
-
typename: 'example.com/type/
|
|
31
|
+
typename: 'example.com/type/Person',
|
|
29
32
|
version: '0.1.0',
|
|
30
33
|
}),
|
|
31
34
|
);
|
|
32
|
-
export interface Contact extends Schema.Schema.Type<typeof _Contact> {}
|
|
33
|
-
export const Contact: Schema.Schema<Contact, Schema.Schema.Encoded<typeof _Contact>, never> = _Contact;
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
export interface Person extends Schema.Schema.Type<typeof Person> {}
|
|
37
|
+
|
|
38
|
+
export const Task = Schema.Struct({
|
|
36
39
|
title: Schema.optional(Schema.String),
|
|
37
40
|
completed: Schema.optional(Schema.Boolean),
|
|
38
|
-
assignee: Schema.optional(Type.Ref(
|
|
41
|
+
assignee: Schema.optional(Type.Ref(Person)),
|
|
39
42
|
previous: Schema.optional(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))),
|
|
40
43
|
subTasks: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))))),
|
|
41
44
|
description: Schema.optional(Schema.String),
|
|
@@ -46,8 +49,34 @@ export namespace Testing {
|
|
|
46
49
|
version: '0.1.0',
|
|
47
50
|
}),
|
|
48
51
|
);
|
|
49
|
-
|
|
50
|
-
export
|
|
52
|
+
|
|
53
|
+
export interface Task extends Schema.Schema.Type<typeof Task> {}
|
|
54
|
+
|
|
55
|
+
export const WorksFor = Schema.Struct({
|
|
56
|
+
since: Schema.optional(Schema.String),
|
|
57
|
+
}).pipe(
|
|
58
|
+
Type.Relation({
|
|
59
|
+
typename: 'example.com/type/WorksFor',
|
|
60
|
+
version: '0.1.0',
|
|
61
|
+
source: Person,
|
|
62
|
+
target: Person,
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export interface WorksFor extends Schema.Schema.Type<typeof WorksFor> {}
|
|
67
|
+
|
|
68
|
+
export const HasManager = Schema.Struct({
|
|
69
|
+
since: Schema.optional(Schema.String),
|
|
70
|
+
}).pipe(
|
|
71
|
+
Type.Relation({
|
|
72
|
+
typename: 'example.com/type/HasManager',
|
|
73
|
+
version: '0.1.0',
|
|
74
|
+
source: Person,
|
|
75
|
+
target: Person,
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
export interface HasManager extends Schema.Schema.Type<typeof HasManager> {}
|
|
51
80
|
|
|
52
81
|
export enum RecordType {
|
|
53
82
|
UNDEFINED = 0,
|
|
@@ -63,7 +92,7 @@ export namespace Testing {
|
|
|
63
92
|
Schema.Struct({
|
|
64
93
|
title: Schema.String,
|
|
65
94
|
description: Schema.String,
|
|
66
|
-
contacts: Schema.mutable(Schema.Array(Type.Ref(
|
|
95
|
+
contacts: Schema.mutable(Schema.Array(Type.Ref(Person))),
|
|
67
96
|
type: Schema.Enums(RecordType),
|
|
68
97
|
}),
|
|
69
98
|
),
|
|
@@ -76,16 +105,4 @@ export namespace Testing {
|
|
|
76
105
|
version: '0.1.0',
|
|
77
106
|
}),
|
|
78
107
|
);
|
|
79
|
-
|
|
80
|
-
export const WorksFor = Schema.Struct({
|
|
81
|
-
since: Schema.optional(Schema.String),
|
|
82
|
-
}).pipe(
|
|
83
|
-
Type.Relation({
|
|
84
|
-
typename: 'example.com/type/WorksFor',
|
|
85
|
-
version: '0.1.0',
|
|
86
|
-
source: Contact,
|
|
87
|
-
target: Contact,
|
|
88
|
-
}),
|
|
89
|
-
);
|
|
90
|
-
export interface WorksFor extends Schema.Schema.Type<typeof WorksFor> {}
|
|
91
108
|
}
|