@okf/ootils 1.15.4 → 1.17.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.js CHANGED
@@ -370,7 +370,8 @@ function getRollupPossibilities({
370
370
  if (visited.includes(startTagType) || visited.length >= maxDepth) {
371
371
  return [];
372
372
  }
373
- const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
373
+ const allBlocksInTemplate = getCachedTemplateBlocks(startTagType);
374
+ const tagBlocks = allBlocksInTemplate.filter(
374
375
  (block) => block.valuePath?.startsWith("tags.")
375
376
  );
376
377
  const chains = [];
@@ -392,6 +393,20 @@ function getRollupPossibilities({
392
393
  }
393
394
  }
394
395
  }
396
+ const valuePathBlocks = allBlocksInTemplate.filter(
397
+ (block) => block.props?.options?.length > 0 && !block.valuePath?.startsWith("tags.")
398
+ );
399
+ for (const block of valuePathBlocks) {
400
+ const terminalValuePath = block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`;
401
+ chains.push({
402
+ rollupType: "tagType",
403
+ tagTypeCollectionToRollup: tagType,
404
+ rollupPath: [...visited, startTagType, terminalValuePath],
405
+ // Additional metadata for filter display
406
+ filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath,
407
+ isTerminalValuePath: true
408
+ });
409
+ }
395
410
  return chains;
396
411
  };
397
412
  const singleLevelValuePathRollups = allBlocks.map((block) => {
package/dist/browser.mjs CHANGED
@@ -334,7 +334,8 @@ function getRollupPossibilities({
334
334
  if (visited.includes(startTagType) || visited.length >= maxDepth) {
335
335
  return [];
336
336
  }
337
- const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
337
+ const allBlocksInTemplate = getCachedTemplateBlocks(startTagType);
338
+ const tagBlocks = allBlocksInTemplate.filter(
338
339
  (block) => block.valuePath?.startsWith("tags.")
339
340
  );
340
341
  const chains = [];
@@ -356,6 +357,20 @@ function getRollupPossibilities({
356
357
  }
357
358
  }
358
359
  }
360
+ const valuePathBlocks = allBlocksInTemplate.filter(
361
+ (block) => block.props?.options?.length > 0 && !block.valuePath?.startsWith("tags.")
362
+ );
363
+ for (const block of valuePathBlocks) {
364
+ const terminalValuePath = block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`;
365
+ chains.push({
366
+ rollupType: "tagType",
367
+ tagTypeCollectionToRollup: tagType,
368
+ rollupPath: [...visited, startTagType, terminalValuePath],
369
+ // Additional metadata for filter display
370
+ filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath,
371
+ isTerminalValuePath: true
372
+ });
373
+ }
359
374
  return chains;
360
375
  };
361
376
  const singleLevelValuePathRollups = allBlocks.map((block) => {
package/dist/node.d.mts CHANGED
@@ -1180,6 +1180,10 @@ declare class BaseProducer {
1180
1180
  execute(params: any): Promise<void>;
1181
1181
  addBulkJobs(jobs: any): Promise<bullmq.Job<any, any, string>[]>;
1182
1182
  addJob(name: any, data: any, opts?: {}): Promise<bullmq.Job<any, any, string>>;
1183
+ removeJobs(jobIds: any): Promise<{
1184
+ removed: number;
1185
+ results: any[];
1186
+ }>;
1183
1187
  getStatus(): Promise<{
1184
1188
  waiting: number;
1185
1189
  active: number;
package/dist/node.d.ts CHANGED
@@ -1180,6 +1180,10 @@ declare class BaseProducer {
1180
1180
  execute(params: any): Promise<void>;
1181
1181
  addBulkJobs(jobs: any): Promise<bullmq.Job<any, any, string>[]>;
1182
1182
  addJob(name: any, data: any, opts?: {}): Promise<bullmq.Job<any, any, string>>;
1183
+ removeJobs(jobIds: any): Promise<{
1184
+ removed: number;
1185
+ results: any[];
1186
+ }>;
1183
1187
  getStatus(): Promise<{
1184
1188
  waiting: number;
1185
1189
  active: number;
package/dist/node.js CHANGED
@@ -1328,6 +1328,33 @@ var require_BaseProducer = __commonJS({
1328
1328
  throw error;
1329
1329
  }
1330
1330
  }
1331
+ async removeJobs(jobIds) {
1332
+ if (!jobIds || jobIds.length === 0) {
1333
+ return { removed: 0, results: [] };
1334
+ }
1335
+ try {
1336
+ const results = await Promise.all(
1337
+ jobIds.map(async (jobId) => {
1338
+ try {
1339
+ const job = await this.queue.getJob(jobId);
1340
+ if (job) {
1341
+ await job.remove();
1342
+ return { jobId, removed: true };
1343
+ }
1344
+ return { jobId, removed: false, reason: "not found" };
1345
+ } catch (err) {
1346
+ return { jobId, removed: false, reason: err.message };
1347
+ }
1348
+ })
1349
+ );
1350
+ const removedCount = results.filter((r) => r.removed).length;
1351
+ console.log(`\u{1F5D1}\uFE0F ${this.constructor.name}: Removed ${removedCount}/${jobIds.length} jobs`);
1352
+ return { removed: removedCount, results };
1353
+ } catch (error) {
1354
+ console.error(`\u274C ${this.constructor.name}: Failed to remove jobs:`, error);
1355
+ throw error;
1356
+ }
1357
+ }
1331
1358
  async getStatus() {
1332
1359
  const waiting = await this.queue.getWaiting();
1333
1360
  const active = await this.queue.getActive();
@@ -1854,7 +1881,8 @@ function getRollupPossibilities({
1854
1881
  if (visited.includes(startTagType) || visited.length >= maxDepth) {
1855
1882
  return [];
1856
1883
  }
1857
- const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
1884
+ const allBlocksInTemplate = getCachedTemplateBlocks(startTagType);
1885
+ const tagBlocks = allBlocksInTemplate.filter(
1858
1886
  (block) => block.valuePath?.startsWith("tags.")
1859
1887
  );
1860
1888
  const chains = [];
@@ -1876,6 +1904,20 @@ function getRollupPossibilities({
1876
1904
  }
1877
1905
  }
1878
1906
  }
1907
+ const valuePathBlocks = allBlocksInTemplate.filter(
1908
+ (block) => block.props?.options?.length > 0 && !block.valuePath?.startsWith("tags.")
1909
+ );
1910
+ for (const block of valuePathBlocks) {
1911
+ const terminalValuePath = block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`;
1912
+ chains.push({
1913
+ rollupType: "tagType",
1914
+ tagTypeCollectionToRollup: tagType,
1915
+ rollupPath: [...visited, startTagType, terminalValuePath],
1916
+ // Additional metadata for filter display
1917
+ filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath,
1918
+ isTerminalValuePath: true
1919
+ });
1920
+ }
1879
1921
  return chains;
1880
1922
  };
1881
1923
  const singleLevelValuePathRollups = allBlocks.map((block) => {
package/dist/node.mjs CHANGED
@@ -1333,6 +1333,33 @@ var require_BaseProducer = __commonJS({
1333
1333
  throw error;
1334
1334
  }
1335
1335
  }
1336
+ async removeJobs(jobIds) {
1337
+ if (!jobIds || jobIds.length === 0) {
1338
+ return { removed: 0, results: [] };
1339
+ }
1340
+ try {
1341
+ const results = await Promise.all(
1342
+ jobIds.map(async (jobId) => {
1343
+ try {
1344
+ const job = await this.queue.getJob(jobId);
1345
+ if (job) {
1346
+ await job.remove();
1347
+ return { jobId, removed: true };
1348
+ }
1349
+ return { jobId, removed: false, reason: "not found" };
1350
+ } catch (err) {
1351
+ return { jobId, removed: false, reason: err.message };
1352
+ }
1353
+ })
1354
+ );
1355
+ const removedCount = results.filter((r) => r.removed).length;
1356
+ console.log(`\u{1F5D1}\uFE0F ${this.constructor.name}: Removed ${removedCount}/${jobIds.length} jobs`);
1357
+ return { removed: removedCount, results };
1358
+ } catch (error) {
1359
+ console.error(`\u274C ${this.constructor.name}: Failed to remove jobs:`, error);
1360
+ throw error;
1361
+ }
1362
+ }
1336
1363
  async getStatus() {
1337
1364
  const waiting = await this.queue.getWaiting();
1338
1365
  const active = await this.queue.getActive();
@@ -1822,7 +1849,8 @@ function getRollupPossibilities({
1822
1849
  if (visited.includes(startTagType) || visited.length >= maxDepth) {
1823
1850
  return [];
1824
1851
  }
1825
- const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
1852
+ const allBlocksInTemplate = getCachedTemplateBlocks(startTagType);
1853
+ const tagBlocks = allBlocksInTemplate.filter(
1826
1854
  (block) => block.valuePath?.startsWith("tags.")
1827
1855
  );
1828
1856
  const chains = [];
@@ -1844,6 +1872,20 @@ function getRollupPossibilities({
1844
1872
  }
1845
1873
  }
1846
1874
  }
1875
+ const valuePathBlocks = allBlocksInTemplate.filter(
1876
+ (block) => block.props?.options?.length > 0 && !block.valuePath?.startsWith("tags.")
1877
+ );
1878
+ for (const block of valuePathBlocks) {
1879
+ const terminalValuePath = block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`;
1880
+ chains.push({
1881
+ rollupType: "tagType",
1882
+ tagTypeCollectionToRollup: tagType,
1883
+ rollupPath: [...visited, startTagType, terminalValuePath],
1884
+ // Additional metadata for filter display
1885
+ filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath,
1886
+ isTerminalValuePath: true
1887
+ });
1888
+ }
1847
1889
  return chains;
1848
1890
  };
1849
1891
  const singleLevelValuePathRollups = allBlocks.map((block) => {
package/dist/universal.js CHANGED
@@ -370,7 +370,8 @@ function getRollupPossibilities({
370
370
  if (visited.includes(startTagType) || visited.length >= maxDepth) {
371
371
  return [];
372
372
  }
373
- const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
373
+ const allBlocksInTemplate = getCachedTemplateBlocks(startTagType);
374
+ const tagBlocks = allBlocksInTemplate.filter(
374
375
  (block) => block.valuePath?.startsWith("tags.")
375
376
  );
376
377
  const chains = [];
@@ -392,6 +393,20 @@ function getRollupPossibilities({
392
393
  }
393
394
  }
394
395
  }
396
+ const valuePathBlocks = allBlocksInTemplate.filter(
397
+ (block) => block.props?.options?.length > 0 && !block.valuePath?.startsWith("tags.")
398
+ );
399
+ for (const block of valuePathBlocks) {
400
+ const terminalValuePath = block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`;
401
+ chains.push({
402
+ rollupType: "tagType",
403
+ tagTypeCollectionToRollup: tagType,
404
+ rollupPath: [...visited, startTagType, terminalValuePath],
405
+ // Additional metadata for filter display
406
+ filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath,
407
+ isTerminalValuePath: true
408
+ });
409
+ }
395
410
  return chains;
396
411
  };
397
412
  const singleLevelValuePathRollups = allBlocks.map((block) => {
@@ -334,7 +334,8 @@ function getRollupPossibilities({
334
334
  if (visited.includes(startTagType) || visited.length >= maxDepth) {
335
335
  return [];
336
336
  }
337
- const tagBlocks = getCachedTemplateBlocks(startTagType).filter(
337
+ const allBlocksInTemplate = getCachedTemplateBlocks(startTagType);
338
+ const tagBlocks = allBlocksInTemplate.filter(
338
339
  (block) => block.valuePath?.startsWith("tags.")
339
340
  );
340
341
  const chains = [];
@@ -356,6 +357,20 @@ function getRollupPossibilities({
356
357
  }
357
358
  }
358
359
  }
360
+ const valuePathBlocks = allBlocksInTemplate.filter(
361
+ (block) => block.props?.options?.length > 0 && !block.valuePath?.startsWith("tags.")
362
+ );
363
+ for (const block of valuePathBlocks) {
364
+ const terminalValuePath = block.props?.saveValueAsString ? block.valuePath : `${block.valuePath}.value`;
365
+ chains.push({
366
+ rollupType: "tagType",
367
+ tagTypeCollectionToRollup: tagType,
368
+ rollupPath: [...visited, startTagType, terminalValuePath],
369
+ // Additional metadata for filter display
370
+ filterDisplay: block.props?.shortLabel || block.props?.label || block.valuePath,
371
+ isTerminalValuePath: true
372
+ });
373
+ }
359
374
  return chains;
360
375
  };
361
376
  const singleLevelValuePathRollups = allBlocks.map((block) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.15.4",
6
+ "version": "1.17.0",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",