@conloca/content-api 0.1.15 → 0.1.16

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 (187) hide show
  1. package/dist/asset-manifest.d.ts +23 -0
  2. package/dist/asset-manifest.d.ts.map +1 -0
  3. package/dist/asset-manifest.js +73 -0
  4. package/dist/asset-operations.d.ts +159 -0
  5. package/dist/asset-operations.d.ts.map +1 -0
  6. package/dist/asset-operations.js +736 -0
  7. package/dist/asset-types.d.ts +56 -0
  8. package/dist/asset-types.d.ts.map +1 -0
  9. package/dist/asset-types.js +7 -0
  10. package/dist/base-content-index.d.ts +57 -0
  11. package/dist/base-content-index.d.ts.map +1 -0
  12. package/dist/base-content-index.js +179 -0
  13. package/dist/block-index.d.ts +9 -0
  14. package/dist/block-index.d.ts.map +1 -0
  15. package/dist/block-index.js +11 -0
  16. package/dist/blocks.d.ts +16 -0
  17. package/dist/blocks.d.ts.map +1 -0
  18. package/dist/blocks.js +103 -0
  19. package/dist/cf-access.d.ts +31 -0
  20. package/dist/cf-access.d.ts.map +1 -0
  21. package/dist/cf-access.js +66 -0
  22. package/dist/component-registry.d.ts +50 -0
  23. package/dist/component-registry.d.ts.map +1 -0
  24. package/dist/component-registry.js +120 -0
  25. package/dist/{component-registry.types-CBGONnYn.d.mts → component-registry.types-C0ctF9nh.d.mts} +1 -1
  26. package/dist/component-registry.types-C0ctF9nh.d.mts.map +1 -0
  27. package/dist/component-registry.types.d.ts +11 -0
  28. package/dist/component-registry.types.d.ts.map +1 -0
  29. package/dist/component-registry.types.js +1 -0
  30. package/dist/content-api.interface.d.ts +64 -0
  31. package/dist/content-api.interface.d.ts.map +1 -0
  32. package/dist/content-api.interface.js +1 -0
  33. package/dist/content-filters.d.ts +31 -0
  34. package/dist/content-filters.d.ts.map +1 -0
  35. package/dist/content-filters.js +246 -0
  36. package/dist/content-index-D092_vk1.mjs +629 -0
  37. package/dist/content-index-D092_vk1.mjs.map +1 -0
  38. package/dist/content-index-D6IVMmAB.d.mts +127 -0
  39. package/dist/content-index-D6IVMmAB.d.mts.map +1 -0
  40. package/dist/content-index.d.ts +126 -0
  41. package/dist/content-index.d.ts.map +1 -0
  42. package/dist/content-index.js +418 -0
  43. package/dist/content-operations-DIbsxG5A.d.mts +354 -0
  44. package/dist/content-operations-DIbsxG5A.d.mts.map +1 -0
  45. package/dist/content-operations.d.ts +93 -0
  46. package/dist/content-operations.d.ts.map +1 -0
  47. package/dist/content-operations.js +275 -0
  48. package/dist/content-reader.d.ts +10 -0
  49. package/dist/content-reader.d.ts.map +1 -0
  50. package/dist/content-reader.js +13 -0
  51. package/dist/content-utils-fWNHTrPy.mjs +280 -0
  52. package/dist/content-utils-fWNHTrPy.mjs.map +1 -0
  53. package/dist/content-utils.d.ts +132 -0
  54. package/dist/content-utils.d.ts.map +1 -0
  55. package/dist/content-utils.js +352 -0
  56. package/dist/content-watcher.d.ts +43 -0
  57. package/dist/content-watcher.d.ts.map +1 -0
  58. package/dist/content-watcher.js +83 -0
  59. package/dist/{data-Db1Iv9T0.mjs → data-DquNIEnQ.mjs} +4 -2
  60. package/dist/{data-Db1Iv9T0.mjs.map → data-DquNIEnQ.mjs.map} +1 -1
  61. package/dist/data-index.d.ts +8 -0
  62. package/dist/data-index.d.ts.map +1 -0
  63. package/dist/data-index.js +7 -0
  64. package/dist/data.d.ts +43 -0
  65. package/dist/data.d.ts.map +1 -0
  66. package/dist/data.js +103 -0
  67. package/dist/etag-utils.d.ts +77 -0
  68. package/dist/etag-utils.d.ts.map +1 -0
  69. package/dist/etag-utils.js +160 -0
  70. package/dist/filesystem-content-api-B1KIQJfk.mjs +2 -0
  71. package/dist/{filesystem-content-api-kxKY5IUw.mjs → filesystem-content-api-C0HIhqZi.mjs} +172 -1230
  72. package/dist/filesystem-content-api-C0HIhqZi.mjs.map +1 -0
  73. package/dist/{filesystem-content-api-C1TM0GLo.d.mts → filesystem-content-api-DCdNi-co.d.mts} +19 -4
  74. package/dist/filesystem-content-api-DCdNi-co.d.mts.map +1 -0
  75. package/dist/filesystem-content-api.d.ts +135 -0
  76. package/dist/filesystem-content-api.d.ts.map +1 -0
  77. package/dist/filesystem-content-api.js +2181 -0
  78. package/dist/git-operations.d.ts +49 -0
  79. package/dist/git-operations.d.ts.map +1 -0
  80. package/dist/git-operations.js +252 -0
  81. package/dist/header-parser.d.ts +37 -0
  82. package/dist/header-parser.d.ts.map +1 -0
  83. package/dist/header-parser.js +286 -0
  84. package/dist/in-memory-content-api.d.ts +35 -0
  85. package/dist/in-memory-content-api.d.ts.map +1 -0
  86. package/dist/in-memory-content-api.js +591 -0
  87. package/dist/index-DxVTFK66.d.mts +105 -0
  88. package/dist/index-DxVTFK66.d.mts.map +1 -0
  89. package/dist/index.d.mts +6 -5
  90. package/dist/index.d.mts.map +1 -1
  91. package/dist/index.d.ts +19 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +16 -0
  94. package/dist/index.mjs +37 -6
  95. package/dist/index.mjs.map +1 -1
  96. package/dist/indexing.d.mts +152 -0
  97. package/dist/indexing.d.mts.map +1 -0
  98. package/dist/indexing.d.ts +5 -0
  99. package/dist/indexing.d.ts.map +1 -0
  100. package/dist/indexing.js +7 -0
  101. package/dist/indexing.mjs +255 -0
  102. package/dist/indexing.mjs.map +1 -0
  103. package/dist/json-whitespace-view.d.ts +32 -0
  104. package/dist/json-whitespace-view.d.ts.map +1 -0
  105. package/dist/json-whitespace-view.js +152 -0
  106. package/dist/middleware.d.ts +20 -0
  107. package/dist/middleware.d.ts.map +1 -0
  108. package/dist/middleware.js +1031 -0
  109. package/dist/node.d.mts +10 -15
  110. package/dist/node.d.mts.map +1 -1
  111. package/dist/node.d.ts +25 -0
  112. package/dist/node.d.ts.map +1 -0
  113. package/dist/node.js +24 -0
  114. package/dist/node.mjs +89 -135
  115. package/dist/node.mjs.map +1 -1
  116. package/dist/reader.d.mts +5 -8
  117. package/dist/reader.d.mts.map +1 -1
  118. package/dist/reader.d.ts +15 -0
  119. package/dist/reader.d.ts.map +1 -0
  120. package/dist/reader.js +13 -0
  121. package/dist/reader.mjs +8 -8
  122. package/dist/reader.mjs.map +1 -1
  123. package/dist/schemas/index.d.mts +2 -90
  124. package/dist/schemas/index.d.ts +102 -0
  125. package/dist/schemas/index.d.ts.map +1 -0
  126. package/dist/schemas/index.js +87 -0
  127. package/dist/schemas/index.mjs +2 -70
  128. package/dist/schemas-CFRD0FIQ.mjs +84 -0
  129. package/dist/schemas-CFRD0FIQ.mjs.map +1 -0
  130. package/dist/{site-vNtJ5jCh.mjs → site-8oaj1Q60.mjs} +21 -193
  131. package/dist/site-8oaj1Q60.mjs.map +1 -0
  132. package/dist/site-index-B_254bCc.d.mts +136 -0
  133. package/dist/site-index-B_254bCc.d.mts.map +1 -0
  134. package/dist/site-index.d.ts +60 -0
  135. package/dist/site-index.d.ts.map +1 -0
  136. package/dist/site-index.js +287 -0
  137. package/dist/site.d.ts +21 -0
  138. package/dist/site.d.ts.map +1 -0
  139. package/dist/site.js +168 -0
  140. package/dist/{types-DWt912tu.mjs → types-DOdldbfD.mjs} +3 -2
  141. package/dist/types-DOdldbfD.mjs.map +1 -0
  142. package/dist/types-DjfhS272.d.mts +456 -0
  143. package/dist/types-DjfhS272.d.mts.map +1 -0
  144. package/dist/types.d.ts +453 -0
  145. package/dist/types.d.ts.map +1 -0
  146. package/dist/types.js +36 -0
  147. package/dist/url-safe-base64.d.ts +12 -0
  148. package/dist/url-safe-base64.d.ts.map +1 -0
  149. package/dist/url-safe-base64.js +40 -0
  150. package/dist/url-validation.d.ts +14 -0
  151. package/dist/url-validation.d.ts.map +1 -0
  152. package/dist/url-validation.js +81 -0
  153. package/dist/utils/atomic-write.d.ts +6 -0
  154. package/dist/utils/atomic-write.d.ts.map +1 -0
  155. package/dist/utils/atomic-write.js +20 -0
  156. package/dist/utils.d.ts +46 -0
  157. package/dist/utils.d.ts.map +1 -0
  158. package/dist/utils.js +70 -0
  159. package/dist/vite-plugin.d.ts +12 -0
  160. package/dist/vite-plugin.d.ts.map +1 -0
  161. package/dist/vite-plugin.js +29 -0
  162. package/dist/vxjson-qHrgLGip.mjs +555 -0
  163. package/dist/vxjson-qHrgLGip.mjs.map +1 -0
  164. package/dist/vxjson-serialize-geF6qvpn.mjs +34 -0
  165. package/dist/vxjson-serialize-geF6qvpn.mjs.map +1 -0
  166. package/dist/vxjson-serialize.d.mts +17 -0
  167. package/dist/vxjson-serialize.d.mts.map +1 -0
  168. package/dist/vxjson-serialize.d.ts +14 -0
  169. package/dist/vxjson-serialize.d.ts.map +1 -0
  170. package/dist/vxjson-serialize.js +50 -0
  171. package/dist/vxjson-serialize.mjs +2 -0
  172. package/dist/vxjson.d.ts +112 -0
  173. package/dist/vxjson.d.ts.map +1 -0
  174. package/dist/vxjson.js +391 -0
  175. package/dist/xxhash.d.ts +10 -0
  176. package/dist/xxhash.d.ts.map +1 -0
  177. package/dist/xxhash.js +31 -0
  178. package/package.json +79 -17
  179. package/dist/component-registry.types-CBGONnYn.d.mts.map +0 -1
  180. package/dist/content-operations-Dv67amz3.d.mts +0 -852
  181. package/dist/content-operations-Dv67amz3.d.mts.map +0 -1
  182. package/dist/filesystem-content-api-C1TM0GLo.d.mts.map +0 -1
  183. package/dist/filesystem-content-api-kxKY5IUw.mjs.map +0 -1
  184. package/dist/schemas/index.d.mts.map +0 -1
  185. package/dist/schemas/index.mjs.map +0 -1
  186. package/dist/site-vNtJ5jCh.mjs.map +0 -1
  187. package/dist/types-DWt912tu.mjs.map +0 -1
@@ -0,0 +1,418 @@
1
+ import { BlockIndex } from './block-index';
2
+ import { localesOf, mapSiteNames } from './content-utils';
3
+ import { DataIndex } from './data-index';
4
+ import { SiteIndex } from './site-index';
5
+ /**
6
+ * ContentIndex coordinates between per-site indexes and the block index
7
+ * This provides efficient filtering by routing to the appropriate specialized index
8
+ */
9
+ // Use global registry to survive module reloads in development
10
+ const globalCache = globalThis.__CONLOCA_CONTENT_INDEX_CACHE__ || {};
11
+ if (!globalThis.__CONLOCA_CONTENT_INDEX_CACHE__) {
12
+ globalThis.__CONLOCA_CONTENT_INDEX_CACHE__ = globalCache;
13
+ }
14
+ export class ContentIndex {
15
+ sitesConfig;
16
+ // Use global cache instead of static cache
17
+ static get cache() {
18
+ return globalCache;
19
+ }
20
+ // Per-site indexes using V8-optimized object
21
+ siteIndexes;
22
+ // Single block index
23
+ blockIndex;
24
+ // Single data index
25
+ dataIndex;
26
+ constructor(sitesConfig) {
27
+ this.sitesConfig = sitesConfig;
28
+ // Initialize block index
29
+ this.blockIndex = new BlockIndex(sitesConfig.globalLocales);
30
+ // Initialize data index
31
+ this.dataIndex = new DataIndex();
32
+ // Initialize V8-optimized site indexes
33
+ this.siteIndexes = mapSiteNames(sitesConfig, (siteName) => {
34
+ const siteConfig = sitesConfig.sites[siteName];
35
+ return new SiteIndex(siteName, siteConfig.locales);
36
+ });
37
+ }
38
+ /**
39
+ * Get cached index or create a new one
40
+ */
41
+ static async getCachedOrCreate(contentRoot, sitesConfig) {
42
+ if (!ContentIndex.cache[contentRoot]) {
43
+ ContentIndex.cache[contentRoot] = new ContentIndex(sitesConfig);
44
+ }
45
+ return ContentIndex.cache[contentRoot];
46
+ }
47
+ /**
48
+ * Clear all cached indexes
49
+ */
50
+ static clearCache() {
51
+ for (const key of Object.keys(globalCache)) {
52
+ delete globalCache[key];
53
+ }
54
+ }
55
+ /**
56
+ * Create a new index without caching - for testing
57
+ */
58
+ static createUncached(sitesConfig) {
59
+ return new ContentIndex(sitesConfig);
60
+ }
61
+ /**
62
+ * Add or update content in the appropriate index
63
+ * Updates a single locale's manifest and content cache if provided
64
+ */
65
+ addContent(identity, localeVersion, content) {
66
+ // Validate that blocks and data don't have a site
67
+ if ((identity.kind === 'block' || identity.kind === 'data') && identity.site) {
68
+ throw new Error(`${identity.kind} cannot have a site property`);
69
+ }
70
+ // Validate that pages must have a site
71
+ if (identity.kind === 'page' && !identity.site) {
72
+ throw new Error('Pages must have a site property');
73
+ }
74
+ if (identity.kind === 'block') {
75
+ this.blockIndex.addContent(identity, localeVersion, content);
76
+ }
77
+ else if (identity.kind === 'data') {
78
+ this.dataIndex.addContent(identity, localeVersion, content);
79
+ }
80
+ else {
81
+ const siteIndex = this.siteIndexes[identity.site];
82
+ if (siteIndex) {
83
+ siteIndex.addContent(identity, localeVersion, content);
84
+ }
85
+ }
86
+ }
87
+ /**
88
+ * Remove a specific locale from content
89
+ */
90
+ removeLocale(id, locale) {
91
+ const manifest = this.getManifest(id);
92
+ if (!manifest)
93
+ return;
94
+ // Remove from the appropriate index
95
+ if (manifest.kind === 'block') {
96
+ this.blockIndex.removeLocale(id, locale);
97
+ }
98
+ else if (manifest.kind === 'data') {
99
+ this.dataIndex.removeLocale(id, locale);
100
+ }
101
+ else {
102
+ const siteIndex = this.siteIndexes[manifest.site];
103
+ if (siteIndex) {
104
+ siteIndex.removeLocale(id, locale);
105
+ }
106
+ }
107
+ }
108
+ /**
109
+ * Get cached content
110
+ */
111
+ getCachedContent(id, locale) {
112
+ const manifest = this.getManifest(id);
113
+ if (!manifest)
114
+ return null;
115
+ if (manifest.kind === 'block') {
116
+ return this.blockIndex.getCachedContent(id, locale);
117
+ }
118
+ if (manifest.kind === 'data') {
119
+ return this.dataIndex.getCachedContent(id, locale);
120
+ }
121
+ const siteIndex = this.siteIndexes[manifest.site];
122
+ return siteIndex ? siteIndex.getCachedContent(id, locale) : null;
123
+ }
124
+ /**
125
+ * Remove an entry from all indexes
126
+ */
127
+ removeEntry(id) {
128
+ // Try blocks first
129
+ this.blockIndex.removeEntry(id);
130
+ // Try data
131
+ this.dataIndex.removeEntry(id);
132
+ // Then try each site
133
+ for (const site in this.siteIndexes) {
134
+ const siteIndex = this.siteIndexes[site];
135
+ if (siteIndex) {
136
+ siteIndex.removeEntry(id);
137
+ }
138
+ }
139
+ }
140
+ /**
141
+ * Get content manifest for a content ID
142
+ */
143
+ getManifest(id) {
144
+ // Check blocks first
145
+ let manifest = this.blockIndex.getManifest(id);
146
+ if (manifest)
147
+ return manifest;
148
+ // Check data
149
+ manifest = this.dataIndex.getManifest(id);
150
+ if (manifest)
151
+ return manifest;
152
+ // Then check each site
153
+ for (const site in this.siteIndexes) {
154
+ const siteIndex = this.siteIndexes[site];
155
+ if (siteIndex) {
156
+ manifest = siteIndex.getManifest(id);
157
+ if (manifest)
158
+ return manifest;
159
+ }
160
+ }
161
+ return null;
162
+ }
163
+ /**
164
+ * Get a specific locale manifest
165
+ */
166
+ getLocaleVersion(id, locale) {
167
+ const manifest = this.getManifest(id);
168
+ if (!manifest)
169
+ return null;
170
+ return manifest.locales[locale] || null;
171
+ }
172
+ /**
173
+ * Get site index
174
+ */
175
+ getSiteIndex(site) {
176
+ return this.siteIndexes[site] || null;
177
+ }
178
+ /**
179
+ * Get block index
180
+ */
181
+ getBlockIndex() {
182
+ return this.blockIndex;
183
+ }
184
+ /**
185
+ * Find content by pathname (delegates to site indexes)
186
+ */
187
+ getByPathname(site, pathname, locale) {
188
+ const siteIndex = this.siteIndexes[site];
189
+ return siteIndex ? siteIndex.getByPathname(pathname, locale) : null;
190
+ }
191
+ /**
192
+ * Find content by previous pathname (for redirects)
193
+ */
194
+ getByPreviousPathname(site, pathname, locale) {
195
+ const siteIndex = this.siteIndexes[site];
196
+ return siteIndex ? siteIndex.getByPreviousPathname(pathname, locale) : null;
197
+ }
198
+ /**
199
+ * Find block by name
200
+ */
201
+ getBlockByName(collection, name, locale) {
202
+ return this.blockIndex.getByName(collection, name, locale);
203
+ }
204
+ /**
205
+ * Get data index
206
+ */
207
+ getDataIndex() {
208
+ return this.dataIndex;
209
+ }
210
+ /**
211
+ * Find data entry by name
212
+ */
213
+ getDataByName(collection, name, locale) {
214
+ return this.dataIndex.getByName(collection, name, locale);
215
+ }
216
+ /**
217
+ * Get all collections for data
218
+ */
219
+ getDataCollections() {
220
+ return this.dataIndex.collections;
221
+ }
222
+ /**
223
+ * List all content (for iteration)
224
+ */
225
+ *listAllContent() {
226
+ // Yield all blocks
227
+ yield* this.blockIndex.getAllManifests();
228
+ // Yield all data entries
229
+ yield* this.dataIndex.getAllManifests();
230
+ // Yield all site entries
231
+ for (const site in this.siteIndexes) {
232
+ const siteIndex = this.siteIndexes[site];
233
+ if (siteIndex) {
234
+ yield* siteIndex.getAllManifests();
235
+ }
236
+ }
237
+ }
238
+ /**
239
+ * Generator for all sites
240
+ */
241
+ *allSites() {
242
+ for (const site in this.siteIndexes) {
243
+ if (this.siteIndexes[site]) {
244
+ yield site;
245
+ }
246
+ }
247
+ }
248
+ /**
249
+ * Get all collections for a site
250
+ */
251
+ getCollectionsForSite(site) {
252
+ const siteIndex = this.siteIndexes[site];
253
+ return siteIndex ? siteIndex.collections : new Set();
254
+ }
255
+ /**
256
+ * Get all collections for blocks
257
+ */
258
+ getBlockCollections() {
259
+ return this.blockIndex.collections;
260
+ }
261
+ /**
262
+ * Get default locale for a site
263
+ */
264
+ getDefaultLocale(site) {
265
+ // This method should only be called for pages, but handle gracefully
266
+ if (!site) {
267
+ return this.sitesConfig.globalLocales[0];
268
+ }
269
+ const siteConfig = this.sitesConfig.sites[site];
270
+ return siteConfig?.defaultLocale || this.sitesConfig.globalLocales[0];
271
+ }
272
+ /**
273
+ * Find content missing a specific locale
274
+ */
275
+ *findUntranslatedContent(targetLocale, options) {
276
+ // Always check blocks as they don't belong to any site
277
+ for (const manifest of this.blockIndex.getAllManifests()) {
278
+ if (!manifest.locales[targetLocale]) {
279
+ // Check if we should include unpublished content
280
+ if (!options?.includeUnpublished) {
281
+ // Need to check if any locale is published
282
+ let hasPublishedLocale = false;
283
+ for (const locale of localesOf(manifest)) {
284
+ if (!locale.unpublishAt || new Date(locale.unpublishAt) > new Date()) {
285
+ hasPublishedLocale = true;
286
+ break;
287
+ }
288
+ }
289
+ if (!hasPublishedLocale)
290
+ continue;
291
+ }
292
+ yield manifest;
293
+ }
294
+ }
295
+ // Check each site
296
+ for (const siteName in this.siteIndexes) {
297
+ const siteIndex = this.siteIndexes[siteName];
298
+ if (!siteIndex || options?.excludeSites?.includes(siteName))
299
+ continue;
300
+ for (const manifest of siteIndex.getAllManifests()) {
301
+ if (!manifest.locales[targetLocale]) {
302
+ // Check if we should include unpublished content
303
+ if (!options?.includeUnpublished) {
304
+ let hasPublishedLocale = false;
305
+ for (const locale of localesOf(manifest)) {
306
+ if (!locale.unpublishAt || new Date(locale.unpublishAt) > new Date()) {
307
+ hasPublishedLocale = true;
308
+ break;
309
+ }
310
+ }
311
+ if (!hasPublishedLocale)
312
+ continue;
313
+ }
314
+ yield manifest;
315
+ }
316
+ }
317
+ }
318
+ }
319
+ /**
320
+ * Generators for efficient filtering
321
+ */
322
+ *getManifestsForKind(kind) {
323
+ if (kind === 'block') {
324
+ yield* this.blockIndex.getAllManifests();
325
+ }
326
+ else if (kind === 'data') {
327
+ yield* this.dataIndex.getAllManifests();
328
+ }
329
+ else {
330
+ for (const site in this.siteIndexes) {
331
+ const siteIndex = this.siteIndexes[site];
332
+ if (siteIndex) {
333
+ yield* siteIndex.getAllManifests();
334
+ }
335
+ }
336
+ }
337
+ }
338
+ *getManifestsForSite(site) {
339
+ const siteIndex = this.siteIndexes[site];
340
+ if (siteIndex) {
341
+ yield* siteIndex.getAllManifests();
342
+ }
343
+ }
344
+ *getManifestsForSiteLocale(site, locale) {
345
+ const siteIndex = this.siteIndexes[site];
346
+ if (siteIndex) {
347
+ yield* siteIndex.getManifestsByLocale(locale);
348
+ }
349
+ }
350
+ *getManifestsForSiteCollection(site, collection) {
351
+ // For regular sites, we need to filter by collection
352
+ const siteIndex = this.siteIndexes[site];
353
+ if (siteIndex) {
354
+ for (const manifest of siteIndex.getAllManifests()) {
355
+ if (manifest.collection === collection) {
356
+ yield manifest;
357
+ }
358
+ }
359
+ }
360
+ }
361
+ *getManifestsForLocale(locale) {
362
+ // Yield from blocks
363
+ yield* this.blockIndex.getManifestsByLocale(locale);
364
+ // Yield from data
365
+ yield* this.dataIndex.getManifestsByLocale(locale);
366
+ // Yield from all sites
367
+ for (const site in this.siteIndexes) {
368
+ const siteIndex = this.siteIndexes[site];
369
+ if (siteIndex) {
370
+ yield* siteIndex.getManifestsByLocale(locale);
371
+ }
372
+ }
373
+ }
374
+ *getManifestsForCollection(collection) {
375
+ // Check blocks first
376
+ yield* this.blockIndex.getManifestsByCollection(collection);
377
+ // Check data
378
+ yield* this.dataIndex.getManifestsByCollection(collection);
379
+ // Then check all sites
380
+ for (const site in this.siteIndexes) {
381
+ const siteIndex = this.siteIndexes[site];
382
+ if (siteIndex) {
383
+ for (const manifest of siteIndex.getAllManifests()) {
384
+ if (manifest.collection === collection) {
385
+ yield manifest;
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+ /**
392
+ * Get the count of indexed content entries
393
+ */
394
+ get entryCount() {
395
+ let count = this.blockIndex.entryCount;
396
+ count += this.dataIndex.entryCount;
397
+ for (const site in this.siteIndexes) {
398
+ const siteIndex = this.siteIndexes[site];
399
+ if (siteIndex) {
400
+ count += siteIndex.entryCount;
401
+ }
402
+ }
403
+ return count;
404
+ }
405
+ /**
406
+ * Clear all indexes
407
+ */
408
+ clear() {
409
+ this.blockIndex.clear();
410
+ this.dataIndex.clear();
411
+ for (const site in this.siteIndexes) {
412
+ const siteIndex = this.siteIndexes[site];
413
+ if (siteIndex) {
414
+ siteIndex.clear();
415
+ }
416
+ }
417
+ }
418
+ }