@dxos/echo 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +3 -3
- package/dist/lib/neutral/Annotation.mjs +5 -3
- package/dist/lib/neutral/Database.mjs +8 -4
- package/dist/lib/neutral/Entity.mjs +16 -14
- package/dist/lib/neutral/Err.mjs +1 -1
- package/dist/lib/neutral/Extension.mjs +18 -0
- package/dist/lib/neutral/Extension.mjs.map +7 -0
- package/dist/lib/neutral/Feed.mjs +23 -18
- package/dist/lib/neutral/Filter.mjs +23 -13
- package/dist/lib/neutral/Format.mjs +3 -3
- package/dist/lib/neutral/JsonSchema.mjs +8 -8
- package/dist/lib/neutral/Key.mjs +1 -1
- package/dist/lib/neutral/Migration.mjs +17 -0
- package/dist/lib/neutral/Migration.mjs.map +7 -0
- package/dist/lib/neutral/Obj.mjs +16 -13
- package/dist/lib/neutral/Order.mjs +1 -1
- package/dist/lib/neutral/Query.mjs +19 -17
- package/dist/lib/neutral/QueryResult.mjs +1 -1
- package/dist/lib/neutral/Ref.mjs +9 -7
- package/dist/lib/neutral/Relation.mjs +15 -14
- package/dist/lib/neutral/SchemaRegistry.mjs +1 -1
- package/dist/lib/neutral/Tag.mjs +14 -13
- package/dist/lib/neutral/Type.mjs +10 -10
- package/dist/lib/neutral/{chunk-FZO7LQO7.mjs → chunk-44HT3MEC.mjs} +2 -2
- package/dist/lib/neutral/{chunk-ROAGDPV7.mjs → chunk-4A2GS5LQ.mjs} +12 -8
- package/dist/lib/neutral/chunk-4A2GS5LQ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-OENWMTE6.mjs → chunk-5SL5LDLD.mjs} +4 -2
- package/dist/lib/neutral/chunk-5SL5LDLD.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-ANHVGJI4.mjs → chunk-7RVZT53K.mjs} +1 -1
- package/dist/lib/neutral/{chunk-YWXWXIE5.mjs → chunk-APHSOTIX.mjs} +2 -2
- package/dist/lib/neutral/{chunk-YWXWXIE5.mjs.map → chunk-APHSOTIX.mjs.map} +2 -2
- package/dist/lib/neutral/{chunk-6DNYDXCV.mjs → chunk-B2P7IVG3.mjs} +61 -14
- package/dist/lib/neutral/chunk-B2P7IVG3.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-BNCCGLJN.mjs → chunk-BICZKPQG.mjs} +1 -1
- package/dist/lib/neutral/{chunk-43Y5DOS6.mjs → chunk-BMB7IHGB.mjs} +16 -66
- package/dist/lib/neutral/chunk-BMB7IHGB.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-6K2MVI2O.mjs → chunk-BUBEC474.mjs} +4 -4
- package/dist/lib/neutral/{chunk-YMNSMKKW.mjs → chunk-C4PSESGN.mjs} +6 -22
- package/dist/lib/neutral/{chunk-YMNSMKKW.mjs.map → chunk-C4PSESGN.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-FIWO2FZK.mjs +36 -0
- package/dist/lib/neutral/chunk-FIWO2FZK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GWFFC34K.mjs +50 -0
- package/dist/lib/neutral/chunk-GWFFC34K.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-NXMFBIT5.mjs → chunk-HKETO4L4.mjs} +72 -6
- package/dist/lib/neutral/chunk-HKETO4L4.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-NEGC54NE.mjs → chunk-I2DARWPX.mjs} +17 -19
- package/dist/lib/neutral/chunk-I2DARWPX.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-7VNVH63N.mjs → chunk-IVSI7QO6.mjs} +50 -20
- package/dist/lib/neutral/chunk-IVSI7QO6.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-BOZZPUXE.mjs → chunk-MLS7U7AT.mjs} +12 -65
- package/dist/lib/neutral/chunk-MLS7U7AT.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-WYOKA6AE.mjs → chunk-N4B7FHQT.mjs} +2 -2
- package/dist/lib/neutral/{chunk-WYOKA6AE.mjs.map → chunk-N4B7FHQT.mjs.map} +1 -1
- package/dist/lib/neutral/{chunk-FXEG7EOK.mjs → chunk-N7VOEPSV.mjs} +6 -3
- package/dist/lib/neutral/{chunk-FXEG7EOK.mjs.map → chunk-N7VOEPSV.mjs.map} +3 -3
- package/dist/lib/neutral/{chunk-UTBRYVQC.mjs → chunk-QRZ2I3ZM.mjs} +2 -2
- package/dist/lib/neutral/{chunk-SEMVAGBM.mjs → chunk-TNBK56IN.mjs} +19 -24
- package/dist/lib/neutral/chunk-TNBK56IN.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-B5OXLWZL.mjs → chunk-TRPZU2HV.mjs} +2 -2
- package/dist/lib/neutral/{chunk-UI6MWK5W.mjs → chunk-TTCSATUD.mjs} +1 -1
- package/dist/lib/neutral/{chunk-OMUPQMLR.mjs → chunk-V72DY6LU.mjs} +1 -1
- package/dist/lib/neutral/{chunk-6GPU7XC3.mjs → chunk-VW42HESL.mjs} +54 -17
- package/dist/lib/neutral/chunk-VW42HESL.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-4JRI2ZJI.mjs → chunk-X3356HPV.mjs} +120 -12
- package/dist/lib/neutral/chunk-X3356HPV.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-W47JKR3X.mjs → chunk-XEXM5HWQ.mjs} +18 -46
- package/dist/lib/neutral/chunk-XEXM5HWQ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-C4JZK4J7.mjs → chunk-Z5GKP74O.mjs} +231 -479
- package/dist/lib/neutral/chunk-Z5GKP74O.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-UBEZSGXY.mjs → chunk-ZISMEVKD.mjs} +1 -1
- package/dist/lib/neutral/{chunk-UBEZSGXY.mjs.map → chunk-ZISMEVKD.mjs.map} +2 -2
- package/dist/lib/neutral/index.mjs +38 -28
- package/dist/lib/neutral/internal/index.mjs +15 -9
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/testing/index.mjs +185 -129
- package/dist/lib/neutral/testing/index.mjs.map +3 -3
- package/dist/types/src/Annotation.d.ts +1 -1
- package/dist/types/src/Annotation.d.ts.map +1 -1
- package/dist/types/src/Collection.d.ts.map +1 -1
- package/dist/types/src/Database.d.ts +14 -2
- package/dist/types/src/Database.d.ts.map +1 -1
- package/dist/types/src/Dataset.d.ts +2 -1
- package/dist/types/src/Dataset.d.ts.map +1 -1
- package/dist/types/src/Entity.d.ts +17 -11
- package/dist/types/src/Entity.d.ts.map +1 -1
- package/dist/types/src/Err.d.ts +18 -18
- package/dist/types/src/Err.d.ts.map +1 -1
- package/dist/types/src/Extension.d.ts +80 -0
- package/dist/types/src/Extension.d.ts.map +1 -0
- package/dist/types/src/Extension.test.d.ts +2 -0
- package/dist/types/src/Extension.test.d.ts.map +1 -0
- package/dist/types/src/Feed.d.ts +62 -21
- package/dist/types/src/Feed.d.ts.map +1 -1
- package/dist/types/src/Filter.d.ts +54 -4
- package/dist/types/src/Filter.d.ts.map +1 -1
- package/dist/types/src/Filter.test.d.ts +2 -0
- package/dist/types/src/Filter.test.d.ts.map +1 -0
- package/dist/types/src/Hypergraph.d.ts +3 -3
- package/dist/types/src/Hypergraph.d.ts.map +1 -1
- package/dist/types/src/Json.d.ts +33 -0
- package/dist/types/src/Json.d.ts.map +1 -0
- package/dist/types/src/Json.test.d.ts +2 -0
- package/dist/types/src/Json.test.d.ts.map +1 -0
- package/dist/types/src/JsonSchema.d.ts +1 -1
- package/dist/types/src/Migration.d.ts +69 -0
- package/dist/types/src/Migration.d.ts.map +1 -0
- package/dist/types/src/Obj.d.ts +42 -28
- package/dist/types/src/Obj.d.ts.map +1 -1
- package/dist/types/src/Order.d.ts.map +1 -1
- package/dist/types/src/Query.d.ts +13 -2
- package/dist/types/src/Query.d.ts.map +1 -1
- package/dist/types/src/Ref.d.ts +1 -0
- package/dist/types/src/Ref.d.ts.map +1 -1
- package/dist/types/src/Relation.d.ts +17 -18
- package/dist/types/src/Relation.d.ts.map +1 -1
- package/dist/types/src/Tag.d.ts +2 -2
- package/dist/types/src/Tag.d.ts.map +1 -1
- package/dist/types/src/Type.d.ts +3 -3
- package/dist/types/src/Type.d.ts.map +1 -1
- package/dist/types/src/View.d.ts +1 -1
- package/dist/types/src/View.d.ts.map +1 -1
- package/dist/types/src/exemplars.test.d.ts +2 -0
- package/dist/types/src/exemplars.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/annotations.d.ts +12 -2
- package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -1
- package/dist/types/src/internal/Annotation/util.d.ts +1 -1
- package/dist/types/src/internal/Annotation/util.d.ts.map +1 -1
- package/dist/types/src/internal/Entity/api.d.ts.map +1 -1
- package/dist/types/src/internal/Entity/model.d.ts +2 -0
- package/dist/types/src/internal/Entity/model.d.ts.map +1 -1
- package/dist/types/src/internal/Entity/object.d.ts.map +1 -1
- package/dist/types/src/internal/Entity/relation.d.ts.map +1 -1
- package/dist/types/src/internal/Entity/version.d.ts.map +1 -1
- package/dist/types/src/internal/Format/date.d.ts.map +1 -1
- package/dist/types/src/internal/Format/format.d.ts.map +1 -1
- package/dist/types/src/internal/Format/number.d.ts.map +1 -1
- package/dist/types/src/internal/Format/object.d.ts.map +1 -1
- package/dist/types/src/internal/Format/types.d.ts.map +1 -1
- package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -1
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts +28 -28
- package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -1
- package/dist/types/src/internal/JsonSchema/json-schema.d.ts +1 -1
- package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/clone.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/common.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/ids.d.ts +1 -1
- package/dist/types/src/internal/Obj/ids.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/json-serializer.d.ts +4 -3
- package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/set-value.d.ts +1 -1
- package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -1
- package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -1
- package/dist/types/src/internal/Query.d.ts +10 -0
- package/dist/types/src/internal/Query.d.ts.map +1 -0
- package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -1
- package/dist/types/src/internal/Ref/ref.d.ts +14 -1
- package/dist/types/src/internal/Ref/ref.d.ts.map +1 -1
- package/dist/types/src/internal/Type/compose.d.ts.map +1 -1
- package/dist/types/src/internal/Type/echo-schema.d.ts +2 -2
- package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -1
- package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -1
- package/dist/types/src/internal/common/api/meta.d.ts +3 -3
- package/dist/types/src/internal/common/api/meta.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/change-context.d.ts +1 -1
- package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/errors.d.ts +1 -1
- package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/reactive-array.d.ts +1 -1
- package/dist/types/src/internal/common/proxy/reactive.d.ts +1 -1
- package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/reactive.test.d.ts +2 -0
- package/dist/types/src/internal/common/proxy/reactive.test.d.ts.map +1 -0
- package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -1
- package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -1
- package/dist/types/src/internal/common/types/base.d.ts.map +1 -1
- package/dist/types/src/internal/common/types/entity.d.ts +4 -4
- package/dist/types/src/internal/common/types/entity.d.ts.map +1 -1
- package/dist/types/src/internal/common/types/meta.d.ts +10 -0
- package/dist/types/src/internal/common/types/meta.d.ts.map +1 -1
- package/dist/types/src/internal/common/types/version.d.ts +1 -1
- package/dist/types/src/internal/index.d.ts +1 -0
- package/dist/types/src/internal/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +8 -8
- package/dist/types/src/testing/test-data.d.ts.map +1 -1
- package/dist/types/src/testing/test-schema.d.ts +53 -53
- package/dist/types/src/testing/test-schema.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -15
- package/src/Annotation.ts +1 -0
- package/src/Collection.ts +2 -2
- package/src/Database.ts +50 -15
- package/src/Entity.ts +18 -12
- package/src/Extension.test.ts +235 -0
- package/src/Extension.ts +122 -0
- package/src/Feed.ts +107 -34
- package/src/Filter.test.ts +90 -0
- package/src/Filter.ts +97 -3
- package/src/Hypergraph.ts +3 -3
- package/src/Json.test.ts +175 -0
- package/src/Json.ts +102 -0
- package/src/Migration.ts +106 -0
- package/src/Obj.test.ts +105 -13
- package/src/Obj.ts +154 -33
- package/src/Query.test.ts +199 -9
- package/src/Query.ts +58 -8
- package/src/Ref.ts +2 -0
- package/src/Relation.ts +24 -20
- package/src/Type.ts +1 -1
- package/src/View.ts +1 -1
- package/src/exemplars.test.ts +21 -0
- package/src/index.ts +4 -0
- package/src/internal/Annotation/annotations.test.ts +51 -2
- package/src/internal/Annotation/annotations.ts +33 -14
- package/src/internal/Annotation/sorting.ts +0 -1
- package/src/internal/Entity/api.ts +0 -1
- package/src/internal/Entity/model.ts +2 -0
- package/src/internal/Entity/object.ts +0 -1
- package/src/internal/Entity/version.ts +0 -1
- package/src/internal/Format/date.test.ts +0 -1
- package/src/internal/Format/format.test.ts +0 -1
- package/src/internal/JsonSchema/json-schema-type.ts +1 -1
- package/src/internal/JsonSchema/json-schema.test.ts +1 -2
- package/src/internal/JsonSchema/json-schema.ts +1 -2
- package/src/internal/Obj/clone.ts +1 -1
- package/src/internal/Obj/create-object.test.ts +2 -4
- package/src/internal/Obj/create-object.ts +2 -3
- package/src/internal/Obj/deleted.ts +1 -1
- package/src/internal/Obj/ids.ts +1 -1
- package/src/internal/Obj/json-serializer.test.ts +49 -5
- package/src/internal/Obj/json-serializer.ts +47 -25
- package/src/internal/Obj/set-value.test.ts +24 -24
- package/src/internal/Obj/set-value.ts +1 -1
- package/src/internal/Query.ts +156 -0
- package/src/internal/Ref/ref-array.ts +0 -1
- package/src/internal/Ref/ref.test.ts +0 -1
- package/src/internal/Ref/ref.ts +18 -1
- package/src/internal/Type/compose.test.ts +0 -1
- package/src/internal/Type/echo-schema.ts +3 -4
- package/src/internal/common/README.md +1 -1
- package/src/internal/common/api/meta.ts +3 -3
- package/src/internal/common/proxy/change-context.ts +1 -1
- package/src/internal/common/proxy/change.test.ts +94 -94
- package/src/internal/common/proxy/errors.ts +2 -2
- package/src/internal/common/proxy/handler.test.ts +0 -2
- package/src/internal/common/proxy/json-serializer.ts +4 -1
- package/src/internal/common/proxy/make-object.ts +0 -1
- package/src/internal/common/proxy/ownership.ts +0 -1
- package/src/internal/common/proxy/reactive-array.ts +1 -1
- package/src/internal/common/proxy/reactive.test.ts +54 -0
- package/src/internal/common/proxy/reactive.ts +11 -3
- package/src/internal/common/proxy/typed-handler.test.ts +0 -1
- package/src/internal/common/proxy/typed-handler.ts +8 -10
- package/src/internal/common/proxy/typed-object.test.ts +2 -3
- package/src/internal/common/types/entity.ts +1 -1
- package/src/internal/common/types/meta.ts +12 -1
- package/src/internal/index.ts +1 -0
- package/src/testing/api.test.ts +0 -1
- package/src/testing/test-data.ts +157 -98
- package/dist/lib/neutral/chunk-43Y5DOS6.mjs.map +0 -7
- package/dist/lib/neutral/chunk-4JRI2ZJI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-6DNYDXCV.mjs.map +0 -7
- package/dist/lib/neutral/chunk-6GPU7XC3.mjs.map +0 -7
- package/dist/lib/neutral/chunk-7VNVH63N.mjs.map +0 -7
- package/dist/lib/neutral/chunk-BOZZPUXE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-C4JZK4J7.mjs.map +0 -7
- package/dist/lib/neutral/chunk-NEGC54NE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-NXMFBIT5.mjs.map +0 -7
- package/dist/lib/neutral/chunk-OENWMTE6.mjs.map +0 -7
- package/dist/lib/neutral/chunk-ROAGDPV7.mjs.map +0 -7
- package/dist/lib/neutral/chunk-SEMVAGBM.mjs.map +0 -7
- package/dist/lib/neutral/chunk-W47JKR3X.mjs.map +0 -7
- /package/dist/lib/neutral/{chunk-FZO7LQO7.mjs.map → chunk-44HT3MEC.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-ANHVGJI4.mjs.map → chunk-7RVZT53K.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-BNCCGLJN.mjs.map → chunk-BICZKPQG.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-6K2MVI2O.mjs.map → chunk-BUBEC474.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-UTBRYVQC.mjs.map → chunk-QRZ2I3ZM.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-B5OXLWZL.mjs.map → chunk-TRPZU2HV.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-UI6MWK5W.mjs.map → chunk-TTCSATUD.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-OMUPQMLR.mjs.map → chunk-V72DY6LU.mjs.map} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import * as Obj from '../../../Obj';
|
|
8
|
+
import { TestSchema } from '../../../testing';
|
|
9
|
+
|
|
10
|
+
describe('Obj.subscribe', () => {
|
|
11
|
+
test('subscribes and fires for reactive proxies', () => {
|
|
12
|
+
const obj = Obj.make(TestSchema.Person, { name: 'Test' });
|
|
13
|
+
let calls = 0;
|
|
14
|
+
const unsubscribe = Obj.subscribe(obj, () => {
|
|
15
|
+
calls++;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
Obj.update(obj, (obj) => {
|
|
19
|
+
obj.name = 'Updated';
|
|
20
|
+
});
|
|
21
|
+
expect(calls).toBeGreaterThan(0);
|
|
22
|
+
|
|
23
|
+
unsubscribe();
|
|
24
|
+
const seen = calls;
|
|
25
|
+
Obj.update(obj, (obj) => {
|
|
26
|
+
obj.name = 'After unsubscribe';
|
|
27
|
+
});
|
|
28
|
+
expect(calls).toBe(seen);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Regression: queue-stored typed objects (e.g. AiContext.Binding) and other Obj-shaped values
|
|
32
|
+
// satisfy `Obj.isObject` (KindId is set) but are not wrapped in a reactive Proxy. Earlier
|
|
33
|
+
// versions invariant'd inside `getProxyTarget` when an atom body did `Obj.subscribe(obj)` on
|
|
34
|
+
// such an input. The contract is "no-op for non-reactive inputs"; verify the function
|
|
35
|
+
// returns gracefully instead of throwing.
|
|
36
|
+
test('returns a no-op unsubscribe for non-proxy inputs', () => {
|
|
37
|
+
const queueShaped: any = {
|
|
38
|
+
id: '01KQ5NKXJWSKMRPVTVG2GHV8V3',
|
|
39
|
+
blueprints: { added: [], removed: [] },
|
|
40
|
+
objects: { added: [], removed: [] },
|
|
41
|
+
};
|
|
42
|
+
const unsubscribe = Obj.subscribe(queueShaped, () => {});
|
|
43
|
+
expect(typeof unsubscribe).toBe('function');
|
|
44
|
+
expect(() => unsubscribe()).not.toThrow();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('returns a no-op unsubscribe for primitives, null, and undefined', () => {
|
|
48
|
+
for (const value of [null, undefined, 42, 'string', true]) {
|
|
49
|
+
const unsubscribe = Obj.subscribe(value as any, () => {});
|
|
50
|
+
expect(typeof unsubscribe).toBe('function');
|
|
51
|
+
expect(() => unsubscribe()).not.toThrow();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type RefTypeId } from '../../Ref/ref';
|
|
6
|
-
|
|
7
|
-
import { getProxyTarget } from './proxy-utils';
|
|
6
|
+
import { getProxyTarget, isProxy } from './proxy-utils';
|
|
8
7
|
import { ChangeId, EventId } from './symbols';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -15,6 +14,15 @@ import { ChangeId, EventId } from './symbols';
|
|
|
15
14
|
*/
|
|
16
15
|
// TODO(wittjosiah): Consider throwing if obj doesn't have EventId instead of returning no-op.
|
|
17
16
|
export const subscribe = (obj: unknown, callback: () => void): (() => void) => {
|
|
17
|
+
// Guard against non-reactive inputs (queue-stored typed objects, snapshots, plain shapes
|
|
18
|
+
// with branded symbols) before `getProxyTarget`'s `ProxyHandlerSlot` invariant kicks in.
|
|
19
|
+
// `Obj.isObject` (KindId-based) is satisfied by these inputs, so callers like
|
|
20
|
+
// `Atom.family((obj) => Atom.make((get) => Obj.subscribe(obj, ...)))` legitimately reach
|
|
21
|
+
// here with a non-proxy. Falling back to a no-op preserves the documented contract that
|
|
22
|
+
// values without subscription support get a no-op unsubscribe.
|
|
23
|
+
if (!isProxy(obj)) {
|
|
24
|
+
return () => {};
|
|
25
|
+
}
|
|
18
26
|
const target = getProxyTarget(obj as any);
|
|
19
27
|
if (target && EventId in target) {
|
|
20
28
|
return (target as any)[EventId].on(callback);
|
|
@@ -24,7 +32,7 @@ export const subscribe = (obj: unknown, callback: () => void): (() => void) => {
|
|
|
24
32
|
|
|
25
33
|
/**
|
|
26
34
|
* Deeply removes readonly modifiers from all properties of T.
|
|
27
|
-
* Inside Obj.
|
|
35
|
+
* Inside Obj.update, all properties are fully mutable regardless of schema definition.
|
|
28
36
|
* Ref types are preserved as-is since they are value-like objects that are replaced, not mutated.
|
|
29
37
|
* Primitive types (including branded primitives) are preserved as-is.
|
|
30
38
|
*/
|
|
@@ -10,7 +10,6 @@ import { EchoObjectSchema } from '../../Entity';
|
|
|
10
10
|
import { setValue } from '../../Obj';
|
|
11
11
|
import { Ref } from '../../Ref';
|
|
12
12
|
import { foreignKey, getMeta } from '../types';
|
|
13
|
-
|
|
14
13
|
import { makeObject } from './make-object';
|
|
15
14
|
import { change, subscribe } from './reactive';
|
|
16
15
|
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type InspectOptionsStylized } from 'node:util';
|
|
6
|
-
|
|
7
5
|
import * as Schema from 'effect/Schema';
|
|
8
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
|
+
import { type InspectOptionsStylized } from 'node:util';
|
|
9
8
|
|
|
10
9
|
import { Event } from '@dxos/async';
|
|
11
10
|
import { inspectCustom } from '@dxos/debug';
|
|
@@ -13,7 +12,6 @@ import { invariant } from '@dxos/invariant';
|
|
|
13
12
|
|
|
14
13
|
import { getSchemaDXN } from '../../Annotation';
|
|
15
14
|
import { ObjectDeletedId, ParentId, SchemaId, TypeId } from '../types';
|
|
16
|
-
|
|
17
15
|
import { executeChange, isInChangeContext, queueNotification } from './change-context';
|
|
18
16
|
import { defineHiddenProperty } from './define-hidden-property';
|
|
19
17
|
import { createPropertyDeleteError } from './errors';
|
|
@@ -228,7 +226,7 @@ export class TypedReactiveHandler implements ReactiveHandler<ProxyTarget> {
|
|
|
228
226
|
set(target: ProxyTarget, prop: string | symbol, value: any, receiver: any): boolean {
|
|
229
227
|
const echoRoot = getEchoRoot(target);
|
|
230
228
|
|
|
231
|
-
// Check readonly enforcement - mutations only allowed within Obj.
|
|
229
|
+
// Check readonly enforcement - mutations only allowed within Obj.update().
|
|
232
230
|
// Skip check if the object is still being initialized (no ChangeId handler yet).
|
|
233
231
|
// Also skip for non-initialized root objects (those without EventId).
|
|
234
232
|
// Skip for symbol properties (internal infrastructure, not user data).
|
|
@@ -236,8 +234,8 @@ export class TypedReactiveHandler implements ReactiveHandler<ProxyTarget> {
|
|
|
236
234
|
const isSymbolProp = typeof prop === 'symbol';
|
|
237
235
|
if (isInitialized && !isSymbolProp && !isInChangeContext(echoRoot)) {
|
|
238
236
|
throw new Error(
|
|
239
|
-
`Cannot modify object property "${String(prop)}" outside of Obj.
|
|
240
|
-
'Use Obj.
|
|
237
|
+
`Cannot modify object property "${String(prop)}" outside of Obj.update(). ` +
|
|
238
|
+
'Use Obj.update(obj, (mutableObj) => { mutableObj.property = value; }) instead.',
|
|
241
239
|
);
|
|
242
240
|
}
|
|
243
241
|
|
|
@@ -267,7 +265,7 @@ export class TypedReactiveHandler implements ReactiveHandler<ProxyTarget> {
|
|
|
267
265
|
deleteProperty(target: ProxyTarget, property: string | symbol): boolean {
|
|
268
266
|
const echoRoot = getEchoRoot(target);
|
|
269
267
|
|
|
270
|
-
// Check readonly enforcement - mutations only allowed within Obj.
|
|
268
|
+
// Check readonly enforcement - mutations only allowed within Obj.update().
|
|
271
269
|
// Skip for symbol properties (internal infrastructure, not user data).
|
|
272
270
|
const isInitialized = (echoRoot as any)[ChangeId] === true || EventId in echoRoot;
|
|
273
271
|
const isSymbolProp = typeof property === 'symbol';
|
|
@@ -285,15 +283,15 @@ export class TypedReactiveHandler implements ReactiveHandler<ProxyTarget> {
|
|
|
285
283
|
defineProperty(target: ProxyTarget, property: string | symbol, attributes: PropertyDescriptor): boolean {
|
|
286
284
|
const echoRoot = getEchoRoot(target);
|
|
287
285
|
|
|
288
|
-
// Check readonly enforcement - mutations only allowed within Obj.
|
|
286
|
+
// Check readonly enforcement - mutations only allowed within Obj.update().
|
|
289
287
|
// Skip check if the object is still being initialized (no ChangeId handler yet).
|
|
290
288
|
// Skip for symbol properties (internal infrastructure, not user data).
|
|
291
289
|
const isInitialized = ChangeId in echoRoot || EventId in echoRoot;
|
|
292
290
|
const isSymbolProp = typeof property === 'symbol';
|
|
293
291
|
if (isInitialized && !isSymbolProp && !isInChangeContext(echoRoot)) {
|
|
294
292
|
throw new Error(
|
|
295
|
-
`Cannot modify object property "${String(property)}" outside of Obj.
|
|
296
|
-
'Use Obj.
|
|
293
|
+
`Cannot modify object property "${String(property)}" outside of Obj.update(). ` +
|
|
294
|
+
'Use Obj.update(obj, (mutableObj) => { mutableObj.property = value; }) instead.',
|
|
297
295
|
);
|
|
298
296
|
}
|
|
299
297
|
|
|
@@ -8,7 +8,6 @@ import { describe, expect, test } from 'vitest';
|
|
|
8
8
|
|
|
9
9
|
import { EchoObjectSchema } from '../../Entity';
|
|
10
10
|
import { getSchema } from '../types';
|
|
11
|
-
|
|
12
11
|
import { makeObject } from './make-object';
|
|
13
12
|
import { change } from './reactive';
|
|
14
13
|
|
|
@@ -87,7 +86,7 @@ describe('EchoObjectSchema class DSL', () => {
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
{
|
|
90
|
-
// Plain object (not a reactive proxy) - doesn't need Obj.
|
|
89
|
+
// Plain object (not a reactive proxy) - doesn't need Obj.update.
|
|
91
90
|
// Note: Schema.Schema.Type generates readonly types, so we cast to mutable for plain objects.
|
|
92
91
|
type Test1 = Types.Mutable<Schema.Schema.Type<typeof schema>>;
|
|
93
92
|
|
|
@@ -101,7 +100,7 @@ describe('EchoObjectSchema class DSL', () => {
|
|
|
101
100
|
meta: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
102
101
|
}).pipe(
|
|
103
102
|
EchoObjectSchema({
|
|
104
|
-
typename: 'org.dxos.type.
|
|
103
|
+
typename: 'org.dxos.type.functionTrigger',
|
|
105
104
|
version: '0.1.0',
|
|
106
105
|
}),
|
|
107
106
|
);
|
|
@@ -46,7 +46,7 @@ export const EntityKindSchema = Schema.Enums(EntityKind);
|
|
|
46
46
|
* Typename for generic object references (Type.Obj / Ref.Ref(Obj.Unknown)).
|
|
47
47
|
* Used when referencing any object without a specific schema.
|
|
48
48
|
*/
|
|
49
|
-
export const ANY_OBJECT_TYPENAME = 'org.dxos.schema.
|
|
49
|
+
export const ANY_OBJECT_TYPENAME = 'org.dxos.schema.anyObject';
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Version for generic object references.
|
|
@@ -9,7 +9,6 @@ import { invariant } from '@dxos/invariant';
|
|
|
9
9
|
import { type Comparator, intersection } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
import type * as Entity from '../../../Entity';
|
|
12
|
-
|
|
13
12
|
import { type AnyProperties } from './base';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -39,6 +38,18 @@ export const ObjectMetaSchema = Schema.Struct({
|
|
|
39
38
|
// Defaulting to an empty array is possible but requires a bit more work.
|
|
40
39
|
// TODO(dmaretskyi): In automerge this should be a map of { [tag]: boolean } for uniqueness and conflict resolution.
|
|
41
40
|
tags: Schema.optional(Schema.Array(Schema.String)),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Fully-qualified registry key for the object (FQN format, e.g. `org.example.type.foo`).
|
|
44
|
+
* Identifies the canonical registry entry the object instance was created from.
|
|
45
|
+
*/
|
|
46
|
+
key: Schema.optional(Schema.String),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Semantic version of the registry entry the object was created from.
|
|
50
|
+
* Must be a valid semver string (e.g. `1.2.3`).
|
|
51
|
+
*/
|
|
52
|
+
version: Schema.optional(Schema.String),
|
|
42
53
|
});
|
|
43
54
|
|
|
44
55
|
export type ObjectMeta = Schema.Schema.Type<typeof ObjectMetaSchema>;
|
package/src/internal/index.ts
CHANGED
|
@@ -12,5 +12,6 @@ export * from './Format';
|
|
|
12
12
|
export * from './JsonSchema';
|
|
13
13
|
// TODO(wittjosiah): Required to ensure types are portable (need to export all types required for downstream inference).
|
|
14
14
|
export * from './Obj';
|
|
15
|
+
export * from './Query';
|
|
15
16
|
export * from './Ref';
|
|
16
17
|
export * from './Type';
|
package/src/testing/api.test.ts
CHANGED
package/src/testing/test-data.ts
CHANGED
|
@@ -6,125 +6,184 @@ import { DatabaseDirectory, ObjectStructure } from '@dxos/echo-protocol';
|
|
|
6
6
|
import { DXN, ObjectId, PublicKey } from '@dxos/keys';
|
|
7
7
|
|
|
8
8
|
import { Type } from '../index';
|
|
9
|
-
|
|
10
9
|
import { TestSchema } from './test-schema';
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
// Lazy init: Cloudflare workers disallow non-determinism at module scope (e.g. random keys).
|
|
12
|
+
let cachedSpaceKeyHex: string | undefined;
|
|
13
|
+
const getSpaceKeyHex = (): string => {
|
|
14
|
+
if (cachedSpaceKeyHex === undefined) {
|
|
15
|
+
cachedSpaceKeyHex = PublicKey.random().toHex();
|
|
16
|
+
}
|
|
17
|
+
return cachedSpaceKeyHex;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
let cachedPeopleAlice: DatabaseDirectory | undefined;
|
|
21
|
+
let cachedPeopleBob: DatabaseDirectory | undefined;
|
|
22
|
+
let cachedOrgsDxos: DatabaseDirectory | undefined;
|
|
23
|
+
let cachedOrgsCyberdyne: DatabaseDirectory | undefined;
|
|
24
|
+
let cachedWorksFredCyberdyne: DatabaseDirectory | undefined;
|
|
25
|
+
let cachedWorksAliceAperture: DatabaseDirectory | undefined;
|
|
26
|
+
let cachedTasksTask1: DatabaseDirectory | undefined;
|
|
27
|
+
let cachedTasksTask2: DatabaseDirectory | undefined;
|
|
13
28
|
|
|
14
29
|
// TODO(burdon): Use Obj.make.
|
|
15
30
|
|
|
16
31
|
export const PEOPLE = {
|
|
17
|
-
alice: DatabaseDirectory
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
get alice(): DatabaseDirectory {
|
|
33
|
+
if (cachedPeopleAlice === undefined) {
|
|
34
|
+
cachedPeopleAlice = DatabaseDirectory.make({
|
|
35
|
+
spaceKey: getSpaceKeyHex(),
|
|
36
|
+
objects: {
|
|
37
|
+
[ObjectId.random()]: ObjectStructure.makeObject({
|
|
38
|
+
type: Type.getDXN(TestSchema.Person)!.toString(),
|
|
39
|
+
data: {
|
|
40
|
+
name: 'Alice',
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
24
43
|
},
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return cachedPeopleAlice;
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
get bob(): DatabaseDirectory {
|
|
50
|
+
if (cachedPeopleBob === undefined) {
|
|
51
|
+
cachedPeopleBob = DatabaseDirectory.make({
|
|
52
|
+
spaceKey: getSpaceKeyHex(),
|
|
53
|
+
objects: {
|
|
54
|
+
[ObjectId.random()]: ObjectStructure.makeObject({
|
|
55
|
+
type: Type.getDXN(TestSchema.Person)!.toString(),
|
|
56
|
+
data: {
|
|
57
|
+
name: 'Bob',
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
35
60
|
},
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return cachedPeopleBob;
|
|
64
|
+
},
|
|
39
65
|
};
|
|
40
66
|
|
|
41
67
|
export const ORGS = {
|
|
42
|
-
dxos: DatabaseDirectory
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
get dxos(): DatabaseDirectory {
|
|
69
|
+
if (cachedOrgsDxos === undefined) {
|
|
70
|
+
cachedOrgsDxos = DatabaseDirectory.make({
|
|
71
|
+
spaceKey: getSpaceKeyHex(),
|
|
72
|
+
objects: {
|
|
73
|
+
[ObjectId.random()]: ObjectStructure.makeObject({
|
|
74
|
+
type: Type.getDXN(TestSchema.Organization)!.toString(),
|
|
75
|
+
data: {
|
|
76
|
+
name: 'DXOS',
|
|
77
|
+
founded: '2023',
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
50
80
|
},
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return cachedOrgsDxos;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
get cyberdyne(): DatabaseDirectory {
|
|
87
|
+
if (cachedOrgsCyberdyne === undefined) {
|
|
88
|
+
cachedOrgsCyberdyne = DatabaseDirectory.make({
|
|
89
|
+
spaceKey: getSpaceKeyHex(),
|
|
90
|
+
objects: {
|
|
91
|
+
[ObjectId.random()]: ObjectStructure.makeObject({
|
|
92
|
+
type: Type.getDXN(TestSchema.Organization)!.toString(),
|
|
93
|
+
data: {
|
|
94
|
+
name: 'Cyberdyne Systems',
|
|
95
|
+
founded: '1984',
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
62
98
|
},
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return cachedOrgsCyberdyne;
|
|
102
|
+
},
|
|
66
103
|
};
|
|
67
104
|
|
|
68
105
|
export const WORKS_FOR = {
|
|
69
|
-
fredWorksForCyberdyne: DatabaseDirectory
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
get fredWorksForCyberdyne(): DatabaseDirectory {
|
|
107
|
+
if (cachedWorksFredCyberdyne === undefined) {
|
|
108
|
+
cachedWorksFredCyberdyne = DatabaseDirectory.make({
|
|
109
|
+
spaceKey: getSpaceKeyHex(),
|
|
110
|
+
objects: {
|
|
111
|
+
[ObjectId.random()]: ObjectStructure.makeRelation({
|
|
112
|
+
type: Type.getDXN(TestSchema.EmployedBy)!.toString(),
|
|
113
|
+
source: { '/': DXN.fromLocalObjectId(Object.keys(PEOPLE.bob.objects!)[0]).toString() },
|
|
114
|
+
target: { '/': DXN.fromLocalObjectId(Object.keys(ORGS.cyberdyne.objects!)[0]).toString() },
|
|
115
|
+
data: {
|
|
116
|
+
since: '2020',
|
|
117
|
+
position: 'Engineer',
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
79
120
|
},
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return cachedWorksFredCyberdyne;
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
get aliceWorksForAperture(): DatabaseDirectory {
|
|
127
|
+
if (cachedWorksAliceAperture === undefined) {
|
|
128
|
+
cachedWorksAliceAperture = DatabaseDirectory.make({
|
|
129
|
+
spaceKey: getSpaceKeyHex(),
|
|
130
|
+
objects: {
|
|
131
|
+
[ObjectId.random()]: ObjectStructure.makeRelation({
|
|
132
|
+
type: Type.getDXN(TestSchema.EmployedBy)!.toString(),
|
|
133
|
+
source: { '/': DXN.fromLocalObjectId(Object.keys(PEOPLE.alice.objects!)[0]).toString() },
|
|
134
|
+
target: { '/': DXN.fromLocalObjectId(Object.keys(ORGS.dxos.objects!)[0]).toString() },
|
|
135
|
+
data: {
|
|
136
|
+
since: '2018',
|
|
137
|
+
position: 'Research Scientist',
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
93
140
|
},
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return cachedWorksAliceAperture;
|
|
144
|
+
},
|
|
97
145
|
};
|
|
98
146
|
|
|
99
147
|
export const TASKS = {
|
|
100
|
-
task1: DatabaseDirectory
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
148
|
+
get task1(): DatabaseDirectory {
|
|
149
|
+
if (cachedTasksTask1 === undefined) {
|
|
150
|
+
cachedTasksTask1 = DatabaseDirectory.make({
|
|
151
|
+
spaceKey: getSpaceKeyHex(),
|
|
152
|
+
objects: {
|
|
153
|
+
[ObjectId.random()]: ObjectStructure.makeObject({
|
|
154
|
+
type: Type.getDXN(TestSchema.Task)!.toString(),
|
|
155
|
+
data: {
|
|
156
|
+
title: 'Complete project documentation',
|
|
157
|
+
description: 'Write comprehensive documentation for the new system',
|
|
158
|
+
status: 'in-progress',
|
|
159
|
+
dueDate: '2023-12-31',
|
|
160
|
+
assignee: { '/': DXN.fromLocalObjectId(Object.keys(PEOPLE.bob.objects!)[0]).toString() },
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
111
163
|
},
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return cachedTasksTask1;
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
get task2(): DatabaseDirectory {
|
|
170
|
+
if (cachedTasksTask2 === undefined) {
|
|
171
|
+
cachedTasksTask2 = DatabaseDirectory.make({
|
|
172
|
+
spaceKey: getSpaceKeyHex(),
|
|
173
|
+
objects: {
|
|
174
|
+
[ObjectId.random()]: ObjectStructure.makeObject({
|
|
175
|
+
type: Type.getDXN(TestSchema.Task)!.toString(),
|
|
176
|
+
data: {
|
|
177
|
+
title: 'Run experiments',
|
|
178
|
+
description: 'Conduct series of experiments on the portal device',
|
|
179
|
+
status: 'pending',
|
|
180
|
+
dueDate: '2023-11-15',
|
|
181
|
+
assignee: { '/': DXN.fromLocalObjectId(Object.keys(PEOPLE.alice.objects!)[0]).toString() },
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
126
184
|
},
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return cachedTasksTask2;
|
|
188
|
+
},
|
|
130
189
|
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/internal/Ref/ref.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Equal from 'effect/Equal';\nimport * as Hash from 'effect/Hash';\nimport * as Option from 'effect/Option';\nimport * as ParseResult from 'effect/ParseResult';\nimport * as Pipeable from 'effect/Pipeable';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\nimport type * as Types from 'effect/Types';\n\nimport { Event } from '@dxos/async';\nimport { type CustomInspectFunction, inspectCustom } from '@dxos/debug';\nimport { EncodedReference } from '@dxos/echo-protocol';\nimport { assertArgument, invariant } from '@dxos/invariant';\nimport { DXN, ObjectId } from '@dxos/keys';\n\nimport * as Database from '../../Database';\nimport { ReferenceAnnotationId, getSchemaDXN, getTypeAnnotation, getTypeIdentifierAnnotation } from '../Annotation';\nimport { type JsonSchemaType } from '../JsonSchema';\nimport type { AnyEntity, AnyProperties } from '../common/types';\n\n/**\n * The `$id` and `$ref` fields for an ECHO reference schema.\n */\nexport const JSON_SCHEMA_ECHO_REF_ID = '/schemas/echo/ref';\n\nexport const getSchemaReference = (property: JsonSchemaType): { typename: string } | undefined => {\n const { $id, reference: { schema: { $ref } = {} } = {} } = property;\n if ($id === JSON_SCHEMA_ECHO_REF_ID && $ref) {\n return { typename: DXN.parse($ref).typename };\n }\n};\n\nexport const createSchemaReference = (typename: string): Types.DeepMutable<JsonSchemaType> => {\n return {\n $id: JSON_SCHEMA_ECHO_REF_ID,\n reference: {\n schema: {\n $ref: DXN.fromTypename(typename).toString(),\n },\n },\n };\n};\n\n/**\n * Runtime type-info for a reference extracted from effect AST.\n */\nexport type RefereneAST = {\n /**\n * Typename of linked schema.\n */\n typename: string;\n\n /**\n * Version of linked schema.\n */\n version: string;\n};\n\nexport const getReferenceAst = (ast: SchemaAST.AST): RefereneAST | undefined => {\n if (ast._tag !== 'Declaration' || !ast.annotations[ReferenceAnnotationId]) {\n return undefined;\n }\n return {\n typename: (ast.annotations[ReferenceAnnotationId] as any).typename,\n version: (ast.annotations[ReferenceAnnotationId] as any).version,\n };\n};\n\nexport const RefTypeId: unique symbol = Symbol('@dxos/echo/internal/Ref');\n\n/**\n * Reference Schema.\n */\nexport interface RefSchema<T extends AnyEntity> extends Schema.SchemaClass<Ref<T>, EncodedReference> {}\n\n/**\n * Type of the `Ref` function and extra methods attached to it.\n */\nexport interface RefFn {\n <S extends Schema.Schema.Any>(schema: S): RefSchema<Schema.Schema.Type<S>>;\n\n /**\n * @returns True if the object is a reference.\n */\n isRef: (obj: unknown) => obj is Ref<any>;\n\n /**\n * @returns True if the reference points to the given object id.\n */\n hasObjectId: (id: ObjectId) => (ref: Ref<any>) => boolean;\n\n /**\n * @returns True if the schema is a reference schema.\n */\n isRefSchema: (schema: Schema.Schema<any, any>) => schema is RefSchema<any>;\n\n /**\n * @returns True if the schema AST is a reference schema.\n */\n isRefSchemaAST: (ast: SchemaAST.AST) => boolean;\n\n /**\n * Constructs a reference that points to the given object.\n */\n // TODO(burdon): Narrow to Obj.Unknown?\n make: <T extends AnyEntity>(object: T) => Ref<T>;\n\n /**\n * Constructs a reference that points to the object specified by the provided DXN.\n */\n fromDXN: (dxn: DXN) => Ref<any>;\n}\n\n/**\n * Schema builder for references.\n */\nexport const Ref: RefFn = <S extends Schema.Schema.Any>(schema: S): RefSchema<Schema.Schema.Type<S>> => {\n assertArgument(Schema.isSchema(schema), 'schema', 'Must call with an instance of effect-schema');\n const annotation = getTypeAnnotation(schema);\n if (annotation == null) {\n throw new Error('Reference target must be an ECHO schema.');\n }\n\n return createEchoReferenceSchema(getTypeIdentifierAnnotation(schema), annotation.typename, annotation.version);\n};\n\n/**\n * Represents materialized reference to a target.\n * This is the data type for the fields marked as ref.\n */\nexport interface Ref<T> extends Pipeable.Pipeable {\n /**\n * Target object DXN.\n */\n get dxn(): DXN;\n\n /**\n * Returns true if the reference has a target available (inlined or resolver set).\n */\n get isAvailable(): boolean;\n\n /**\n * @returns The reference target.\n * May return `undefined` if the object is not loaded in the working set.\n * Accessing this property, even if it returns `undefined` will trigger the object to be loaded to the working set.\n */\n get target(): T | undefined;\n\n /**\n * @returns Promise that will resolves with the target object.\n * Will load the object from disk if it is not present in the working set.\n * @throws If the object is not available locally.\n */\n load(): Promise<T>;\n\n /**\n * @returns Promise that will resolves with the target object or undefined if the object is not loaded locally.\n */\n\n tryLoad(): Promise<T | undefined>;\n\n /**\n * Do not inline the target object in the reference.\n * Makes .target unavailable unless the reference is connected to a database context.\n *\n * When serialized with toJSON, the difference is between:\n * `{ \"/\": \"dxn:...\" }`\n * and\n * `{ \"/\": \"dxn:...\", \"target\": { ... } }`\n *\n * Clones the reference object.\n */\n noInline(): Ref<T>;\n\n /**\n * Serializes the reference to a JSON object.\n * The serialization format is compatible with the IPLD-style encoded references.\n * When a reference has a saved target (i.e. the target or object holding the reference is not in the database),\n * the target is included in the serialized object.\n *\n * Examples:\n * `{ \"/\": \"dxn:...\" }`\n * `{ \"/\": \"dxn:...\", \"target\": { ... } }`\n */\n encode(): EncodedReference;\n\n [RefTypeId]: {\n _T: T;\n };\n}\n\nexport declare namespace Ref {\n /**\n * Target of the reference.\n */\n export type Target<R> = R extends Ref<infer U> ? U : never;\n}\n\nRef.isRef = (obj: any): obj is Ref<any> => {\n return obj && typeof obj === 'object' && RefTypeId in obj;\n};\n\nRef.hasObjectId = (id: ObjectId) => (ref: Ref<any>) => ref.dxn.isLocalObjectId() && ref.dxn.parts[1] === id;\n\nRef.isRefSchema = (schema: Schema.Schema<any, any>): schema is RefSchema<any> => {\n return Ref.isRefSchemaAST(schema.ast);\n};\n\nRef.isRefSchemaAST = (ast: SchemaAST.AST): boolean => {\n return SchemaAST.getAnnotation(ast, ReferenceAnnotationId).pipe(Option.isSome);\n};\n\nRef.make = <T extends AnyProperties>(obj: T): Ref<T> => {\n if (typeof obj !== 'object' || obj === null) {\n throw new TypeError('Expected: ECHO object.');\n }\n\n // TODO(dmaretskyi): Extract to `getObjectDXN` function.\n const id = obj.id;\n invariant(ObjectId.isValid(id), 'Invalid object ID');\n const dxn = DXN.fromLocalObjectId(id);\n return new RefImpl(dxn, obj);\n};\n\nRef.fromDXN = (dxn: DXN): Ref<any> => {\n assertArgument(dxn instanceof DXN, 'dxn', 'Expected DXN');\n return new RefImpl(dxn);\n};\n\n/**\n * `reference` field on the schema object.\n */\nexport type JsonSchemaReferenceInfo = {\n schema: { $ref: string };\n schemaVersion?: string;\n};\n\n/**\n * @internal\n */\n// TODO(burdon): Move to json schema and make private?\nexport const createEchoReferenceSchema = (\n echoId: string | undefined,\n typename: string | undefined,\n version: string | undefined,\n): Schema.SchemaClass<Ref<any>, EncodedReference> => {\n if (!echoId && !typename) {\n throw new TypeError('Either echoId or typename must be provided.');\n }\n\n const referenceInfo: JsonSchemaReferenceInfo = {\n schema: {\n // TODO(dmaretskyi): Include version?\n $ref: echoId ?? DXN.fromTypename(typename!).toString(),\n },\n schemaVersion: version,\n };\n\n // TODO(dmaretskyi): Add name and description.\n const refSchema = Schema.declare<Ref<any>, EncodedReference, []>(\n [],\n {\n encode: () => {\n return (value) =>\n Effect.gen(function* () {\n if (Ref.isRef(value)) {\n return EncodedReference.fromDXN((value as Ref<any>).dxn);\n } else if (EncodedReference.isEncodedReference(value)) {\n return value;\n }\n throw new Error('Invalid reference');\n });\n },\n decode: () => {\n return (value) =>\n Effect.gen(function* () {\n const dbService = yield* Effect.serviceOption(Database.Service);\n\n // TODO(dmaretskyi): This branch seems to be taken by Schema.is\n if (Ref.isRef(value)) {\n if (Option.isSome(dbService)) {\n return dbService.value.db.makeRef(value.dxn);\n } else {\n return value;\n }\n }\n\n if (!EncodedReference.isEncodedReference(value)) {\n return yield* Effect.fail(new ParseResult.Unexpected(value, 'reference'));\n }\n if (Option.isSome(dbService)) {\n return dbService.value.db.makeRef(EncodedReference.toDXN(value));\n } else {\n return Ref.fromDXN(EncodedReference.toDXN(value));\n }\n });\n },\n },\n {\n jsonSchema: {\n // TODO(dmaretskyi): We should remove `$id` and keep `$ref` with a fully qualified name.\n $id: JSON_SCHEMA_ECHO_REF_ID,\n $ref: JSON_SCHEMA_ECHO_REF_ID,\n reference: referenceInfo,\n },\n [ReferenceAnnotationId]: {\n typename: typename ?? '',\n version,\n },\n },\n );\n\n return refSchema;\n};\n\nconst getSchemaExpectedName = (ast: SchemaAST.Annotated): string | undefined => {\n return SchemaAST.getIdentifierAnnotation(ast).pipe(\n Option.orElse(() => SchemaAST.getTitleAnnotation(ast)),\n Option.orElse(() => SchemaAST.getDescriptionAnnotation(ast)),\n Option.getOrElse(() => undefined),\n );\n};\n\nexport interface RefResolver {\n /**\n * Resolve ref synchronously from the objects in the working set.\n *\n * @param dxn\n * @param load If true the resolver should attempt to load the object from disk.\n * @param onLoad Callback to call when the object is loaded.\n */\n resolveSync(dxn: DXN, load: boolean, onLoad?: () => void): AnyProperties | undefined;\n\n /**\n * Resolver ref asynchronously.\n */\n resolve(dxn: DXN): Promise<AnyProperties | undefined>;\n\n // TODO(dmaretskyi): Combine with `resolve`.\n resolveSchema(dxn: DXN): Promise<Schema.Schema.AnyNoContext | undefined>;\n}\n\nexport class RefImpl<T> implements Ref<T> {\n #dxn: DXN;\n #resolver?: RefResolver = undefined;\n #resolved = new Event<void>();\n\n /**\n * Target is set when the reference is created from a specific object.\n * In this case, the target might not be in the database.\n */\n #target: T | undefined = undefined;\n\n /**\n * Callback to issue a reactive notification when object is resolved.\n */\n #resolverCallback = () => {\n this.#resolved.emit();\n };\n\n constructor(dxn: DXN, target?: T) {\n this.#dxn = dxn;\n this.#target = target;\n }\n\n /**\n * @inheritdoc\n */\n get dxn(): DXN {\n return this.#dxn;\n }\n\n /**\n * @inheritdoc\n */\n get isAvailable(): boolean {\n return this.#target !== undefined || this.#resolver !== undefined;\n }\n\n /**\n * @inheritdoc\n */\n get target(): T | undefined {\n if (this.#target) {\n return this.#target;\n }\n\n invariant(this.#resolver, 'Resolver is not set');\n return this.#resolver.resolveSync(this.#dxn, true, this.#resolverCallback) as T | undefined;\n }\n\n /**\n * @inheritdoc\n */\n async load(): Promise<T> {\n if (this.#target) {\n return this.#target;\n }\n invariant(this.#resolver, 'Resolver is not set');\n const obj = await this.#resolver.resolve(this.#dxn);\n if (obj == null) {\n throw new Error('Object not found');\n }\n return obj as T;\n }\n\n /**\n * @inheritdoc\n */\n async tryLoad(): Promise<T | undefined> {\n if (this.#target) {\n return this.#target;\n }\n invariant(this.#resolver, 'Resolver is not set');\n return (await this.#resolver.resolve(this.#dxn)) as T | undefined;\n }\n\n /**\n * Do not inline the target object in the reference.\n * Makes .target unavailable unless the reference is connected to a database context.\n * Clones the reference object.\n */\n noInline(): RefImpl<T> {\n const ref = new RefImpl<T>(this.#dxn, undefined);\n ref.#resolver = this.#resolver;\n return ref;\n }\n\n encode(): EncodedReference {\n return {\n '/': this.#dxn.toString(),\n ...(this.#target ? { target: this.#target } : {}),\n };\n }\n\n /**\n * Serializes the reference to a JSON object.\n * The serialization format is compatible with the IPLD-style encoded references.\n * When a reference has a saved target (i.e. the target or object holding the reference is not in the database),\n * the target is included in the serialized object.\n */\n toJSON(): EncodedReference {\n return this.encode();\n }\n\n toString(): string {\n if (this.#target) {\n return `Ref(${this.#target.toString()})`;\n }\n\n return `Ref(${this.#dxn.toString()})`;\n }\n\n [inspectCustom]: CustomInspectFunction = (depth, options, inspect) => {\n return this.toString();\n };\n\n [RefTypeId] = refVariance;\n\n /**\n * Effect Hash trait. Required for MutableHashMap-based caches (e.g., Atom.family)\n * to deduplicate Ref instances that point to the same object.\n * ECHO proxies return new RefImpl instances on every property access,\n * so without this, each access would create a separate cache entry.\n */\n [Hash.symbol](): number {\n return Hash.hash(this.#dxn.toString());\n }\n\n /** Effect Equal trait. See {@link Hash.symbol} for rationale. */\n [Equal.symbol](that: Equal.Equal): boolean {\n return that instanceof RefImpl && this.#dxn.toString() === that.dxn.toString();\n }\n\n /**\n * Internal method to set the resolver.\n *\n * @internal\n */\n _setResolver(resolver: RefResolver): void {\n this.#resolver = resolver;\n }\n\n /**\n * @internal\n */\n _getSavedTarget(): T | undefined {\n return this.#target;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Internal API for setting the reference resolver.\n */\nexport const setRefResolver = (ref: Ref<any>, resolver: RefResolver) => {\n invariant(ref instanceof RefImpl, 'Ref is not an instance of RefImpl');\n ref._setResolver(resolver);\n};\n\n/**\n * Internal API for getting the saved target on a reference.\n */\nexport const getRefSavedTarget = (ref: Ref<any>): AnyProperties | undefined => {\n invariant(ref instanceof RefImpl, 'Ref is not an instance of RefImpl');\n return ref._getSavedTarget();\n};\n\n// Used to validate reference target type.\nconst refVariance: Ref<any>[typeof RefTypeId] = {\n _T: null as any,\n};\n\nexport const refFromEncodedReference = (encodedReference: EncodedReference, resolver?: RefResolver): Ref<any> => {\n const dxn = DXN.parse(encodedReference['/']);\n const ref = new RefImpl(dxn);\n\n // TODO(dmaretskyi): Handle inline target in the encoded reference.\n\n if (resolver) {\n setRefResolver(ref, resolver);\n }\n return ref;\n};\n\nexport class StaticRefResolver implements RefResolver {\n public objects = new Map<ObjectId, AnyProperties>();\n public schemas = new Map<DXN.String, Schema.Schema.AnyNoContext>();\n\n addObject(obj: AnyProperties): this {\n this.objects.set(obj.id, obj);\n return this;\n }\n\n addSchema(schema: Schema.Schema.AnyNoContext): this {\n const dxn = getSchemaDXN(schema);\n invariant(dxn, 'Schema has no DXN');\n this.schemas.set(dxn.toString(), schema);\n return this;\n }\n\n resolveSync(dxn: DXN, _load: boolean, _onLoad?: () => void): AnyProperties | undefined {\n const id = dxn?.asEchoDXN()?.echoId;\n if (id == null) {\n return undefined;\n }\n\n return this.objects.get(id);\n }\n\n async resolve(dxn: DXN): Promise<AnyProperties | undefined> {\n const id = dxn?.asEchoDXN()?.echoId;\n if (id == null) {\n return undefined;\n }\n\n return this.objects.get(id);\n }\n\n async resolveSchema(dxn: DXN): Promise<Schema.Schema.AnyNoContext | undefined> {\n return this.schemas.get(dxn.toString());\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,UAAU;AACtB,YAAYC,YAAY;AACxB,YAAYC,iBAAiB;AAC7B,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAG3B,SAASC,aAAa;AACtB,SAAqCC,qBAAqB;AAC1D,SAASC,wBAAwB;AACjC,SAASC,gBAAgBC,iBAAiB;AAC1C,SAASC,KAAKC,gBAAgB;;AAUvB,IAAMC,0BAA0B;AAEhC,IAAMC,qBAAqB,CAACC,aAAAA;AACjC,QAAM,EAAEC,KAAKC,WAAW,EAAEC,QAAQ,EAAEC,KAAI,IAAK,CAAC,EAAC,IAAK,CAAC,EAAC,IAAKJ;AAC3D,MAAIC,QAAQH,2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"Hash", "Option", "ParseResult", "Pipeable", "Schema", "SchemaAST", "Event", "inspectCustom", "EncodedReference", "assertArgument", "invariant", "DXN", "ObjectId", "JSON_SCHEMA_ECHO_REF_ID", "getSchemaReference", "property", "$id", "reference", "schema", "$ref", "typename", "DXN", "parse", "createSchemaReference", "fromTypename", "toString", "getReferenceAst", "ast", "_tag", "annotations", "ReferenceAnnotationId", "undefined", "version", "RefTypeId", "Symbol", "Ref", "assertArgument", "isSchema", "annotation", "getTypeAnnotation", "Error", "createEchoReferenceSchema", "getTypeIdentifierAnnotation", "isRef", "obj", "hasObjectId", "id", "ref", "dxn", "isLocalObjectId", "parts", "isRefSchema", "isRefSchemaAST", "getAnnotation", "pipe", "isSome", "make", "TypeError", "invariant", "ObjectId", "isValid", "fromLocalObjectId", "RefImpl", "fromDXN", "echoId", "referenceInfo", "schemaVersion", "refSchema", "declare", "encode", "value", "gen", "EncodedReference", "isEncodedReference", "decode", "dbService", "serviceOption", "Service", "db", "makeRef", "fail", "Unexpected", "toDXN", "jsonSchema", "RefImpl", "undefined", "Event", "emit", "dxn", "target", "isAvailable", "invariant", "resolveSync", "load", "obj", "resolve", "Error", "tryLoad", "noInline", "ref", "encode", "toString", "toJSON", "inspectCustom", "depth", "options", "inspect", "RefTypeId", "refVariance", "symbol", "hash", "that", "_setResolver", "resolver", "_getSavedTarget", "pipe", "pipeArguments", "arguments", "setRefResolver", "getRefSavedTarget", "_T", "refFromEncodedReference", "encodedReference", "DXN", "parse", "StaticRefResolver", "objects", "Map", "schemas", "addObject", "set", "id", "addSchema", "schema", "getSchemaDXN", "_load", "_onLoad", "asEchoDXN", "echoId", "get", "resolveSchema"]
|
|
7
|
-
}
|