@okf/ootils 1.6.13 → 1.7.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.
- package/dist/browser.d.mts +89 -1
- package/dist/browser.d.ts +89 -1
- package/dist/browser.js +111 -0
- package/dist/browser.mjs +110 -0
- package/dist/node.d.mts +89 -1
- package/dist/node.d.ts +89 -1
- package/dist/node.js +111 -0
- package/dist/node.mjs +110 -0
- package/dist/universal.d.mts +89 -1
- package/dist/universal.d.ts +89 -1
- package/dist/universal.js +111 -0
- package/dist/universal.mjs +110 -0
- package/package.json +1 -1
package/dist/node.d.ts
CHANGED
|
@@ -158,6 +158,51 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
158
158
|
blockPathPrefix?: string;
|
|
159
159
|
}) => void;
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Calculates all possible rollup relationships for a tag type
|
|
163
|
+
*
|
|
164
|
+
* Rollups allow indirect filtering (e.g., filter stories by topic type where stories are tagged with topics)
|
|
165
|
+
*
|
|
166
|
+
* Returns two types of possibilities:
|
|
167
|
+
* 1. **valuePathType**: Direct field rollups within the tag (e.g., topics.main.category)
|
|
168
|
+
* 2. **tagType**: Nested tag chain rollups (e.g., topics → themes → categories)
|
|
169
|
+
*
|
|
170
|
+
* Performance optimizations:
|
|
171
|
+
* - Caches template blocks to avoid repeated extractAllBlocksFromTpl calls
|
|
172
|
+
* - Limits recursion depth to MAX_DEPTH_ROLLUP_POSSIBILITIES (10 levels)
|
|
173
|
+
*
|
|
174
|
+
* @param {Object} params - Parameters object
|
|
175
|
+
* @param {string} params.tagType - The tag type to find rollup possibilities for (e.g., 'topics', 'districts')
|
|
176
|
+
* @param {Array} params.allTpls - All templates in the system
|
|
177
|
+
*
|
|
178
|
+
* @returns {Array} Array of rollup possibilities
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* // Input:
|
|
182
|
+
* getRollupPossibilities({ tagType: 'topics', allTpls: [...] })
|
|
183
|
+
*
|
|
184
|
+
* // Output:
|
|
185
|
+
* [
|
|
186
|
+
* {
|
|
187
|
+
* rollupType: 'valuePathType',
|
|
188
|
+
* tagTypeCollectionToRollup: 'topics',
|
|
189
|
+
* valuePathInRolledUpCollection: 'main.category.value',
|
|
190
|
+
* filterSourceValuePath: 'main.category',
|
|
191
|
+
* blockValuePath: 'main.category',
|
|
192
|
+
* filterDisplay: 'Topic Category'
|
|
193
|
+
* },
|
|
194
|
+
* {
|
|
195
|
+
* rollupType: 'tagType',
|
|
196
|
+
* tagTypeCollectionToRollup: 'topics',
|
|
197
|
+
* rollupPath: ['topics', 'themes']
|
|
198
|
+
* }
|
|
199
|
+
* ]
|
|
200
|
+
*/
|
|
201
|
+
declare function getRollupPossibilities({ tagType, allTpls }: {
|
|
202
|
+
tagType: string;
|
|
203
|
+
allTpls: any[];
|
|
204
|
+
}): any[];
|
|
205
|
+
|
|
161
206
|
declare namespace BASE_BULLMQ_CONFIG {
|
|
162
207
|
namespace PLUGIN__MAD_USERS_SYNC_QUEUE {
|
|
163
208
|
let id: string;
|
|
@@ -486,6 +531,49 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
486
531
|
}
|
|
487
532
|
export { workerConfig_7 as workerConfig };
|
|
488
533
|
}
|
|
534
|
+
namespace CONTENT_ELASTIC_SYNC_QUEUE {
|
|
535
|
+
let id_8: string;
|
|
536
|
+
export { id_8 as id };
|
|
537
|
+
export namespace queueConfig_8 {
|
|
538
|
+
export namespace defaultJobOptions_8 {
|
|
539
|
+
let attempts_8: number;
|
|
540
|
+
export { attempts_8 as attempts };
|
|
541
|
+
export namespace backoff_8 {
|
|
542
|
+
let type_8: string;
|
|
543
|
+
export { type_8 as type };
|
|
544
|
+
let delay_8: number;
|
|
545
|
+
export { delay_8 as delay };
|
|
546
|
+
}
|
|
547
|
+
export { backoff_8 as backoff };
|
|
548
|
+
let removeOnComplete_8: number;
|
|
549
|
+
export { removeOnComplete_8 as removeOnComplete };
|
|
550
|
+
let removeOnFail_8: number;
|
|
551
|
+
export { removeOnFail_8 as removeOnFail };
|
|
552
|
+
}
|
|
553
|
+
export { defaultJobOptions_8 as defaultJobOptions };
|
|
554
|
+
export namespace streams_8 {
|
|
555
|
+
export namespace events_8 {
|
|
556
|
+
let maxLen_8: number;
|
|
557
|
+
export { maxLen_8 as maxLen };
|
|
558
|
+
}
|
|
559
|
+
export { events_8 as events };
|
|
560
|
+
}
|
|
561
|
+
export { streams_8 as streams };
|
|
562
|
+
}
|
|
563
|
+
export { queueConfig_8 as queueConfig };
|
|
564
|
+
export namespace workerConfig_8 {
|
|
565
|
+
let concurrency_8: number;
|
|
566
|
+
export { concurrency_8 as concurrency };
|
|
567
|
+
export namespace limiter_8 {
|
|
568
|
+
let max_8: number;
|
|
569
|
+
export { max_8 as max };
|
|
570
|
+
let duration_8: number;
|
|
571
|
+
export { duration_8 as duration };
|
|
572
|
+
}
|
|
573
|
+
export { limiter_8 as limiter };
|
|
574
|
+
}
|
|
575
|
+
export { workerConfig_8 as workerConfig };
|
|
576
|
+
}
|
|
489
577
|
}
|
|
490
578
|
|
|
491
579
|
interface PlatformContextContentItem {
|
|
@@ -1030,4 +1118,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
1030
1118
|
};
|
|
1031
1119
|
}): Object;
|
|
1032
1120
|
|
|
1033
|
-
export { AIChatSchema, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getTplModelByTenant, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
|
1121
|
+
export { AIChatSchema, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getTplModelByTenant, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
package/dist/node.js
CHANGED
|
@@ -186,6 +186,7 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
|
|
|
186
186
|
},
|
|
187
187
|
workerConfig: {
|
|
188
188
|
concurrency: 1,
|
|
189
|
+
// Cannot mess with this else duplicate options in tpl, maybe even duplicate tags
|
|
189
190
|
limiter: {
|
|
190
191
|
max: 20,
|
|
191
192
|
// Max 5 jobs per...
|
|
@@ -280,6 +281,35 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
|
|
|
280
281
|
// ...60 seconds (higher throughput for chunking)
|
|
281
282
|
}
|
|
282
283
|
}
|
|
284
|
+
},
|
|
285
|
+
CONTENT_ELASTIC_SYNC_QUEUE: {
|
|
286
|
+
id: "content-elastic-sync-queue",
|
|
287
|
+
queueConfig: {
|
|
288
|
+
defaultJobOptions: {
|
|
289
|
+
attempts: 3,
|
|
290
|
+
backoff: {
|
|
291
|
+
type: "exponential",
|
|
292
|
+
delay: 2e3
|
|
293
|
+
},
|
|
294
|
+
removeOnComplete: 30,
|
|
295
|
+
removeOnFail: 100
|
|
296
|
+
},
|
|
297
|
+
streams: {
|
|
298
|
+
events: {
|
|
299
|
+
maxLen: 10
|
|
300
|
+
// Keep very low, cuz we dont really use historical stream events as of now
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
workerConfig: {
|
|
305
|
+
concurrency: 5,
|
|
306
|
+
limiter: {
|
|
307
|
+
max: 200,
|
|
308
|
+
// (lets always keep this same as content enhance & embed since it comes immediately after)
|
|
309
|
+
duration: 6e4
|
|
310
|
+
// ...60 seconds (higher throughput for chunking)
|
|
311
|
+
}
|
|
312
|
+
}
|
|
283
313
|
}
|
|
284
314
|
};
|
|
285
315
|
}
|
|
@@ -1390,6 +1420,7 @@ __export(node_exports, {
|
|
|
1390
1420
|
getModelByTenant: () => import_getModelByTenant2.getModelByTenant,
|
|
1391
1421
|
getPlatformConfigsModelByTenant: () => import_getModelByTenant2.getPlatformConfigsModelByTenant,
|
|
1392
1422
|
getPlatformContextContent: () => getPlatformContextContent,
|
|
1423
|
+
getRollupPossibilities: () => getRollupPossibilities,
|
|
1393
1424
|
getTplModelByTenant: () => import_getModelByTenant2.getTplModelByTenant,
|
|
1394
1425
|
getVal: () => getVal,
|
|
1395
1426
|
recursivelyExtractBlocks: () => _recursExtractBlocks,
|
|
@@ -1673,6 +1704,85 @@ var _extractBlocksFromSomeBuilders = ({
|
|
|
1673
1704
|
}
|
|
1674
1705
|
};
|
|
1675
1706
|
|
|
1707
|
+
// src/utils/getRollupPossibilities.ts
|
|
1708
|
+
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
1709
|
+
function getRollupPossibilities({
|
|
1710
|
+
tagType,
|
|
1711
|
+
allTpls
|
|
1712
|
+
}) {
|
|
1713
|
+
const thisTagTpl = allTpls.find((d) => d.kp_content_type === tagType);
|
|
1714
|
+
if (!thisTagTpl) return [];
|
|
1715
|
+
const allBlocks = extractAllBlocksFromTpl({ tpl: thisTagTpl });
|
|
1716
|
+
const templateBlocksCache = /* @__PURE__ */ new Map();
|
|
1717
|
+
const getCachedTemplateBlocks = (templateTagType) => {
|
|
1718
|
+
if (!templateBlocksCache.has(templateTagType)) {
|
|
1719
|
+
const template = allTpls.find((d) => d.kp_content_type === templateTagType);
|
|
1720
|
+
if (template) {
|
|
1721
|
+
templateBlocksCache.set(templateTagType, extractAllBlocksFromTpl({ tpl: template }));
|
|
1722
|
+
} else {
|
|
1723
|
+
templateBlocksCache.set(templateTagType, []);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
return templateBlocksCache.get(templateTagType);
|
|
1727
|
+
};
|
|
1728
|
+
const findTagChains = (startTagType, visited = [], maxDepth = 10) => {
|
|
1729
|
+
if (visited.includes(startTagType) || visited.length >= maxDepth) {
|
|
1730
|
+
return [];
|
|
1731
|
+
}
|
|
1732
|
+
const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
|
|
1733
|
+
(block) => block.valuePath?.startsWith("tags.")
|
|
1734
|
+
);
|
|
1735
|
+
const chains = [];
|
|
1736
|
+
for (const block of tagBlocks) {
|
|
1737
|
+
const nextTagType = block.props?.tagType;
|
|
1738
|
+
if (nextTagType) {
|
|
1739
|
+
chains.push({
|
|
1740
|
+
rollupType: "tagType",
|
|
1741
|
+
tagTypeCollectionToRollup: tagType,
|
|
1742
|
+
rollupPath: [...visited, startTagType, nextTagType]
|
|
1743
|
+
});
|
|
1744
|
+
if (visited.length < maxDepth - 1) {
|
|
1745
|
+
const nextChains = findTagChains(
|
|
1746
|
+
nextTagType,
|
|
1747
|
+
[...visited, startTagType],
|
|
1748
|
+
maxDepth
|
|
1749
|
+
);
|
|
1750
|
+
chains.push(...nextChains);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
return chains;
|
|
1755
|
+
};
|
|
1756
|
+
const singleLevelValuePathRollups = allBlocks.map((block) => {
|
|
1757
|
+
if (block.props?.options?.length > 0) {
|
|
1758
|
+
return {
|
|
1759
|
+
rollupType: "valuePathType",
|
|
1760
|
+
tagTypeCollectionToRollup: tagType,
|
|
1761
|
+
// Handle both string values and object values (with .value accessor)
|
|
1762
|
+
valuePathInRolledUpCollection: block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`,
|
|
1763
|
+
filterSourceValuePath: block.valuePath,
|
|
1764
|
+
blockValuePath: block.valuePath,
|
|
1765
|
+
filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
return void 0;
|
|
1769
|
+
}).filter(Boolean);
|
|
1770
|
+
const nestedTagRollups = allBlocks.filter((block) => block.valuePath?.startsWith("tags.")).flatMap((block) => {
|
|
1771
|
+
const directChain = {
|
|
1772
|
+
rollupType: "tagType",
|
|
1773
|
+
tagTypeCollectionToRollup: tagType,
|
|
1774
|
+
rollupPath: [tagType, block.props.tagType]
|
|
1775
|
+
};
|
|
1776
|
+
const deeperChains = findTagChains(
|
|
1777
|
+
block.props?.tagType,
|
|
1778
|
+
[tagType],
|
|
1779
|
+
MAX_DEPTH_ROLLUP_POSSIBILITIES
|
|
1780
|
+
);
|
|
1781
|
+
return [directChain, ...deeperChains];
|
|
1782
|
+
});
|
|
1783
|
+
return [...singleLevelValuePathRollups, ...nestedTagRollups];
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1676
1786
|
// src/universal.ts
|
|
1677
1787
|
init_GLOBAL_BULLMQ_CONFIG();
|
|
1678
1788
|
|
|
@@ -2048,6 +2158,7 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
|
|
|
2048
2158
|
getModelByTenant,
|
|
2049
2159
|
getPlatformConfigsModelByTenant,
|
|
2050
2160
|
getPlatformContextContent,
|
|
2161
|
+
getRollupPossibilities,
|
|
2051
2162
|
getTplModelByTenant,
|
|
2052
2163
|
getVal,
|
|
2053
2164
|
recursivelyExtractBlocks,
|
package/dist/node.mjs
CHANGED
|
@@ -191,6 +191,7 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
|
|
|
191
191
|
},
|
|
192
192
|
workerConfig: {
|
|
193
193
|
concurrency: 1,
|
|
194
|
+
// Cannot mess with this else duplicate options in tpl, maybe even duplicate tags
|
|
194
195
|
limiter: {
|
|
195
196
|
max: 20,
|
|
196
197
|
// Max 5 jobs per...
|
|
@@ -285,6 +286,35 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
|
|
|
285
286
|
// ...60 seconds (higher throughput for chunking)
|
|
286
287
|
}
|
|
287
288
|
}
|
|
289
|
+
},
|
|
290
|
+
CONTENT_ELASTIC_SYNC_QUEUE: {
|
|
291
|
+
id: "content-elastic-sync-queue",
|
|
292
|
+
queueConfig: {
|
|
293
|
+
defaultJobOptions: {
|
|
294
|
+
attempts: 3,
|
|
295
|
+
backoff: {
|
|
296
|
+
type: "exponential",
|
|
297
|
+
delay: 2e3
|
|
298
|
+
},
|
|
299
|
+
removeOnComplete: 30,
|
|
300
|
+
removeOnFail: 100
|
|
301
|
+
},
|
|
302
|
+
streams: {
|
|
303
|
+
events: {
|
|
304
|
+
maxLen: 10
|
|
305
|
+
// Keep very low, cuz we dont really use historical stream events as of now
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
workerConfig: {
|
|
310
|
+
concurrency: 5,
|
|
311
|
+
limiter: {
|
|
312
|
+
max: 200,
|
|
313
|
+
// (lets always keep this same as content enhance & embed since it comes immediately after)
|
|
314
|
+
duration: 6e4
|
|
315
|
+
// ...60 seconds (higher throughput for chunking)
|
|
316
|
+
}
|
|
317
|
+
}
|
|
288
318
|
}
|
|
289
319
|
};
|
|
290
320
|
}
|
|
@@ -1645,6 +1675,85 @@ var _extractBlocksFromSomeBuilders = ({
|
|
|
1645
1675
|
}
|
|
1646
1676
|
};
|
|
1647
1677
|
|
|
1678
|
+
// src/utils/getRollupPossibilities.ts
|
|
1679
|
+
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
1680
|
+
function getRollupPossibilities({
|
|
1681
|
+
tagType,
|
|
1682
|
+
allTpls
|
|
1683
|
+
}) {
|
|
1684
|
+
const thisTagTpl = allTpls.find((d) => d.kp_content_type === tagType);
|
|
1685
|
+
if (!thisTagTpl) return [];
|
|
1686
|
+
const allBlocks = extractAllBlocksFromTpl({ tpl: thisTagTpl });
|
|
1687
|
+
const templateBlocksCache = /* @__PURE__ */ new Map();
|
|
1688
|
+
const getCachedTemplateBlocks = (templateTagType) => {
|
|
1689
|
+
if (!templateBlocksCache.has(templateTagType)) {
|
|
1690
|
+
const template = allTpls.find((d) => d.kp_content_type === templateTagType);
|
|
1691
|
+
if (template) {
|
|
1692
|
+
templateBlocksCache.set(templateTagType, extractAllBlocksFromTpl({ tpl: template }));
|
|
1693
|
+
} else {
|
|
1694
|
+
templateBlocksCache.set(templateTagType, []);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return templateBlocksCache.get(templateTagType);
|
|
1698
|
+
};
|
|
1699
|
+
const findTagChains = (startTagType, visited = [], maxDepth = 10) => {
|
|
1700
|
+
if (visited.includes(startTagType) || visited.length >= maxDepth) {
|
|
1701
|
+
return [];
|
|
1702
|
+
}
|
|
1703
|
+
const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
|
|
1704
|
+
(block) => block.valuePath?.startsWith("tags.")
|
|
1705
|
+
);
|
|
1706
|
+
const chains = [];
|
|
1707
|
+
for (const block of tagBlocks) {
|
|
1708
|
+
const nextTagType = block.props?.tagType;
|
|
1709
|
+
if (nextTagType) {
|
|
1710
|
+
chains.push({
|
|
1711
|
+
rollupType: "tagType",
|
|
1712
|
+
tagTypeCollectionToRollup: tagType,
|
|
1713
|
+
rollupPath: [...visited, startTagType, nextTagType]
|
|
1714
|
+
});
|
|
1715
|
+
if (visited.length < maxDepth - 1) {
|
|
1716
|
+
const nextChains = findTagChains(
|
|
1717
|
+
nextTagType,
|
|
1718
|
+
[...visited, startTagType],
|
|
1719
|
+
maxDepth
|
|
1720
|
+
);
|
|
1721
|
+
chains.push(...nextChains);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
return chains;
|
|
1726
|
+
};
|
|
1727
|
+
const singleLevelValuePathRollups = allBlocks.map((block) => {
|
|
1728
|
+
if (block.props?.options?.length > 0) {
|
|
1729
|
+
return {
|
|
1730
|
+
rollupType: "valuePathType",
|
|
1731
|
+
tagTypeCollectionToRollup: tagType,
|
|
1732
|
+
// Handle both string values and object values (with .value accessor)
|
|
1733
|
+
valuePathInRolledUpCollection: block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`,
|
|
1734
|
+
filterSourceValuePath: block.valuePath,
|
|
1735
|
+
blockValuePath: block.valuePath,
|
|
1736
|
+
filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
return void 0;
|
|
1740
|
+
}).filter(Boolean);
|
|
1741
|
+
const nestedTagRollups = allBlocks.filter((block) => block.valuePath?.startsWith("tags.")).flatMap((block) => {
|
|
1742
|
+
const directChain = {
|
|
1743
|
+
rollupType: "tagType",
|
|
1744
|
+
tagTypeCollectionToRollup: tagType,
|
|
1745
|
+
rollupPath: [tagType, block.props.tagType]
|
|
1746
|
+
};
|
|
1747
|
+
const deeperChains = findTagChains(
|
|
1748
|
+
block.props?.tagType,
|
|
1749
|
+
[tagType],
|
|
1750
|
+
MAX_DEPTH_ROLLUP_POSSIBILITIES
|
|
1751
|
+
);
|
|
1752
|
+
return [directChain, ...deeperChains];
|
|
1753
|
+
});
|
|
1754
|
+
return [...singleLevelValuePathRollups, ...nestedTagRollups];
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1648
1757
|
// src/universal.ts
|
|
1649
1758
|
init_GLOBAL_BULLMQ_CONFIG();
|
|
1650
1759
|
|
|
@@ -2031,6 +2140,7 @@ export {
|
|
|
2031
2140
|
export_getModelByTenant as getModelByTenant,
|
|
2032
2141
|
export_getPlatformConfigsModelByTenant as getPlatformConfigsModelByTenant,
|
|
2033
2142
|
getPlatformContextContent,
|
|
2143
|
+
getRollupPossibilities,
|
|
2034
2144
|
export_getTplModelByTenant as getTplModelByTenant,
|
|
2035
2145
|
getVal,
|
|
2036
2146
|
_recursExtractBlocks as recursivelyExtractBlocks,
|
package/dist/universal.d.mts
CHANGED
|
@@ -151,6 +151,51 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
151
151
|
blockPathPrefix?: string;
|
|
152
152
|
}) => void;
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Calculates all possible rollup relationships for a tag type
|
|
156
|
+
*
|
|
157
|
+
* Rollups allow indirect filtering (e.g., filter stories by topic type where stories are tagged with topics)
|
|
158
|
+
*
|
|
159
|
+
* Returns two types of possibilities:
|
|
160
|
+
* 1. **valuePathType**: Direct field rollups within the tag (e.g., topics.main.category)
|
|
161
|
+
* 2. **tagType**: Nested tag chain rollups (e.g., topics → themes → categories)
|
|
162
|
+
*
|
|
163
|
+
* Performance optimizations:
|
|
164
|
+
* - Caches template blocks to avoid repeated extractAllBlocksFromTpl calls
|
|
165
|
+
* - Limits recursion depth to MAX_DEPTH_ROLLUP_POSSIBILITIES (10 levels)
|
|
166
|
+
*
|
|
167
|
+
* @param {Object} params - Parameters object
|
|
168
|
+
* @param {string} params.tagType - The tag type to find rollup possibilities for (e.g., 'topics', 'districts')
|
|
169
|
+
* @param {Array} params.allTpls - All templates in the system
|
|
170
|
+
*
|
|
171
|
+
* @returns {Array} Array of rollup possibilities
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* // Input:
|
|
175
|
+
* getRollupPossibilities({ tagType: 'topics', allTpls: [...] })
|
|
176
|
+
*
|
|
177
|
+
* // Output:
|
|
178
|
+
* [
|
|
179
|
+
* {
|
|
180
|
+
* rollupType: 'valuePathType',
|
|
181
|
+
* tagTypeCollectionToRollup: 'topics',
|
|
182
|
+
* valuePathInRolledUpCollection: 'main.category.value',
|
|
183
|
+
* filterSourceValuePath: 'main.category',
|
|
184
|
+
* blockValuePath: 'main.category',
|
|
185
|
+
* filterDisplay: 'Topic Category'
|
|
186
|
+
* },
|
|
187
|
+
* {
|
|
188
|
+
* rollupType: 'tagType',
|
|
189
|
+
* tagTypeCollectionToRollup: 'topics',
|
|
190
|
+
* rollupPath: ['topics', 'themes']
|
|
191
|
+
* }
|
|
192
|
+
* ]
|
|
193
|
+
*/
|
|
194
|
+
declare function getRollupPossibilities({ tagType, allTpls }: {
|
|
195
|
+
tagType: string;
|
|
196
|
+
allTpls: any[];
|
|
197
|
+
}): any[];
|
|
198
|
+
|
|
154
199
|
declare namespace BASE_BULLMQ_CONFIG {
|
|
155
200
|
namespace PLUGIN__MAD_USERS_SYNC_QUEUE {
|
|
156
201
|
let id: string;
|
|
@@ -479,6 +524,49 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
479
524
|
}
|
|
480
525
|
export { workerConfig_7 as workerConfig };
|
|
481
526
|
}
|
|
527
|
+
namespace CONTENT_ELASTIC_SYNC_QUEUE {
|
|
528
|
+
let id_8: string;
|
|
529
|
+
export { id_8 as id };
|
|
530
|
+
export namespace queueConfig_8 {
|
|
531
|
+
export namespace defaultJobOptions_8 {
|
|
532
|
+
let attempts_8: number;
|
|
533
|
+
export { attempts_8 as attempts };
|
|
534
|
+
export namespace backoff_8 {
|
|
535
|
+
let type_8: string;
|
|
536
|
+
export { type_8 as type };
|
|
537
|
+
let delay_8: number;
|
|
538
|
+
export { delay_8 as delay };
|
|
539
|
+
}
|
|
540
|
+
export { backoff_8 as backoff };
|
|
541
|
+
let removeOnComplete_8: number;
|
|
542
|
+
export { removeOnComplete_8 as removeOnComplete };
|
|
543
|
+
let removeOnFail_8: number;
|
|
544
|
+
export { removeOnFail_8 as removeOnFail };
|
|
545
|
+
}
|
|
546
|
+
export { defaultJobOptions_8 as defaultJobOptions };
|
|
547
|
+
export namespace streams_8 {
|
|
548
|
+
export namespace events_8 {
|
|
549
|
+
let maxLen_8: number;
|
|
550
|
+
export { maxLen_8 as maxLen };
|
|
551
|
+
}
|
|
552
|
+
export { events_8 as events };
|
|
553
|
+
}
|
|
554
|
+
export { streams_8 as streams };
|
|
555
|
+
}
|
|
556
|
+
export { queueConfig_8 as queueConfig };
|
|
557
|
+
export namespace workerConfig_8 {
|
|
558
|
+
let concurrency_8: number;
|
|
559
|
+
export { concurrency_8 as concurrency };
|
|
560
|
+
export namespace limiter_8 {
|
|
561
|
+
let max_8: number;
|
|
562
|
+
export { max_8 as max };
|
|
563
|
+
let duration_8: number;
|
|
564
|
+
export { duration_8 as duration };
|
|
565
|
+
}
|
|
566
|
+
export { limiter_8 as limiter };
|
|
567
|
+
}
|
|
568
|
+
export { workerConfig_8 as workerConfig };
|
|
569
|
+
}
|
|
482
570
|
}
|
|
483
571
|
|
|
484
572
|
interface PlatformContextContentItem {
|
|
@@ -498,4 +586,4 @@ interface GetPlatformContextContentParams {
|
|
|
498
586
|
}
|
|
499
587
|
declare const getPlatformContextContent: ({ platformConfigs_ai, }: GetPlatformContextContentParams) => string;
|
|
500
588
|
|
|
501
|
-
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
|
589
|
+
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getRollupPossibilities, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
package/dist/universal.d.ts
CHANGED
|
@@ -151,6 +151,51 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
151
151
|
blockPathPrefix?: string;
|
|
152
152
|
}) => void;
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Calculates all possible rollup relationships for a tag type
|
|
156
|
+
*
|
|
157
|
+
* Rollups allow indirect filtering (e.g., filter stories by topic type where stories are tagged with topics)
|
|
158
|
+
*
|
|
159
|
+
* Returns two types of possibilities:
|
|
160
|
+
* 1. **valuePathType**: Direct field rollups within the tag (e.g., topics.main.category)
|
|
161
|
+
* 2. **tagType**: Nested tag chain rollups (e.g., topics → themes → categories)
|
|
162
|
+
*
|
|
163
|
+
* Performance optimizations:
|
|
164
|
+
* - Caches template blocks to avoid repeated extractAllBlocksFromTpl calls
|
|
165
|
+
* - Limits recursion depth to MAX_DEPTH_ROLLUP_POSSIBILITIES (10 levels)
|
|
166
|
+
*
|
|
167
|
+
* @param {Object} params - Parameters object
|
|
168
|
+
* @param {string} params.tagType - The tag type to find rollup possibilities for (e.g., 'topics', 'districts')
|
|
169
|
+
* @param {Array} params.allTpls - All templates in the system
|
|
170
|
+
*
|
|
171
|
+
* @returns {Array} Array of rollup possibilities
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* // Input:
|
|
175
|
+
* getRollupPossibilities({ tagType: 'topics', allTpls: [...] })
|
|
176
|
+
*
|
|
177
|
+
* // Output:
|
|
178
|
+
* [
|
|
179
|
+
* {
|
|
180
|
+
* rollupType: 'valuePathType',
|
|
181
|
+
* tagTypeCollectionToRollup: 'topics',
|
|
182
|
+
* valuePathInRolledUpCollection: 'main.category.value',
|
|
183
|
+
* filterSourceValuePath: 'main.category',
|
|
184
|
+
* blockValuePath: 'main.category',
|
|
185
|
+
* filterDisplay: 'Topic Category'
|
|
186
|
+
* },
|
|
187
|
+
* {
|
|
188
|
+
* rollupType: 'tagType',
|
|
189
|
+
* tagTypeCollectionToRollup: 'topics',
|
|
190
|
+
* rollupPath: ['topics', 'themes']
|
|
191
|
+
* }
|
|
192
|
+
* ]
|
|
193
|
+
*/
|
|
194
|
+
declare function getRollupPossibilities({ tagType, allTpls }: {
|
|
195
|
+
tagType: string;
|
|
196
|
+
allTpls: any[];
|
|
197
|
+
}): any[];
|
|
198
|
+
|
|
154
199
|
declare namespace BASE_BULLMQ_CONFIG {
|
|
155
200
|
namespace PLUGIN__MAD_USERS_SYNC_QUEUE {
|
|
156
201
|
let id: string;
|
|
@@ -479,6 +524,49 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
479
524
|
}
|
|
480
525
|
export { workerConfig_7 as workerConfig };
|
|
481
526
|
}
|
|
527
|
+
namespace CONTENT_ELASTIC_SYNC_QUEUE {
|
|
528
|
+
let id_8: string;
|
|
529
|
+
export { id_8 as id };
|
|
530
|
+
export namespace queueConfig_8 {
|
|
531
|
+
export namespace defaultJobOptions_8 {
|
|
532
|
+
let attempts_8: number;
|
|
533
|
+
export { attempts_8 as attempts };
|
|
534
|
+
export namespace backoff_8 {
|
|
535
|
+
let type_8: string;
|
|
536
|
+
export { type_8 as type };
|
|
537
|
+
let delay_8: number;
|
|
538
|
+
export { delay_8 as delay };
|
|
539
|
+
}
|
|
540
|
+
export { backoff_8 as backoff };
|
|
541
|
+
let removeOnComplete_8: number;
|
|
542
|
+
export { removeOnComplete_8 as removeOnComplete };
|
|
543
|
+
let removeOnFail_8: number;
|
|
544
|
+
export { removeOnFail_8 as removeOnFail };
|
|
545
|
+
}
|
|
546
|
+
export { defaultJobOptions_8 as defaultJobOptions };
|
|
547
|
+
export namespace streams_8 {
|
|
548
|
+
export namespace events_8 {
|
|
549
|
+
let maxLen_8: number;
|
|
550
|
+
export { maxLen_8 as maxLen };
|
|
551
|
+
}
|
|
552
|
+
export { events_8 as events };
|
|
553
|
+
}
|
|
554
|
+
export { streams_8 as streams };
|
|
555
|
+
}
|
|
556
|
+
export { queueConfig_8 as queueConfig };
|
|
557
|
+
export namespace workerConfig_8 {
|
|
558
|
+
let concurrency_8: number;
|
|
559
|
+
export { concurrency_8 as concurrency };
|
|
560
|
+
export namespace limiter_8 {
|
|
561
|
+
let max_8: number;
|
|
562
|
+
export { max_8 as max };
|
|
563
|
+
let duration_8: number;
|
|
564
|
+
export { duration_8 as duration };
|
|
565
|
+
}
|
|
566
|
+
export { limiter_8 as limiter };
|
|
567
|
+
}
|
|
568
|
+
export { workerConfig_8 as workerConfig };
|
|
569
|
+
}
|
|
482
570
|
}
|
|
483
571
|
|
|
484
572
|
interface PlatformContextContentItem {
|
|
@@ -498,4 +586,4 @@ interface GetPlatformContextContentParams {
|
|
|
498
586
|
}
|
|
499
587
|
declare const getPlatformContextContent: ({ platformConfigs_ai, }: GetPlatformContextContentParams) => string;
|
|
500
588
|
|
|
501
|
-
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|
|
589
|
+
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getRollupPossibilities, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
|