@dxos/echo 0.8.4-main.5ea62a8 → 0.8.4-main.72ec0f3
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 +17 -4
- 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 +17 -4
- 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 +70 -8
- 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 +68 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -1
- 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} +52 -22
- 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 -17
- package/src/Obj.ts +195 -16
- package/src/Ref.ts +1 -2
- package/src/Relation.ts +16 -5
- package/src/Tag.ts +39 -0
- package/src/Type.ts +29 -30
- package/src/errors.ts +18 -0
- package/src/index.ts +5 -1
- 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} +188 -45
- package/src/test/api.test.ts +16 -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-2KNTYMIW.mjs +0 -697
- package/dist/lib/browser/chunk-2KNTYMIW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EXNNC62J.mjs +0 -697
- package/dist/lib/node-esm/chunk-EXNNC62J.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 -324
|
@@ -1,16 +1,96 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
Type_exports
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-CGDHRZWH.mjs";
|
|
5
|
+
import "../chunk-HWS6VBQC.mjs";
|
|
6
|
+
import {
|
|
7
|
+
EchoObject,
|
|
8
|
+
EchoRelation,
|
|
9
|
+
EchoSchema,
|
|
10
|
+
Ref,
|
|
11
|
+
StoredSchema,
|
|
12
|
+
TypedObject,
|
|
13
|
+
getSchemaTypename,
|
|
14
|
+
live,
|
|
15
|
+
toJsonSchema
|
|
16
|
+
} from "../chunk-3SVRRCUU.mjs";
|
|
5
17
|
|
|
6
|
-
// src/testing/types.ts
|
|
7
|
-
import
|
|
8
|
-
(function(
|
|
9
|
-
const
|
|
18
|
+
// src/internal/testing/types.ts
|
|
19
|
+
import * as Schema from "effect/Schema";
|
|
20
|
+
(function(Testing3) {
|
|
21
|
+
const Circle = Schema.Struct({
|
|
22
|
+
type: Schema.Literal("circle"),
|
|
23
|
+
radius: Schema.Number
|
|
24
|
+
});
|
|
25
|
+
const Square = Schema.Struct({
|
|
26
|
+
type: Schema.Literal("square"),
|
|
27
|
+
side: Schema.Number
|
|
28
|
+
});
|
|
29
|
+
const Shape = Schema.Union(Circle, Square);
|
|
30
|
+
const TestNestedSchema = Schema.mutable(Schema.Struct({
|
|
31
|
+
field: Schema.String
|
|
32
|
+
}));
|
|
33
|
+
Testing3.TestNestedType = TestNestedSchema.pipe(EchoObject({
|
|
34
|
+
typename: "example.com/type/TestNested",
|
|
35
|
+
version: "0.1.0"
|
|
36
|
+
}));
|
|
37
|
+
class EmptySchemaType extends TypedObject({
|
|
38
|
+
typename: "example.com/type/Empty",
|
|
39
|
+
version: "0.1.0"
|
|
40
|
+
})({}) {
|
|
41
|
+
}
|
|
42
|
+
Testing3.EmptySchemaType = EmptySchemaType;
|
|
43
|
+
const fields = {
|
|
44
|
+
string: Schema.String,
|
|
45
|
+
number: Schema.Number,
|
|
46
|
+
nullableShapeArray: Schema.mutable(Schema.Array(Schema.Union(Shape, Schema.Null))),
|
|
47
|
+
boolean: Schema.Boolean,
|
|
48
|
+
null: Schema.Null,
|
|
49
|
+
undefined: Schema.Undefined,
|
|
50
|
+
stringArray: Schema.mutable(Schema.Array(Schema.String)),
|
|
51
|
+
twoDimNumberArray: Schema.mutable(Schema.Array(Schema.mutable(Schema.Array(Schema.Number)))),
|
|
52
|
+
object: TestNestedSchema,
|
|
53
|
+
objectArray: Schema.mutable(Schema.Array(TestNestedSchema)),
|
|
54
|
+
nested: Schema.optional(Ref(Testing3.TestNestedType)),
|
|
55
|
+
other: Schema.Any
|
|
56
|
+
};
|
|
57
|
+
Testing3.TestSchema = Schema.mutable(Schema.partial(Schema.Struct(fields)));
|
|
58
|
+
class TestSchemaType extends TypedObject({
|
|
59
|
+
typename: "example.com/type/Test",
|
|
60
|
+
version: "0.1.0"
|
|
61
|
+
})(fields, {
|
|
62
|
+
partial: true
|
|
63
|
+
}) {
|
|
64
|
+
}
|
|
65
|
+
Testing3.TestSchemaType = TestSchemaType;
|
|
66
|
+
Testing3.TestType = Testing3.TestSchema.pipe(EchoObject({
|
|
67
|
+
typename: "example.com/type/Test",
|
|
68
|
+
version: "0.1.0"
|
|
69
|
+
}));
|
|
70
|
+
class TestClass {
|
|
71
|
+
field = "value";
|
|
72
|
+
toJSON() {
|
|
73
|
+
return {
|
|
74
|
+
field: this.field
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
Testing3.TestClass = TestClass;
|
|
79
|
+
Testing3.TestSchemaWithClass = Schema.mutable(Schema.extend(Testing3.TestSchema, Schema.mutable(Schema.Struct({
|
|
80
|
+
classInstance: Schema.optional(Schema.instanceOf(TestClass))
|
|
81
|
+
}))));
|
|
82
|
+
class Person extends TypedObject({
|
|
83
|
+
typename: "example.com/type/Person",
|
|
84
|
+
version: "0.1.0"
|
|
85
|
+
})({
|
|
10
86
|
name: Schema.String,
|
|
11
87
|
username: Schema.String,
|
|
12
88
|
email: Schema.String,
|
|
13
|
-
|
|
89
|
+
phoneNumbers: Schema.optional(Schema.Array(Schema.Struct({
|
|
90
|
+
label: Schema.String,
|
|
91
|
+
number: Schema.String
|
|
92
|
+
}))),
|
|
93
|
+
tasks: Schema.suspend(() => Schema.mutable(Schema.Array(Ref(Task)))),
|
|
14
94
|
address: Schema.Struct({
|
|
15
95
|
city: Schema.optional(Schema.String),
|
|
16
96
|
state: Schema.optional(Schema.String),
|
|
@@ -20,51 +100,168 @@ import { Schema } from "effect";
|
|
|
20
100
|
lng: Schema.optional(Schema.Number)
|
|
21
101
|
})
|
|
22
102
|
})
|
|
23
|
-
}
|
|
24
|
-
|
|
103
|
+
}, {
|
|
104
|
+
partial: true
|
|
105
|
+
}) {
|
|
106
|
+
}
|
|
107
|
+
Testing3.Person = Person;
|
|
108
|
+
class Task extends TypedObject({
|
|
109
|
+
typename: "example.com/type/Task",
|
|
25
110
|
version: "0.1.0"
|
|
26
|
-
})
|
|
27
|
-
Testing2.Contact = _Contact;
|
|
28
|
-
const _Task = Schema.Struct({
|
|
111
|
+
})({
|
|
29
112
|
title: Schema.optional(Schema.String),
|
|
30
113
|
completed: Schema.optional(Schema.Boolean),
|
|
31
|
-
assignee: Schema.optional(
|
|
32
|
-
previous: Schema.optional(Schema.suspend(() =>
|
|
33
|
-
subTasks: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend(() =>
|
|
114
|
+
assignee: Schema.optional(Ref(Person)),
|
|
115
|
+
previous: Schema.optional(Schema.suspend(() => Ref(Task))),
|
|
116
|
+
subTasks: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend(() => Ref(Task))))),
|
|
34
117
|
description: Schema.optional(Schema.String)
|
|
35
|
-
}
|
|
118
|
+
}, {
|
|
119
|
+
partial: true
|
|
120
|
+
}) {
|
|
121
|
+
}
|
|
122
|
+
Testing3.Task = Task;
|
|
123
|
+
Testing3.HasManager = Schema.Struct({
|
|
124
|
+
since: Schema.optional(Schema.String)
|
|
125
|
+
}).pipe(EchoRelation({
|
|
126
|
+
typename: "example.com/type/HasManager",
|
|
127
|
+
version: "0.1.0",
|
|
128
|
+
source: Person,
|
|
129
|
+
target: Person
|
|
130
|
+
}));
|
|
131
|
+
})(Testing || (Testing = {}));
|
|
132
|
+
var Testing;
|
|
133
|
+
|
|
134
|
+
// src/internal/testing/utils.ts
|
|
135
|
+
import { effect } from "@preact/signals-core";
|
|
136
|
+
import { registerSignalsRuntime } from "@dxos/echo-signals";
|
|
137
|
+
import { deepMapValues } from "@dxos/util";
|
|
138
|
+
registerSignalsRuntime();
|
|
139
|
+
var updateCounter = (touch) => {
|
|
140
|
+
let updateCount = -1;
|
|
141
|
+
const unsubscribe = effect(() => {
|
|
142
|
+
touch();
|
|
143
|
+
updateCount++;
|
|
144
|
+
});
|
|
145
|
+
return {
|
|
146
|
+
// https://github.com/tc39/proposal-explicit-resource-management
|
|
147
|
+
[Symbol.dispose]: unsubscribe,
|
|
148
|
+
get count() {
|
|
149
|
+
return updateCount;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
var prepareAstForCompare = (obj) => deepMapValues(obj, (value, recurse) => {
|
|
154
|
+
if (typeof value === "function") {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
if (value instanceof RegExp) {
|
|
158
|
+
return value;
|
|
159
|
+
}
|
|
160
|
+
if (typeof value === "object") {
|
|
161
|
+
const clone = {
|
|
162
|
+
...value
|
|
163
|
+
};
|
|
164
|
+
for (const sym of Object.getOwnPropertySymbols(clone)) {
|
|
165
|
+
clone[sym.toString()] = clone[sym];
|
|
166
|
+
delete clone[sym];
|
|
167
|
+
}
|
|
168
|
+
return recurse(clone);
|
|
169
|
+
}
|
|
170
|
+
return recurse(value);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// src/testing/types.ts
|
|
174
|
+
import * as Schema2 from "effect/Schema";
|
|
175
|
+
(function(Testing3) {
|
|
176
|
+
Testing3.Person = Schema2.Struct({
|
|
177
|
+
name: Schema2.String,
|
|
178
|
+
username: Schema2.String,
|
|
179
|
+
email: Schema2.String,
|
|
180
|
+
tasks: Schema2.mutable(Schema2.Array(Schema2.suspend(() => Type_exports.Ref(Testing3.Task)))),
|
|
181
|
+
address: Schema2.Struct({
|
|
182
|
+
city: Schema2.optional(Schema2.String),
|
|
183
|
+
state: Schema2.optional(Schema2.String),
|
|
184
|
+
zip: Schema2.optional(Schema2.String),
|
|
185
|
+
coordinates: Schema2.Struct({
|
|
186
|
+
lat: Schema2.optional(Schema2.Number),
|
|
187
|
+
lng: Schema2.optional(Schema2.Number)
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
}).pipe(Schema2.partial, Type_exports.Obj({
|
|
191
|
+
typename: "example.com/type/Person",
|
|
192
|
+
version: "0.1.0"
|
|
193
|
+
}));
|
|
194
|
+
Testing3.Task = Schema2.Struct({
|
|
195
|
+
title: Schema2.optional(Schema2.String),
|
|
196
|
+
completed: Schema2.optional(Schema2.Boolean),
|
|
197
|
+
assignee: Schema2.optional(Type_exports.Ref(Testing3.Person)),
|
|
198
|
+
previous: Schema2.optional(Schema2.suspend(() => Type_exports.Ref(Testing3.Task))),
|
|
199
|
+
subTasks: Schema2.optional(Schema2.mutable(Schema2.Array(Schema2.suspend(() => Type_exports.Ref(Testing3.Task))))),
|
|
200
|
+
description: Schema2.optional(Schema2.String)
|
|
201
|
+
}).pipe(Schema2.partial, Type_exports.Obj({
|
|
36
202
|
typename: "example.com/type/Task",
|
|
37
203
|
version: "0.1.0"
|
|
38
204
|
}));
|
|
39
|
-
|
|
205
|
+
Testing3.WorksFor = Schema2.Struct({
|
|
206
|
+
since: Schema2.optional(Schema2.String)
|
|
207
|
+
}).pipe(Type_exports.Relation({
|
|
208
|
+
typename: "example.com/type/WorksFor",
|
|
209
|
+
version: "0.1.0",
|
|
210
|
+
source: Testing3.Person,
|
|
211
|
+
target: Testing3.Person
|
|
212
|
+
}));
|
|
213
|
+
Testing3.HasManager = Schema2.Struct({
|
|
214
|
+
since: Schema2.optional(Schema2.String)
|
|
215
|
+
}).pipe(Type_exports.Relation({
|
|
216
|
+
typename: "example.com/type/HasManager",
|
|
217
|
+
version: "0.1.0",
|
|
218
|
+
source: Testing3.Person,
|
|
219
|
+
target: Testing3.Person
|
|
220
|
+
}));
|
|
40
221
|
(function(RecordType) {
|
|
41
222
|
RecordType[RecordType["UNDEFINED"] = 0] = "UNDEFINED";
|
|
42
223
|
RecordType[RecordType["PERSONAL"] = 1] = "PERSONAL";
|
|
43
224
|
RecordType[RecordType["WORK"] = 2] = "WORK";
|
|
44
|
-
})(
|
|
45
|
-
|
|
46
|
-
objects:
|
|
47
|
-
records:
|
|
48
|
-
title:
|
|
49
|
-
description:
|
|
50
|
-
contacts:
|
|
51
|
-
type:
|
|
225
|
+
})(Testing3.RecordType || (Testing3.RecordType = {}));
|
|
226
|
+
Testing3.Container = Schema2.Struct({
|
|
227
|
+
objects: Schema2.mutable(Schema2.Array(Type_exports.Ref(Type_exports.Expando))),
|
|
228
|
+
records: Schema2.mutable(Schema2.Array(Schema2.partial(Schema2.Struct({
|
|
229
|
+
title: Schema2.String,
|
|
230
|
+
description: Schema2.String,
|
|
231
|
+
contacts: Schema2.mutable(Schema2.Array(Type_exports.Ref(Testing3.Person))),
|
|
232
|
+
type: Schema2.Enums(Testing3.RecordType)
|
|
52
233
|
}))))
|
|
53
|
-
}).pipe(
|
|
234
|
+
}).pipe(Schema2.partial, Type_exports.Obj({
|
|
54
235
|
typename: "example.com/type/Container",
|
|
55
236
|
version: "0.1.0"
|
|
56
237
|
}));
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
238
|
+
})(Testing2 || (Testing2 = {}));
|
|
239
|
+
var Testing2;
|
|
240
|
+
|
|
241
|
+
// src/testing/echo-schema.ts
|
|
242
|
+
import { effect as effect2 } from "@preact/signals-core";
|
|
243
|
+
import { registerSignalsRuntime as registerSignalsRuntime2 } from "@dxos/echo-signals";
|
|
244
|
+
import { assertArgument } from "@dxos/invariant";
|
|
245
|
+
registerSignalsRuntime2();
|
|
246
|
+
var createEchoSchema = (schema) => {
|
|
247
|
+
const typename = getSchemaTypename(schema);
|
|
248
|
+
assertArgument(typename, "typename", "Schema does not have a typename.");
|
|
249
|
+
const echoSchema = new EchoSchema(live(StoredSchema, {
|
|
250
|
+
typename,
|
|
61
251
|
version: "0.1.0",
|
|
62
|
-
|
|
63
|
-
target: Testing2.Contact
|
|
252
|
+
jsonSchema: toJsonSchema(schema)
|
|
64
253
|
}));
|
|
65
|
-
|
|
66
|
-
|
|
254
|
+
effect2(() => {
|
|
255
|
+
const _ = echoSchema.jsonSchema;
|
|
256
|
+
echoSchema._invalidate();
|
|
257
|
+
});
|
|
258
|
+
return echoSchema;
|
|
259
|
+
};
|
|
67
260
|
export {
|
|
68
|
-
Testing
|
|
261
|
+
Testing2 as Testing,
|
|
262
|
+
Testing as TestingDeprecated,
|
|
263
|
+
createEchoSchema,
|
|
264
|
+
prepareAstForCompare,
|
|
265
|
+
updateCounter
|
|
69
266
|
};
|
|
70
267
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type } from '..';\n\n// TODO(burdon): These are non-canonical test types, so we really shouldn't export and use in other classes (compare with @dxos/sdk/testing).\nexport namespace Testing {\n const _Contact = Schema.Struct({\n name: Schema.String,\n username: Schema.String,\n email: Schema.String,\n tasks: Schema.mutable(Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task)))),\n address: Schema.Struct({\n city: Schema.optional(Schema.String),\n state: Schema.optional(Schema.String),\n zip: Schema.optional(Schema.String),\n coordinates: Schema.Struct({\n lat: Schema.optional(Schema.Number),\n lng: Schema.optional(Schema.Number),\n }),\n }),\n }).pipe(\n Schema.partial,\n Type.Obj({\n typename: 'example.com/type/Contact',\n version: '0.1.0',\n }),\n );\n export interface Contact extends Schema.Schema.Type<typeof _Contact> {}\n export const Contact: Schema.Schema<Contact, Schema.Schema.Encoded<typeof _Contact>, never> = _Contact;\n\n const _Task = Schema.Struct({\n title: Schema.optional(Schema.String),\n completed: Schema.optional(Schema.Boolean),\n assignee: Schema.optional(Type.Ref(Contact)),\n previous: Schema.optional(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))),\n subTasks: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))))),\n description: Schema.optional(Schema.String),\n }).pipe(\n Schema.partial,\n Type.Obj({\n typename: 'example.com/type/Task',\n version: '0.1.0',\n }),\n );\n export interface Task extends Schema.Schema.Type<typeof _Task> {}\n export const Task: Schema.Schema<Task, Schema.Schema.Encoded<typeof _Task>, never> = _Task;\n\n export enum RecordType {\n UNDEFINED = 0,\n PERSONAL = 1,\n WORK = 2,\n }\n\n export const Container = Schema.Struct({\n objects: Schema.mutable(Schema.Array(Type.Ref(Type.Expando))),\n records: Schema.mutable(\n Schema.Array(\n Schema.partial(\n Schema.Struct({\n title: Schema.String,\n description: Schema.String,\n contacts: Schema.mutable(Schema.Array(Type.Ref(Contact))),\n type: Schema.Enums(RecordType),\n }),\n ),\n ),\n ),\n }).pipe(\n Schema.partial,\n Type.Obj({\n typename: 'example.com/type/Container',\n version: '0.1.0',\n }),\n );\n\n export const WorksFor = Schema.Struct({\n since: Schema.optional(Schema.String),\n }).pipe(\n Type.Relation({\n typename: 'example.com/type/WorksFor',\n version: '0.1.0',\n source: Contact,\n target: Contact,\n }),\n );\n export interface WorksFor extends Schema.Schema.Type<typeof WorksFor> {}\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Schema", "Testing", "
|
|
3
|
+
"sources": ["../../../../src/internal/testing/types.ts", "../../../../src/internal/testing/utils.ts", "../../../../src/testing/types.ts", "../../../../src/testing/echo-schema.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { EchoObject, EchoRelation, TypedObject } from '../object';\nimport { Ref, type Ref$ } from '../ref';\n\n/**\n * @deprecated\n */\n// TOOD(burdon): Reconcile with ../testing (remove this).\nexport namespace Testing {\n //\n // Primitives\n //\n\n const Circle = Schema.Struct({ type: Schema.Literal('circle'), radius: Schema.Number });\n const Square = Schema.Struct({ type: Schema.Literal('square'), side: Schema.Number });\n const Shape = Schema.Union(Circle, Square);\n\n //\n // Simple types\n //\n\n const TestNestedSchema = Schema.mutable(Schema.Struct({ field: Schema.String }));\n export type TestNestedSchema = Schema.Schema.Type<typeof TestNestedSchema>;\n export const TestNestedType = TestNestedSchema.pipe(\n EchoObject({ typename: 'example.com/type/TestNested', version: '0.1.0' }),\n );\n\n //\n // Complex types\n // TODO(burdon): Change to Type.Obj.\n //\n\n export class EmptySchemaType extends TypedObject({\n typename: 'example.com/type/Empty',\n version: '0.1.0',\n })({}) {}\n\n const fields = {\n string: Schema.String,\n number: Schema.Number,\n nullableShapeArray: Schema.mutable(Schema.Array(Schema.Union(Shape, Schema.Null))),\n boolean: Schema.Boolean,\n null: Schema.Null,\n undefined: Schema.Undefined,\n stringArray: Schema.mutable(Schema.Array(Schema.String)),\n twoDimNumberArray: Schema.mutable(Schema.Array(Schema.mutable(Schema.Array(Schema.Number)))),\n object: TestNestedSchema,\n objectArray: Schema.mutable(Schema.Array(TestNestedSchema)),\n nested: Schema.optional(Ref(TestNestedType)),\n other: Schema.Any,\n };\n\n export const TestSchema = Schema.mutable(Schema.partial(Schema.Struct(fields)));\n export type TestSchema = Schema.Schema.Type<typeof TestSchema>;\n\n export class TestSchemaType extends TypedObject({\n typename: 'example.com/type/Test',\n version: '0.1.0',\n })(fields, { partial: true }) {} // TODO(burdon): Partial?\n\n // TODO(burdon): Why do we use need this rather then TestSchemaType?\n export const TestType = TestSchema.pipe(\n EchoObject({\n typename: 'example.com/type/Test',\n version: '0.1.0',\n }),\n );\n\n export class TestClass {\n field = 'value';\n toJSON() {\n return { field: this.field };\n }\n }\n\n // TODO(dmaretskyi): Another top-level Schema.mutable call as a workaround for the regression in the last minor.\n export const TestSchemaWithClass = Schema.mutable(\n Schema.extend(\n TestSchema,\n Schema.mutable(\n Schema.Struct({\n classInstance: Schema.optional(Schema.instanceOf(TestClass)),\n }),\n ),\n ),\n );\n\n export type TestSchemaWithClass = Schema.Schema.Type<typeof TestSchemaWithClass>;\n\n export class Person extends TypedObject({\n typename: 'example.com/type/Person',\n version: '0.1.0',\n })(\n {\n name: Schema.String,\n username: Schema.String,\n email: Schema.String,\n phoneNumbers: Schema.optional(Schema.Array(Schema.Struct({ label: Schema.String, number: Schema.String }))),\n tasks: Schema.suspend((): Schema.mutable<Schema.Array$<Ref$<Task>>> => Schema.mutable(Schema.Array(Ref(Task)))),\n address: Schema.Struct({\n city: Schema.optional(Schema.String),\n state: Schema.optional(Schema.String),\n zip: Schema.optional(Schema.String),\n coordinates: Schema.Struct({\n lat: Schema.optional(Schema.Number),\n lng: Schema.optional(Schema.Number),\n }),\n }),\n },\n { partial: true },\n ) {}\n\n export class Task extends TypedObject({\n typename: 'example.com/type/Task',\n version: '0.1.0',\n })(\n {\n title: Schema.optional(Schema.String),\n completed: Schema.optional(Schema.Boolean),\n assignee: Schema.optional(Ref(Person)),\n previous: Schema.optional(Schema.suspend((): Ref$<Task> => Ref(Task))),\n subTasks: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend((): Ref$<Task> => Ref(Task))))),\n description: Schema.optional(Schema.String),\n },\n { partial: true },\n ) {}\n\n export const HasManager = Schema.Struct({\n since: Schema.optional(Schema.String),\n }).pipe(\n EchoRelation({\n typename: 'example.com/type/HasManager',\n version: '0.1.0',\n source: Person,\n target: Person,\n }),\n );\n export interface HasManager extends Schema.Schema.Type<typeof HasManager> {}\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport type * as SchemaAST from 'effect/SchemaAST';\n\nimport { registerSignalsRuntime } from '@dxos/echo-signals';\nimport { deepMapValues } from '@dxos/util';\n\nregisterSignalsRuntime();\n\n// TODO(burdon): Move to util.\nexport const updateCounter = (touch: () => void) => {\n let updateCount = -1;\n const unsubscribe = effect(() => {\n touch();\n updateCount++;\n });\n\n return {\n // https://github.com/tc39/proposal-explicit-resource-management\n [Symbol.dispose]: unsubscribe,\n get count() {\n return updateCount;\n },\n };\n};\n\n/**\n * Converts AST to a format that can be compared with test matchers.\n */\nexport const prepareAstForCompare = (obj: SchemaAST.AST): any =>\n deepMapValues(obj, (value: any, recurse) => {\n if (typeof value === 'function') {\n return null;\n }\n\n if (value instanceof RegExp) {\n return value;\n }\n\n // Convert symbols to strings.\n if (typeof value === 'object') {\n const clone = { ...value };\n for (const sym of Object.getOwnPropertySymbols(clone as any)) {\n clone[sym.toString()] = clone[sym];\n delete clone[sym];\n }\n return recurse(clone);\n }\n\n return recurse(value);\n });\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Type } from '..';\n\n/**\n * @deprecated\n */\n// TOOD(burdon): Reconcile with @dxos/schema.\nexport namespace Testing {\n export const Person = Schema.Struct({\n name: Schema.String,\n username: Schema.String,\n email: Schema.String,\n tasks: Schema.mutable(Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task)))),\n address: Schema.Struct({\n city: Schema.optional(Schema.String),\n state: Schema.optional(Schema.String),\n zip: Schema.optional(Schema.String),\n coordinates: Schema.Struct({\n lat: Schema.optional(Schema.Number),\n lng: Schema.optional(Schema.Number),\n }),\n }),\n }).pipe(\n Schema.partial,\n Type.Obj({\n typename: 'example.com/type/Person',\n version: '0.1.0',\n }),\n );\n\n export interface Person extends Schema.Schema.Type<typeof Person> {}\n\n export const Task = Schema.Struct({\n title: Schema.optional(Schema.String),\n completed: Schema.optional(Schema.Boolean),\n assignee: Schema.optional(Type.Ref(Person)),\n previous: Schema.optional(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))),\n subTasks: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))))),\n description: Schema.optional(Schema.String),\n }).pipe(\n Schema.partial,\n Type.Obj({\n typename: 'example.com/type/Task',\n version: '0.1.0',\n }),\n );\n\n export interface Task extends Schema.Schema.Type<typeof Task> {}\n\n export const WorksFor = Schema.Struct({\n since: Schema.optional(Schema.String),\n }).pipe(\n Type.Relation({\n typename: 'example.com/type/WorksFor',\n version: '0.1.0',\n source: Person,\n target: Person,\n }),\n );\n\n export interface WorksFor extends Schema.Schema.Type<typeof WorksFor> {}\n\n export const HasManager = Schema.Struct({\n since: Schema.optional(Schema.String),\n }).pipe(\n Type.Relation({\n typename: 'example.com/type/HasManager',\n version: '0.1.0',\n source: Person,\n target: Person,\n }),\n );\n\n export interface HasManager extends Schema.Schema.Type<typeof HasManager> {}\n\n export enum RecordType {\n UNDEFINED = 0,\n PERSONAL = 1,\n WORK = 2,\n }\n\n export const Container = Schema.Struct({\n objects: Schema.mutable(Schema.Array(Type.Ref(Type.Expando))),\n records: Schema.mutable(\n Schema.Array(\n Schema.partial(\n Schema.Struct({\n title: Schema.String,\n description: Schema.String,\n contacts: Schema.mutable(Schema.Array(Type.Ref(Person))),\n type: Schema.Enums(RecordType),\n }),\n ),\n ),\n ),\n }).pipe(\n Schema.partial,\n Type.Obj({\n typename: 'example.com/type/Container',\n version: '0.1.0',\n }),\n );\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport type * as Schema from 'effect/Schema';\n\nimport { registerSignalsRuntime } from '@dxos/echo-signals';\nimport { assertArgument } from '@dxos/invariant';\n\nimport { EchoSchema, StoredSchema, getSchemaTypename, live, toJsonSchema } from '../internal';\n\n// NOTE: Registration is done here is this is the module that calls out to `effect`.\nregisterSignalsRuntime();\n\n/**\n * Create a reactive mutable schema that updates when the JSON schema is updated.\n */\n// TODO(dmaretskyi): Should be replaced by registration of typed object.\nexport const createEchoSchema = (schema: Schema.Schema.AnyNoContext): EchoSchema => {\n const typename = getSchemaTypename(schema);\n assertArgument(typename, 'typename', 'Schema does not have a typename.');\n\n const echoSchema = new EchoSchema(\n live(StoredSchema, {\n typename,\n version: '0.1.0',\n jsonSchema: toJsonSchema(schema),\n }),\n );\n\n // TODO(burdon): Unsubscribe is never called.\n effect(() => {\n const _ = echoSchema.jsonSchema;\n echoSchema._invalidate();\n });\n\n return echoSchema;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;UASPC,UAAAA;AAKf,QAAMC,SAAgBC,cAAO;IAAEC,MAAaC,eAAQ,QAAA;IAAWC,QAAeC;EAAO,CAAA;AACrF,QAAMC,SAAgBL,cAAO;IAAEC,MAAa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tC,gBAAeC,cAAME,aAAKC,IAAGZ,SAACC,MAAAA,CAAAA,CAAAA;MAC/C8C,MAAaC,cAAKhD,SAACyC,UAAAA;IACrB,CAAA,CAAA,CAAA,CAAA;EAIR,CAAA,EAAGlB,KACMC,iBACPb,aAAKc,IAAI;IACPC,UAAU;IACVC,SAAS;EACX,CAAA,CAAA;AAEJ,GA/FiB3B,aAAAA,WAAAA,CAAAA,EAAAA;;;;ACRjB,SAASiD,UAAAA,eAAc;AAGvB,SAASC,0BAAAA,+BAA8B;AACvC,SAASC,sBAAsB;AAK/BC,wBAAAA;AAMO,IAAMC,mBAAmB,CAACC,WAAAA;AAC/B,QAAMC,WAAWC,kBAAkBF,MAAAA;AACnCG,iBAAeF,UAAU,YAAY,kCAAA;AAErC,QAAMG,aAAa,IAAIC,WACrBC,KAAKC,cAAc;IACjBN;IACAO,SAAS;IACTC,YAAYC,aAAaV,MAAAA;EAC3B,CAAA,CAAA;AAIFW,EAAAA,QAAO,MAAA;AACL,UAAMC,IAAIR,WAAWK;AACrBL,eAAWS,YAAW;EACxB,CAAA;AAEA,SAAOT;AACT;",
|
|
6
|
+
"names": ["Schema", "Testing", "Circle", "Struct", "type", "Literal", "radius", "Number", "Square", "side", "Shape", "Union", "TestNestedSchema", "mutable", "field", "String", "TestNestedType", "pipe", "EchoObject", "typename", "version", "EmptySchemaType", "TypedObject", "fields", "string", "number", "nullableShapeArray", "Array", "Null", "boolean", "Boolean", "null", "undefined", "Undefined", "stringArray", "twoDimNumberArray", "object", "objectArray", "nested", "optional", "Ref", "other", "Any", "TestSchema", "partial", "TestSchemaType", "TestType", "TestClass", "toJSON", "TestSchemaWithClass", "extend", "classInstance", "instanceOf", "Person", "name", "username", "email", "phoneNumbers", "label", "tasks", "suspend", "Task", "address", "city", "state", "zip", "coordinates", "lat", "lng", "title", "completed", "assignee", "previous", "subTasks", "description", "HasManager", "since", "EchoRelation", "source", "target", "effect", "registerSignalsRuntime", "deepMapValues", "registerSignalsRuntime", "updateCounter", "touch", "updateCount", "unsubscribe", "effect", "Symbol", "dispose", "count", "prepareAstForCompare", "obj", "deepMapValues", "value", "recurse", "RegExp", "clone", "sym", "Object", "getOwnPropertySymbols", "toString", "Schema", "Testing", "Person", "Struct", "name", "String", "username", "email", "tasks", "mutable", "Array", "suspend", "Type", "Ref", "Task", "address", "city", "optional", "state", "zip", "coordinates", "lat", "Number", "lng", "pipe", "partial", "Obj", "typename", "version", "title", "completed", "Boolean", "assignee", "previous", "subTasks", "description", "WorksFor", "since", "Relation", "source", "target", "HasManager", "RecordType", "Container", "objects", "Expando", "records", "contacts", "type", "Enums", "effect", "registerSignalsRuntime", "assertArgument", "registerSignalsRuntime", "createEchoSchema", "schema", "typename", "getSchemaTypename", "assertArgument", "echoSchema", "EchoSchema", "live", "StoredSchema", "version", "jsonSchema", "toJsonSchema", "effect", "_", "_invalidate"]
|
|
7
7
|
}
|
package/dist/types/src/Obj.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as EchoSchema from '@dxos/echo-schema';
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
3
2
|
import { type DXN } from '@dxos/keys';
|
|
4
|
-
import
|
|
3
|
+
import * as LiveObject from '@dxos/live-object';
|
|
4
|
+
import * as EchoSchema from './internal';
|
|
5
5
|
import type * as Ref from './Ref';
|
|
6
6
|
import type * as Relation from './Relation';
|
|
7
|
-
import
|
|
7
|
+
import * as Type from './Type';
|
|
8
8
|
/**
|
|
9
9
|
* NOTE: Don't export: Obj.Any and Obj.Obj form the public API.
|
|
10
10
|
*/
|
|
@@ -16,9 +16,20 @@ interface BaseObj extends EchoSchema.HasId, Type.OfKind<EchoSchema.EntityKind.Ob
|
|
|
16
16
|
export type Obj<Props> = BaseObj & Props;
|
|
17
17
|
/**
|
|
18
18
|
* Base type for all ECHO objects.
|
|
19
|
+
* This type does not define any properties.
|
|
19
20
|
*/
|
|
20
21
|
export interface Any extends BaseObj {
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Object with arbitrary properties.
|
|
25
|
+
*
|
|
26
|
+
* NOTE: Due to how typescript works, this type is not assignable to a specific schema type.
|
|
27
|
+
* In that case, use `Obj.instanceOf` to check if an object is of a specific type.
|
|
28
|
+
*/
|
|
29
|
+
export interface AnyProps extends BaseObj {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export declare const Any: Type.obj<Schema.Struct<{}>>;
|
|
22
33
|
type Props<T = any> = {
|
|
23
34
|
id?: EchoSchema.ObjectId;
|
|
24
35
|
} & Type.Properties<T>;
|
|
@@ -39,7 +50,7 @@ export declare const Meta: unique symbol;
|
|
|
39
50
|
* const obj = Obj.make(Person, { [Obj.Meta]: { keys: [...] }, name: 'John' });
|
|
40
51
|
* ```
|
|
41
52
|
*/
|
|
42
|
-
export declare const make: <S extends Type.Obj.Any>(schema: S, props: MakeProps<S>, meta?: EchoSchema.ObjectMeta) => LiveObject.Live<Schema.Schema.Type<S>>;
|
|
53
|
+
export declare const make: <S extends Type.Obj.Any>(schema: S, props: MakeProps<S>, meta?: Partial<EchoSchema.ObjectMeta>) => LiveObject.Live<Schema.Schema.Type<S>>;
|
|
43
54
|
export declare const isObject: (obj: unknown) => obj is Any;
|
|
44
55
|
/**
|
|
45
56
|
* Test if object or relation is an instance of a schema.
|
|
@@ -49,7 +60,7 @@ export declare const isObject: (obj: unknown) => obj is Any;
|
|
|
49
60
|
* const johnIsPerson = Obj.instanceOf(Person)(john);
|
|
50
61
|
*
|
|
51
62
|
* const isPerson = Obj.instanceOf(Person);
|
|
52
|
-
* if(isPerson(john)) {
|
|
63
|
+
* if (isPerson(john)) {
|
|
53
64
|
* // john is Person
|
|
54
65
|
* }
|
|
55
66
|
* ```
|
|
@@ -62,12 +73,12 @@ export declare const getSchema: (obj: unknown | undefined) => Schema.Schema.AnyN
|
|
|
62
73
|
export declare const getDXN: (obj: Any | Relation.Any) => DXN;
|
|
63
74
|
/**
|
|
64
75
|
* @returns The DXN of the object's type.
|
|
65
|
-
* @example dxn:example.com/type/
|
|
76
|
+
* @example dxn:example.com/type/Person:1.0.0
|
|
66
77
|
*/
|
|
67
78
|
export declare const getTypeDXN: (obj: EchoSchema.BaseObject) => DXN | undefined;
|
|
68
79
|
/**
|
|
69
80
|
* @returns The typename of the object's type.
|
|
70
|
-
* @example `example.com/type/
|
|
81
|
+
* @example `example.com/type/Person`
|
|
71
82
|
*/
|
|
72
83
|
export declare const getTypename: (obj: Any | Relation.Any) => string | undefined;
|
|
73
84
|
export declare const getMeta: (obj: Any | Relation.Any) => EchoSchema.ObjectMeta;
|
|
@@ -87,6 +98,14 @@ export declare const deleteKeys: (obj: Any | Relation.Any, source: string) => vo
|
|
|
87
98
|
export declare const isDeleted: (obj: Any | Relation.Any) => boolean;
|
|
88
99
|
export declare const getLabel: (obj: Any | Relation.Any) => string | undefined;
|
|
89
100
|
export declare const setLabel: (obj: Any | Relation.Any, label: string) => void;
|
|
101
|
+
export declare const getDescription: (obj: Any | Relation.Any) => string | undefined;
|
|
102
|
+
export declare const setDescription: (obj: Any | Relation.Any, description: string) => void;
|
|
103
|
+
export declare const addTag: (obj: Any | Relation.Any, tag: string) => void;
|
|
104
|
+
export declare const removeTag: (obj: Any | Relation.Any, tag: string) => void;
|
|
105
|
+
export type Comparator = (a: Any, b: Any) => number;
|
|
106
|
+
export declare const sortByLabel: Comparator;
|
|
107
|
+
export declare const sortByTypename: Comparator;
|
|
108
|
+
export declare const sort: (...comparators: Comparator[]) => Comparator;
|
|
90
109
|
/**
|
|
91
110
|
* JSON representation of an object.
|
|
92
111
|
*/
|
|
@@ -110,6 +129,10 @@ export declare const fromJSON: (json: unknown, options?: {
|
|
|
110
129
|
refResolver?: Ref.Resolver;
|
|
111
130
|
dxn?: DXN;
|
|
112
131
|
}) => Promise<Any>;
|
|
132
|
+
/**
|
|
133
|
+
* Returns an immutable snapshot of an object.
|
|
134
|
+
*/
|
|
135
|
+
export declare const getSnapshot: <T extends Any>(obj: Obj<T>) => T;
|
|
113
136
|
export type CloneOptions = {
|
|
114
137
|
/**
|
|
115
138
|
* Retain the original object's ID.
|
|
@@ -123,5 +146,44 @@ export type CloneOptions = {
|
|
|
123
146
|
* @returns A new object with the same schema and properties.
|
|
124
147
|
*/
|
|
125
148
|
export declare const clone: <T extends Any | Relation.Any>(obj: T, opts?: CloneOptions) => T;
|
|
149
|
+
export declare const VersionTypeId: symbol;
|
|
150
|
+
export type VersionType = typeof VersionTypeId;
|
|
151
|
+
/**
|
|
152
|
+
* Represent object version.
|
|
153
|
+
* May be backed by Automerge.
|
|
154
|
+
* Objects with no history are not versioned.
|
|
155
|
+
*/
|
|
156
|
+
export interface Version {
|
|
157
|
+
/**
|
|
158
|
+
* Whether the object is versioned.
|
|
159
|
+
*/
|
|
160
|
+
versioned: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Automerge heads.
|
|
163
|
+
*/
|
|
164
|
+
automergeHeads?: string[];
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Checks that `obj` is a version object.
|
|
168
|
+
*/
|
|
169
|
+
export declare const isVersion: (obj: unknown) => obj is Version;
|
|
170
|
+
/**
|
|
171
|
+
* Returns the version of the object.
|
|
172
|
+
*/
|
|
173
|
+
export declare const version: (obj: Any | Relation.Any) => Version;
|
|
174
|
+
/**
|
|
175
|
+
* Checks that `version` is a valid version object.
|
|
176
|
+
*/
|
|
177
|
+
export declare const versionValid: (version: Version) => boolean;
|
|
178
|
+
export type VersionCompareResult = 'unversioned' | 'equal' | 'different';
|
|
179
|
+
/**
|
|
180
|
+
* Compares two versions.
|
|
181
|
+
* @param version1
|
|
182
|
+
* @param version2
|
|
183
|
+
* @returns 'unversioned' if either object is unversioned, 'equal' if the versions are equal, 'different' if the versions are different.
|
|
184
|
+
*/
|
|
185
|
+
export declare const compareVersions: (version1: Version, version2: Version) => VersionCompareResult;
|
|
186
|
+
export declare const encodeVersion: (version: Version) => string;
|
|
187
|
+
export declare const decodeVersion: (version: string) => Version;
|
|
126
188
|
export {};
|
|
127
189
|
//# sourceMappingURL=Obj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Obj.d.ts","sourceRoot":"","sources":["../../../src/Obj.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Obj.d.ts","sourceRoot":"","sources":["../../../src/Obj.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAIhD,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,KAAK,GAAG,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,KAAK,QAAQ,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B;;GAEG;AACH,UAAU,OAAQ,SAAQ,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC;CAAG;AAExF;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,OAAO,GAAG,KAAK,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,GAAI,SAAQ,OAAO;CAAG;AAEvC;;;;;GAKG;AACH,MAAM,WAAW,QAAS,SAAQ,OAAO;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,GAAG,6BAKf,CAAC;AAEF,KAAK,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI;IAAE,EAAE,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAA;CAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAExE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,KA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W,OAAO;IAGtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAOD;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,OAE/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,KAAK,GAAG,GAAG,QAAQ,CAAC,GAAG,KAAG,OAMjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,OAG/C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,OAAO,GAAG,WAAW,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,OAAO,EAAE,UAAU,OAAO,KAAG,oBAgBtE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,MAEhD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,OAI/C,CAAC"}
|
package/dist/types/src/Ref.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../../src/Ref.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../../src/Ref.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,KAAK,GAAG,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvC,MAAM,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE1C,eAAO,MAAM,KAAK;;;;EAAsB,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC;AAE9C,eAAO,MAAM,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,GAA0B,CAAC;AAE5E,eAAO,MAAM,IAAI,+DAAsB,CAAC;AAGxC,eAAO,MAAM,OAAO,wDAAyB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as EchoSchema from '@dxos/echo-schema';
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
3
2
|
import { DXN } from '@dxos/keys';
|
|
4
3
|
import { type Live } from '@dxos/live-object';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import * as EchoSchema from './internal';
|
|
5
|
+
import * as Obj from './Obj';
|
|
6
|
+
import * as Type from './Type';
|
|
7
7
|
/**
|
|
8
8
|
* NOTE: Don't export: Relation.Relation and Relation.Any form the public API.
|
|
9
9
|
*/
|
|
@@ -18,6 +18,7 @@ export type Relation<Source extends Obj.Any, Target extends Obj.Any, Props> = Ba
|
|
|
18
18
|
*/
|
|
19
19
|
export interface Any extends BaseRelation<Obj.Any, Obj.Any> {
|
|
20
20
|
}
|
|
21
|
+
export declare const Any: Type.relation<Schema.Struct<{}>, Type.obj<Schema.Struct<{}>>, Type.obj<Schema.Struct<{}>>>;
|
|
21
22
|
export declare const Source: unique symbol;
|
|
22
23
|
export type Source = typeof Source;
|
|
23
24
|
export declare const Target: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Relation.d.ts","sourceRoot":"","sources":["../../../src/Relation.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"Relation.d.ts","sourceRoot":"","sources":["../../../src/Relation.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EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;CACrB,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAEvB;;;;;;GAMG;AAGH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,GAAG,EAC9C,QAAQ,CAAC,EACT,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAChD,OAAO,UAAU,CAAC,UAAU,KAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAkB1E,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,GAUpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG,KAAG,GAMzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG,KAAG,GAMzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,GAAG,EAAE,UAAU,CAAC,KAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAM5E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,GAAG,EAAE,UAAU,CAAC,KAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAM5E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import * as Obj from './Obj';
|
|
3
|
+
import * as Type from './Type';
|
|
4
|
+
export declare const Tag: Type.obj<Schema.Struct<{
|
|
5
|
+
label: typeof Schema.String;
|
|
6
|
+
hue: Schema.optional<typeof Schema.String>;
|
|
7
|
+
}>>;
|
|
8
|
+
export type Tag = Schema.Schema.Type<typeof Tag>;
|
|
9
|
+
export declare const make: (props: Obj.MakeProps<typeof Tag>) => import("@dxos/live-object").Live<Type.OfKind<import("./internal").EntityKind.Object> & {
|
|
10
|
+
label: string;
|
|
11
|
+
hue?: string | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export type Map = Record<string, Tag>;
|
|
14
|
+
export declare const sortTags: ({ label: a }: Tag, { label: b }: Tag) => number;
|
|
15
|
+
export declare const createTagList: (tags: Map) => Tag[];
|
|
16
|
+
export declare const findTagByLabel: (tags: Map | undefined, name: string) => Tag | undefined;
|
|
17
|
+
//# sourceMappingURL=Tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../../src/Tag.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B,eAAO,MAAM,GAAG;;;GASf,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;AAEjD,eAAO,MAAM,IAAI,GAAI,OAAO,GAAG,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC;;;EAAyB,CAAC;AAG/E,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEtC,eAAO,MAAM,QAAQ,GAAI,cAAc,GAAG,EAAE,cAAc,GAAG,WAAuB,CAAC;AAErF,eAAO,MAAM,aAAa,GAAI,MAAM,GAAG,KAAG,GAAG,EAG1B,CAAC;AAEpB,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,GAAG,SAAS,EAAE,MAAM,MAAM,KAAG,GAAG,GAAG,SAG1E,CAAC"}
|