@osmix/core 0.1.8 → 0.2.0

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +21 -0
  3. package/README.md +86 -69
  4. package/dist/contracts.d.ts +26 -0
  5. package/dist/contracts.d.ts.map +1 -0
  6. package/dist/contracts.js +1 -0
  7. package/dist/contracts.js.map +1 -0
  8. package/dist/entities.d.ts +1 -1
  9. package/dist/entities.d.ts.map +1 -1
  10. package/dist/entities.js +2 -7
  11. package/dist/entities.js.map +1 -1
  12. package/dist/ids.d.ts +2 -0
  13. package/dist/ids.d.ts.map +1 -1
  14. package/dist/ids.js +23 -15
  15. package/dist/ids.js.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +0 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/mocks.d.ts.map +1 -1
  21. package/dist/mocks.js.map +1 -1
  22. package/dist/nodes.d.ts +9 -3
  23. package/dist/nodes.d.ts.map +1 -1
  24. package/dist/nodes.js +6 -13
  25. package/dist/nodes.js.map +1 -1
  26. package/dist/osm.d.ts +1 -1
  27. package/dist/osm.d.ts.map +1 -1
  28. package/dist/osm.js +1 -4
  29. package/dist/osm.js.map +1 -1
  30. package/dist/relations.d.ts +3 -2
  31. package/dist/relations.d.ts.map +1 -1
  32. package/dist/relations.js +15 -9
  33. package/dist/relations.js.map +1 -1
  34. package/dist/stringtable.d.ts.map +1 -1
  35. package/dist/stringtable.js +4 -13
  36. package/dist/stringtable.js.map +1 -1
  37. package/dist/tags.d.ts +1 -1
  38. package/dist/tags.d.ts.map +1 -1
  39. package/dist/tags.js.map +1 -1
  40. package/dist/typed-arrays.d.ts +1 -1
  41. package/dist/typed-arrays.d.ts.map +1 -1
  42. package/dist/typed-arrays.js.map +1 -1
  43. package/dist/ways.d.ts +2 -1
  44. package/dist/ways.d.ts.map +1 -1
  45. package/dist/ways.js +18 -18
  46. package/dist/ways.js.map +1 -1
  47. package/package.json +46 -31
  48. package/src/contracts.ts +28 -0
  49. package/src/entities.ts +179 -194
  50. package/src/ids.ts +228 -235
  51. package/src/index.ts +12 -9
  52. package/src/mocks.ts +114 -113
  53. package/src/nodes.ts +364 -397
  54. package/src/osm.ts +196 -207
  55. package/src/relations.ts +530 -558
  56. package/src/stringtable.ts +174 -183
  57. package/src/tags.ts +263 -271
  58. package/src/typed-arrays.ts +184 -194
  59. package/src/types/geoflatbush.d.ts +28 -33
  60. package/src/types/geokdbush.d.ts +28 -33
  61. package/src/types/kdbush.d.ts +34 -34
  62. package/src/ways.ts +381 -405
  63. package/test/ids.bench.ts +29 -0
  64. package/test/ids.test.ts +84 -0
  65. package/test/memory.test.ts +29 -30
  66. package/test/relations.bench.ts +27 -0
  67. package/test/relations.test.ts +101 -0
  68. package/test/tags-search.test.ts +76 -56
  69. package/test/typed-arrays.test.ts +100 -99
  70. package/tsconfig.build.json +6 -3
  71. package/tsconfig.json +7 -7
package/src/tags.ts CHANGED
@@ -8,30 +8,31 @@
8
8
  * @module
9
9
  */
10
10
 
11
- import type { ContentHasher } from "@osmix/shared/content-hasher"
12
- import type { OsmTags } from "@osmix/shared/types"
13
- import StringTable from "./stringtable.ts"
14
- import { type BufferType, ResizeableTypedArray as RTA } from "./typed-arrays.ts"
11
+ import type { ContentHasher } from "@osmix/shared/content-hasher";
12
+ import type { OsmTags } from "@osmix/types";
13
+
14
+ import StringTable from "./stringtable.ts";
15
+ import { type BufferType, ResizeableTypedArray as RTA } from "./typed-arrays.ts";
15
16
 
16
17
  /**
17
18
  * Serializable state for worker transfer.
18
19
  */
19
20
  export interface TagsTransferables<T extends BufferType = BufferType> {
20
- /** Maps entity index → start position in tagKeys/tagVals. */
21
- tagStart: T
22
- /** Maps entity index → number of tags. */
23
- tagCount: T
24
- /** Flattened tag key indices. */
25
- tagKeys: T
26
- /** Flattened tag value indices. */
27
- tagVals: T
28
-
29
- /** Flattened entity indices for reverse key lookup. */
30
- keyEntities: T
31
- /** Maps key index → start position in keyEntities. */
32
- keyIndexStart: T
33
- /** Maps key index → count of entities with that key. */
34
- keyIndexCount: T
21
+ /** Maps entity index → start position in tagKeys/tagVals. */
22
+ tagStart: T;
23
+ /** Maps entity index → number of tags. */
24
+ tagCount: T;
25
+ /** Flattened tag key indices. */
26
+ tagKeys: T;
27
+ /** Flattened tag value indices. */
28
+ tagVals: T;
29
+
30
+ /** Flattened entity indices for reverse key lookup. */
31
+ keyEntities: T;
32
+ /** Maps key index → start position in keyEntities. */
33
+ keyIndexStart: T;
34
+ /** Maps key index → count of entities with that key. */
35
+ keyIndexCount: T;
35
36
  }
36
37
 
37
38
  /**
@@ -41,256 +42,247 @@ export interface TagsTransferables<T extends BufferType = BufferType> {
41
42
  * Note: String indices reference a shared `StringTable`.
42
43
  */
43
44
  export class Tags {
44
- /** Reference to the shared string table for key/value storage */
45
- private stringTable: StringTable = new StringTable()
46
-
47
- // ─── Entity → Tag Lookup ───────────────────────────────────────────────────
48
- /** Maps entity index → start position in tagKeys/tagVals */
49
- private tagStart: RTA<Uint32Array>
50
- /** Maps entity index → number of tags (max 255) */
51
- private tagCount: RTA<Uint8Array>
52
- /** All tag key string indices, concatenated */
53
- private tagKeys: RTA<Uint32Array>
54
- /** All tag value string indices, concatenated (parallel to tagKeys) */
55
- private tagVals: RTA<Uint32Array>
56
-
57
- // ─── Key → Entity Reverse Lookup ───────────────────────────────────────────
58
- /**
59
- * Flattened array of entity indices that have each tag key.
60
- * Indexed via keyIndexStart and keyIndexCount.
61
- */
62
- private keyEntities: RTA<Uint32Array>
63
-
64
- /** Maps key string index → start position in keyEntities */
65
- private keyIndexStart: RTA<Uint32Array>
66
- /** Maps key string index → count of entities with that key */
67
- private keyIndexCount: RTA<Uint32Array>
68
-
69
- /**
70
- * Temporary map used during ingestion to collect entity indices per key.
71
- * Converted to flat arrays during buildIndex() and then cleared.
72
- */
73
- private keyEntityIndexBuilder = new Map<number, number[]>()
74
-
75
- /** Whether buildIndex() has been called */
76
- private indexBuilt = false
77
-
78
- /**
79
- * Create a new Tags index.
80
- */
81
- constructor(stringTable: StringTable, transferables?: TagsTransferables) {
82
- this.stringTable = stringTable
83
- if (transferables) {
84
- this.tagStart = RTA.from(Uint32Array, transferables.tagStart)
85
- this.tagCount = RTA.from(Uint8Array, transferables.tagCount)
86
- this.tagKeys = RTA.from(Uint32Array, transferables.tagKeys)
87
- this.tagVals = RTA.from(Uint32Array, transferables.tagVals)
88
- this.keyEntities = RTA.from(Uint32Array, transferables.keyEntities)
89
- this.keyIndexStart = RTA.from(Uint32Array, transferables.keyIndexStart)
90
- this.keyIndexCount = RTA.from(Uint32Array, transferables.keyIndexCount)
91
- this.indexBuilt = true
92
- } else {
93
- this.tagStart = new RTA(Uint32Array)
94
- this.tagCount = new RTA(Uint8Array)
95
- this.tagKeys = new RTA(Uint32Array)
96
- this.tagVals = new RTA(Uint32Array)
97
- this.keyEntities = new RTA(Uint32Array)
98
- this.keyIndexStart = new RTA(Uint32Array)
99
- this.keyIndexCount = new RTA(Uint32Array)
100
- }
101
- }
102
-
103
- /**
104
- * Add tags to an entity.
105
- */
106
- addTags(index: number, tags?: OsmTags): [number[], number[]] {
107
- const tagKeys: number[] = []
108
- const tagValues: number[] = []
109
-
110
- if (tags) {
111
- for (const [key, value] of Object.entries(tags)) {
112
- tagKeys.push(this.stringTable.add(key))
113
- tagValues.push(this.stringTable.add(String(value)))
114
- }
115
- }
116
-
117
- this.addTagKeysAndValues(index, tagKeys, tagValues)
118
-
119
- return [tagKeys, tagValues]
120
- }
121
-
122
- /**
123
- * Add tags to an entity using key and value indexes.
124
- */
125
- addTagKeysAndValues(index: number, keys: number[], values: number[]) {
126
- this.tagStart.set(index, this.tagKeys.length)
127
- this.tagCount.set(index, keys.length)
128
- this.tagKeys.pushMany(keys)
129
- this.tagVals.pushMany(values)
130
-
131
- keys.forEach((key) => {
132
- const keyEntities = this.keyEntityIndexBuilder.get(key)
133
- if (keyEntities) {
134
- keyEntities.push(index)
135
- } else {
136
- this.keyEntityIndexBuilder.set(key, [index])
137
- }
138
- })
139
- }
140
-
141
- /**
142
- * Finalize the tag index.
143
- *
144
- * Compacts arrays and builds the reverse key→entity index.
145
- * Must be called before `hasKey()`.
146
- */
147
- buildIndex() {
148
- this.tagStart.compact()
149
- this.tagCount.compact()
150
- this.tagKeys.compact()
151
- this.tagVals.compact()
152
-
153
- // Convert the builder map to flat arrays for the reverse index
154
- for (const [keyIndex, entityIndexes] of this.keyEntityIndexBuilder) {
155
- this.keyIndexStart.set(keyIndex, this.keyEntities.length)
156
- this.keyIndexCount.set(keyIndex, entityIndexes.length)
157
- this.keyEntities.pushMany(entityIndexes)
158
- }
159
-
160
- this.keyIndexStart.compact()
161
- this.keyIndexCount.compact()
162
- this.keyEntityIndexBuilder.clear()
163
-
164
- this.indexBuilt = true
165
- }
166
-
167
- /**
168
- * Check if the index is built and ready for use.
169
- */
170
- isReady() {
171
- return this.indexBuilt
172
- }
173
-
174
- /**
175
- * Get the number of tags for an entity.
176
- */
177
- cardinality(index: number): number {
178
- return this.tagCount.at(index) ?? 0
179
- }
180
-
181
- /**
182
- * Get the tags for an entity.
183
- */
184
- getTags(index: number): OsmTags | undefined {
185
- const tagCount = this.tagCount.at(index) ?? 0
186
- if (tagCount === 0) return
187
- const tagStart = this.tagStart.at(index) ?? 0
188
- const tagKeyIndexes = this.tagKeys.array.slice(
189
- tagStart,
190
- tagStart + tagCount,
191
- )
192
- const tagValIndexes = this.tagVals.array.slice(
193
- tagStart,
194
- tagStart + tagCount,
195
- )
196
- const tags: OsmTags = {}
197
- for (let i = 0; i < tagCount; i++) {
198
- const keyIndex = tagKeyIndexes[i]
199
- const valIndex = tagValIndexes[i]
200
- if (keyIndex === undefined || valIndex === undefined)
201
- throw Error("Tag key or value not found")
202
- tags[this.stringTable.get(keyIndex)] = this.stringTable.get(valIndex)
203
- }
204
- return tags
205
- }
206
-
207
- /**
208
- * Get tags from key and value indexes.
209
- */
210
- getTagsFromIndices(keys: number[], values: number[]): OsmTags {
211
- const tags: OsmTags = {}
212
- for (let i = 0; i < keys.length; i++) {
213
- const keyIndex = keys[i]
214
- const valIndex = values[i]
215
- if (keyIndex === undefined || valIndex === undefined)
216
- throw Error("Tag key or value not found")
217
- tags[this.stringTable.get(keyIndex)] = this.stringTable.get(valIndex)
218
- }
219
- return tags
220
- }
221
-
222
- /**
223
- * Find the index of a tag key.
224
- */
225
- find(key: string): number {
226
- return this.stringTable.find(key)
227
- }
228
-
229
- /**
230
- * Get all entity indexes that have a specific tag key.
231
- */
232
- hasKey(keyIndex: number): number[] {
233
- if (keyIndex < 0) return []
234
- const start = this.keyIndexStart.at(keyIndex) ?? 0
235
- const count = this.keyIndexCount.at(keyIndex) ?? 0
236
- return Array.from(this.keyEntities.array.subarray(start, start + count))
237
- }
238
-
239
- /**
240
- * Create a unique composite index for a key=value pair.
241
- * Uses row-major indexing: `key * width + val`.
242
- */
243
- kvToIndex(key: number, val: number) {
244
- const width = this.stringTable.length
245
- return key * width + val
246
- }
247
-
248
- /**
249
- * Get transferable objects for passing to another thread.
250
- */
251
- transferables(): TagsTransferables {
252
- return {
253
- tagStart: this.tagStart.array.buffer,
254
- tagCount: this.tagCount.array.buffer,
255
- tagKeys: this.tagKeys.array.buffer,
256
- tagVals: this.tagVals.array.buffer,
257
- keyEntities: this.keyEntities.array.buffer,
258
- keyIndexStart: this.keyIndexStart.array.buffer,
259
- keyIndexCount: this.keyIndexCount.array.buffer,
260
- }
261
- }
262
-
263
- /**
264
- * Get the approximate memory requirements for a given number of tags in bytes.
265
- */
266
- static getBytesRequired(count: number) {
267
- return (
268
- count * Uint32Array.BYTES_PER_ELEMENT + // tagStart
269
- count * Uint8Array.BYTES_PER_ELEMENT // tagCount
270
- )
271
- }
272
-
273
- /**
274
- * Reconstruct a Tags index from transferable objects.
275
- */
276
- static fromTransferables(
277
- stringTable: StringTable,
278
- transferables: TagsTransferables,
279
- ) {
280
- const tagIndex = new Tags(stringTable, transferables)
281
- tagIndex.indexBuilt = true
282
- return tagIndex
283
- }
284
-
285
- /**
286
- * Update a ContentHasher with the tags data.
287
- * Hashes tag keys and values for each entity.
288
- */
289
- updateHash(hasher: ContentHasher): ContentHasher {
290
- return hasher
291
- .update(this.tagStart.array)
292
- .update(this.tagCount.array)
293
- .update(this.tagKeys.array)
294
- .update(this.tagVals.array)
295
- }
45
+ /** Reference to the shared string table for key/value storage */
46
+ private stringTable: StringTable = new StringTable();
47
+
48
+ // ─── Entity → Tag Lookup ───────────────────────────────────────────────────
49
+ /** Maps entity index → start position in tagKeys/tagVals */
50
+ private tagStart: RTA<Uint32Array>;
51
+ /** Maps entity index → number of tags (max 255) */
52
+ private tagCount: RTA<Uint8Array>;
53
+ /** All tag key string indices, concatenated */
54
+ private tagKeys: RTA<Uint32Array>;
55
+ /** All tag value string indices, concatenated (parallel to tagKeys) */
56
+ private tagVals: RTA<Uint32Array>;
57
+
58
+ // ─── Key → Entity Reverse Lookup ───────────────────────────────────────────
59
+ /**
60
+ * Flattened array of entity indices that have each tag key.
61
+ * Indexed via keyIndexStart and keyIndexCount.
62
+ */
63
+ private keyEntities: RTA<Uint32Array>;
64
+
65
+ /** Maps key string index → start position in keyEntities */
66
+ private keyIndexStart: RTA<Uint32Array>;
67
+ /** Maps key string index → count of entities with that key */
68
+ private keyIndexCount: RTA<Uint32Array>;
69
+
70
+ /**
71
+ * Temporary map used during ingestion to collect entity indices per key.
72
+ * Converted to flat arrays during buildIndex() and then cleared.
73
+ */
74
+ private keyEntityIndexBuilder = new Map<number, number[]>();
75
+
76
+ /** Whether buildIndex() has been called */
77
+ private indexBuilt = false;
78
+
79
+ /**
80
+ * Create a new Tags index.
81
+ */
82
+ constructor(stringTable: StringTable, transferables?: TagsTransferables) {
83
+ this.stringTable = stringTable;
84
+ if (transferables) {
85
+ this.tagStart = RTA.from(Uint32Array, transferables.tagStart);
86
+ this.tagCount = RTA.from(Uint8Array, transferables.tagCount);
87
+ this.tagKeys = RTA.from(Uint32Array, transferables.tagKeys);
88
+ this.tagVals = RTA.from(Uint32Array, transferables.tagVals);
89
+ this.keyEntities = RTA.from(Uint32Array, transferables.keyEntities);
90
+ this.keyIndexStart = RTA.from(Uint32Array, transferables.keyIndexStart);
91
+ this.keyIndexCount = RTA.from(Uint32Array, transferables.keyIndexCount);
92
+ this.indexBuilt = true;
93
+ } else {
94
+ this.tagStart = new RTA(Uint32Array);
95
+ this.tagCount = new RTA(Uint8Array);
96
+ this.tagKeys = new RTA(Uint32Array);
97
+ this.tagVals = new RTA(Uint32Array);
98
+ this.keyEntities = new RTA(Uint32Array);
99
+ this.keyIndexStart = new RTA(Uint32Array);
100
+ this.keyIndexCount = new RTA(Uint32Array);
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Add tags to an entity.
106
+ */
107
+ addTags(index: number, tags?: OsmTags): [number[], number[]] {
108
+ const tagKeys: number[] = [];
109
+ const tagValues: number[] = [];
110
+
111
+ if (tags) {
112
+ for (const [key, value] of Object.entries(tags)) {
113
+ tagKeys.push(this.stringTable.add(key));
114
+ tagValues.push(this.stringTable.add(String(value)));
115
+ }
116
+ }
117
+
118
+ this.addTagKeysAndValues(index, tagKeys, tagValues);
119
+
120
+ return [tagKeys, tagValues];
121
+ }
122
+
123
+ /**
124
+ * Add tags to an entity using key and value indexes.
125
+ */
126
+ addTagKeysAndValues(index: number, keys: number[], values: number[]) {
127
+ this.tagStart.set(index, this.tagKeys.length);
128
+ this.tagCount.set(index, keys.length);
129
+ this.tagKeys.pushMany(keys);
130
+ this.tagVals.pushMany(values);
131
+
132
+ keys.forEach((key) => {
133
+ const keyEntities = this.keyEntityIndexBuilder.get(key);
134
+ if (keyEntities) {
135
+ keyEntities.push(index);
136
+ } else {
137
+ this.keyEntityIndexBuilder.set(key, [index]);
138
+ }
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Finalize the tag index.
144
+ *
145
+ * Compacts arrays and builds the reverse key→entity index.
146
+ * Must be called before `hasKey()`.
147
+ */
148
+ buildIndex() {
149
+ this.tagStart.compact();
150
+ this.tagCount.compact();
151
+ this.tagKeys.compact();
152
+ this.tagVals.compact();
153
+
154
+ // Convert the builder map to flat arrays for the reverse index
155
+ for (const [keyIndex, entityIndexes] of this.keyEntityIndexBuilder) {
156
+ this.keyIndexStart.set(keyIndex, this.keyEntities.length);
157
+ this.keyIndexCount.set(keyIndex, entityIndexes.length);
158
+ this.keyEntities.pushMany(entityIndexes);
159
+ }
160
+
161
+ this.keyIndexStart.compact();
162
+ this.keyIndexCount.compact();
163
+ this.keyEntityIndexBuilder.clear();
164
+
165
+ this.indexBuilt = true;
166
+ }
167
+
168
+ /**
169
+ * Check if the index is built and ready for use.
170
+ */
171
+ isReady() {
172
+ return this.indexBuilt;
173
+ }
174
+
175
+ /**
176
+ * Get the number of tags for an entity.
177
+ */
178
+ cardinality(index: number): number {
179
+ return this.tagCount.at(index) ?? 0;
180
+ }
181
+
182
+ /**
183
+ * Get the tags for an entity.
184
+ */
185
+ getTags(index: number): OsmTags | undefined {
186
+ const tagCount = this.tagCount.at(index) ?? 0;
187
+ if (tagCount === 0) return;
188
+ const tagStart = this.tagStart.at(index) ?? 0;
189
+ const tagKeyIndexes = this.tagKeys.array.slice(tagStart, tagStart + tagCount);
190
+ const tagValIndexes = this.tagVals.array.slice(tagStart, tagStart + tagCount);
191
+ const tags: OsmTags = {};
192
+ for (let i = 0; i < tagCount; i++) {
193
+ const keyIndex = tagKeyIndexes[i];
194
+ const valIndex = tagValIndexes[i];
195
+ if (keyIndex === undefined || valIndex === undefined)
196
+ throw Error("Tag key or value not found");
197
+ tags[this.stringTable.get(keyIndex)] = this.stringTable.get(valIndex);
198
+ }
199
+ return tags;
200
+ }
201
+
202
+ /**
203
+ * Get tags from key and value indexes.
204
+ */
205
+ getTagsFromIndices(keys: number[], values: number[]): OsmTags {
206
+ const tags: OsmTags = {};
207
+ for (let i = 0; i < keys.length; i++) {
208
+ const keyIndex = keys[i];
209
+ const valIndex = values[i];
210
+ if (keyIndex === undefined || valIndex === undefined)
211
+ throw Error("Tag key or value not found");
212
+ tags[this.stringTable.get(keyIndex)] = this.stringTable.get(valIndex);
213
+ }
214
+ return tags;
215
+ }
216
+
217
+ /**
218
+ * Find the index of a tag key.
219
+ */
220
+ find(key: string): number {
221
+ return this.stringTable.find(key);
222
+ }
223
+
224
+ /**
225
+ * Get all entity indexes that have a specific tag key.
226
+ */
227
+ hasKey(keyIndex: number): number[] {
228
+ if (keyIndex < 0) return [];
229
+ const start = this.keyIndexStart.at(keyIndex) ?? 0;
230
+ const count = this.keyIndexCount.at(keyIndex) ?? 0;
231
+ return Array.from(this.keyEntities.array.subarray(start, start + count));
232
+ }
233
+
234
+ /**
235
+ * Create a unique composite index for a key=value pair.
236
+ * Uses row-major indexing: `key * width + val`.
237
+ */
238
+ kvToIndex(key: number, val: number) {
239
+ const width = this.stringTable.length;
240
+ return key * width + val;
241
+ }
242
+
243
+ /**
244
+ * Get transferable objects for passing to another thread.
245
+ */
246
+ transferables(): TagsTransferables {
247
+ return {
248
+ tagStart: this.tagStart.array.buffer,
249
+ tagCount: this.tagCount.array.buffer,
250
+ tagKeys: this.tagKeys.array.buffer,
251
+ tagVals: this.tagVals.array.buffer,
252
+ keyEntities: this.keyEntities.array.buffer,
253
+ keyIndexStart: this.keyIndexStart.array.buffer,
254
+ keyIndexCount: this.keyIndexCount.array.buffer,
255
+ };
256
+ }
257
+
258
+ /**
259
+ * Get the approximate memory requirements for a given number of tags in bytes.
260
+ */
261
+ static getBytesRequired(count: number) {
262
+ return (
263
+ count * Uint32Array.BYTES_PER_ELEMENT + // tagStart
264
+ count * Uint8Array.BYTES_PER_ELEMENT // tagCount
265
+ );
266
+ }
267
+
268
+ /**
269
+ * Reconstruct a Tags index from transferable objects.
270
+ */
271
+ static fromTransferables(stringTable: StringTable, transferables: TagsTransferables) {
272
+ const tagIndex = new Tags(stringTable, transferables);
273
+ tagIndex.indexBuilt = true;
274
+ return tagIndex;
275
+ }
276
+
277
+ /**
278
+ * Update a ContentHasher with the tags data.
279
+ * Hashes tag keys and values for each entity.
280
+ */
281
+ updateHash(hasher: ContentHasher): ContentHasher {
282
+ return hasher
283
+ .update(this.tagStart.array)
284
+ .update(this.tagCount.array)
285
+ .update(this.tagKeys.array)
286
+ .update(this.tagVals.array);
287
+ }
296
288
  }