@dxos/echo-protocol 0.8.4-main.e098934 → 0.8.4-main.ead640a

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/echo-protocol",
3
- "version": "0.8.4-main.e098934",
3
+ "version": "0.8.4-main.ead640a",
4
4
  "description": "Core ECHO APIs.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -26,12 +26,12 @@
26
26
  "src"
27
27
  ],
28
28
  "dependencies": {
29
- "effect": "3.17.7",
30
- "@dxos/crypto": "0.8.4-main.e098934",
31
- "@dxos/invariant": "0.8.4-main.e098934",
32
- "@dxos/keys": "0.8.4-main.e098934",
33
- "@dxos/util": "0.8.4-main.e098934",
34
- "@dxos/protocols": "0.8.4-main.e098934"
29
+ "effect": "3.18.3",
30
+ "@dxos/crypto": "0.8.4-main.ead640a",
31
+ "@dxos/invariant": "0.8.4-main.ead640a",
32
+ "@dxos/keys": "0.8.4-main.ead640a",
33
+ "@dxos/util": "0.8.4-main.ead640a",
34
+ "@dxos/protocols": "0.8.4-main.ead640a"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -153,6 +153,10 @@ export const ObjectStructure = Object.freeze({
153
153
  return references;
154
154
  },
155
155
 
156
+ getTags: (object: ObjectStructure): string[] => {
157
+ return object.meta.tags ?? [];
158
+ },
159
+
156
160
  makeObject: ({
157
161
  type,
158
162
  data,
@@ -214,6 +218,14 @@ export type ObjectMeta = {
214
218
  * Foreign keys.
215
219
  */
216
220
  keys: ForeignKey[];
221
+
222
+ /**
223
+ * Tags.
224
+ * An array of DXNs of Tag objects within the space.
225
+ *
226
+ * NOTE: Optional for backwards compatibilty.
227
+ */
228
+ tags?: string[];
217
229
  };
218
230
 
219
231
  /**
@@ -2,7 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema, SchemaAST } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
+ import * as SchemaAST from 'effect/SchemaAST';
6
7
 
7
8
  const ForeignKey_ = Schema.Struct({
8
9
  /**
@@ -15,8 +16,8 @@ const ForeignKey_ = Schema.Struct({
15
16
  * Id within the foreign database.
16
17
  */
17
18
  // TODO(wittjosiah): This annotation is currently used to ensure id field shows up in forms.
18
- // TODO(dmaretskyi): `false` is not a valid value for the annotation.
19
- id: Schema.String.annotations({ [SchemaAST.IdentifierAnnotationId]: false }),
19
+ // TODO(dmaretskyi): `false` is not a valid value for the annotation. Use a different annotation.
20
+ id: Schema.String.annotations({ [SchemaAST.IdentifierAnnotationId]: 'false' }),
20
21
  });
21
22
 
22
23
  export type ForeignKey = Schema.Schema.Type<typeof ForeignKey_>;
package/src/query/ast.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Match, Schema } from 'effect';
5
+ import * as Match from 'effect/Match';
6
+ import * as Schema from 'effect/Schema';
6
7
 
7
8
  import { DXN, ObjectId } from '@dxos/keys';
8
9
 
@@ -46,6 +47,9 @@ const FilterObject_ = Schema.Struct({
46
47
  export interface FilterObject extends Schema.Schema.Type<typeof FilterObject_> {}
47
48
  export const FilterObject: Schema.Schema<FilterObject> = FilterObject_;
48
49
 
50
+ /**
51
+ * Compare.
52
+ */
49
53
  const FilterCompare_ = Schema.Struct({
50
54
  type: Schema.Literal('compare'),
51
55
  operator: Schema.Literal('eq', 'neq', 'gt', 'gte', 'lt', 'lte'),
@@ -54,6 +58,9 @@ const FilterCompare_ = Schema.Struct({
54
58
  export interface FilterCompare extends Schema.Schema.Type<typeof FilterCompare_> {}
55
59
  export const FilterCompare: Schema.Schema<FilterCompare> = FilterCompare_;
56
60
 
61
+ /**
62
+ * In.
63
+ */
57
64
  const FilterIn_ = Schema.Struct({
58
65
  type: Schema.Literal('in'),
59
66
  values: Schema.Array(Schema.Any),
@@ -61,6 +68,9 @@ const FilterIn_ = Schema.Struct({
61
68
  export interface FilterIn extends Schema.Schema.Type<typeof FilterIn_> {}
62
69
  export const FilterIn: Schema.Schema<FilterIn> = FilterIn_;
63
70
 
71
+ /**
72
+ * Contains.
73
+ */
64
74
  const FilterContains_ = Schema.Struct({
65
75
  type: Schema.Literal('contains'),
66
76
  value: Schema.Any,
@@ -72,6 +82,19 @@ export interface FilterContains extends Schema.Schema.Type<typeof FilterContains
72
82
  */
73
83
  export const FilterContains: Schema.Schema<FilterContains> = FilterContains_;
74
84
 
85
+ /**
86
+ * Filters objects that have certain tag.
87
+ */
88
+ const FilterTag_ = Schema.Struct({
89
+ type: Schema.Literal('tag'),
90
+ tag: Schema.String, // TODO(burdon): Make OR-collection?
91
+ });
92
+ export interface FilterTag extends Schema.Schema.Type<typeof FilterTag_> {}
93
+ export const FilterTag: Schema.Schema<FilterTag> = FilterTag_;
94
+
95
+ /**
96
+ * Range.
97
+ */
75
98
  const FilterRange_ = Schema.Struct({
76
99
  type: Schema.Literal('range'),
77
100
  from: Schema.Any,
@@ -80,6 +103,9 @@ const FilterRange_ = Schema.Struct({
80
103
  export interface FilterRange extends Schema.Schema.Type<typeof FilterRange_> {}
81
104
  export const FilterRange: Schema.Schema<FilterRange> = FilterRange_;
82
105
 
106
+ /**
107
+ * Text search.
108
+ */
83
109
  const FilterTextSearch_ = Schema.Struct({
84
110
  type: Schema.Literal('text-search'),
85
111
  text: Schema.String,
@@ -88,6 +114,9 @@ const FilterTextSearch_ = Schema.Struct({
88
114
  export interface FilterTextSearch extends Schema.Schema.Type<typeof FilterTextSearch_> {}
89
115
  export const FilterTextSearch: Schema.Schema<FilterTextSearch> = FilterTextSearch_;
90
116
 
117
+ /**
118
+ * Not.
119
+ */
91
120
  const FilterNot_ = Schema.Struct({
92
121
  type: Schema.Literal('not'),
93
122
  filter: Schema.suspend(() => Filter),
@@ -95,6 +124,9 @@ const FilterNot_ = Schema.Struct({
95
124
  export interface FilterNot extends Schema.Schema.Type<typeof FilterNot_> {}
96
125
  export const FilterNot: Schema.Schema<FilterNot> = FilterNot_;
97
126
 
127
+ /**
128
+ * And.
129
+ */
98
130
  const FilterAnd_ = Schema.Struct({
99
131
  type: Schema.Literal('and'),
100
132
  filters: Schema.Array(Schema.suspend(() => Filter)),
@@ -102,6 +134,9 @@ const FilterAnd_ = Schema.Struct({
102
134
  export interface FilterAnd extends Schema.Schema.Type<typeof FilterAnd_> {}
103
135
  export const FilterAnd: Schema.Schema<FilterAnd> = FilterAnd_;
104
136
 
137
+ /**
138
+ * Or.
139
+ */
105
140
  const FilterOr_ = Schema.Struct({
106
141
  type: Schema.Literal('or'),
107
142
  filters: Schema.Array(Schema.suspend(() => Filter)),
@@ -109,17 +144,21 @@ const FilterOr_ = Schema.Struct({
109
144
  export interface FilterOr extends Schema.Schema.Type<typeof FilterOr_> {}
110
145
  export const FilterOr: Schema.Schema<FilterOr> = FilterOr_;
111
146
 
147
+ /**
148
+ * Union of filters.
149
+ */
112
150
  export const Filter = Schema.Union(
113
151
  FilterObject,
114
- FilterTextSearch,
115
152
  FilterCompare,
116
153
  FilterIn,
117
154
  FilterContains,
155
+ FilterTag,
118
156
  FilterRange,
157
+ FilterTextSearch,
119
158
  FilterNot,
120
159
  FilterAnd,
121
160
  FilterOr,
122
- );
161
+ ).annotations({ identifier: 'dxos.org/schema/Filter' });
123
162
  export type Filter = Schema.Schema.Type<typeof Filter>;
124
163
 
125
164
  /**
@@ -268,7 +307,7 @@ const Query_ = Schema.Union(
268
307
  QuerySetDifferenceClause,
269
308
  QueryOrderClause,
270
309
  QueryOptionsClause,
271
- );
310
+ ).annotations({ identifier: 'dxos.org/schema/Query' });
272
311
 
273
312
  export type Query = Schema.Schema.Type<typeof Query_>;
274
313
  export const Query: Schema.Schema<Query> = Query_;