@dxos/index-core 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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/{node-esm → neutral}/index.mjs +141 -25
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/meta.json +1 -1
- package/dist/types/src/index-engine.d.ts +30 -4
- package/dist/types/src/index-engine.d.ts.map +1 -1
- package/dist/types/src/index-tracker.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/indexes/interface.d.ts +4 -0
- package/dist/types/src/indexes/interface.d.ts.map +1 -1
- package/dist/types/src/indexes/object-meta-index.d.ts +38 -0
- package/dist/types/src/indexes/object-meta-index.d.ts.map +1 -1
- package/dist/types/src/utils.d.ts +1 -1
- package/dist/types/src/utils.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -19
- package/src/index-engine.test.ts +50 -3
- package/src/index-engine.ts +50 -8
- package/src/index-tracker.ts +9 -0
- package/src/index.ts +1 -0
- package/src/indexes/fts-index.test.ts +20 -2
- package/src/indexes/interface.ts +5 -0
- package/src/indexes/object-meta-index.test.ts +143 -13
- package/src/indexes/object-meta-index.ts +187 -15
- package/src/indexes/reverse-ref-index.test.ts +9 -2
- package/src/utils.ts +1 -1
- package/dist/lib/browser/index.mjs +0 -630
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/index-core",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bcb3aa67d6",
|
|
4
4
|
"description": "Indexing core.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"source": "./src/index.ts",
|
|
18
18
|
"types": "./dist/types/src/index.d.ts",
|
|
19
|
-
"
|
|
20
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
19
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
22
|
"files": [
|
|
@@ -25,24 +24,24 @@
|
|
|
25
24
|
"src"
|
|
26
25
|
],
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@
|
|
38
|
-
"@effect
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"@dxos/sql-sqlite": "0.8.4-main.
|
|
27
|
+
"@effect/cli": "0.73.2",
|
|
28
|
+
"@effect/experimental": "0.58.0",
|
|
29
|
+
"@effect/platform": "0.94.4",
|
|
30
|
+
"@effect/sql": "0.49.0",
|
|
31
|
+
"effect": "3.20.0",
|
|
32
|
+
"@dxos/async": "0.8.4-main.bcb3aa67d6",
|
|
33
|
+
"@dxos/debug": "0.8.4-main.bcb3aa67d6",
|
|
34
|
+
"@dxos/context": "0.8.4-main.bcb3aa67d6",
|
|
35
|
+
"@dxos/echo": "0.8.4-main.bcb3aa67d6",
|
|
36
|
+
"@dxos/echo-protocol": "0.8.4-main.bcb3aa67d6",
|
|
37
|
+
"@dxos/effect": "0.8.4-main.bcb3aa67d6",
|
|
38
|
+
"@dxos/invariant": "0.8.4-main.bcb3aa67d6",
|
|
39
|
+
"@dxos/keys": "0.8.4-main.bcb3aa67d6",
|
|
40
|
+
"@dxos/log": "0.8.4-main.bcb3aa67d6",
|
|
41
|
+
"@dxos/sql-sqlite": "0.8.4-main.bcb3aa67d6"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@effect/sql-sqlite-node": "0.
|
|
44
|
+
"@effect/sql-sqlite-node": "0.50.1"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|
package/src/index-engine.test.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { describe, expect, it } from '@effect/vitest';
|
|
|
8
8
|
import * as Effect from 'effect/Effect';
|
|
9
9
|
import * as Layer from 'effect/Layer';
|
|
10
10
|
|
|
11
|
+
import { Context } from '@dxos/context';
|
|
11
12
|
import { ATTR_TYPE } from '@dxos/echo/internal';
|
|
12
13
|
import { invariant } from '@dxos/invariant';
|
|
13
14
|
import { DXN, ObjectId, SpaceId } from '@dxos/keys';
|
|
@@ -49,6 +50,7 @@ class MockIndexDataSource implements IndexDataSource {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
getChangedObjects(
|
|
53
|
+
_ctx: Context,
|
|
52
54
|
cursors: IndexCursor[],
|
|
53
55
|
opts?: { limit?: number },
|
|
54
56
|
): Effect.Effect<{ objects: IndexerObject[]; cursors: DataSourceCursor[] }> {
|
|
@@ -118,6 +120,7 @@ describe('IndexEngine', () => {
|
|
|
118
120
|
documentId: 'doc-1',
|
|
119
121
|
queueId: null,
|
|
120
122
|
recordId: null,
|
|
123
|
+
updatedAt: Date.now(),
|
|
121
124
|
data: {
|
|
122
125
|
id: ObjectId.random(),
|
|
123
126
|
[ATTR_TYPE]: TYPE_DEFAULT,
|
|
@@ -128,7 +131,7 @@ describe('IndexEngine', () => {
|
|
|
128
131
|
dataSource.push([obj1]);
|
|
129
132
|
|
|
130
133
|
// First update.
|
|
131
|
-
const { updated } = yield* engine.update(dataSource, { spaceId: null });
|
|
134
|
+
const { updated } = yield* engine.update(Context.default(), dataSource, { spaceId: null });
|
|
132
135
|
// Updates objectMeta, FTS, and reverseRef indexes.
|
|
133
136
|
expect(updated).toBe(2);
|
|
134
137
|
|
|
@@ -154,12 +157,13 @@ describe('IndexEngine', () => {
|
|
|
154
157
|
documentId: obj1.documentId,
|
|
155
158
|
queueId: null,
|
|
156
159
|
recordId: null,
|
|
160
|
+
updatedAt: Date.now(),
|
|
157
161
|
data: { id: obj1.data.id, [ATTR_TYPE]: obj1.data[ATTR_TYPE], title: 'Hello World' },
|
|
158
162
|
};
|
|
159
163
|
dataSource.push([obj1Updated]);
|
|
160
164
|
|
|
161
165
|
// Second update.
|
|
162
|
-
const { updated: updated2 } = yield* engine.update(dataSource, { spaceId: null });
|
|
166
|
+
const { updated: updated2 } = yield* engine.update(Context.default(), dataSource, { spaceId: null });
|
|
163
167
|
expect(updated2).toBe(2);
|
|
164
168
|
|
|
165
169
|
// Verify update.
|
|
@@ -193,6 +197,7 @@ describe('IndexEngine', () => {
|
|
|
193
197
|
queueId: null,
|
|
194
198
|
documentId: 'd1',
|
|
195
199
|
recordId: null,
|
|
200
|
+
updatedAt: Date.now(),
|
|
196
201
|
data: {
|
|
197
202
|
id: ObjectId.random(),
|
|
198
203
|
[ATTR_TYPE]: TYPE_A,
|
|
@@ -204,6 +209,7 @@ describe('IndexEngine', () => {
|
|
|
204
209
|
queueId: null,
|
|
205
210
|
documentId: 'd2',
|
|
206
211
|
recordId: null,
|
|
212
|
+
updatedAt: Date.now(),
|
|
207
213
|
data: {
|
|
208
214
|
id: ObjectId.random(),
|
|
209
215
|
[ATTR_TYPE]: TYPE_A,
|
|
@@ -215,6 +221,7 @@ describe('IndexEngine', () => {
|
|
|
215
221
|
queueId: null,
|
|
216
222
|
documentId: 'd3',
|
|
217
223
|
recordId: null,
|
|
224
|
+
updatedAt: Date.now(),
|
|
218
225
|
data: {
|
|
219
226
|
id: ObjectId.random(),
|
|
220
227
|
[ATTR_TYPE]: TYPE_B,
|
|
@@ -225,7 +232,7 @@ describe('IndexEngine', () => {
|
|
|
225
232
|
|
|
226
233
|
dataSource.push(objects);
|
|
227
234
|
|
|
228
|
-
yield* engine.update(dataSource, { spaceId: null });
|
|
235
|
+
yield* engine.update(Context.default(), dataSource, { spaceId: null });
|
|
229
236
|
|
|
230
237
|
const resultsA = yield* metaIndex.query({ spaceId: spaceId.toString(), typeDxn: TYPE_A });
|
|
231
238
|
expect(resultsA).toHaveLength(2);
|
|
@@ -242,4 +249,44 @@ describe('IndexEngine', () => {
|
|
|
242
249
|
expect(ftsResults).toHaveLength(2);
|
|
243
250
|
}, Effect.provide(TestLayer)),
|
|
244
251
|
);
|
|
252
|
+
|
|
253
|
+
it.effect(
|
|
254
|
+
'done is true only when all sub-indexes have no remaining work',
|
|
255
|
+
Effect.fnUntraced(function* () {
|
|
256
|
+
const { tracker, metaIndex, ftsIndex, reverseRefIndex } = yield* setup;
|
|
257
|
+
|
|
258
|
+
const engine = new IndexEngine({ tracker, objectMetaIndex: metaIndex, ftsIndex, reverseRefIndex });
|
|
259
|
+
const dataSource = new MockIndexDataSource();
|
|
260
|
+
const spaceId = SpaceId.random();
|
|
261
|
+
|
|
262
|
+
// First update with no data — both sub-indexes report done immediately.
|
|
263
|
+
const { updated: updated0, done: done0 } = yield* engine.update(Context.default(), dataSource, { spaceId: null });
|
|
264
|
+
expect(updated0).toBe(0);
|
|
265
|
+
expect(done0).toBe(true);
|
|
266
|
+
|
|
267
|
+
// Push an object so sub-indexes have work to do.
|
|
268
|
+
dataSource.push([
|
|
269
|
+
{
|
|
270
|
+
spaceId,
|
|
271
|
+
queueId: null,
|
|
272
|
+
documentId: 'doc-done-test',
|
|
273
|
+
recordId: null,
|
|
274
|
+
updatedAt: Date.now(),
|
|
275
|
+
data: { id: ObjectId.random(), [ATTR_TYPE]: TYPE_DEFAULT, title: 'Done test' },
|
|
276
|
+
},
|
|
277
|
+
]);
|
|
278
|
+
|
|
279
|
+
// Update with pending data — sub-indexes process objects, done is false.
|
|
280
|
+
const { updated: updated1, done: done1 } = yield* engine.update(Context.default(), dataSource, { spaceId: null });
|
|
281
|
+
expect(updated1).toBeGreaterThan(0);
|
|
282
|
+
expect(done1).toBe(false);
|
|
283
|
+
|
|
284
|
+
// Second update with no new data — all sub-indexes caught up, done is true.
|
|
285
|
+
const { updated: updated2, done: done2 } = yield* engine.update(Context.default(), dataSource, {
|
|
286
|
+
spaceId: null,
|
|
287
|
+
});
|
|
288
|
+
expect(updated2).toBe(0);
|
|
289
|
+
expect(done2).toBe(true);
|
|
290
|
+
}, Effect.provide(TestLayer)),
|
|
291
|
+
);
|
|
245
292
|
});
|
package/src/index-engine.ts
CHANGED
|
@@ -6,7 +6,8 @@ import type * as SqlClient from '@effect/sql/SqlClient';
|
|
|
6
6
|
import type * as SqlError from '@effect/sql/SqlError';
|
|
7
7
|
import * as Effect from 'effect/Effect';
|
|
8
8
|
|
|
9
|
-
import type
|
|
9
|
+
import { type Context } from '@dxos/context';
|
|
10
|
+
import type { ObjectId, SpaceId } from '@dxos/keys';
|
|
10
11
|
import * as SqlTransaction from '@dxos/sql-sqlite/SqlTransaction';
|
|
11
12
|
|
|
12
13
|
import { type IndexCursor, IndexTracker } from './index-tracker';
|
|
@@ -29,7 +30,7 @@ export interface DataSourceCursor {
|
|
|
29
30
|
spaceId: SpaceId | null;
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
* documentId or
|
|
33
|
+
* documentId or queueNamespace.
|
|
33
34
|
*/
|
|
34
35
|
resourceId: string | null;
|
|
35
36
|
|
|
@@ -43,6 +44,7 @@ export interface IndexDataSource {
|
|
|
43
44
|
readonly sourceName: string; // e.g. queue, automerge, etc.
|
|
44
45
|
|
|
45
46
|
getChangedObjects(
|
|
47
|
+
ctx: Context,
|
|
46
48
|
cursors: DataSourceCursor[],
|
|
47
49
|
opts?: { limit?: number },
|
|
48
50
|
): Effect.Effect<{ objects: IndexerObject[]; cursors: DataSourceCursor[] }>;
|
|
@@ -93,6 +95,8 @@ export class IndexEngine {
|
|
|
93
95
|
|
|
94
96
|
queryAll(query: {
|
|
95
97
|
spaceIds: readonly SpaceId[];
|
|
98
|
+
includeAllQueues?: boolean;
|
|
99
|
+
queueIds?: readonly string[] | null;
|
|
96
100
|
}): Effect.Effect<readonly ObjectMeta[], SqlError.SqlError, SqlClient.SqlClient> {
|
|
97
101
|
return this.#objectMetaIndex.queryAll(query);
|
|
98
102
|
}
|
|
@@ -111,13 +115,36 @@ export class IndexEngine {
|
|
|
111
115
|
return this.#objectMetaIndex.query(query);
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Query children by parent object ids.
|
|
120
|
+
*/
|
|
121
|
+
queryChildren(query: {
|
|
122
|
+
spaceId: SpaceId[];
|
|
123
|
+
parentIds: ObjectId[];
|
|
124
|
+
}): Effect.Effect<readonly ObjectMeta[], SqlError.SqlError, SqlClient.SqlClient> {
|
|
125
|
+
return this.#objectMetaIndex.queryChildren(query);
|
|
126
|
+
}
|
|
127
|
+
|
|
114
128
|
queryTypes(query: {
|
|
115
129
|
spaceIds: readonly SpaceId[];
|
|
116
130
|
typeDxns: readonly ObjectMeta['typeDxn'][];
|
|
117
131
|
inverted?: boolean;
|
|
132
|
+
includeAllQueues?: boolean;
|
|
133
|
+
queueIds?: readonly string[] | null;
|
|
118
134
|
}): Effect.Effect<readonly ObjectMeta[], SqlError.SqlError, SqlClient.SqlClient> {
|
|
119
135
|
return this.#objectMetaIndex.queryTypes(query);
|
|
120
136
|
}
|
|
137
|
+
queryByTimeRange(query: {
|
|
138
|
+
spaceIds: readonly string[];
|
|
139
|
+
updatedAfter?: number;
|
|
140
|
+
updatedBefore?: number;
|
|
141
|
+
createdAfter?: number;
|
|
142
|
+
createdBefore?: number;
|
|
143
|
+
includeAllQueues?: boolean;
|
|
144
|
+
queueIds?: readonly string[] | null;
|
|
145
|
+
}): Effect.Effect<readonly ObjectMeta[], SqlError.SqlError, SqlClient.SqlClient> {
|
|
146
|
+
return this.#objectMetaIndex.queryByTimeRange(query);
|
|
147
|
+
}
|
|
121
148
|
|
|
122
149
|
queryRelations(query: {
|
|
123
150
|
endpoint: 'source' | 'target';
|
|
@@ -125,12 +152,20 @@ export class IndexEngine {
|
|
|
125
152
|
}): Effect.Effect<readonly ObjectMeta[], SqlError.SqlError, SqlClient.SqlClient> {
|
|
126
153
|
return this.#objectMetaIndex.queryRelations(query);
|
|
127
154
|
}
|
|
128
|
-
|
|
129
155
|
lookupByRecordIds(recordIds: number[]): Effect.Effect<readonly ObjectMeta[], SqlError.SqlError, SqlClient.SqlClient> {
|
|
130
156
|
return this.#objectMetaIndex.lookupByRecordIds(recordIds);
|
|
131
157
|
}
|
|
132
158
|
|
|
159
|
+
lookupByObjectId(query: {
|
|
160
|
+
objectId: string;
|
|
161
|
+
spaceId: string;
|
|
162
|
+
queueId: string;
|
|
163
|
+
}): Effect.Effect<ObjectMeta | null, SqlError.SqlError, SqlClient.SqlClient> {
|
|
164
|
+
return this.#objectMetaIndex.lookupByObjectId(query);
|
|
165
|
+
}
|
|
166
|
+
|
|
133
167
|
update(
|
|
168
|
+
ctx: Context,
|
|
134
169
|
dataSource: IndexDataSource,
|
|
135
170
|
opts: { spaceId: SpaceId | null; limit?: number },
|
|
136
171
|
): Effect.Effect<
|
|
@@ -140,15 +175,18 @@ export class IndexEngine {
|
|
|
140
175
|
> {
|
|
141
176
|
return Effect.gen(this, function* () {
|
|
142
177
|
let updated = 0;
|
|
178
|
+
let done = true;
|
|
143
179
|
|
|
144
|
-
const { updated: updatedFtsIndex, done: doneFtsIndex } = yield* this.#update(this.#ftsIndex, dataSource, {
|
|
145
|
-
indexName: '
|
|
180
|
+
const { updated: updatedFtsIndex, done: doneFtsIndex } = yield* this.#update(ctx, this.#ftsIndex, dataSource, {
|
|
181
|
+
indexName: 'fts5',
|
|
146
182
|
spaceId: opts.spaceId,
|
|
147
183
|
limit: opts.limit,
|
|
148
184
|
});
|
|
149
185
|
updated += updatedFtsIndex;
|
|
186
|
+
done = done && doneFtsIndex;
|
|
150
187
|
|
|
151
188
|
const { updated: updatedReverseRefIndex, done: doneReverseRefIndex } = yield* this.#update(
|
|
189
|
+
ctx,
|
|
152
190
|
this.#reverseRefIndex,
|
|
153
191
|
dataSource,
|
|
154
192
|
{
|
|
@@ -158,8 +196,9 @@ export class IndexEngine {
|
|
|
158
196
|
},
|
|
159
197
|
);
|
|
160
198
|
updated += updatedReverseRefIndex;
|
|
199
|
+
done = done && doneReverseRefIndex;
|
|
161
200
|
|
|
162
|
-
return { updated, done
|
|
201
|
+
return { updated, done };
|
|
163
202
|
}).pipe(Effect.withSpan('IndexEngine.update'));
|
|
164
203
|
}
|
|
165
204
|
|
|
@@ -173,6 +212,7 @@ export class IndexEngine {
|
|
|
173
212
|
* 5. Updates the dependent index.
|
|
174
213
|
*/
|
|
175
214
|
#update(
|
|
215
|
+
ctx: Context,
|
|
176
216
|
index: Index,
|
|
177
217
|
source: IndexDataSource,
|
|
178
218
|
opts: { indexName: string; spaceId: SpaceId | null; limit?: number },
|
|
@@ -192,7 +232,9 @@ export class IndexEngine {
|
|
|
192
232
|
// Pass undefined to get all cursors when spaceId is null.
|
|
193
233
|
spaceId: opts.spaceId ?? undefined,
|
|
194
234
|
});
|
|
195
|
-
const { objects, cursors: updatedCursors } = yield* source.getChangedObjects(cursors, {
|
|
235
|
+
const { objects, cursors: updatedCursors } = yield* source.getChangedObjects(ctx, cursors, {
|
|
236
|
+
limit: opts.limit,
|
|
237
|
+
});
|
|
196
238
|
if (objects.length === 0) {
|
|
197
239
|
return { updated: 0, done: true };
|
|
198
240
|
}
|
|
@@ -218,6 +260,6 @@ export class IndexEngine {
|
|
|
218
260
|
return { updated: objects.length, done: false };
|
|
219
261
|
}),
|
|
220
262
|
);
|
|
221
|
-
}).pipe(Effect.withSpan('IndexEngine.#
|
|
263
|
+
}).pipe(Effect.withSpan('IndexEngine.#update'));
|
|
222
264
|
}
|
|
223
265
|
}
|
package/src/index-tracker.ts
CHANGED
|
@@ -35,6 +35,11 @@ export const IndexCursor = Schema.Struct({
|
|
|
35
35
|
});
|
|
36
36
|
export interface IndexCursor extends Schema.Schema.Type<typeof IndexCursor> {}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Deprecated index names that are no longer used. Will be cleaned up on migration.
|
|
40
|
+
*/
|
|
41
|
+
const DEPRECATED_INDEX_NAMES = ['fts'];
|
|
42
|
+
|
|
38
43
|
export class IndexTracker {
|
|
39
44
|
migrate = Effect.fn('IndexTracker.migrate')(function* () {
|
|
40
45
|
const sql = yield* SqlClient.SqlClient;
|
|
@@ -49,6 +54,10 @@ export class IndexTracker {
|
|
|
49
54
|
cursor,
|
|
50
55
|
PRIMARY KEY (indexName, spaceId, sourceName, resourceId)
|
|
51
56
|
)`;
|
|
57
|
+
|
|
58
|
+
yield* Effect.forEach(DEPRECATED_INDEX_NAMES, (indexName) => {
|
|
59
|
+
return sql`DELETE FROM indexCursor WHERE indexName = ${indexName}`;
|
|
60
|
+
});
|
|
52
61
|
});
|
|
53
62
|
|
|
54
63
|
queryCursors = Effect.fn('IndexTracker.queryCursors')(
|
package/src/index.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { type IndexerObject, type Index } from './indexes/interface';
|
|
|
8
8
|
export { FtsIndex, type FtsQuery } from './indexes/fts-index';
|
|
9
9
|
export { ObjectMetaIndex, type ObjectMeta } from './indexes/object-meta-index';
|
|
10
10
|
export { ReverseRefIndex, type ReverseRef, type ReverseRefQuery } from './indexes/reverse-ref-index';
|
|
11
|
+
export { EscapedPropPath, type ObjectPropPath } from './utils';
|
|
@@ -16,7 +16,7 @@ import { FtsIndex } from './fts-index';
|
|
|
16
16
|
import type { IndexerObject } from './interface';
|
|
17
17
|
import { ObjectMetaIndex } from './object-meta-index';
|
|
18
18
|
|
|
19
|
-
const TYPE_PERSON = DXN.parse('dxn:type:example.
|
|
19
|
+
const TYPE_PERSON = DXN.parse('dxn:type:com.example.type.person:0.1.0').toString();
|
|
20
20
|
const TYPE_DEFAULT = DXN.parse('dxn:type:test.com/type/Type:0.1.0').toString();
|
|
21
21
|
|
|
22
22
|
const TestLayer = Layer.merge(
|
|
@@ -57,6 +57,7 @@ describe('FtsIndex', () => {
|
|
|
57
57
|
queueId: null,
|
|
58
58
|
documentId: 'doc-1',
|
|
59
59
|
recordId: null,
|
|
60
|
+
updatedAt: Date.now(),
|
|
60
61
|
data: {
|
|
61
62
|
id: ObjectId.random(),
|
|
62
63
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -101,9 +102,10 @@ describe('FtsIndex', () => {
|
|
|
101
102
|
queueId: null,
|
|
102
103
|
documentId: 'doc-1',
|
|
103
104
|
recordId: null,
|
|
105
|
+
updatedAt: Date.now(),
|
|
104
106
|
data: {
|
|
105
107
|
id: objectId,
|
|
106
|
-
[ATTR_TYPE]: DXN.parse('dxn:type:example.
|
|
108
|
+
[ATTR_TYPE]: DXN.parse('dxn:type:com.example.type.person:0.1.0').toString(),
|
|
107
109
|
title: 'Original Title',
|
|
108
110
|
},
|
|
109
111
|
};
|
|
@@ -120,6 +122,7 @@ describe('FtsIndex', () => {
|
|
|
120
122
|
queueId: null,
|
|
121
123
|
documentId: 'doc-1',
|
|
122
124
|
recordId: null,
|
|
125
|
+
updatedAt: Date.now(),
|
|
123
126
|
data: {
|
|
124
127
|
id: objectId,
|
|
125
128
|
[ATTR_TYPE]: TYPE_DEFAULT,
|
|
@@ -157,6 +160,7 @@ describe('FtsIndex', () => {
|
|
|
157
160
|
queueId: null,
|
|
158
161
|
documentId: 'doc-100',
|
|
159
162
|
recordId: null,
|
|
163
|
+
updatedAt: Date.now(),
|
|
160
164
|
data: {
|
|
161
165
|
id: ObjectId.random(),
|
|
162
166
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -168,6 +172,7 @@ describe('FtsIndex', () => {
|
|
|
168
172
|
queueId: null,
|
|
169
173
|
documentId: 'doc-200',
|
|
170
174
|
recordId: null,
|
|
175
|
+
updatedAt: Date.now(),
|
|
171
176
|
data: {
|
|
172
177
|
id: ObjectId.random(),
|
|
173
178
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -179,6 +184,7 @@ describe('FtsIndex', () => {
|
|
|
179
184
|
queueId: null,
|
|
180
185
|
documentId: 'doc-1000',
|
|
181
186
|
recordId: null,
|
|
187
|
+
updatedAt: Date.now(),
|
|
182
188
|
data: {
|
|
183
189
|
id: ObjectId.random(),
|
|
184
190
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -227,6 +233,7 @@ describe('FtsIndex', () => {
|
|
|
227
233
|
queueId: null,
|
|
228
234
|
documentId: 'doc-s1',
|
|
229
235
|
recordId: null,
|
|
236
|
+
updatedAt: Date.now(),
|
|
230
237
|
data: {
|
|
231
238
|
id: ObjectId.random(),
|
|
232
239
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -239,6 +246,7 @@ describe('FtsIndex', () => {
|
|
|
239
246
|
queueId: null,
|
|
240
247
|
documentId: 'doc-s2',
|
|
241
248
|
recordId: null,
|
|
249
|
+
updatedAt: Date.now(),
|
|
242
250
|
data: {
|
|
243
251
|
id: ObjectId.random(),
|
|
244
252
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -297,6 +305,7 @@ describe('FtsIndex', () => {
|
|
|
297
305
|
queueId: null,
|
|
298
306
|
documentId: 'doc-1',
|
|
299
307
|
recordId: null,
|
|
308
|
+
updatedAt: Date.now(),
|
|
300
309
|
data: {
|
|
301
310
|
id: ObjectId.random(),
|
|
302
311
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -309,6 +318,7 @@ describe('FtsIndex', () => {
|
|
|
309
318
|
queueId: null,
|
|
310
319
|
documentId: 'doc-2',
|
|
311
320
|
recordId: null,
|
|
321
|
+
updatedAt: Date.now(),
|
|
312
322
|
data: {
|
|
313
323
|
id: ObjectId.random(),
|
|
314
324
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -378,6 +388,7 @@ describe('FtsIndex', () => {
|
|
|
378
388
|
queueId: null,
|
|
379
389
|
documentId: 'doc-space',
|
|
380
390
|
recordId: null,
|
|
391
|
+
updatedAt: Date.now(),
|
|
381
392
|
data: {
|
|
382
393
|
id: ObjectId.random(),
|
|
383
394
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -390,6 +401,7 @@ describe('FtsIndex', () => {
|
|
|
390
401
|
queueId: queue1,
|
|
391
402
|
documentId: null,
|
|
392
403
|
recordId: null,
|
|
404
|
+
updatedAt: Date.now(),
|
|
393
405
|
data: {
|
|
394
406
|
id: ObjectId.random(),
|
|
395
407
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -402,6 +414,7 @@ describe('FtsIndex', () => {
|
|
|
402
414
|
queueId: queue2,
|
|
403
415
|
documentId: null,
|
|
404
416
|
recordId: null,
|
|
417
|
+
updatedAt: Date.now(),
|
|
405
418
|
data: {
|
|
406
419
|
id: ObjectId.random(),
|
|
407
420
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -450,6 +463,7 @@ describe('FtsIndex', () => {
|
|
|
450
463
|
queueId: null,
|
|
451
464
|
documentId: 'doc-space',
|
|
452
465
|
recordId: null,
|
|
466
|
+
updatedAt: Date.now(),
|
|
453
467
|
data: {
|
|
454
468
|
id: ObjectId.random(),
|
|
455
469
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -462,6 +476,7 @@ describe('FtsIndex', () => {
|
|
|
462
476
|
queueId,
|
|
463
477
|
documentId: null,
|
|
464
478
|
recordId: null,
|
|
479
|
+
updatedAt: Date.now(),
|
|
465
480
|
data: {
|
|
466
481
|
id: ObjectId.random(),
|
|
467
482
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -511,6 +526,7 @@ describe('FtsIndex', () => {
|
|
|
511
526
|
queueId: null,
|
|
512
527
|
documentId: 'doc-s1',
|
|
513
528
|
recordId: null,
|
|
529
|
+
updatedAt: Date.now(),
|
|
514
530
|
data: {
|
|
515
531
|
id: ObjectId.random(),
|
|
516
532
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -523,6 +539,7 @@ describe('FtsIndex', () => {
|
|
|
523
539
|
queueId: null,
|
|
524
540
|
documentId: 'doc-s2',
|
|
525
541
|
recordId: null,
|
|
542
|
+
updatedAt: Date.now(),
|
|
526
543
|
data: {
|
|
527
544
|
id: ObjectId.random(),
|
|
528
545
|
[ATTR_TYPE]: TYPE_PERSON,
|
|
@@ -535,6 +552,7 @@ describe('FtsIndex', () => {
|
|
|
535
552
|
queueId: queueInSpace2,
|
|
536
553
|
documentId: null,
|
|
537
554
|
recordId: null,
|
|
555
|
+
updatedAt: Date.now(),
|
|
538
556
|
data: {
|
|
539
557
|
id: ObjectId.random(),
|
|
540
558
|
[ATTR_TYPE]: TYPE_PERSON,
|